Ver código fonte

修改天宇游打包脚本

zengqb 5 anos atrás
pai
commit
c649f7b471
2 arquivos alterados com 81 adições e 2 exclusões
  1. 35 2
      sdk/jm_tianyuyou/script/sdk_script.py
  2. 46 0
      sdk_script/jm_tianyuyou.py

+ 35 - 2
sdk/jm_tianyuyou/script/sdk_script.py

@@ -3,6 +3,8 @@ import common_utils
 import xml_utils
 import os.path
 import xml.etree.ElementTree as ET
+import json
+
 
 namespaces = {'android': 'http://schemas.android.com/apk/res/android'}
 encoding = 'UTF-8'
@@ -15,10 +17,12 @@ def execute(game, sdk, config):
     subChannel = config['subChannel']
 
     createJmhyProperties(game, sdk, subChannel, config)
-    #ret = deleteSplash(game, sdk, subChannel, config)
     addLauncher(game, sdk, subChannel, config)
     common_utils.changeApplication(game, sdk, subChannel, config, 'com.tygrm.sdk.TYRApplication')
 
+    #生成json
+
+
     return 0
 
 
@@ -169,4 +173,33 @@ def addGameLauncherActivity(manifest, screenOrientation, activity):
     application = root.find('application')
     application.insert(0, activity)
 
-    tree.write(manifest, encoding)
+    tree.write(manifest, encoding)
+
+def addAKJson(game, sdk, subChannel, config):
+        '''
+        添加config.json
+        '''
+        if 'tianyuyou' not in config:
+            return 0
+
+        print('add config.json...')
+        decompliePath = file_utils.getDecompliePath(game, sdk, subChannel, config['cache'])
+        configJson = os.path.join(decompliePath, 'assets', 'tygrm_ak.json')
+        jsonText = json.dumps(config['configData'], ensure_ascii=False)
+        file_utils.createFile(configJson, jsonText)
+        return 0
+
+
+def addPJson(game, sdk, subChannel, config):
+    '''
+    添加config.json
+    '''
+    if 'configData' not in config:
+        return 0
+
+    print('add config.json...')
+    decompliePath = file_utils.getDecompliePath(game, sdk, subChannel, config['cache'])
+    configJson = os.path.join(decompliePath, 'assets', 'jmhy_config.json')
+    jsonText = json.dumps(config['configData'], ensure_ascii=False)
+    file_utils.createFile(configJson, jsonText)
+    return 0

+ 46 - 0
sdk_script/jm_tianyuyou.py

@@ -0,0 +1,46 @@
+def getSdkConfig(jsonConfig, config):
+    print('getSdkConfig tianyuyou...')
+    
+    if 'tianyuyou' in config:
+        tianyuyou = config['tianyuyou']
+
+        akJson = {}
+        akJson['cp_game_id'] = tianyuyou['cp_game_id']
+        akJson['a'] = tianyuyou['a']
+        akJson['k'] = tianyuyou['k']
+        akJson['game_name'] = config['name']
+
+
+        pJson = {}
+        splash_sc = {}
+        sub_sdk_param = {}
+
+        pJson['splash_land'] = 'tyr_splash_land.png'
+        pJson['splash_port'] = 'tyr_splash_port.png'
+        pJson['splash_bgc'] = 'splash_bgc'
+
+        splash_sc['setScaleType'] = False
+        splash_sc['type'] = 0
+        pJson['splash_sc'] = 'splash_sc'
+
+        pJson['agent_id'] = tianyuyou['agent_id']
+        pJson['agent_app_id'] = tianyuyou['agent_app_id']
+
+        sub_sdk_param['TY_APPID'] = tianyuyou['TY_APPID']
+        sub_sdk_param['TY_CLIENTID'] = tianyuyou['TY_CLIENTID']
+        sub_sdk_param['TY_CLIENTKEY'] = tianyuyou['TY_CLIENTKEY']
+        sub_sdk_param['URL_ID'] = tianyuyou['URL_ID']
+
+        pJson['sub_sdk_param'] = 'sub_sdk_param'
+
+        jsonConfig['akJson'] = akJson
+        jsonConfig['pJson'] = pJson
+
+
+        if 'includeOtherPay' in tianyuyou:
+            if tianyuyou['includeOtherPay'] == 0:
+                jsonConfig['libConfig'] = 'nopay'
+            else:
+                jsonConfig['libConfig'] = 'default'
+        else:
+            jsonConfig['libConfig'] = 'default'