def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if event.type == pygame.MOUSEBUTTONUP:
for each in self.board.units:
if each.is_door is True:
self.board.all_sprites_list.move_to_front(each)
if True: # self.data[5] == 1:
self.auto_check()
self.check_result()
python类MOUSEBUTTONUP的实例源码
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if event.type == pygame.MOUSEBUTTONUP and event.button == 1:
self.draw_lines()
self.mainloop.redraw_needed[0] = True
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if event.type == pygame.MOUSEBUTTONUP:
self.check_result()
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if self.show_msg == False:
if event.type == pygame.KEYDOWN and (event.key == pygame.K_RIGHT or event.key == pygame.K_LEFT):
self.next_step()
elif event.type == pygame.MOUSEBUTTONUP:
if self.board.active_ship == self.next_step_btn.unit_id:
if self.current_pos + 1 > self.all_a_count:
self.level.next_board_load()
else:
self.next_step()
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if self.show_msg == False:
if event.type == pygame.KEYDOWN and (event.key == pygame.K_RIGHT or event.key == pygame.K_LEFT):
self.next_step()
elif event.type == pygame.MOUSEBUTTONUP:
if self.board.active_ship == self.next_step_btn.unit_id:
if self.current_pos + 1 > self.all_a_count: # if self.cursor_pos == self.sumn1n2sl+1:
self.level.next_board_load()
else:
self.next_step()
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if event.type == pygame.MOUSEBUTTONUP:
for each in self.board.units:
if each.is_door is True:
self.board.all_sprites_list.move_to_front(each)
self.check_result()
if event.type == pygame.KEYDOWN or event.type == pygame.MOUSEBUTTONDOWN:
self.auto_check_reset()
elif event.type == pygame.KEYUP:
self.check_result()
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if event.type == pygame.KEYDOWN or event.type == pygame.MOUSEBUTTONDOWN:
self.auto_check_reset()
elif event.type == pygame.MOUSEBUTTONUP and event.button == 1:
self.draw_lines()
self.mainloop.redraw_needed[0] = True
self.check_result()
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if event.type == pygame.MOUSEBUTTONUP:
for each in self.board.units:
if each.is_door is True:
self.board.all_sprites_list.move_to_front(each)
self.check_result(auto=True)
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if event.type == pygame.KEYDOWN or event.type == pygame.MOUSEBUTTONDOWN:
self.auto_check_reset()
elif event.type == pygame.MOUSEBUTTONUP and event.button == 1:
self.draw_lines()
self.mainloop.redraw_needed[0] = True
self.check_result()
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if event.type == pygame.KEYDOWN or event.type == pygame.MOUSEBUTTONDOWN:
self.auto_check_reset()
if event.type == pygame.MOUSEBUTTONDOWN:
if self.board.active_ship >= 0:
active = self.board.ships[self.board.active_ship]
active.image.set_alpha(150)
elif event.type == pygame.MOUSEBUTTONUP:
if self.board.active_ship >= 0:
active = self.board.ships[self.board.active_ship]
active.image.set_alpha(255)
self.check_result()
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if event.type == pygame.KEYDOWN or event.type == pygame.MOUSEBUTTONDOWN:
self.auto_check_reset()
if event.type == pygame.MOUSEMOTION:
if self.drag:
self.swap_font_color()
# if self.drag and self.mouse_entered_new:
# self.swap_font_color()
elif event.type == pygame.MOUSEBUTTONUP:
self.swap_font_color()
self.check_result()
# if self.drag and self.mouse_entered_new:
# self.swap_font_color()
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if self.ship_id < 0 and event.type == pygame.MOUSEBUTTONDOWN:
# make it impossible to deselect the main character
self.board.active_ship = 0
self.ship_id = 0
if self.moveable == True:
pos = event.pos
column = (pos[0] - self.layout.menu_w) // (self.layout.width)
row = (pos[1] - self.layout.top_margin) // (self.layout.height)
self.direction = [0, 0]
arrow_clicked = False
if column == self.owl_pos[0] - 1 and row == self.owl_pos[1]:
self.direction[0] = -1
arrow_clicked = True
elif column == self.owl_pos[0] + 1 and row == self.owl_pos[1]:
self.direction[0] = 1
arrow_clicked = True
elif column == self.owl_pos[0] and row == self.owl_pos[1] - 1:
self.direction[1] = -1
arrow_clicked = True
elif column == self.owl_pos[0] and row == self.owl_pos[1] + 1:
self.direction[1] = 1
arrow_clicked = True
if arrow_clicked:
self.check_direction_kdown()
if (event.type == pygame.KEYDOWN or event.type == pygame.MOUSEBUTTONDOWN) and self.moveable == False:
self.move = False
elif event.type == pygame.KEYUP or event.type == pygame.MOUSEBUTTONUP:
self.highlight_color(-1)
self.mainloop.redraw_needed[0] = True
self.move = False
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if event.type == pygame.MOUSEBUTTONUP:
for each in self.board.units:
if each.is_door is True:
self.board.all_sprites_list.move_to_front(each)
self.check_result()
if event.type == pygame.KEYDOWN or event.type == pygame.MOUSEBUTTONDOWN:
self.auto_check_reset()
elif event.type == pygame.KEYUP:
self.check_result()
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if event.type == pygame.MOUSEBUTTONUP:
for each in self.board.units:
if each.is_door is True:
self.board.all_sprites_list.move_to_front(each)
self.auto_check()
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if event.type == pygame.MOUSEBUTTONUP:
for each in self.board.units:
if each.is_door is True:
self.board.all_sprites_list.move_to_front(each)
if self.data[5] == 1:
self.auto_check()
self.check_result()
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if self.show_msg == False:
if event.type == pygame.KEYDOWN or event.type == pygame.MOUSEBUTTONDOWN:
self.auto_check_reset()
if event.type == pygame.KEYDOWN and event.key == pygame.K_LEFT:
self.home_sqare_switch(self.board.active_ship + 1)
elif event.type == pygame.KEYDOWN and event.key == pygame.K_RIGHT:
self.home_sqare_switch(self.board.active_ship - 1)
elif event.type == pygame.KEYDOWN and event.key == pygame.K_UP:
self.home_sqare_switch(self.board.active_ship - self.sumn1n2sl + 1)
elif event.type == pygame.KEYDOWN and event.key == pygame.K_DOWN:
self.home_sqare_switch(self.board.active_ship + self.sumn1n2sl)
elif event.type == pygame.KEYDOWN and event.key != pygame.K_RETURN and not self.correct:
lhv = len(self.home_square.value)
self.changed_since_check = True
if event.key == pygame.K_BACKSPACE:
if lhv > 0:
self.home_square.value = self.home_square.value[0:lhv - 1]
else:
char = event.unicode
if (len(char) > 0 and lhv < 2 and char in self.digits):
self.home_square.value = char
if self.auto_select:
self.home_sqare_switch(self.board.active_ship + 1)
else:
self.home_square.value = ""
self.home_square.update_me = True
self.mainloop.redraw_needed[0] = True
elif event.type == pygame.MOUSEBUTTONUP:
self.home_sqare_switch(self.board.active_ship)
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if event.type == pygame.MOUSEBUTTONUP:
for each in self.board.units:
if each.is_door is True:
self.board.all_sprites_list.move_to_front(each)
self.auto_check()
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if event.type == pygame.MOUSEBUTTONUP:
pass
#self.check_result(auto=True)
#self.auto_check_reset()
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if event.type == pygame.MOUSEBUTTONUP:
for each in self.board.units:
if each.is_door is True:
self.board.all_sprites_list.move_to_front(each)
self.check_result(auto=True)
def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if event.type == pygame.MOUSEBUTTONUP:
for each in self.board.units:
if each.is_door is True:
self.board.all_sprites_list.move_to_front(each)
if event.type == pygame.KEYDOWN or event.type == pygame.MOUSEBUTTONDOWN:
self.auto_check_reset()
elif event.type == pygame.KEYUP or event.type == pygame.MOUSEBUTTONUP:
self.check_result()