Ver código fonte

神宠大作战
幻界之镜
模拟城市我是市长
3款游戏的脚本

DONGGUOLIANGNEW\edy 1 ano atrás
pai
commit
72e04fe2f8

+ 79 - 0
幻界之镜酷派/script.py

@@ -0,0 +1,79 @@
+# coding:utf8
+
+__author__ = 'Snow'
+
+import os
+import logging
+import xml.dom.minidom
+import re
+import shutil
+import glob
+import distutils.dir_util
+import gw_file_system
+import gw_data_center
+
+ANDROID_NS = 'http://schemas.android.com/apk/res/android'
+from xml.etree import ElementTree as ET
+
+
+def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    # modify_manifest(decompileDir)
+    modify_manifest_requestLegacyExternalStorage(decompileDir)
+
+def modify_manifest(decompileDir):
+    ET.register_namespace('android', ANDROID_NS)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    root_node = ET.parse(xmlparse)
+    root = root_node.getroot()
+    name = '{' + ANDROID_NS + '}name'
+    authorities = '{' + ANDROID_NS + '}foregroundServiceType'
+    authoritiesTwo = '{' + ANDROID_NS + '}requestLegacyExternalStorage'
+
+    package_name = root.attrib.get('package')
+    if package_name == None:
+        return
+    providers = root.findall('./application/service')
+    if providers != None:
+        for provider in providers:
+            providerName = provider.attrib.get(name)
+            if 'com.uwa.uwascreen.CaptureScreenService' == providerName:
+                # 使用try 主要是为了 防止此属性不在时,导致的错误,而程序终止
+                try:
+                    del provider.attrib[authorities]
+                    del provider.attrib[authoritiesTwo]
+                except:
+                    ""
+            if 'com.uwa.screenshot.mediaprojection.ScreenShotService' == providerName:
+                # 使用try 主要是为了 防止此属性不在时,导致的错误,而程序终止
+                try:
+                    del provider.attrib[authorities]
+                except:
+                    ""
+
+    root_node.write(xmlparse, 'utf-8')
+
+
+def modify_manifest_requestLegacyExternalStorage(decompileDir):
+    ET.register_namespace('android', ANDROID_NS)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    root_node = ET.parse(xmlparse)
+    root = root_node.getroot()
+    name = '{' + ANDROID_NS + '}name'
+    authorities = '{' + ANDROID_NS + '}preserveLegacyExternalStorage'
+    package_name = root.attrib.get('package')
+    if package_name == None:
+        return
+    providers = root.findall('./application')
+    if providers != None:
+        for provider in providers:
+            # 使用try 主要是为了 防止此属性不在时,导致的错误,而程序终止
+            try:
+                del provider.attrib[authorities]
+            except:
+                ""
+
+    root_node.write(xmlparse, 'utf-8')
+
+
+if __name__ == '__main__':
+    ""

+ 94 - 0
模拟城市我是市长酷派/script.py

@@ -0,0 +1,94 @@
+# coding:utf8
+
+__author__ = 'dong'
+
+import os
+import logging
+import xml.dom.minidom
+import re
+import shutil
+import glob
+from xml.etree.ElementTree import ElementTree, Element
+import distutils.dir_util
+from xml.etree import ElementTree as ET
+import gw_file_system
+import gw_data_center
+
+ANDROID_NS = 'http://schemas.android.com/apk/res/android'
+
+
+def script_init(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
+    # gw_data_center.pack_small=True
+    return
+
+
+def script_second(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
+    list_dpi = ["drawable-mdpi", "drawable-hdpi", "drawable-xhdpi","drawable-xxhdpi","drawable-xxxhdpi"]
+    list_png = [
+        "abc_ab_share_pack_mtrl_alpha", "abc_btn_switch_to_on_mtrl_00001", "abc_btn_switch_to_on_mtrl_00012",
+        "abc_cab_background_top_mtrl_alpha", "abc_list_divider_mtrl_alpha", "abc_list_focused_holo",
+        "abc_list_longpressed_holo",
+        "abc_list_pressed_holo_dark", "abc_list_pressed_holo_light", "abc_list_selector_disabled_holo_dark",
+        "abc_list_selector_disabled_holo_light",
+        "abc_menu_hardkey_panel_mtrl_mult", "abc_popup_background_mtrl_mult", "abc_scrubber_primary_mtrl_alpha",
+        "abc_scrubber_track_mtrl_alpha",
+        "abc_spinner_mtrl_am_alpha", "abc_switch_track_mtrl_alpha", "abc_tab_indicator_mtrl_alpha",
+        "abc_textfield_activated_mtrl_alpha",
+        "abc_textfield_default_mtrl_alpha", "abc_textfield_search_activated_mtrl_alpha",
+        "abc_textfield_search_default_mtrl_alpha",
+    ]
+    list_xml=[
+            "abc_edit_text_material","abc_item_background_holo_dark","abc_item_background_holo_light","abc_list_selector_background_transition_holo_dark",
+              "abc_list_selector_background_transition_holo_light","abc_list_selector_holo_dark","abc_list_selector_holo_light","abc_seekbar_track_material",
+              "abc_spinner_textfield_background_material","abc_switch_thumb_material","abc_tab_indicator_material","abc_textfield_search_material",
+              ]
+    list_style=["listChoiceBackgroundIndicator","editTextBackground","selectableItemBackground"]
+    public_path = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/public.xml")
+    style_path = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/styles.xml")
+    for png in list_png:
+        for dpi in list_dpi:
+            png_path = os.path.join(extract_dir, "../sdk/smallsheep/ForRes", dpi, png+".9.png")
+            logging.info(png_path)
+            if os.path.exists(png_path):
+                os.remove(png_path)
+                handle_public_xml(public_path, png)
+                handle_public_xml(style_path, png)
+    for xml in list_xml:
+        xml_path=os.path.join(extract_dir,"../sdk/smallsheep/ForRes/drawable",xml+".xml")
+        logging.info(xml_path)
+        if os.path.exists(xml_path):
+            os.remove(xml_path)
+            handle_public_xml(public_path, xml)
+            handle_public_xml(style_path,xml)
+
+    for style in list_style:
+        handle_public_xml(style_path,style)
+
+def handle_public_xml(public_xml_path, remove_node):
+    if not os.path.exists(public_xml_path):
+        logging.info('public_xml is null: ' + public_xml_path)
+        return
+    new_lines = []
+    with open(public_xml_path, 'r+') as f:
+        for line in f.readlines():
+            # l = line.strip()
+            if line.find(remove_node) > -1:
+                continue
+            new_lines.append(line)
+        f.seek(0)
+        f.truncate()
+        f.writelines(new_lines)
+    return
+
+
+def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    logging.info("-----debug-----")
+
+
+def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    return
+
+
+if __name__ == '__main__':
+    # replace_super_application("D:\work\wzdq")
+    ""

+ 2 - 1
神宠大作战2百度/script.py

@@ -23,7 +23,8 @@ def script_second(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_cha
     handle_public_xml(public_xml, "ss_sgn")
 
     raws_xml = os.path.join(extract_dir, "res/values/raws.xml")
-    os.remove(raws_xml)
+    if os.path.exists(raws_xml):
+        os.remove(raws_xml)
     return