本文整理汇总了Python中the_tale.game.logic_storage.LogicStorage.get_action_uid方法的典型用法代码示例。如果您正苦于以下问题:Python LogicStorage.get_action_uid方法的具体用法?Python LogicStorage.get_action_uid怎么用?Python LogicStorage.get_action_uid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类the_tale.game.logic_storage.LogicStorage
的用法示例。
在下文中一共展示了LogicStorage.get_action_uid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_load_account_data_with_meta_action
# 需要导入模块: from the_tale.game.logic_storage import LogicStorage [as 别名]
# 或者: from the_tale.game.logic_storage.LogicStorage import get_action_uid [as 别名]
def test_load_account_data_with_meta_action(self):
bundle_id = 666
meta_action_battle = meta_actions.ArenaPvP1x1.create(self.storage, self.hero_1, self.hero_2)
proxy_action_1 = actions_prototypes.ActionMetaProxyPrototype.create(hero=self.hero_1, _bundle_id=bundle_id, meta_action=meta_action_battle)
proxy_action_2 = actions_prototypes.ActionMetaProxyPrototype.create(hero=self.hero_2, _bundle_id=bundle_id, meta_action=meta_action_battle)
self.assertEqual(len(self.storage.meta_actions), 1)
self.assertEqual(len(self.storage.meta_actions_to_actions), 1)
self.assertEqual(self.storage.meta_actions_to_actions[meta_action_battle.uid], set([LogicStorage.get_action_uid(proxy_action_1),
LogicStorage.get_action_uid(proxy_action_2)]))
self.storage.save_changed_data()
self.assertIs(self.hero_1.actions.current_action.meta_action, self.hero_2.actions.current_action.meta_action)
self.assertIs(self.hero_1.actions.current_action.saved_meta_action, self.hero_2.actions.current_action.saved_meta_action)
storage = LogicStorage()
storage.load_account_data(AccountPrototype.get_by_id(self.account_1.id))
storage.load_account_data(AccountPrototype.get_by_id(self.account_2.id))
self.assertEqual(len(storage.meta_actions), 1)
self.assertEqual(len(storage.meta_actions_to_actions), 1)
self.assertEqual(storage.meta_actions_to_actions[meta_action_battle.uid], set([LogicStorage.get_action_uid(proxy_action_1),
LogicStorage.get_action_uid(proxy_action_2)]))
self.assertEqual(storage.bundles_to_accounts, {self.hero_1.actions.current_action.bundle_id: set([self.account_1.id, self.account_2.id])})
hero_1 = storage.accounts_to_heroes[self.account_1.id]
hero_2 = storage.accounts_to_heroes[self.account_2.id]
self.assertIs(hero_1.actions.current_action.meta_action, hero_2.actions.current_action.meta_action)
self.assertIsNot(hero_1.actions.current_action.saved_meta_action, hero_2.actions.current_action.saved_meta_action)
self.assertEqual(hero_1.actions.current_action.saved_meta_action.serialize(), hero_2.actions.current_action.saved_meta_action.serialize())
示例2: test_remove_action__metaaction
# 需要导入模块: from the_tale.game.logic_storage import LogicStorage [as 别名]
# 或者: from the_tale.game.logic_storage.LogicStorage import get_action_uid [as 别名]
def test_remove_action__metaaction(self):
bundle_id = 666
meta_action_battle = meta_actions.ArenaPvP1x1.create(self.storage, self.hero_1, self.hero_2)
proxy_action_1 = actions_prototypes.ActionMetaProxyPrototype.create(hero=self.hero_1, _bundle_id=bundle_id, meta_action=meta_action_battle)
proxy_action_2 = actions_prototypes.ActionMetaProxyPrototype.create(hero=self.hero_2, _bundle_id=bundle_id, meta_action=meta_action_battle)
self.assertEqual(len(self.storage.meta_actions), 1)
self.assertEqual(len(self.storage.meta_actions_to_actions), 1)
self.assertEqual(self.storage.meta_actions_to_actions[meta_action_battle.uid], set([LogicStorage.get_action_uid(proxy_action_1),
LogicStorage.get_action_uid(proxy_action_2)]))
self.storage.remove_action(proxy_action_2)
self.assertEqual(len(self.storage.meta_actions), 1)
self.assertEqual(len(self.storage.meta_actions_to_actions), 1)
self.assertEqual(self.storage.meta_actions_to_actions[meta_action_battle.uid], set([LogicStorage.get_action_uid(proxy_action_1)]))
self.storage.remove_action(proxy_action_1)
self.assertEqual(len(self.storage.meta_actions), 0)
self.assertEqual(len(self.storage.meta_actions_to_actions), 0)