예제 #1
0
 def get_move_buttons(self, actionCrit):
     buttons = []
     moves = self.battle.get_critter_moves(actionCrit)
     x, y = 0.05, 0.82
     for i in range(4):
         if i < len(moves):
             buttons.append(button.Button(self.battleImgs['graybox'], moves[i],
                                          (x, x+0.13, y, y+0.08), i))
         x += 0.15
     buttons.append(button.Button(self.battleImgs['darkbluebox'], 'switch',
                                  (0.65, 0.78, 0.82, 0.90), 4))
     buttons.append(self.get_back_button())
     return buttons
예제 #2
0
def test_update():
    button0 = button.Button('image', 'words', (0, 0.5, 0.3, 0.7), 3)
    assert button0.update(0.25, 0.35) == 3
    assert button0.update(0.4, 0.6) == 3
    assert button0.update(0, 0.3) == 3
    assert button0.update(1, 1) == None
    assert button0.update(0.6, 0.3) == None
    assert button0.update(0.4, 0.2) == None
예제 #3
0
def test_init():
    button0 = button.Button('image', 'words', (0, 0.5, 0.3, 0.7), 3)
    assert button0.image == 'image'
    assert button0.words == 'words'
    assert button0.x1 == 0
    assert button0.x2 == 0.5
    assert button0.y1 == 0.3
    assert button0.y2 == 0.7
    assert button0.keytype == 3
예제 #4
0
 def get_target_buttons(self, actionCrit):
     buttons = []
     boxPos = [(0.04, 0.19, 0.60, 0.75), (0.04, 0.19, 0.77, 0.92),
               (0.21, 0.36, 0.60, 0.75), (0.21, 0.36, 0.77, 0.92)]
     names = self.battle.get_targets(actionCrit)
     for i in range(4):
         buttons.append(button.Button(self.battleImgs['targetbox'],
                     names[i], boxPos[i], i))
     buttons.append(self.get_back_button())
     return buttons
예제 #5
0
 def get_switch_buttons(self):
     buttons = []
     switchCrits = self.battle.get_switch_options()
     x, y = 0.05, 0.82
     i = 0
     while i < len(switchCrits):
         buttons.append(button.Button(self.battleImgs['greenbox'], switchCrits[i].name,
                                      (x, x+0.13, y, y+0.08), i))
         x += 0.15
         i += 1
     buttons.append(self.get_back_button())
     return buttons
예제 #6
0
 def get_back_button(self):
     return button.Button(self.battleImgs['redbox'], 'back', (0.8, 0.9, 0.82, 0.9), 5)
예제 #7
0
def test_get_drawing_info():
    button0 = button.Button('image', 'words', (0, 0.5, 0.3, 0.7), 3)
    print(button0.get_drawing_info())
    assert button0.get_drawing_info() == (('image', (0, 0.5, 0.3, 0.7)), 
                                        ('words', (0.01, 0.49, 0.31, 0.69)))