|
@@ -24,6 +24,7 @@ import uuid
|
|
|
import zipfile
|
|
|
|
|
|
ignoreLauncher = ['jm_ysdk', 'jm_yijie', 'jm_quick', 'jm_beiyu', 'jm_xq_jrtt']
|
|
|
+adaptApp = ['yjzx']
|
|
|
|
|
|
def pack(game, sdk, config):
|
|
|
config['cache'] = uuid.uuid1()
|
|
@@ -98,6 +99,8 @@ def pack(game, sdk, config):
|
|
|
return ret
|
|
|
# 添加多图标
|
|
|
#ret = addMoreIcon(game, sdk, subChannel, config)
|
|
|
+ # 复制icon图标到res
|
|
|
+ ret = copyIcon(game, sdk, subChannel, config)
|
|
|
#if ret:
|
|
|
# return ret
|
|
|
# 打包lib依赖
|
|
@@ -311,12 +314,44 @@ def copyAppRes(game, sdk, subChannel, config):
|
|
|
|
|
|
# assets
|
|
|
print('copy assets...')
|
|
|
- assetsPath = file_utils.getFullPath(channelPath, 'assets')
|
|
|
- decomplieAssetsPath = file_utils.getFullPath(decompliePath, 'assets')
|
|
|
- if os.path.exists(assetsPath):
|
|
|
- ret = file_utils.copyFileAllDir(assetsPath, decomplieAssetsPath)
|
|
|
- if ret:
|
|
|
- return ret
|
|
|
+ #适配一剑斩仙
|
|
|
+ if config['app'] in adaptApp:
|
|
|
+ print('适配一剑斩仙...')
|
|
|
+ decomplieAssetsPath = file_utils.getFullPath(decompliePath, 'assets')
|
|
|
+ skinZipPath = os.path.join(decomplieAssetsPath, 'skin.zip')
|
|
|
+ skinPath = os.path.join(decomplieAssetsPath, 'skin')
|
|
|
+ if os.path.exists(skinZipPath):
|
|
|
+ with zipfile.ZipFile(skinZipPath) as zf:
|
|
|
+ zf.extractall(decomplieAssetsPath)
|
|
|
+ print('create unzip skin' )
|
|
|
+ assetsPath = file_utils.getFullPath(channelPath, 'assets')
|
|
|
+ decomplieAssetsPath = file_utils.getFullPath(decompliePath, 'assets')
|
|
|
+ if os.path.exists(assetsPath):
|
|
|
+ ret = file_utils.copyFileAllDir(assetsPath, decomplieAssetsPath)
|
|
|
+ with zipfile.ZipFile(skinZipPath, 'w') as z:
|
|
|
+ for root, dirs, files in os.walk(skinPath):
|
|
|
+ for single_file in files:
|
|
|
+ filepath = os.path.join(root, single_file)
|
|
|
+ print ('create zip ---> ' + filepath)
|
|
|
+ temPath = 'skin/' + single_file
|
|
|
+ z.write(filepath, temPath)
|
|
|
+ z.close()
|
|
|
+ else:
|
|
|
+ print('normal copy assets...')
|
|
|
+ assetsPath = file_utils.getFullPath(channelPath, 'assets')
|
|
|
+ decomplieAssetsPath = file_utils.getFullPath(decompliePath, 'assets')
|
|
|
+ if os.path.exists(assetsPath):
|
|
|
+ ret = file_utils.copyFileAllDir(assetsPath, decomplieAssetsPath)
|
|
|
+ if ret:
|
|
|
+ return ret
|
|
|
+ else:
|
|
|
+ print('normal copy assets...')
|
|
|
+ assetsPath = file_utils.getFullPath(channelPath, 'assets')
|
|
|
+ decomplieAssetsPath = file_utils.getFullPath(decompliePath, 'assets')
|
|
|
+ if os.path.exists(assetsPath):
|
|
|
+ ret = file_utils.copyFileAllDir(assetsPath, decomplieAssetsPath)
|
|
|
+ if ret:
|
|
|
+ return ret
|
|
|
|
|
|
# icon
|
|
|
print('copy icon...')
|
|
@@ -573,6 +608,37 @@ def addMoreIcon(game, sdk, subChannel, config):
|
|
|
manifest = os.path.join(decompliePath, 'AndroidManifest.xml')
|
|
|
return xml_utils.addMoreIcon(manifest, icon, switchIcon)
|
|
|
|
|
|
+def copyIcon(game, sdk, subChannel, config):
|
|
|
+ '''
|
|
|
+ 复制icon到res ,一键登录使用
|
|
|
+ '''
|
|
|
+ if config['changeIcon']:
|
|
|
+ decompliePath = file_utils.getDecompliePath(game, sdk, subChannel, config['cache'])
|
|
|
+ decomplieResPath = file_utils.getFullPath(decompliePath, 'res')
|
|
|
+ iconPath = os.path.join(decomplieResPath, 'mipmap-xhdpi', 'common_sdk_icon.png')
|
|
|
+ desPath = os.path.join(decomplieResPath, 'drawable-hdpi', 'jm_cmcc_icon.png')
|
|
|
+ file_utils.copyFile(iconPath, desPath)
|
|
|
+ else:
|
|
|
+ decompliePath = file_utils.getDecompliePath(game, sdk, subChannel, config['cache'])
|
|
|
+ decomplieResPath = file_utils.getFullPath(decompliePath, 'res')
|
|
|
+ desPath = os.path.join(decomplieResPath, 'drawable-hdpi', 'jm_cmcc_icon.png')
|
|
|
+
|
|
|
+ manifest = os.path.join(decompliePath, 'AndroidManifest.xml')
|
|
|
+ icon = xml_utils.getApplicationAttr(manifest, 'icon')
|
|
|
+ tag = icon[1:].split("/")
|
|
|
+ if len(tag) < 1:
|
|
|
+ return
|
|
|
+ hdpi = ['-xhdpi', '-xxhdpi', '-xxxhdpi']
|
|
|
+ for h in hdpi:
|
|
|
+ p1 = '%s%s' % (tag[0],h)
|
|
|
+ png = tag[1] + ".png"
|
|
|
+ iconPath = os.path.join(decomplieResPath, p1, png)
|
|
|
+ if os.path.exists(iconPath):
|
|
|
+ print ('iconPath = ' + iconPath)
|
|
|
+ file_utils.copyFile(iconPath, desPath)
|
|
|
+ break
|
|
|
+
|
|
|
+
|
|
|
def formatHex(millisecond):
|
|
|
'''
|
|
|
将毫秒转为16进制,4位格式
|
|
@@ -581,7 +647,7 @@ def formatHex(millisecond):
|
|
|
timeHex = timeHex[2:]
|
|
|
formatHex = ''
|
|
|
if len(timeHex) == 3:
|
|
|
- formatHex = '0x0' + timeHex
|
|
|
+ formatHex = '0x0' + timeHexaddLauncher
|
|
|
elif len(timeHex) == 4:
|
|
|
formatHex = '0x' + timeHex
|
|
|
else:
|