コード例 #1
0
def draw(screen, tick_result):
    #print(json.dumps(tick_result))
    ret = tick_result['battle_data']

    screen.blit(draw_util.text(ret['battle_second'],(0,0,0)), (240,20))
    
    if 'move_list' in ret:
        for move in ret['move_list']:
            if (move['type'] == 'h') or (move['type'] == 'v'):
                xy0 = _logic2draw(move['x0'],move['y0'])
                xy1 = _logic2draw(move['x1'],move['y1'])
                color = (255,0,0) if move['is_best'] else (0,0,255)
                pygame.draw.line(screen, color, tuple(xy0), tuple(xy1), 2)
            elif (move['type'] == 'i'):
                xy0 = _logic2draw(move['x0'],move['y0'])
                xy00 = xy0[0]-2,xy0[1]-2
                xy01 = 4,4
                color = (255,0,0) if move['is_best'] else (0,0,255)
                pygame.draw.rect(screen, color, tuple(xy00)+tuple(xy01), 1)

    if 'board_animal_list_list' in ret:
        board_animal_list_list = ret['board_animal_list_list']
        age_list_list = ret['age_list_list']
        for i in range(SIDE_COUNT):
            for j in range(SIDE_COUNT):
                if board_animal_list_list[i][j] == 'z_chao':
                    xy = _logic2draw(i,j)
                    x0,y0 = x1,y1 = xy
                    x0-=4
                    x1+=4
                    y0-=4
                    y1+=4
                    color,line_width = ((0,0,0),4) if age_list_list[i][j] else ((31,31,31),2)
                    pygame.draw.line(screen, color, (x0,y0), (x1,y1), line_width)
                    pygame.draw.line(screen, color, (x0,y1), (x1,y0), line_width)
コード例 #2
0
    def draw(self, screen, tick_result):
        if tick_result != None:
            state = tick_result['state']
            screen.blit(draw_util.text(state, (0, 0, 0)), (240, 0))
            if tick_result['play']:
                if state in self.state_op_dict:
                    self.state_op_dict[state].draw(screen, tick_result)

        if self.play:
            screen.blit(draw_util.text('P', (0, 127, 0)), PLAY_BTN_RECT[:2])
        else:
            screen.blit(draw_util.text('S', (127, 0, 0)), PLAY_BTN_RECT[:2])

        if self.cap_screen:
            screen.blit(draw_util.text('CAP', (127, 0, 0)),
                        SCREENCAP_BTN_RECT[:2])
        else:
            screen.blit(draw_util.text('NoCAP', (0, 127, 0)),
                        SCREENCAP_BTN_RECT[:2])
コード例 #3
0
def draw(screen, tick_result):
    if 'ok_dialog_y' in tick_result:
        y = tick_result['ok_dialog_y']
        if y != None:
            xy = np.array([60, (tick_result['ok_dialog_y'])])
            draw_xy = xy + DRAW_SCREEN_XY
            draw_xy00 = draw_xy + np.array([-4, -4])
            draw_xy01 = draw_xy + np.array([-4, 4])
            draw_xy10 = draw_xy + np.array([4, -4])
            draw_xy11 = draw_xy + np.array([4, 4])
            pygame.draw.line(screen, (255, 0, 0), tuple(draw_xy00),
                             tuple(draw_xy11), 4)
            pygame.draw.line(screen, (255, 0, 0), tuple(draw_xy01),
                             tuple(draw_xy10), 4)
        else:
            screen.blit(draw_util.text('y==None', (0, 0, 0)), (240, 20))
コード例 #4
0
def draw(screen, tick_result):
    ret = tick_result['main_menu_data']

    screen.blit(draw_util.text(ret['button_label'], (0, 0, 0)), (240, 20))