Browse Source

quick适配我在江湖

zqbo 5 years ago
parent
commit
0641b73311

BIN
sdk/jm_quick/script/__pycache__/sdk_script.cpython-37.pyc


+ 59 - 2
sdk/jm_quick/script/sdk_script.py

@@ -14,9 +14,10 @@ def execute(game, sdk, config):
     subChannel = config['subChannel']
 
     createJmhyProperties(game, sdk, subChannel, config)
-    if config['addLauncher']:
-        addLauncher(game, sdk, subChannel, config)
+    ret = deleteSplash(game, sdk, subChannel, config)
+    addLauncher(game, sdk, subChannel, config)
     common_utils.changeApplication(game, sdk, subChannel, config, 'com.inner.sdk.ui.QuickApplication')
+
     return 0
 
 def checkConfig(config):
@@ -105,4 +106,60 @@ def addLauncherActivity(manifest, screenOrientation):
     application = root.find('application')
     application.insert(0, activity)
 
+    tree.write(manifest, encoding)
+
+def deleteSplash(game, sdk, subChannel, config):
+    '''
+    删除闪屏
+    '''
+    if game != 'wzjh':
+        return 0
+    channelPath = file_utils.getSubChannelPath(game, sdk, subChannel)
+    print('delete Splash...')
+    decompliePath = file_utils.getDecompliePath(game, sdk, subChannel, config['cache'])
+    manifest = os.path.join(decompliePath, 'AndroidManifest.xml')
+    activity = xml_utils.getLauncherActivityName(manifest)
+    activity = xml_utils.removeLauncherActivity(manifest)
+    xml_utils.deleteActivityByName(manifest,'com.hugenstar.nanobox.NaNoUnityContext')
+    addGameLauncherActivity(manifest, config['screenOrientation'], 'com.hugenstar.nanobox.NaNoUnityContext')
+    return 0
+
+def addGameLauncherActivity(manifest, screenOrientation, activity):
+    '''
+    修改特定游戏启动的activity
+    '''
+    for key in namespaces:
+        ET.register_namespace(key, namespaces[key])
+
+    tree = ET.parse(manifest)
+    root = tree.getroot()
+
+    # activity
+    '''<activity android:name=".LauncherActivity"
+            android:theme="@style/LauncherStyle">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>'''
+
+    activity = ET.Element('activity', {'android:name' : activity,
+    'android:theme' : '@android:style/Theme.Holo.Light.NoActionBar.Fullscreen',
+    'android:launchMode' : 'singleTop',
+    'android:configChanges' : 'orientation|screenSize|keyboardHidden',
+    'android:screenOrientation' : screenOrientation})
+    intent = ET.Element('intent-filter')
+    action = ET.Element('action', {'android:name' : 'android.intent.action.MAIN'})
+    category = ET.Element('category', {'android:name' : 'android.intent.category.LAUNCHER'})
+    intent.append(action)
+    intent.append(category)
+    activity.append(intent)
+    intent2 = ET.Element('intent-filter')
+    category = ET.Element('category', {'android:name' : 'android.intent.category.LEANBACK_LAUNCHER'})
+    intent2.append(category)
+    activity.append(intent2)
+
+    application = root.find('application')
+    application.insert(0, activity)
+
     tree.write(manifest, encoding)