com.typhoon.unitysdk 1.0.93 → 1.0.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -1
- package/Editor/ApplyTool.cs +17 -0
- package/Editor/ChinaAndroidConfig.cs +128 -0
- package/Editor/ChinaAndroidConfig.cs.meta +11 -0
- package/Editor/DouyinConfig.cs +6 -2
- package/Editor/ExportModule.cs +3 -3
- package/Editor/ISaveConfigPipeline.cs +14 -0
- package/Editor/ISaveConfigPipeline.cs.meta +11 -0
- package/Editor/OppoMiniConfig.cs +6 -1
- package/Editor/PublishResult.cs +11 -4
- package/Editor/PublishSetting.cs +4 -0
- package/Editor/PublishSettingGUIDrawer.cs +19 -0
- package/Editor/TempPublish/PublishVivoBatSettingInspector.cs +53 -354
- package/Editor/VariablePreset.cs +6 -2
- package/Editor/VivoMiniConfig.cs +6 -1
- package/Editor/WxMiniConfig.cs +6 -1
- package/Runtime/BaseSdk.cs +15 -0
- package/Runtime/Interface.cs +15 -1
- package/Runtime/SdkLite.cs +28 -1
- package/Runtime/SdkTestInUnity.cs +2 -1
- package/Runtime/TyphoonSdkCallback.cs +16 -16
- package/Sources~/Package/ChinaAndroid.unitypackage +0 -0
- package/Sources~/Package/ChinaAndroid.unitypackage.manifest +1 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/Editor/ApplyTool.cs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
using System;
|
|
2
2
|
using System.Collections.Generic;
|
|
3
3
|
using System.IO;
|
|
4
|
+
using System.Text.RegularExpressions;
|
|
5
|
+
using System.Threading.Tasks;
|
|
4
6
|
using UnityEditor;
|
|
5
7
|
using UnityEngine;
|
|
6
8
|
|
|
@@ -38,11 +40,26 @@ namespace TyphoonUnitySDK
|
|
|
38
40
|
/// </summary>
|
|
39
41
|
public static void SaveAllChannelConfig()
|
|
40
42
|
{
|
|
43
|
+
// var classTypes = UniEditor.GetSubClassTypes(typeof(ISaveConfigPipeline));
|
|
44
|
+
// foreach (var classType in classTypes)
|
|
45
|
+
// {
|
|
46
|
+
// var guids = AssetDatabase.FindAssets($"t:{classType.FullName}", new[] { "Assets" });
|
|
47
|
+
// foreach (var guid in guids)
|
|
48
|
+
// {
|
|
49
|
+
// var path = AssetDatabase.GUIDToAssetPath(guid);
|
|
50
|
+
// if (!string.IsNullOrEmpty(path))
|
|
51
|
+
// {
|
|
52
|
+
// var asset = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(path);
|
|
53
|
+
// (asset as ISaveConfigPipeline)?.SaveConfig();
|
|
54
|
+
// }
|
|
55
|
+
// }
|
|
56
|
+
// }
|
|
41
57
|
VivoMiniConfig.Default.Save();
|
|
42
58
|
WxMiniConfig.Default.Save();
|
|
43
59
|
DouyinConfig.Default.Save();
|
|
44
60
|
VariablePreset.Default.Save();
|
|
45
61
|
OppoMiniConfig.Default.Save();
|
|
62
|
+
ChinaAndroidConfig.Default.Save();
|
|
46
63
|
}
|
|
47
64
|
|
|
48
65
|
/// <summary>
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.IO;
|
|
4
|
+
using UnityEditor;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
|
|
7
|
+
namespace TyphoonUnitySDK
|
|
8
|
+
{
|
|
9
|
+
public static class ChinaAndroidConfigGUIDrawer
|
|
10
|
+
{
|
|
11
|
+
public static Dictionary<string, Func<ChinaAndroidConfig, bool>> OverrideDrawGUIFunc =
|
|
12
|
+
new Dictionary<string, Func<ChinaAndroidConfig, bool>>()
|
|
13
|
+
{
|
|
14
|
+
{ "m_Script", DrawProperty_m_Script },
|
|
15
|
+
{ $"{nameof(Orientation)}", DrawProperty_Orientation },
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
private static bool DrawProperty_Orientation(ChinaAndroidConfig arg)
|
|
19
|
+
{
|
|
20
|
+
var txt = arg.Orientation == ChinaAndroidConfig.ScreenOrientation.Portrait ? "竖屏" : "横屏";
|
|
21
|
+
GUILayout.Label("横竖屏模式", Styles.BoldLabel);
|
|
22
|
+
if (GUILayout.Button(txt, "PopUp"))
|
|
23
|
+
{
|
|
24
|
+
var menu = new GenericMenu();
|
|
25
|
+
menu.AddItem(new GUIContent("竖屏"), arg.Orientation == ChinaAndroidConfig.ScreenOrientation.Portrait,
|
|
26
|
+
() =>
|
|
27
|
+
{
|
|
28
|
+
arg.Orientation = ChinaAndroidConfig.ScreenOrientation.Portrait;
|
|
29
|
+
arg.Save();
|
|
30
|
+
});
|
|
31
|
+
menu.AddItem(new GUIContent("横屏"), arg.Orientation == ChinaAndroidConfig.ScreenOrientation.Landscape,
|
|
32
|
+
() =>
|
|
33
|
+
{
|
|
34
|
+
arg.Orientation = ChinaAndroidConfig.ScreenOrientation.Landscape;
|
|
35
|
+
arg.Save();
|
|
36
|
+
});
|
|
37
|
+
menu.ShowAsContext();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private static bool DrawProperty_m_Script(ChinaAndroidConfig arg)
|
|
44
|
+
{
|
|
45
|
+
var tmpEnable = GUI.enabled;
|
|
46
|
+
GUI.enabled = true;
|
|
47
|
+
GUILayout.Space(6);
|
|
48
|
+
GUIDrawer.DrawKeynotes("①需要Unity 2019.3+ 或以上,即新版 android 目录结构");
|
|
49
|
+
GUIDrawer.DrawKeynotes("②剔除第三方SDK,避免与渠道冲突或不兼容");
|
|
50
|
+
GUILayout.Space(6);
|
|
51
|
+
GUI.enabled = tmpEnable;
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
/*绘制GUI*/
|
|
57
|
+
public static void DrawGUI()
|
|
58
|
+
{
|
|
59
|
+
var config = ChinaAndroidConfig.Default;
|
|
60
|
+
GUIDrawer.DrawProperty(config, (property) =>
|
|
61
|
+
{
|
|
62
|
+
if (OverrideDrawGUIFunc.TryGetValue(property, out var match))
|
|
63
|
+
{
|
|
64
|
+
return match.Invoke(config);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return false;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public class ChinaAndroidConfig : ScriptableObject
|
|
73
|
+
{
|
|
74
|
+
private static string ConfigPath = "Assets/Typhoon_Gen/TyphoonSDK/Editor/ChinaAndroidConfig.asset";
|
|
75
|
+
|
|
76
|
+
private static ChinaAndroidConfig _instance = null;
|
|
77
|
+
|
|
78
|
+
public static ChinaAndroidConfig Default
|
|
79
|
+
{
|
|
80
|
+
get
|
|
81
|
+
{
|
|
82
|
+
if (_instance == null)
|
|
83
|
+
{
|
|
84
|
+
_instance = AssetDatabase.LoadAssetAtPath<ChinaAndroidConfig>(ConfigPath);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (_instance == null)
|
|
88
|
+
{
|
|
89
|
+
_instance = CreateInstance<ChinaAndroidConfig>();
|
|
90
|
+
var folder = Path.GetDirectoryName(ConfigPath);
|
|
91
|
+
if (!Directory.Exists(folder))
|
|
92
|
+
{
|
|
93
|
+
Directory.CreateDirectory(folder);
|
|
94
|
+
AssetDatabase.Refresh();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
AssetDatabase.CreateAsset(_instance, ConfigPath);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return _instance;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/// <summary>
|
|
105
|
+
/// 横竖屏模式
|
|
106
|
+
/// </summary>
|
|
107
|
+
public enum ScreenOrientation
|
|
108
|
+
{
|
|
109
|
+
Portrait,
|
|
110
|
+
Landscape,
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
[Header("横竖屏模式")] public ScreenOrientation Orientation = ScreenOrientation.Portrait;
|
|
114
|
+
|
|
115
|
+
[LabelOverride("保留导出工程")] public bool KeepProj = false;
|
|
116
|
+
|
|
117
|
+
public void Save()
|
|
118
|
+
{
|
|
119
|
+
EditorUtility.SetDirty(this);
|
|
120
|
+
AssetDatabase.SaveAssets();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
public void SaveConfig()
|
|
124
|
+
{
|
|
125
|
+
Save();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
package/Editor/DouyinConfig.cs
CHANGED
|
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|
|
3
3
|
using System.IO;
|
|
4
4
|
using UnityEditor;
|
|
5
5
|
using UnityEngine;
|
|
6
|
-
using UnityEngine.Serialization;
|
|
7
6
|
|
|
8
7
|
namespace TyphoonUnitySDK
|
|
9
8
|
{
|
|
@@ -95,7 +94,7 @@ namespace TyphoonUnitySDK
|
|
|
95
94
|
/// <summary>
|
|
96
95
|
/// 抖音小游戏配置
|
|
97
96
|
/// </summary>
|
|
98
|
-
public class DouyinConfig : ScriptableObject
|
|
97
|
+
public class DouyinConfig : ScriptableObject, ISaveConfigPipeline
|
|
99
98
|
{
|
|
100
99
|
private static string ConfigPath = "Assets/Typhoon_Gen/TyphoonSDK/Editor/DouyinConfig.asset";
|
|
101
100
|
public static string INIPath = ".typhoon/unitysdk/douyin.ini";
|
|
@@ -139,5 +138,10 @@ namespace TyphoonUnitySDK
|
|
|
139
138
|
EditorUtility.SetDirty(this);
|
|
140
139
|
AssetDatabase.SaveAssets();
|
|
141
140
|
}
|
|
141
|
+
|
|
142
|
+
public void SaveConfig()
|
|
143
|
+
{
|
|
144
|
+
Save();
|
|
145
|
+
}
|
|
142
146
|
}
|
|
143
147
|
}
|
package/Editor/ExportModule.cs
CHANGED
|
@@ -18,9 +18,9 @@ namespace TyphoonUnitySDK
|
|
|
18
18
|
{
|
|
19
19
|
var manifest = new List<string>()
|
|
20
20
|
{
|
|
21
|
-
"Assets/Plugins/Android/libs/sdk_plug-release.aar",
|
|
22
|
-
"Assets/Plugins/Android/libs/unity_app-release.aar",
|
|
23
|
-
"Assets/Plugins/Android/libs/
|
|
21
|
+
// "Assets/Plugins/Android/libs/sdk_plug-release.aar",
|
|
22
|
+
// "Assets/Plugins/Android/libs/unity_app-release.aar",
|
|
23
|
+
"Assets/Plugins/Android/libs/lib-union-sdk.aar",
|
|
24
24
|
"Assets/Plugins/Android/AndroidManifest.xml",
|
|
25
25
|
"Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid",
|
|
26
26
|
};
|
package/Editor/OppoMiniConfig.cs
CHANGED
|
@@ -470,7 +470,7 @@ namespace TyphoonUnitySDK
|
|
|
470
470
|
/// <summary>
|
|
471
471
|
/// oppo mini 参数
|
|
472
472
|
/// </summary>
|
|
473
|
-
public class OppoMiniConfig : ScriptableObject
|
|
473
|
+
public class OppoMiniConfig : ScriptableObject, ISaveConfigPipeline
|
|
474
474
|
{
|
|
475
475
|
private static string ConfigPath = "Assets/Typhoon_Gen/TyphoonSDK/Editor/OppoMiniConfig.asset";
|
|
476
476
|
|
|
@@ -539,5 +539,10 @@ namespace TyphoonUnitySDK
|
|
|
539
539
|
EditorUtility.SetDirty(this);
|
|
540
540
|
AssetDatabase.SaveAssets();
|
|
541
541
|
}
|
|
542
|
+
|
|
543
|
+
public void SaveConfig()
|
|
544
|
+
{
|
|
545
|
+
Save();
|
|
546
|
+
}
|
|
542
547
|
}
|
|
543
548
|
}
|
package/Editor/PublishResult.cs
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
using System.Collections;
|
|
2
|
-
using System.Collections.Generic;
|
|
3
|
-
using UnityEngine;
|
|
4
|
-
|
|
5
1
|
namespace TyphoonUnitySDK
|
|
6
2
|
{
|
|
7
3
|
/// <summary>
|
|
@@ -9,6 +5,11 @@ namespace TyphoonUnitySDK
|
|
|
9
5
|
/// </summary>
|
|
10
6
|
public class PublishResult
|
|
11
7
|
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
/// 是否成功
|
|
10
|
+
/// </summary>
|
|
11
|
+
public bool IsSuccess = false;
|
|
12
|
+
|
|
12
13
|
/// <summary>
|
|
13
14
|
/// 发布设置
|
|
14
15
|
/// </summary>
|
|
@@ -19,6 +20,12 @@ namespace TyphoonUnitySDK
|
|
|
19
20
|
/// </summary>
|
|
20
21
|
public string AndroidProj;
|
|
21
22
|
|
|
23
|
+
/// <summary>
|
|
24
|
+
/// 导出的AndroidAPK
|
|
25
|
+
/// </summary>
|
|
26
|
+
public string AndroidApk;
|
|
27
|
+
|
|
28
|
+
|
|
22
29
|
/// <summary>
|
|
23
30
|
/// 导出的微信工程
|
|
24
31
|
/// </summary>
|
package/Editor/PublishSetting.cs
CHANGED
|
@@ -54,8 +54,27 @@ namespace TyphoonUnitySDK
|
|
|
54
54
|
{ nameof(PublishSetting.DouyinGUIFoldout), DrawProperty_DouyinGUIFoldout },
|
|
55
55
|
{ nameof(PublishSetting.VivoMiniGUIFoldout), DrawProperty_VivoMiniGUIFoldout },
|
|
56
56
|
{ nameof(PublishSetting.OppoMiniGUIFoldout), DrawProperty_OppoMiniGUIFoldout },
|
|
57
|
+
{ nameof(PublishSetting.ChinaAndroidGUIFoldout), DrawProperty_ChinaAndroidGUIFoldout },
|
|
57
58
|
};
|
|
58
59
|
|
|
60
|
+
private static bool DrawProperty_ChinaAndroidGUIFoldout(PublishSetting arg)
|
|
61
|
+
{
|
|
62
|
+
if (arg.Channel != AppChannel.ChinaAndroid)
|
|
63
|
+
{
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
GUILayout.Space(10);
|
|
68
|
+
arg.ChinaAndroidGUIFoldout =
|
|
69
|
+
GUIDrawer.DrawFoldout("国内Android", arg.ChinaAndroidGUIFoldout, GUILayout.Height(26));
|
|
70
|
+
if (arg.ChinaAndroidGUIFoldout)
|
|
71
|
+
{
|
|
72
|
+
ChinaAndroidConfigGUIDrawer.DrawGUI();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
|
|
59
78
|
private static bool DrawProperty_WebglDataCaching(PublishSetting arg)
|
|
60
79
|
{
|
|
61
80
|
if (arg.BuildTarget != BuildTarget.WebGL)
|
|
@@ -13,68 +13,49 @@ namespace TyphoonUnitySDK
|
|
|
13
13
|
{
|
|
14
14
|
public PublishVivoBatSetting Setting => target as PublishVivoBatSetting;
|
|
15
15
|
|
|
16
|
-
/*Config.java*/
|
|
17
|
-
public string GetConfigJavaPath()
|
|
18
|
-
{
|
|
19
|
-
return $@"{Setting.AndroidPublishProj}\vivo_union\src\main\java\com\typhoon\vivo_union\Config.java";
|
|
20
|
-
}
|
|
21
|
-
|
|
22
16
|
/*build gradle*/
|
|
23
17
|
public string GetBuildGradle()
|
|
24
18
|
{
|
|
25
|
-
return $@"{Setting.AndroidPublishProj}\
|
|
19
|
+
return $@"{Setting.AndroidPublishProj}\proj\launcher_vivo\build.gradle";
|
|
26
20
|
}
|
|
27
21
|
|
|
28
22
|
/*AndroidManifest.xml*/
|
|
29
23
|
public string GetAndroidManifestXml()
|
|
30
24
|
{
|
|
31
|
-
return $@"{Setting.AndroidPublishProj}\
|
|
25
|
+
return $@"{Setting.AndroidPublishProj}\proj\launcher_vivo\src\main\AndroidManifest.xml";
|
|
32
26
|
}
|
|
33
27
|
|
|
34
28
|
/*supplierconfig.json*/
|
|
35
29
|
public string GetSupplierConfigJson()
|
|
36
30
|
{
|
|
37
|
-
return $@"{Setting.AndroidPublishProj}\
|
|
31
|
+
return $@"{Setting.AndroidPublishProj}\proj\launcher_vivo\src\main\assets\supplierconfig.json";
|
|
38
32
|
}
|
|
39
33
|
|
|
40
34
|
|
|
41
35
|
/*strings.xml*/
|
|
42
36
|
public string GetStringsXml()
|
|
43
37
|
{
|
|
44
|
-
return $@"{Setting.AndroidPublishProj}\
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
/*unitylibrary*/
|
|
49
|
-
public string GetUnityLibrary()
|
|
50
|
-
{
|
|
51
|
-
return $@"{Setting.AndroidPublishProj}\unityLibrary";
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/*unitylibrary AndroidManifest.xml*/
|
|
55
|
-
public string GetUnityLibraryAndroidManifestXml()
|
|
56
|
-
{
|
|
57
|
-
return $@"{Setting.AndroidPublishProj}\unityLibrary\src\main\AndroidManifest.xml";
|
|
38
|
+
return $@"{Setting.AndroidPublishProj}\proj\launcher_vivo\src\main\res\values\strings.xml";
|
|
58
39
|
}
|
|
59
40
|
|
|
60
41
|
|
|
61
42
|
/*icon*/
|
|
62
43
|
public string GetIconPath()
|
|
63
44
|
{
|
|
64
|
-
return $@"{Setting.AndroidPublishProj}\
|
|
45
|
+
return $@"{Setting.AndroidPublishProj}\proj\launcher_vivo\src\main\res\mipmap-mdpi\app_icon.png";
|
|
65
46
|
}
|
|
66
47
|
|
|
48
|
+
public string GetLauncherVivoPath() => $@"{Setting.AndroidPublishProj}\proj\launcher_vivo";
|
|
49
|
+
|
|
50
|
+
public string GetBeeUnionSdkConfigJsonPath() =>
|
|
51
|
+
@$"{Setting.AndroidPublishProj}\proj\launcher_vivo\src\main\assets\bee_union_sdk_config.json";
|
|
52
|
+
|
|
67
53
|
|
|
68
54
|
public PublishVivoBatSetting Target => target as PublishVivoBatSetting;
|
|
69
55
|
|
|
70
56
|
public override void OnInspectorGUI()
|
|
71
57
|
{
|
|
72
58
|
base.OnInspectorGUI();
|
|
73
|
-
// if (GUILayout.Button("自动版本号", GUILayout.Height(32)))
|
|
74
|
-
// {
|
|
75
|
-
// Target.Version = AutoVersionSting(Target.Version);
|
|
76
|
-
// Target.Save();
|
|
77
|
-
// }
|
|
78
59
|
|
|
79
60
|
var publish = GUILayout.Button("发布vivo", GUILayout.Height(32));
|
|
80
61
|
|
|
@@ -95,222 +76,46 @@ namespace TyphoonUnitySDK
|
|
|
95
76
|
throw new Exception($"找不到{setting.AndroidPublishProj}");
|
|
96
77
|
}
|
|
97
78
|
|
|
98
|
-
|
|
79
|
+
WriteUnityLibraryAAR();
|
|
99
80
|
WriteIcon();
|
|
100
81
|
WriteBuildGradle();
|
|
101
82
|
WriteStringsXml();
|
|
102
|
-
WriteConfigJava();
|
|
103
83
|
WriteAndroidManifestXml();
|
|
104
84
|
WriteSupplierConfigJson();
|
|
105
|
-
|
|
106
|
-
// {
|
|
107
|
-
// Debug.Log("修改unity manifest");
|
|
108
|
-
//
|
|
109
|
-
// var manifest = $"{unityProj}/unityLibrary/src/main/AndroidManifest.xml";
|
|
110
|
-
// var xml = File.ReadAllText(manifest);
|
|
111
|
-
// // string pattern = @"(?s)<intent-filter\b[^>]*>(.*?)<\/intent-filter>";
|
|
112
|
-
// // string result = Regex.Replace(xml, pattern, "");f
|
|
113
|
-
// xml = xml.Replace("<intent-filter>", "");
|
|
114
|
-
// xml = xml.Replace("<action android:name=\"android.intent.action.MAIN\" />", "");
|
|
115
|
-
// xml = xml.Replace("<category android:name=\"android.intent.category.LAUNCHER\" />", "");
|
|
116
|
-
// xml = xml.Replace("</intent-filter>", "");
|
|
117
|
-
// File.WriteAllText(manifest, xml);
|
|
118
|
-
//
|
|
119
|
-
// //复制unitylib
|
|
120
|
-
// Debug.Log("复制unitylib");
|
|
121
|
-
// var from = $"{unityProj}/unityLibrary";
|
|
122
|
-
// var to = $"{publishProj}/unityLibrary";
|
|
123
|
-
// UniEditor.TryDeleteFolder(to);
|
|
124
|
-
// UniEditor.CopyFolder(from, to);
|
|
125
|
-
// }
|
|
85
|
+
WriteBeeUnionSdkConfigJson();
|
|
126
86
|
Debug.Log("处理完毕!");
|
|
127
87
|
}
|
|
128
88
|
|
|
129
|
-
|
|
130
|
-
/*修改config.java*/
|
|
131
|
-
public void WriteConfigJava()
|
|
132
|
-
|
|
89
|
+
private void WriteBeeUnionSdkConfigJson()
|
|
133
90
|
{
|
|
134
|
-
var
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
/*竖屏模式为true,横屏模式为false*/
|
|
147
|
-
public static boolean ORIENTATION_PORTRAIT = {Setting.Portrait.ToString().ToLower()};
|
|
148
|
-
|
|
149
|
-
/*隐藏政策URL*/
|
|
150
|
-
public static String PRIVACY_POLICY_URL = ""{Setting.PrivacyPolicyYNoteUrl}"";
|
|
151
|
-
/*VIVO-联运 参数*/
|
|
152
|
-
public static String APP_ID = ""{Setting.AppId}"";//appid(看后台)
|
|
153
|
-
/*VIVO-广告联盟 参数*/
|
|
154
|
-
public static String MEDIA_ID = ""{Setting.MediaID}"";//Media ID
|
|
155
|
-
public static String VIDEO_UNIT_ID = ""{Setting.VideoID}""; //视频广告
|
|
156
|
-
public static String SPLASH_UNIT_ID = ""{Setting.SplashID}"";//开屏广告
|
|
157
|
-
public static String INTER_IMAGE_UNIT_ID = ""{Setting.IntersID}""; //图片类插页广告
|
|
158
|
-
public static String INTER_VIDEO_UNIT_ID = """"; //视频类插页广告
|
|
159
|
-
public static String FLOAT_ICON_UNIT_ID = ""{Setting.FloatIconID}""; //悬浮icon
|
|
160
|
-
public static String NATIVE_UNIT_ID = ""{Setting.NativeID}"";//原生广告
|
|
161
|
-
public static String BANNER_UNIT_ID = ""{Setting.BannerID}"";//banner广告
|
|
162
|
-
public static String WX_APP_ID = """";//后台申请的媒体微信APPID
|
|
163
|
-
public static int SPLASH_FETCH_TIMEOUT = 3000;//开屏广告拉取最大超时时间,单位毫秒
|
|
164
|
-
public static int SPLASH_FLOOR_PRICE=-1;//开屏广告底价,-1为不设定
|
|
165
|
-
public static int INTERS_IMAGE_FLOOR_PRICE=-1;//图片类插屏广告底价,-1为不设定
|
|
166
|
-
public static int INTERS_VIDEO_FLOOR_PRICE=-1;//视频类插屏广告底价,-1为不设定
|
|
167
|
-
|
|
168
|
-
/*友盟统计*/
|
|
169
|
-
public static String UM_APP_KEY=""{Setting.UMAppKey}"";//app-key
|
|
170
|
-
public static String UM_APP_CHANNEL=""vivo_union"";//渠道名,unknown为保留,不能使用,不管大小写
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}}
|
|
177
|
-
";
|
|
178
|
-
//写到目标路径
|
|
179
|
-
var path = GetConfigJavaPath();
|
|
180
|
-
File.WriteAllText(path, config);
|
|
181
|
-
Debug.Log($"写入:{path}");
|
|
91
|
+
var path = GetBeeUnionSdkConfigJsonPath();
|
|
92
|
+
var jsonObj = new
|
|
93
|
+
{
|
|
94
|
+
privacyUrl = $"{Setting.PrivacyPolicyYNoteUrl}",
|
|
95
|
+
orientation = Setting.Portrait ? 1 : 2,
|
|
96
|
+
appId = Setting.AppId,
|
|
97
|
+
debug = 1,
|
|
98
|
+
};
|
|
99
|
+
var json = jsonObj.ToXJson();
|
|
100
|
+
File.WriteAllText(path, json);
|
|
101
|
+
Debug.Log($"写入:{path}");
|
|
182
102
|
}
|
|
183
103
|
|
|
184
|
-
|
|
104
|
+
|
|
105
|
+
//写入build.gradle
|
|
185
106
|
public void WriteBuildGradle()
|
|
186
107
|
{
|
|
187
|
-
var gradle = $@"import java.text.SimpleDateFormat
|
|
188
|
-
|
|
189
|
-
apply plugin: 'com.android.application'
|
|
190
|
-
|
|
191
|
-
android {{
|
|
192
|
-
compileSdkVersion 30
|
|
193
|
-
buildToolsVersion '30.0.3'
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
compileOptions {{
|
|
197
|
-
sourceCompatibility JavaVersion.VERSION_1_8
|
|
198
|
-
targetCompatibility JavaVersion.VERSION_1_8
|
|
199
|
-
}}
|
|
200
|
-
|
|
201
|
-
/*签名配置*/
|
|
202
|
-
signingConfigs {{
|
|
203
|
-
release {{
|
|
204
|
-
def signDir = rootProject.file('sign')
|
|
205
|
-
keyAlias 'xiqi'
|
|
206
|
-
keyPassword '1314woaini'
|
|
207
|
-
storeFile file(signDir.getAbsolutePath() + '/xiqi.jks')
|
|
208
|
-
storePassword '1314woaini'
|
|
209
|
-
}}
|
|
210
|
-
|
|
211
|
-
debug {{
|
|
212
|
-
def signDir = rootProject.file('sign')
|
|
213
|
-
keyAlias 'xiqi'
|
|
214
|
-
keyPassword '1314woaini'
|
|
215
|
-
storeFile file(signDir.getAbsolutePath() + '/xiqi.jks')
|
|
216
|
-
storePassword '1314woaini'
|
|
217
|
-
}}
|
|
218
|
-
}}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
defaultConfig {{
|
|
222
|
-
minSdkVersion 21
|
|
223
|
-
targetSdkVersion {Setting.TargetSdkVersion}
|
|
224
|
-
versionCode {Setting.VersionCode}
|
|
225
|
-
versionName '{Setting.Version}'
|
|
226
|
-
applicationId '{Setting.PackageName}'
|
|
227
|
-
consumerProguardFiles ""consumer-rules.pro""
|
|
228
|
-
ndk {{
|
|
229
|
-
abiFilters 'armeabi-v7a', 'arm64-v8a'
|
|
230
|
-
}}
|
|
231
|
-
}}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
//发布的包名
|
|
235
|
-
applicationVariants.all {{ variant ->
|
|
236
|
-
variant.outputs.all {{
|
|
237
|
-
def formattedDate = new SimpleDateFormat(""yyyyMMdd_HHmmss"").format(new Date())
|
|
238
|
-
def versionName = variant.versionName
|
|
239
|
-
def buildType = variant.buildType.name
|
|
240
|
-
def appName = variant.applicationId
|
|
241
|
-
outputFileName = ""${{appName}}_v${{versionName}}_${{buildType}}_${{formattedDate}}.apk""
|
|
242
|
-
}}
|
|
243
|
-
}}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
sourceSets {{
|
|
248
|
-
main {{
|
|
249
|
-
jniLibs.srcDirs = ['libs']
|
|
250
|
-
}}
|
|
251
|
-
}}
|
|
252
|
-
|
|
253
|
-
aaptOptions {{
|
|
254
|
-
noCompress = ['.unity3d', '.ress', '.resource', '.obb', 'aa/catalog.json', 'aa/settings.json', 'aa/AddressablesLink/link.xml', '.bundle']
|
|
255
|
-
ignoreAssetsPattern = ""!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~""
|
|
256
|
-
}}
|
|
257
|
-
|
|
258
|
-
lintOptions {{
|
|
259
|
-
abortOnError false
|
|
260
|
-
}}
|
|
261
|
-
|
|
262
|
-
buildTypes {{
|
|
263
|
-
debug {{
|
|
264
|
-
minifyEnabled false
|
|
265
|
-
useProguard false
|
|
266
|
-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro',getDefaultProguardFile('proguard-android-optimize.txt')
|
|
267
|
-
signingConfig signingConfigs.debug
|
|
268
|
-
jniDebuggable true
|
|
269
|
-
}}
|
|
270
|
-
release {{
|
|
271
|
-
minifyEnabled false
|
|
272
|
-
useProguard false
|
|
273
|
-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro',getDefaultProguardFile('proguard-android-optimize.txt')
|
|
274
|
-
signingConfig signingConfigs.release
|
|
275
|
-
|
|
276
|
-
}}
|
|
277
|
-
}}
|
|
278
|
-
|
|
279
|
-
packagingOptions {{
|
|
280
|
-
doNotStrip '*/armeabi-v7a/*.so'
|
|
281
|
-
doNotStrip '*/arm64-v8a/*.so'
|
|
282
|
-
}}
|
|
283
|
-
packagingOptions {{ doNotStrip ""*/armeabi/libvsecbox.so"" }}
|
|
284
|
-
packagingOptions {{ doNotStrip ""*/armeabi-v7a/libvsecbox.so"" }}
|
|
285
|
-
packagingOptions {{ doNotStrip ""*/arm64-v8a/libvsecbox.so"" }}
|
|
286
|
-
|
|
287
|
-
bundle {{
|
|
288
|
-
language {{
|
|
289
|
-
enableSplit = false
|
|
290
|
-
}}
|
|
291
|
-
density {{
|
|
292
|
-
enableSplit = false
|
|
293
|
-
}}
|
|
294
|
-
abi {{
|
|
295
|
-
enableSplit = true
|
|
296
|
-
}}
|
|
297
|
-
}}
|
|
298
|
-
|
|
299
|
-
}}
|
|
300
|
-
|
|
301
|
-
dependencies {{
|
|
302
|
-
api ""com.android.support:support-v4:28.0.0""
|
|
303
|
-
api ""com.android.support:recyclerview-v7:28.0.0""
|
|
304
|
-
api ""com.android.support:appcompat-v7:28.0.0""
|
|
305
|
-
api fileTree(includes: ['*.jar', '*.aar'], dir: 'libs')
|
|
306
|
-
api project(':sdk_plug')
|
|
307
|
-
api project(':unity_app')
|
|
308
|
-
api project(':umeng_support')
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
}}";
|
|
313
108
|
var path = GetBuildGradle();
|
|
109
|
+
var gradle = File.ReadAllText(path);
|
|
110
|
+
//替换包名,替换版本号
|
|
111
|
+
var pattern = "versionCode[\\s]*[0-9]*";
|
|
112
|
+
gradle = Regex.Replace(gradle, pattern, $"versionCode {Setting.VersionCode}");
|
|
113
|
+
pattern = "versionName[\\s]*'[0-9\\.]*'";
|
|
114
|
+
gradle = Regex.Replace(gradle, pattern, $"versionName '{Setting.Version}'");
|
|
115
|
+
pattern = "applicationId[\\s]*\\'[\\w\\.0-9]*\\'";
|
|
116
|
+
gradle = Regex.Replace(gradle, pattern, $"applicationId '{Setting.PackageName}'");
|
|
117
|
+
pattern = "targetSdkVersion[\\s]*[0-9]*";
|
|
118
|
+
gradle = Regex.Replace(gradle, pattern, $"targetSdkVersion {Setting.TargetSdkVersion}");
|
|
314
119
|
File.WriteAllText(path, gradle);
|
|
315
120
|
Debug.Log($"写入:{path}");
|
|
316
121
|
}
|
|
@@ -319,96 +124,11 @@ dependencies {{
|
|
|
319
124
|
private void WriteAndroidManifestXml()
|
|
320
125
|
{
|
|
321
126
|
var orientation = Setting.Portrait ? "portrait" : "landscape";
|
|
322
|
-
var xml = $@"<?xml version=""1.0"" encoding=""utf-8""?>
|
|
323
|
-
<manifest xmlns:android=""http://schemas.android.com/apk/res/android""
|
|
324
|
-
package=""com.typhoon.vivo_union"">
|
|
325
|
-
<supports-screens
|
|
326
|
-
android:anyDensity=""true""
|
|
327
|
-
android:largeScreens=""true""
|
|
328
|
-
android:normalScreens=""true""
|
|
329
|
-
android:smallScreens=""true""
|
|
330
|
-
android:xlargeScreens=""true"" />
|
|
331
|
-
<!-- 联运SDK跳转游戏中心 -->
|
|
332
|
-
<uses-permission android:name=""vivo.game.permission.OPEN_JUMP_INTENTS"" /> <!-- 联运SDK监听网络状态变化,在支付登录过程中做一些异常处理 -->
|
|
333
|
-
<uses-permission android:name=""android.permission.CHANGE_NETWORK_STATE"" /> <!-- 允许程序访问Wi-Fi网络状态信息 -->
|
|
334
|
-
<uses-permission android:name=""android.permission.ACCESS_WIFI_STATE"" /> <!-- 允许程序打开网络套接字 -->
|
|
335
|
-
<uses-permission android:name=""android.permission.INTERNET"" /> <!-- 允许程序访问有关GSM网络信息 -->
|
|
336
|
-
<uses-permission android:name=""android.permission.ACCESS_NETWORK_STATE"" /> <!-- 判断游戏是否是在主进程初始化,避免初始化进程错误导致功能不可用 -->
|
|
337
|
-
<uses-permission android:name=""android.permission.GET_TASKS"" /> <!-- 获取安装权限,更新安装vivo服务安全插件apk -->
|
|
338
|
-
<uses-permission android:name=""android.permission.REQUEST_INSTALL_PACKAGES"" /> <!-- android11及以上必须添加此权限才能获取vivo服务安全插件安装包的状态 -->
|
|
339
|
-
<uses-permission android:name=""android.permission.QUERY_ALL_PACKAGES"" />
|
|
340
|
-
<!-- SDK 必须的权限 -->
|
|
341
|
-
<uses-permission android:name=""android.permission.INTERNET"" />
|
|
342
|
-
<uses-permission android:name=""android.permission.ACCESS_NETWORK_STATE"" />
|
|
343
|
-
<uses-permission android:name=""android.permission.ACCESS_WIFI_STATE"" />
|
|
344
|
-
<uses-permission android:name=""android.permission.READ_PHONE_STATE"" />
|
|
345
|
-
<uses-permission android:name=""android.permission.WRITE_EXTERNAL_STORAGE"" />
|
|
346
|
-
<!-- 此权限一定要加,否则下载类广告不会进入安装流程,影响后向体验 -->
|
|
347
|
-
<uses-permission android:name=""android.permission.REQUEST_INSTALL_PACKAGES"" />
|
|
348
|
-
<!-- 如果接入了视频相关的广告, 请务必添加否则黑屏 -->
|
|
349
|
-
<uses-permission android:name=""android.permission.WAKE_LOCK"" />
|
|
350
|
-
<uses-permission android:name=""android.permission.MANAGE_EXTERNAL_STORAGE"" />
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
<application
|
|
354
|
-
android:name="".App""
|
|
355
|
-
android:icon=""@mipmap/app_icon""
|
|
356
|
-
android:label=""@string/app_name""
|
|
357
|
-
android:hardwareAccelerated=""true""
|
|
358
|
-
>
|
|
359
|
-
|
|
360
|
-
<activity
|
|
361
|
-
android:name="".LauncherActivity""
|
|
362
|
-
android:exported=""true""
|
|
363
|
-
android:configChanges=""orientation|keyboardHidden|screenSize""
|
|
364
|
-
android:theme=""@android:style/Theme.Translucent.NoTitleBar""
|
|
365
|
-
>
|
|
366
|
-
<intent-filter>
|
|
367
|
-
<action android:name=""android.intent.action.MAIN"" />
|
|
368
|
-
<category android:name=""android.intent.category.LAUNCHER"" />
|
|
369
|
-
<!--友盟埋点验证,实时查看可开启-->
|
|
370
|
-
<!-- <action android:name=""android.intent.action.VIEW"" />-->
|
|
371
|
-
<!-- <category android:name=""android.intent.category.DEFAULT"" />-->
|
|
372
|
-
<!-- <category android:name=""android.intent.category.BROWSABLE"" />-->
|
|
373
|
-
<!-- <data android:scheme=""um.5fe03633345b8b53f5745d30"" />-->
|
|
374
|
-
</intent-filter>
|
|
375
|
-
</activity>
|
|
376
|
-
|
|
377
|
-
<meta-data
|
|
378
|
-
android:name=""vivo_union_sdk""
|
|
379
|
-
android:value=""4.7.4.1"" /> <!-- vivo sdk componets start -->
|
|
380
|
-
<!-- vivo sdk的Activity -->
|
|
381
|
-
<activity
|
|
382
|
-
android:name=""com.vivo.unionsdk.ui.UnionActivity""
|
|
383
|
-
android:configChanges=""orientation|keyboardHidden|navigation|screenSize""
|
|
384
|
-
android:exported=""true""
|
|
385
|
-
android:screenOrientation=""{orientation}""
|
|
386
|
-
android:theme=""@android:style/Theme.Dialog"">
|
|
387
|
-
<intent-filter>
|
|
388
|
-
<action android:name=""android.intent.action.VIEW"" />
|
|
389
|
-
|
|
390
|
-
<category android:name=""android.intent.category.DEFAULT"" />
|
|
391
|
-
<category android:name=""android.intent.category.BROWSABLE"" />
|
|
392
|
-
|
|
393
|
-
<data
|
|
394
|
-
android:host=""union.vivo.com""
|
|
395
|
-
android:path=""/openjump""
|
|
396
|
-
android:scheme=""vivounion"" />
|
|
397
|
-
</intent-filter>
|
|
398
|
-
</activity>
|
|
399
|
-
|
|
400
|
-
<activity
|
|
401
|
-
android:name="".SplashAdActivity""
|
|
402
|
-
android:hardwareAccelerated=""true""
|
|
403
|
-
android:exported=""false""
|
|
404
|
-
android:launchMode=""singleTask""
|
|
405
|
-
android:configChanges=""orientation|keyboardHidden|navigation|screenSize""
|
|
406
|
-
android:theme=""@android:style/Theme.Translucent.NoTitleBar"" />
|
|
407
|
-
</application>
|
|
408
|
-
|
|
409
|
-
</manifest>";
|
|
410
|
-
|
|
411
127
|
var path = GetAndroidManifestXml();
|
|
128
|
+
var xml = File.ReadAllText(path);
|
|
129
|
+
var pattern = "<meta-data[\\s]*android:name=\"vivoUnionAppId\"[\\s]*.*/>";
|
|
130
|
+
xml = Regex.Replace(xml, pattern,
|
|
131
|
+
$"<meta-data android:name=\"vivoUnionAppId\" android:value=\"{Setting.AppId}\"/>");
|
|
412
132
|
File.WriteAllText(path, xml);
|
|
413
133
|
Debug.Log($"写入:{path}");
|
|
414
134
|
}
|
|
@@ -444,55 +164,34 @@ dependencies {{
|
|
|
444
164
|
private void WriteStringsXml()
|
|
445
165
|
{
|
|
446
166
|
var path = GetStringsXml();
|
|
447
|
-
var xml =
|
|
448
|
-
<
|
|
449
|
-
|
|
450
|
-
<string name=""game_view_content_description"">Game view</string>
|
|
451
|
-
</resources>";
|
|
167
|
+
var xml = File.ReadAllText(path);
|
|
168
|
+
var pattern = "<string[\\s]*name=\"app_name\">.*</string>";
|
|
169
|
+
xml = Regex.Replace(xml, pattern, $"<string name=\"app_name\">{Setting.GameName}</string>");
|
|
452
170
|
File.WriteAllText(path, xml);
|
|
453
171
|
Debug.Log($"写入:{path}");
|
|
454
172
|
}
|
|
455
173
|
|
|
456
|
-
|
|
457
|
-
private void
|
|
174
|
+
//写入unityLibrary-release.aar
|
|
175
|
+
private void WriteUnityLibraryAAR()
|
|
458
176
|
{
|
|
459
|
-
var android = GetUnityLibrary();
|
|
460
177
|
var unityProj = GetMatchChinaAndroidProj();
|
|
461
178
|
if (unityProj == null)
|
|
462
179
|
{
|
|
463
180
|
throw new Exception($"找不到unity导出工程");
|
|
464
181
|
}
|
|
465
182
|
|
|
466
|
-
|
|
467
|
-
var
|
|
468
|
-
{
|
|
469
|
-
//{unityProj}\unityLibrary
|
|
470
|
-
($"{android}/libs", $"{unityLib}/libs"),
|
|
471
|
-
($"{android}/src/main/assets", $"{unityLib}/src/main/assets"),
|
|
472
|
-
($"{android}/src/main/java", $"{unityLib}/src/main/java"),
|
|
473
|
-
($"{android}/src/main/jniLibs", $"{unityLib}/src/main/jniLibs"),
|
|
474
|
-
};
|
|
183
|
+
//尝试获取unitylibrary.aar
|
|
184
|
+
var aar = $"{unityProj}/unityLibrary/build/outputs/aar/unityLibrary-release.aar";
|
|
475
185
|
|
|
476
|
-
|
|
477
|
-
var xmlUnity = $"{unityLib}/src/main/AndroidManifest.xml";
|
|
478
|
-
foreach (var e in map)
|
|
186
|
+
if (!File.Exists(aar))
|
|
479
187
|
{
|
|
480
|
-
|
|
481
|
-
UniEditor.CopyFolder(e.unityPath, e.androidPath);
|
|
482
|
-
Debug.Log($"写入:{e.androidPath} ");
|
|
188
|
+
throw new Exception($"找不到{aar}");
|
|
483
189
|
}
|
|
484
190
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
var xml = File.ReadAllText(xmlPath);
|
|
490
|
-
xml = xml.Replace("<intent-filter>", "");
|
|
491
|
-
xml = xml.Replace("<action android:name=\"android.intent.action.MAIN\" />", "");
|
|
492
|
-
xml = xml.Replace("<category android:name=\"android.intent.category.LAUNCHER\" />", "");
|
|
493
|
-
xml = xml.Replace("</intent-filter>", "");
|
|
494
|
-
File.WriteAllText(xmlPath, xml);
|
|
495
|
-
Debug.Log($"写入:{xmlPath}");
|
|
191
|
+
//复制aar到指定目录
|
|
192
|
+
var to = @$"{Setting.AndroidPublishProj}\proj\unionsdk\libs\{Path.GetFileName(aar)}";
|
|
193
|
+
Debug.Log($"复制{aar}->{to}");
|
|
194
|
+
File.Copy(aar, to, true);
|
|
496
195
|
}
|
|
497
196
|
|
|
498
197
|
/*写入icon*/
|
package/Editor/VariablePreset.cs
CHANGED
|
@@ -10,7 +10,7 @@ namespace TyphoonUnitySDK
|
|
|
10
10
|
/// 变量预设
|
|
11
11
|
/// 用于自定义工具内的变量名
|
|
12
12
|
/// </summary>
|
|
13
|
-
public class VariablePreset : ScriptableObject
|
|
13
|
+
public class VariablePreset : ScriptableObject, ISaveConfigPipeline
|
|
14
14
|
{
|
|
15
15
|
private static string ConfigPath = "Assets/Typhoon_Gen/TyphoonSDK/Editor/VariablePreset.asset";
|
|
16
16
|
|
|
@@ -148,7 +148,6 @@ namespace TyphoonUnitySDK
|
|
|
148
148
|
{
|
|
149
149
|
Presets[index].VariableValue = value;
|
|
150
150
|
}
|
|
151
|
-
|
|
152
151
|
}
|
|
153
152
|
|
|
154
153
|
public void Save()
|
|
@@ -156,5 +155,10 @@ namespace TyphoonUnitySDK
|
|
|
156
155
|
EditorUtility.SetDirty(this);
|
|
157
156
|
AssetDatabase.SaveAssets();
|
|
158
157
|
}
|
|
158
|
+
|
|
159
|
+
public void SaveConfig()
|
|
160
|
+
{
|
|
161
|
+
Save();
|
|
162
|
+
}
|
|
159
163
|
}
|
|
160
164
|
}
|
package/Editor/VivoMiniConfig.cs
CHANGED
|
@@ -429,7 +429,7 @@ namespace TyphoonUnitySDK
|
|
|
429
429
|
/// <summary>
|
|
430
430
|
/// vivo mini 参数
|
|
431
431
|
/// </summary>
|
|
432
|
-
public class VivoMiniConfig : ScriptableObject
|
|
432
|
+
public class VivoMiniConfig : ScriptableObject, ISaveConfigPipeline
|
|
433
433
|
{
|
|
434
434
|
private static string ConfigPath = "Assets/Typhoon_Gen/TyphoonSDK/Editor/VivoMiniConfig.asset";
|
|
435
435
|
|
|
@@ -500,5 +500,10 @@ namespace TyphoonUnitySDK
|
|
|
500
500
|
EditorUtility.SetDirty(this);
|
|
501
501
|
AssetDatabase.SaveAssets();
|
|
502
502
|
}
|
|
503
|
+
|
|
504
|
+
public void SaveConfig()
|
|
505
|
+
{
|
|
506
|
+
Save();
|
|
507
|
+
}
|
|
503
508
|
}
|
|
504
509
|
}
|
package/Editor/WxMiniConfig.cs
CHANGED
|
@@ -206,7 +206,7 @@ namespace TyphoonUnitySDK
|
|
|
206
206
|
/// <summary>
|
|
207
207
|
/// 微信小游戏配置
|
|
208
208
|
/// </summary>
|
|
209
|
-
public class WxMiniConfig : ScriptableObject
|
|
209
|
+
public class WxMiniConfig : ScriptableObject, ISaveConfigPipeline
|
|
210
210
|
{
|
|
211
211
|
private static string ConfigPath = "Assets/Typhoon_Gen/TyphoonSDK/Editor/WxMiniConfig.asset";
|
|
212
212
|
|
|
@@ -273,5 +273,10 @@ namespace TyphoonUnitySDK
|
|
|
273
273
|
EditorUtility.SetDirty(this);
|
|
274
274
|
AssetDatabase.SaveAssets();
|
|
275
275
|
}
|
|
276
|
+
|
|
277
|
+
public void SaveConfig()
|
|
278
|
+
{
|
|
279
|
+
Save();
|
|
280
|
+
}
|
|
276
281
|
}
|
|
277
282
|
}
|
package/Runtime/BaseSdk.cs
CHANGED
|
@@ -265,5 +265,20 @@ namespace TyphoonUnitySDK
|
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
#endregion
|
|
268
|
+
|
|
269
|
+
#region 退出挽留
|
|
270
|
+
|
|
271
|
+
public virtual bool IsSupportQuitWithKeep()
|
|
272
|
+
{
|
|
273
|
+
SdkDebug.Log($"[BaseSdk] IsSupportQuitWithKeep 默认不支持,返回false!");
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
public virtual void QuitWithKeep()
|
|
278
|
+
{
|
|
279
|
+
SdkDebug.Log($"[BaseSdk] QuitWithKeep 空实现!");
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
#endregion
|
|
268
283
|
}
|
|
269
284
|
}
|
package/Runtime/Interface.cs
CHANGED
|
@@ -7,7 +7,7 @@ namespace TyphoonUnitySDK
|
|
|
7
7
|
/// SDK全功能接口
|
|
8
8
|
/// </summary>
|
|
9
9
|
public interface ISdk : IOnCreate, IInitSdk, ILogin, IExitGame, IBannerAD, IVideoAD, IIntersAD, IFloatIconAD,
|
|
10
|
-
INativeAD, IRecordGame, IHttpGet, IHttpPost, ISideBarReturn, IShowToast,ITrack
|
|
10
|
+
INativeAD, IRecordGame, IHttpGet, IHttpPost, ISideBarReturn, IShowToast, ITrack,IQuitGameWithKeep
|
|
11
11
|
{
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -211,4 +211,18 @@ namespace TyphoonUnitySDK
|
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
#endregion
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
#region 退出挽留
|
|
217
|
+
|
|
218
|
+
public interface IQuitGameWithKeep
|
|
219
|
+
{
|
|
220
|
+
//是否支持
|
|
221
|
+
bool IsSupportQuitWithKeep();
|
|
222
|
+
|
|
223
|
+
//退出游戏
|
|
224
|
+
void QuitWithKeep();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
#endregion
|
|
214
228
|
}
|
package/Runtime/SdkLite.cs
CHANGED
|
@@ -219,7 +219,7 @@ namespace TyphoonUnitySDK
|
|
|
219
219
|
public bool IsSupportExitGame()
|
|
220
220
|
{
|
|
221
221
|
#if UNITY_EDITOR
|
|
222
|
-
return SdkTestInUnity.Instance.
|
|
222
|
+
return SdkTestInUnity.Instance.IsSupportQuitWithKeep;
|
|
223
223
|
#endif
|
|
224
224
|
return _sdk.IsSupportExitGame();
|
|
225
225
|
}
|
|
@@ -241,6 +241,33 @@ namespace TyphoonUnitySDK
|
|
|
241
241
|
|
|
242
242
|
#endregion
|
|
243
243
|
|
|
244
|
+
#region 退出挽留
|
|
245
|
+
|
|
246
|
+
/// <summary>
|
|
247
|
+
/// 是否支持退出挽留
|
|
248
|
+
/// </summary>
|
|
249
|
+
public bool IsSupportQuitWithKeep()
|
|
250
|
+
{
|
|
251
|
+
#if UNITY_EDITOR
|
|
252
|
+
return SdkTestInUnity.Instance.IsSupportQuitWithKeep;
|
|
253
|
+
#endif
|
|
254
|
+
return _sdk.IsSupportQuitWithKeep();
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/// <summary>
|
|
258
|
+
/// 退出挽留
|
|
259
|
+
/// </summary>
|
|
260
|
+
public void QuitWithKeep()
|
|
261
|
+
{
|
|
262
|
+
Log("QuitWithKeep");
|
|
263
|
+
#if UNITY_EDITOR
|
|
264
|
+
return;
|
|
265
|
+
#endif
|
|
266
|
+
_sdk.QuitWithKeep();
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
#endregion
|
|
270
|
+
|
|
244
271
|
#region 日志
|
|
245
272
|
|
|
246
273
|
private void Log(string log)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
using System.IO;
|
|
2
2
|
using TyphoonUnitySDK;
|
|
3
3
|
using UnityEngine;
|
|
4
|
+
using UnityEngine.Serialization;
|
|
4
5
|
#if UNITY_EDITOR
|
|
5
6
|
using UnityEditor;
|
|
6
7
|
#endif
|
|
@@ -10,7 +11,7 @@ public class SdkTestInUnity : ScriptableObject
|
|
|
10
11
|
private const string ASSET_PATH = "Assets/Typhoon_Gen/TyphoonSDK/Editor/SdkTestInUnity.asset";
|
|
11
12
|
|
|
12
13
|
[LabelOverride("登录回调")] public bool LoginResult = true;
|
|
13
|
-
[LabelOverride("
|
|
14
|
+
[LabelOverride("是否支持退出挽留")] public bool IsSupportQuitWithKeep = true;
|
|
14
15
|
[LabelOverride("开启广告交互式测试")] public bool OpenInteractive = true;
|
|
15
16
|
[LabelOverride("广告交互式悬停关闭时间")] public float InteractiveHoldCloseTime = 1.2f;
|
|
16
17
|
[LabelOverride("视频广告flag")] public bool GetVideoFlagResult = true;
|
|
@@ -34,21 +34,21 @@ namespace TyphoonUnitySDK
|
|
|
34
34
|
SessionItem.Invoke(sessionId, data);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
public void Update()
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
37
|
+
// public void Update()
|
|
38
|
+
// {
|
|
39
|
+
// switch (AppConfig.Channel)
|
|
40
|
+
// {
|
|
41
|
+
// case AppChannel.ChinaAndroid:
|
|
42
|
+
// if (Input.GetKeyDown(KeyCode.Escape))
|
|
43
|
+
// {
|
|
44
|
+
// if (SdkLite.Instance.IsSupportQuitWithKeep())
|
|
45
|
+
// {
|
|
46
|
+
// SdkLite.Instance.QuitWithKeep();
|
|
47
|
+
// }
|
|
48
|
+
// }
|
|
49
|
+
//
|
|
50
|
+
// break;
|
|
51
|
+
// }
|
|
52
|
+
// }
|
|
53
53
|
}
|
|
54
54
|
}
|
|
Binary file
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
Assets/Plugins/Android/libs/
|
|
2
|
-
Assets/Plugins/Android/libs/unity_app-release.aar
|
|
3
|
-
Assets/Plugins/Android/libs/unity_launcher-release.aar
|
|
1
|
+
Assets/Plugins/Android/libs/lib-union-sdk.aar
|
|
4
2
|
Assets/Plugins/Android/AndroidManifest.xml
|
|
5
3
|
Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid
|
|
6
4
|
Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/ChinaAndroidSdk.cs
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.0.
|
|
1
|
+
{"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.0.95","description":"","unity":"2018.1","type":"tool","hideInEditor":false,"author":{"name":"Jan Zhang","email":"","url":""},"changelogUrl":"","documentationUrl":"","keywords":["typhoon"],"license":"","licensesUrl":"","customDependencies":[{"PackageName":"com.unity.nuget.newtonsoft-json","Value":"2.0.0"}],"version_log":"## [1.0.94] - 2024-01-25\r\n\r\n### 新增\n* 更新vivo app sdk\r\n\r\n","major_flag":false,"write_time_stamp":1706850595000,"others":{"items":[]},"dependencies":{"com.unity.nuget.newtonsoft-json":"2.0.0"}}
|