Browse Source

增加浮点sdk

yhz 5 years ago
parent
commit
094fb19421

+ 60 - 0
package_utils_record.py

@@ -68,6 +68,10 @@ def pack(game, sdk, config):
         return ret
     # 复制app res资源
     ret = copyAppRes(game, sdk, subChannel, config)
+    if ret:
+        return ret
+    # 合并语言文件
+    ret = mergeLanguage(game, sdk, subChannel, config)
     if ret:
         return ret
     # 增加配置文件
@@ -323,6 +327,62 @@ def copyAppRes(game, sdk, subChannel, config):
     if ret:
         return ret
     return 0
+
+def mergeLanguage(game, sdk, subChannel, config):
+    '''
+    合并语言文件
+    '''
+    print('merge language...')
+    channelPath = file_utils.getSubChannelPath(game, sdk, subChannel)
+    mergePath = file_utils.getFullPath(channelPath, 'merge')
+    decompliePath = file_utils.getDecompliePath(game, sdk, subChannel, config['cache'])
+
+    if not os.path.exists(mergePath):
+        print('%s not exists!' % mergePath)
+        return 1
+
+    if not os.path.isdir(mergePath):
+        print('%s not a dir!' % mergePath)
+        return 1
+
+    for fileName in os.listdir(mergePath):
+        mergeJson(mergePath, decompliePath, fileName)
+    return 0
+
+def mergeJson(srcDir, changeDir, fileName):
+    srcFile = os.path.join(srcDir, fileName)
+    if os.path.isdir(srcFile):
+        for fileName2 in os.listdir(srcFile):
+            changeDir2 = os.path.join(changeDir, fileName)
+            mergeJson(srcFile, changeDir2, fileName2)
+    else:
+        changeFile = os.path.join(changeDir, fileName)
+        if not os.path.exists(changeFile):
+            print('%s not exists!' % changeFile)
+            return 1
+        jsonText1 = file_utils.readFile(srcFile)
+        jsonText2 = file_utils.readFile(changeFile)
+        print('*************src config*************')
+        print(jsonText1)
+        print('************************************')
+        print('*************target config*************')
+        print(jsonText2)
+        print('************************************')
+
+        json1 = json.loads(jsonText1)
+        json2 = json.loads(jsonText2)
+
+        for item in json1:
+            if item in json2:
+                json2[item] = json1[item]
+
+        jsonStr = json.dumps(json2, ensure_ascii=False)
+        print('*************merge config*************')
+        print(jsonStr)
+        print('************************************')
+        print('>> %s' % changeFile)
+        file_utils.createFile(changeFile, jsonStr)
+    return 0
     
 def copyAppResWithType(decompliePath, channelPath, typeName):
     decomplieResPath = os.path.join(decompliePath, 'res')

+ 1 - 1
package_web.py

@@ -35,7 +35,7 @@ scriptMapping = {
 }
 
 newSdk = ["shanshen", "gzjysdk"]
-recordSdk = ["record"]
+recordSdk = ["record", "float"]
 
 def packageWeb():
     if len(sys.argv) < 2:

+ 14 - 0
package_web_record.py

@@ -69,6 +69,15 @@ def package(config, sdk):
     if 'recordConfig' in config:
         setRecordConfig(jsonConfig, config['recordConfig'])
 
+    configData = jsonConfig['configData']
+    properties = jsonConfig['properties']
+    configData['agent'] = properties['agent']
+    configData['buildTime'] = properties['version']
+    configData['appId'] = properties['appid']
+    configData['appkey'] = properties['appkey']
+    if 'host' in properties:
+        configData['host'] = properties['host']
+
     if 'deleteList' in config:
         jsonConfig['deleteList'] = config['deleteList']
 
@@ -222,6 +231,11 @@ def copyRes(game, sdk, subChannel, config):
         gameApk = file_utils.getFullGameApk(game)
         file_utils.copyFile(newGameApk, gameApk)
 
+    if 'languageList' in config:
+        for item in config['languageList']:
+            languagePath = os.path.join(subChannelPath, 'merge', item['apkLanguage'])
+            file_utils.copyFile(item['language'], languagePath)
+
 def getPackagePath(basePath, packageName):
     '''
     包名对应的目录

BIN
sdk/float/libs/FloatSDK-1.0.8.jar


BIN
sdk/float/libs/logging-interceptor-3.12.3.jar


BIN
sdk/float/libs/okhttp-3.12.3.jar


BIN
sdk/float/libs/okio-1.17.3.jar


BIN
sdk/float/libs/support-annotations-27.1.1.jar


BIN
sdk/float/libs/support-compat-27.1.1.jar


+ 13 - 0
sdk/float/manifest.xml

@@ -0,0 +1,13 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+	<permissions>
+		<uses-permission android:name="android.permission.INTERNET"/>
+		<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+		<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
+	</permissions>
+
+    <application>
+        <activity android:name="com.tool.floatsdk.ui.WebActivity"
+            android:screenOrientation="portrait"
+			android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
+    </application>
+</manifest>

BIN
sdk/float/res/drawable-xxhdpi/sdk_more.png


BIN
sdk/float/res/drawable-xxhdpi/sdk_pause.png


BIN
sdk/float/res/drawable-xxhdpi/sdk_play.png


+ 5 - 0
sdk/float/res/drawable/sdk_button_bg.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+    <solid android:color="@color/sdk_button_bg"/>
+    <corners android:radius="3dp"/>
+</shape>

+ 10 - 0
sdk/float/res/layout/sdk_activity_web.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+    <WebView
+        android:id="@+id/web_view"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"/>
+</FrameLayout>

+ 35 - 0
sdk/float/res/layout/sdk_fragment_float.xml

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+    <LinearLayout
+        android:layout_width="73dp"
+        android:layout_height="@dimen/float_icon_size"
+        android:layout_margin="@dimen/float_icon_bar_margin"
+        android:orientation="horizontal"
+        android:layout_gravity="end"
+        android:gravity="center_vertical"
+        android:background="@drawable/sdk_button_bg">
+        <ImageView
+            android:id="@+id/more"
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="@dimen/float_icon_size"
+            android:scaleType="centerInside"
+            android:src="@drawable/sdk_more"/>
+
+        <View
+            android:layout_width="1dp"
+            android:layout_height="13dp"
+            android:background="@color/sdk_line"/>
+
+        <ImageView
+            android:id="@+id/state"
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="@dimen/float_icon_size"
+            android:scaleType="centerInside"
+            android:src="@drawable/sdk_pause"/>
+    </LinearLayout>
+</FrameLayout>

+ 5 - 0
sdk/float/res/values/sdk_colors.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <color name="sdk_button_bg">#66000000</color>
+    <color name="sdk_line">#80FFFFFF</color>
+</resources>

+ 5 - 0
sdk/float/res/values/sdk_dimens.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <dimen name="float_icon_size">27dp</dimen>
+    <dimen name="float_icon_bar_margin">13dp</dimen>
+</resources>