def on_switch(self): SoundManager.switch_bgm(common_res.bgm_hall) from options import options options.testing and ConfirmBox( u"测试模式开启,现在可以登陆测试服务器。\n" u"测试模式下可能无法登陆正常服务器,\n" u"测试服务器也会随时重新启动。", parent=self, zindex=99999 )
def init(self): ports = self.char_portraits = [ GameCharacterPortrait(parent=self, color=color, x=x, y=y, tag_placement=tp) for x, y, tp, color in self.gcp_location[:len(self.game.players)] ] pl = self.game.players shift = pl.index(self.game.me) for i, c in enumerate(ports): p = pl[(shift + i) % self.game.n_persons] c.player = p c.update() ports[0].equipcard_area.selectable = True # it's TheChosenOne self.begin_select_player() self.end_select_player() self.skill_box = SkillSelectionBox(parent=self, x=161, y=9, width=70, height=22 * 6 - 4) SoundManager.switch_bgm(gres.bgm_game)
def init(self): SoundManager.se_suppress() self.game_event = ObservableEvent() self.game_event += self.on_game_event n = len(self.game.players) ports = self.char_portraits = [ GameCharacterPortrait(parent=self, color=color, x=x, y=y, tag_placement=tp) for x, y, tp, color in self.gcp_location[:n] ] pl = self.game.players shift = pl.index(self.game.me) for i, c in enumerate(ports): self.game_event += c.on_game_event p = pl[(shift + i) % n] c.player = p c.update() ports[0].equipcard_area.selectable = True # it's TheChosenOne self.begin_select_player() self.end_select_player() self.skill_box = SkillSelectionBox( parent=self, x=161, y=9, width=70, height=22*6-4 ) SoundManager.switch_bgm('thb-bgm_game') self.more_init()
def on_switch(self): SoundManager.switch_bgm(common_res.bgm_hall) from options import options options.testing and ConfirmBox( u'测试模式开启,现在可以登陆测试服务器。\n' u'测试模式下可能无法登陆正常服务器,\n' u'测试服务器也会随时重新启动。', parent=self, zindex=99999, )
def on_message(self, _type, *args): rst = handle_chat(_type, args) if rst: self.chat_box.append(rst) elif _type == 'game_started': self.remove_control(self.panel) self.gameui.init() self.add_control(self.gameui) self.game.start() # utils.hub_interrupt(self.game.start) elif _type == 'end_game': self.remove_control(self.gameui) self.add_control(self.panel) g = args[0] elif _type == 'client_game_finished': g = args[0] g.ui_meta.ui_class.show_result(g) elif _type in ('game_left', 'fleed'): GameHallScreen().switch() elif _type == 'game_joined': # last game ended, this is the auto # created game self.game = game = args[0] self.panel.btn_getready.state = Button.NORMAL self.gameui = self.ui_class( parent=False, game=self.game, **r2d((0, 0, 820, 720)) ) SoundManager.switch_bgm(common_res.bgm_hall) self.backdrop = common_res.bg_ingame self.set_color(Colors.green) self.events_box.clear() elif _type == 'game_crashed': ConfirmBox(u'游戏逻辑已经崩溃,请退出房间!\n这是不正常的状态,你可以报告bug。', parent=self) elif _type == 'observe_request': uid, uname = args[0] box = ConfirmBox( u'玩家 %s 希望旁观你的游戏,是否允许?\n旁观玩家可以看到你的手牌。' % uname, parent=self, buttons=((u'允许', True), (u'不允许', False)), default=False ) @box.event def on_confirm(val, uid=uid): Executive.call('observe_grant', ui_message, [uid, val]) else: Screen.on_message(self, _type, *args)
def on_message(self, _type, *args): rst = handle_chat(_type, args) if rst: self.chat_box.append(rst) elif _type == 'game_started': self.remove_control(self.panel) self.gameui.init() self.add_control(self.gameui) self.game.start() # utils.hub_interrupt(self.game.start) elif _type == 'end_game': self.remove_control(self.gameui) self.add_control(self.panel) g = args[0] elif _type == 'client_game_finished': g = args[0] g.ui_meta.ui_class.show_result(g) elif _type in ('game_left', 'fleed'): GameHallScreen().switch() elif _type == 'game_joined': # last game ended, this is the auto # created game self.game = game = args[0] self.panel.btn_getready.state = Button.NORMAL self.gameui = self.ui_class(parent=False, game=self.game, **r2d((0, 0, 820, 720))) SoundManager.switch_bgm(common_res.bgm_hall) self.backdrop = common_res.bg_ingame self.set_color(Colors.green) self.events_box.clear() elif _type == 'game_crashed': ConfirmBox(u'游戏逻辑已经崩溃,请退出房间!\n这是不正常的状态,你可以报告bug。', parent=self) elif _type == 'observe_request': uid, uname = args[0] box = ConfirmBox(u'玩家 %s 希望旁观你的游戏,是否允许?\n旁观玩家可以看到你的手牌。' % uname, parent=self, buttons=((u'允许', True), (u'不允许', False)), default=False) @box.event def on_confirm(val, uid=uid): Executive.call('observe_grant', ui_message, [uid, val]) else: Screen.on_message(self, _type, *args)
def init(self): ports = self.char_portraits = [ GameCharacterPortrait(parent=self, color=color, x=x, y=y, tag_placement=tp) for x, y, tp, color in self.gcp_location[: len(self.game.players)] ] pl = self.game.players shift = pl.index(self.game.me) for i, c in enumerate(ports): p = pl[(shift + i) % self.game.n_persons] c.player = p c.update() ports[0].equipcard_area.selectable = True # it's TheChosenOne self.begin_select_player() self.end_select_player() self.skill_box = SkillSelectionBox(parent=self, x=161, y=9, width=70, height=22 * 6 - 4) SoundManager.switch_bgm(gres.bgm_game)
def on_switch(self): SoundManager.switch_bgm(common_res.bgm_hall)
def on_message(self, _type, *args): rst = handle_chat(_type, args) if rst: self.chat_box.append(rst) return elif _type == 'game_started': from utils import notify notify(u'东方符斗祭 - 游戏提醒', u'游戏已开始,请注意。') self.remove_control(self.panel) self.gameui.init() self.add_control(self.gameui) self.game.start() elif _type == 'end_game': self.remove_control(self.gameui) self.add_control(self.panel) g = args[0] elif _type == 'client_game_finished': g = args[0] g.ui_meta.ui_class.show_result(g) elif _type in ('game_left', 'fleed'): GameHallScreen().switch() elif _type == 'game_joined': # last game ended, this is the auto # created game self.game = args[0] self.panel.btn_getready.state = Button.NORMAL self.gameui = self.ui_class( parent=False, game=self.game, **r2d((0, 0, 820, 720)) ) SoundManager.switch_bgm(common_res.bgm_hall) self.backdrop = common_res.bg_ingame self.set_color(Colors.green) self.events_box.clear() elif _type == 'game_crashed': ConfirmBox( u'游戏逻辑已经崩溃,请退出房间!\n' u'这是不正常的状态,你可以报告bug。\n' u'游戏ID:%d' % self.game.gameid, parent=self ) from __main__ import do_crashreport do_crashreport() elif _type == 'observe_request': uid, uname = args[0] box = ConfirmBox( u'玩家 %s 希望旁观你的游戏,是否允许?\n' u'旁观玩家可以看到你的手牌。' % uname, parent=self, buttons=((u'允许', True), (u'不允许', False)), default=False ) @box.event def on_confirm(val, uid=uid): Executive.call('observe_grant', ui_message, [uid, val]) elif _type == 'observer_enter': obuid, obname, uname = args[0] self.chat_box.append( u'|B|R>> |r|c0000ffff%s|r[|c9100ffff%d|r]|r趴在了|c0000ffff%s|r身后\n' % (obname, obuid, uname) ) elif _type == 'observer_leave': obuid, obname, uname = args[0] self.chat_box.append( u'|B|R>> |r|c0000ffff%s|r飘走了\n' % obname ) else: Screen.on_message(self, _type, *args)
def on_switch(self): SoundManager.switch_bgm(common_res.bgm_hall)
def on_message(self, _type, *args): rst = handle_chat(_type, args) if rst: self.chat_box.append(rst) return elif _type == 'game_started': from utils import notify notify(u'东方符斗祭 - 游戏提醒', u'游戏已开始,请注意。') self.remove_control(self.panel) self.add_control(self.gameui) self.gameui.init() self.game.start() elif _type == 'end_game': self.remove_control(self.gameui) self.add_control(self.panel) g = args[0] elif _type == 'client_game_finished': g = args[0] g.ui_meta.ui_class.show_result(g) elif _type in ('game_left', 'fleed'): GameHallScreen().switch() elif _type == 'game_joined': # last game ended, this is the auto # created game self.game = args[0] self.panel.btn_getready.state = Button.NORMAL self.gameui = self.ui_class( parent=False, game=self.game, **r2d((0, 0, 820, 720)) ) SoundManager.switch_bgm(common_res.bgm_hall) self.backdrop = common_res.bg_ingame.get() self.set_color(Colors.green) self.events_box.clear() elif _type == 'game_crashed': ConfirmBox( u'游戏逻辑已经崩溃,请退出房间!\n' u'这是不正常的状态,你可以报告bug。\n' u'游戏ID:%d' % self.game.gameid, parent=self ) from __main__ import do_crashreport do_crashreport() elif _type == 'observe_request': uid, uname = args[0] box = ConfirmBox( u'玩家 %s 希望旁观你的游戏,是否允许?\n' u'旁观玩家可以看到你的手牌。' % uname, parent=self, buttons=((u'允许', True), (u'不允许', False)), default=False ) @box.event def on_confirm(val, uid=uid): Executive.call('observe_grant', ui_message, [uid, val]) elif _type == 'observer_enter': obuid, obname, uname = args[0] self.chat_box.append( u'|B|R>> |r|c0000ffff%s|r[|c9100ffff%d|r]|r趴在了|c0000ffff%s|r身后\n' % (obname, obuid, uname) ) elif _type == 'observer_leave': obuid, obname, uname = args[0] self.chat_box.append( u'|B|R>> |r|c0000ffff%s|r飘走了\n' % obname ) else: Screen.on_message(self, _type, *args)