當前位置: 首頁>>代碼示例>>Python>>正文


Python IkaUtils.getMyEntryFromContext方法代碼示例

本文整理匯總了Python中ikalog.utils.IkaUtils.getMyEntryFromContext方法的典型用法代碼示例。如果您正苦於以下問題:Python IkaUtils.getMyEntryFromContext方法的具體用法?Python IkaUtils.getMyEntryFromContext怎麽用?Python IkaUtils.getMyEntryFromContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ikalog.utils.IkaUtils的用法示例。


在下文中一共展示了IkaUtils.getMyEntryFromContext方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_getMyEntryFromContext

# 需要導入模塊: from ikalog.utils import IkaUtils [as 別名]
# 或者: from ikalog.utils.IkaUtils import getMyEntryFromContext [as 別名]
    def test_getMyEntryFromContext(self):
        context = {'game': {}}
        self.assertIsNone(IkaUtils.getMyEntryFromContext(context))

        context['game']['players'] = [
            {'me': False, 'team': 1, 'rank_in_team': 1},
            {'me': False, 'team': 1, 'rank_in_team': 2},
            {'me': False, 'team': 2, 'rank_in_team': 1},
            {'me': False, 'team': 2, 'rank_in_team': 2},
        ]
        self.assertIsNone(IkaUtils.getMyEntryFromContext(context))

        context['game']['players'][2]['me'] = True
        me = IkaUtils.getMyEntryFromContext(context)
        self.assertEqual(2, me['team'])
        self.assertEqual(1, me['rank_in_team'])
開發者ID:clovervidia,項目名稱:IkaLog,代碼行數:18,代碼來源:test_ikautils.py

示例2: composite_payload

# 需要導入模塊: from ikalog.utils import IkaUtils [as 別名]
# 或者: from ikalog.utils.IkaUtils import getMyEntryFromContext [as 別名]
    def composite_payload(self, context):
        payload = {
            # 'id': game_id,
            #'recognition_source': filename,
            'recognition_at': int(time.time()),
            'agent': 'IkaLog re-recognition',
            'agent_version': IKALOG_VERSION,
            'players': [],
        }

        me = IkaUtils.getMyEntryFromContext(context)

        for e in context['game']['players']:
            player = {}
            player['team'] = 'my' if (e['team'] == me['team']) else 'his'
            player['is_me'] = 'yes' if e['me'] else 'no'
            player['weapon'] = e['weapon']
            payload['players'].append(player)

            _set_values(
                [  # 'type', 'stat.ink Field', 'IkaLog Field'
                    ['int', 'rank_in_team', 'rank_in_team'],
                    ['int', 'kill', 'kills'],
                    ['int', 'death', 'deaths'],
                    ['int', 'level', 'rank'],
                    ['int', 'point', 'score'],
                    ['str_lower', 'rank', 'udemae_pre'],
                ], player, e)

        return payload
開發者ID:clovervidia,項目名稱:IkaLog,代碼行數:32,代碼來源:reprocess_screenshots.py


注:本文中的ikalog.utils.IkaUtils.getMyEntryFromContext方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。