当前位置: 首页>>代码示例>>Python>>正文


Python LogicStorage.recache_bundle方法代码示例

本文整理汇总了Python中the_tale.game.logic_storage.LogicStorage.recache_bundle方法的典型用法代码示例。如果您正苦于以下问题:Python LogicStorage.recache_bundle方法的具体用法?Python LogicStorage.recache_bundle怎么用?Python LogicStorage.recache_bundle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在the_tale.game.logic_storage.LogicStorage的用法示例。


在下文中一共展示了LogicStorage.recache_bundle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Worker

# 需要导入模块: from the_tale.game.logic_storage import LogicStorage [as 别名]
# 或者: from the_tale.game.logic_storage.LogicStorage import recache_bundle [as 别名]

#.........这里部分代码省略.........

    def process_register_account(self, account_id):
        from the_tale.accounts.prototypes import AccountPrototype
        account = AccountPrototype.get_by_id(account_id)
        if account is None:
            raise LogicException('can not get account with id "%d"' % (account_id,))
        self.storage.load_account_data(account)

    def cmd_release_account(self, account_id):
        return self.send_cmd('release_account', {'account_id': account_id})

    def process_release_account(self, account_id):
        self.release_account(account_id)

    def cmd_logic_task(self, account_id, task_id):
        return self.send_cmd('logic_task', {'task_id': task_id,
                                            'account_id': account_id})

    def process_logic_task(self, account_id, task_id): # pylint: disable=W0613
        hero = self.storage.accounts_to_heroes[account_id]
        bundle_id = hero.actions.current_action.bundle_id

        if bundle_id in self.storage.ignored_bundles:
            return

        with self.storage.on_exception(self.logger,
                                       message='LogicWorker.process_logic_task catch exception, while processing hero %d, try to save all bundles except %d',
                                       data=(hero.id, bundle_id),
                                       excluded_bundle_id=bundle_id):
            task = postponed_tasks.PostponedTaskPrototype.get_by_id(task_id)
            task.process(self.logger, storage=self.storage)
            task.do_postsave_actions()

            self.storage.recache_bundle(bundle_id)


    def cmd_force_save(self, account_id):
        return self.send_cmd('force_save', {'account_id': account_id})

    def process_force_save(self, account_id): # pylint: disable=W0613
        hero = self.storage.accounts_to_heroes[account_id]
        bundle_id = hero.actions.current_action.bundle_id
        if bundle_id in self.storage.ignored_bundles:
            return
        self.storage.save_bundle_data(bundle_id=bundle_id)

    def cmd_start_hero_caching(self, account_id):
        self.send_cmd('start_hero_caching', {'account_id': account_id})

    def process_start_hero_caching(self, account_id):
        hero = self.storage.accounts_to_heroes[account_id]

        if hero.actions.current_action.bundle_id in self.storage.ignored_bundles:
            return

        hero.ui_caching_started_at = datetime.datetime.now()
        self.storage.recache_bundle(hero.actions.current_action.bundle_id)

    def cmd_update_hero_with_account_data(self, account_id, is_fast, premium_end_at, active_end_at, ban_end_at, might, actual_bills):
        self.send_cmd('update_hero_with_account_data', {'account_id': account_id,
                                                        'is_fast': is_fast,
                                                        'premium_end_at': premium_end_at,
                                                        'active_end_at': active_end_at,
                                                        'ban_end_at': ban_end_at,
                                                        'might': might,
                                                        'actual_bills': actual_bills})
开发者ID:Alkalit,项目名称:the-tale,代码行数:70,代码来源:logic.py


注:本文中的the_tale.game.logic_storage.LogicStorage.recache_bundle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。