com.typhoon.unitysdk 1.0.2
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/Editor/AddressableSupport.cs +269 -0
- package/Editor/AddressableSupport.cs.meta +11 -0
- package/Editor/ApplyTool.cs +315 -0
- package/Editor/ApplyTool.cs.meta +11 -0
- package/Editor/EditorIcons.cs +113 -0
- package/Editor/EditorIcons.cs.meta +11 -0
- package/Editor/ExportModule.cs +218 -0
- package/Editor/ExportModule.cs.meta +11 -0
- package/Editor/InstallModule.cs +38 -0
- package/Editor/InstallModule.cs.meta +11 -0
- package/Editor/Interactive/SDKInteractiveUI.prefab +3026 -0
- package/Editor/Interactive/SDKInteractiveUI.prefab.meta +7 -0
- package/Editor/Interactive/sdk_banner.png +0 -0
- package/Editor/Interactive/sdk_banner.png.meta +144 -0
- package/Editor/Interactive/sdk_close.png +0 -0
- package/Editor/Interactive/sdk_close.png.meta +120 -0
- package/Editor/Interactive/sdk_inters.png +0 -0
- package/Editor/Interactive/sdk_inters.png.meta +120 -0
- package/Editor/Interactive/sdk_white_4x4.png +0 -0
- package/Editor/Interactive/sdk_white_4x4.png.meta +120 -0
- package/Editor/Interactive/sdk_/345/244/261/350/264/245/350/277/224/345/233/236.png +0 -0
- package/Editor/Interactive/sdk_/345/244/261/350/264/245/350/277/224/345/233/236.png.meta +120 -0
- package/Editor/Interactive/sdk_/346/202/254/346/265/256/345/271/277/345/221/212.png +0 -0
- package/Editor/Interactive/sdk_/346/202/254/346/265/256/345/271/277/345/221/212.png.meta +120 -0
- package/Editor/Interactive/sdk_/346/210/220/345/212/237/350/277/224/345/233/236.png +0 -0
- package/Editor/Interactive/sdk_/346/210/220/345/212/237/350/277/224/345/233/236.png.meta +120 -0
- package/Editor/Interactive/sdk_/350/277/231/346/230/257/344/270/200/344/270/252/345/216/237/347/224/237/346/250/241/346/235/277.png +0 -0
- package/Editor/Interactive/sdk_/350/277/231/346/230/257/344/270/200/344/270/252/345/216/237/347/224/237/346/250/241/346/235/277.png.meta +120 -0
- package/Editor/Interactive/sdk_/350/277/231/346/230/257/344/270/200/344/270/252/346/217/222/351/241/265/345/271/277/345/221/212.png +0 -0
- package/Editor/Interactive/sdk_/350/277/231/346/230/257/344/270/200/344/270/252/346/217/222/351/241/265/345/271/277/345/221/212.png.meta +120 -0
- package/Editor/Interactive/sdk_/350/277/231/346/230/257/344/270/200/344/270/252/350/247/206/351/242/221/345/271/277/345/221/212.png +0 -0
- package/Editor/Interactive/sdk_/350/277/231/346/230/257/344/270/200/344/270/252/350/247/206/351/242/221/345/271/277/345/221/212.png.meta +120 -0
- package/Editor/Interactive.meta +8 -0
- package/Editor/OnApplyProcessor.cs +22 -0
- package/Editor/OnApplyProcessor.cs.meta +11 -0
- package/Editor/OnBuildAAProcessor.cs +12 -0
- package/Editor/OnBuildAAProcessor.cs.meta +11 -0
- package/Editor/OnPublicProcessor.cs +12 -0
- package/Editor/OnPublicProcessor.cs.meta +11 -0
- package/Editor/OriginalStyles.cs +708 -0
- package/Editor/OriginalStyles.cs.meta +11 -0
- package/Editor/Preferences.cs +43 -0
- package/Editor/Preferences.cs.meta +11 -0
- package/Editor/PreferencesWindow.cs +178 -0
- package/Editor/PreferencesWindow.cs.meta +11 -0
- package/Editor/PropertyInspectorEditor.cs +6 -0
- package/Editor/PropertyInspectorEditor.cs.meta +11 -0
- package/Editor/PublishProcess.cs +13 -0
- package/Editor/PublishProcess.cs.meta +11 -0
- package/Editor/PublishResult.cs +17 -0
- package/Editor/PublishResult.cs.meta +11 -0
- package/Editor/PublishSetting.cs +111 -0
- package/Editor/PublishSetting.cs.meta +11 -0
- package/Editor/PublishSettingGUIDrawer.cs +412 -0
- package/Editor/PublishSettingGUIDrawer.cs.meta +11 -0
- package/Editor/PublishSettingInspector.cs +29 -0
- package/Editor/PublishSettingInspector.cs.meta +11 -0
- package/Editor/PublishTool.cs +137 -0
- package/Editor/PublishTool.cs.meta +11 -0
- package/Editor/PublishVivoBatSetting.cs +62 -0
- package/Editor/PublishVivoBatSetting.cs.meta +11 -0
- package/Editor/PublishVivoBatSettingInspector.cs +371 -0
- package/Editor/PublishVivoBatSettingInspector.cs.meta +11 -0
- package/Editor/PublishVivoBatSettingWindow.cs +69 -0
- package/Editor/PublishVivoBatSettingWindow.cs.meta +11 -0
- package/Editor/PublishWindow.cs +364 -0
- package/Editor/PublishWindow.cs.meta +11 -0
- package/Editor/SdkFont.otf +0 -0
- package/Editor/SdkFont.otf.meta +21 -0
- package/Editor/SdkTestInUnityEditor.cs +20 -0
- package/Editor/SdkTestInUnityEditor.cs.meta +11 -0
- package/Editor/SdkTestInUnityWindow.cs +37 -0
- package/Editor/SdkTestInUnityWindow.cs.meta +11 -0
- package/Editor/Skin.guiskin +2673 -0
- package/Editor/Skin.guiskin.meta +8 -0
- package/Editor/Skins.cs +26 -0
- package/Editor/Skins.cs.meta +11 -0
- package/Editor/StyleEditorWindow.cs +23 -0
- package/Editor/StyleEditorWindow.cs.meta +11 -0
- package/Editor/Styles.cs +52 -0
- package/Editor/Styles.cs.meta +11 -0
- package/Editor/StylesExtension.cs +25 -0
- package/Editor/StylesExtension.cs.meta +11 -0
- package/Editor/Texture/btn_active.png +0 -0
- package/Editor/Texture/btn_active.png.meta +120 -0
- package/Editor/Texture/btn_blue_active.png +0 -0
- package/Editor/Texture/btn_blue_active.png.meta +120 -0
- package/Editor/Texture/btn_blue_hover.png +0 -0
- package/Editor/Texture/btn_blue_hover.png.meta +120 -0
- package/Editor/Texture/btn_blue_normal.png +0 -0
- package/Editor/Texture/btn_blue_normal.png.meta +120 -0
- package/Editor/Texture/btn_green_active.png +0 -0
- package/Editor/Texture/btn_green_active.png.meta +120 -0
- package/Editor/Texture/btn_green_hover.png +0 -0
- package/Editor/Texture/btn_green_hover.png.meta +120 -0
- package/Editor/Texture/btn_green_normal.png +0 -0
- package/Editor/Texture/btn_green_normal.png.meta +120 -0
- package/Editor/Texture/btn_hover.png +0 -0
- package/Editor/Texture/btn_hover.png.meta +120 -0
- package/Editor/Texture/btn_normal.png +0 -0
- package/Editor/Texture/btn_normal.png.meta +120 -0
- package/Editor/Texture/btn_yellow_active.png +0 -0
- package/Editor/Texture/btn_yellow_active.png.meta +120 -0
- package/Editor/Texture/btn_yellow_hover.png +0 -0
- package/Editor/Texture/btn_yellow_hover.png.meta +120 -0
- package/Editor/Texture/btn_yellow_normal.png +0 -0
- package/Editor/Texture/btn_yellow_normal.png.meta +120 -0
- package/Editor/Texture/icon_android.png +0 -0
- package/Editor/Texture/icon_android.png.meta +120 -0
- package/Editor/Texture/icon_douyin.png +0 -0
- package/Editor/Texture/icon_douyin.png.meta +120 -0
- package/Editor/Texture/icon_download.png +0 -0
- package/Editor/Texture/icon_download.png.meta +120 -0
- package/Editor/Texture/icon_error.png +0 -0
- package/Editor/Texture/icon_error.png.meta +144 -0
- package/Editor/Texture/icon_extension.png +0 -0
- package/Editor/Texture/icon_extension.png.meta +120 -0
- package/Editor/Texture/icon_googleplay.png +0 -0
- package/Editor/Texture/icon_googleplay.png.meta +120 -0
- package/Editor/Texture/icon_html5.png +0 -0
- package/Editor/Texture/icon_html5.png.meta +120 -0
- package/Editor/Texture/icon_import.png +0 -0
- package/Editor/Texture/icon_import.png.meta +144 -0
- package/Editor/Texture/icon_ios.png +0 -0
- package/Editor/Texture/icon_ios.png.meta +120 -0
- package/Editor/Texture/icon_oppo.png +0 -0
- package/Editor/Texture/icon_oppo.png.meta +120 -0
- package/Editor/Texture/icon_refresh.png +0 -0
- package/Editor/Texture/icon_refresh.png.meta +120 -0
- package/Editor/Texture/icon_save.png +0 -0
- package/Editor/Texture/icon_save.png.meta +120 -0
- package/Editor/Texture/icon_success.png +0 -0
- package/Editor/Texture/icon_success.png.meta +144 -0
- package/Editor/Texture/icon_vivo.png +0 -0
- package/Editor/Texture/icon_vivo.png.meta +120 -0
- package/Editor/Texture/icon_wechat.png +0 -0
- package/Editor/Texture/icon_wechat.png.meta +120 -0
- package/Editor/Texture/tex_select.png +0 -0
- package/Editor/Texture/tex_select.png.meta +120 -0
- package/Editor/Texture.meta +8 -0
- package/Editor/UniEditor.cs +451 -0
- package/Editor/UniEditor.cs.meta +11 -0
- package/Editor/com.typhoon.unitysdk.editor.asmdef +20 -0
- package/Editor/com.typhoon.unitysdk.editor.asmdef.meta +7 -0
- package/Editor.meta +8 -0
- package/Runtime/AndroidInstance.cs +125 -0
- package/Runtime/AndroidInstance.cs.meta +11 -0
- package/Runtime/AppChannel.cs +55 -0
- package/Runtime/AppChannel.cs.meta +11 -0
- package/Runtime/AppConfig.cs +28 -0
- package/Runtime/AppConfig.cs.meta +11 -0
- package/Runtime/AppConfigAsset.cs +50 -0
- package/Runtime/AppConfigAsset.cs.meta +11 -0
- package/Runtime/BannerPosition.cs +11 -0
- package/Runtime/BannerPosition.cs.meta +11 -0
- package/Runtime/BaseSdk.cs +78 -0
- package/Runtime/BaseSdk.cs.meta +11 -0
- package/Runtime/Extension.cs +58 -0
- package/Runtime/Extension.cs.meta +11 -0
- package/Runtime/Interface.cs +115 -0
- package/Runtime/Interface.cs.meta +11 -0
- package/Runtime/MonoSingleton.cs +76 -0
- package/Runtime/MonoSingleton.cs.meta +11 -0
- package/Runtime/Resources/TYPHOON_SDK_TEST.prefab +45 -0
- package/Runtime/Resources/TYPHOON_SDK_TEST.prefab.meta +7 -0
- package/Runtime/Resources.meta +8 -0
- package/Runtime/SDKInteractiveUI.cs +353 -0
- package/Runtime/SDKInteractiveUI.cs.meta +11 -0
- package/Runtime/SdkDebug.cs +23 -0
- package/Runtime/SdkDebug.cs.meta +11 -0
- package/Runtime/SdkTestInUnity.cs +45 -0
- package/Runtime/SdkTestInUnity.cs.meta +11 -0
- package/Runtime/SessionItem.cs +72 -0
- package/Runtime/SessionItem.cs.meta +11 -0
- package/Runtime/SimpleMap.cs +11 -0
- package/Runtime/SimpleMap.cs.meta +11 -0
- package/Runtime/TestSdk.cs +22 -0
- package/Runtime/TestSdk.cs.meta +11 -0
- package/Runtime/TyphoonSdk.cs +407 -0
- package/Runtime/TyphoonSdk.cs.meta +11 -0
- package/Runtime/TyphoonSdkCallback.cs +48 -0
- package/Runtime/TyphoonSdkCallback.cs.meta +11 -0
- package/Runtime/VersionType.cs +33 -0
- package/Runtime/VersionType.cs.meta +11 -0
- package/Runtime/com.typhoon.unitysdk.asmdef +3 -0
- package/Runtime/com.typhoon.unitysdk.asmdef.meta +7 -0
- package/Runtime.meta +8 -0
- package/Sources~/ChinaAndroid/Assets/Plugins/Android/AndroidManifest.xml +18 -0
- package/Sources~/ChinaAndroid/Assets/Plugins/Android/AndroidManifest.xml.meta +7 -0
- package/Sources~/ChinaAndroid/Assets/Plugins/Android/libs/sdk_plug-release.aar +0 -0
- package/Sources~/ChinaAndroid/Assets/Plugins/Android/libs/sdk_plug-release.aar.meta +32 -0
- package/Sources~/ChinaAndroid/Assets/Plugins/Android/libs/unity_app-release.aar +0 -0
- package/Sources~/ChinaAndroid/Assets/Plugins/Android/libs/unity_app-release.aar.meta +32 -0
- package/Sources~/ChinaAndroid/Assets/Plugins/Android/libs/unity_launcher-release.aar +0 -0
- package/Sources~/ChinaAndroid/Assets/Plugins/Android/libs/unity_launcher-release.aar.meta +32 -0
- package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/ChinaAndroidSdk.cs +154 -0
- package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/ChinaAndroidSdk.cs.meta +11 -0
- package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/Editor/PublishChinaAndroidAAR.cs +56 -0
- package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/Editor/PublishChinaAndroidAAR.cs.meta +11 -0
- package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/Editor.meta +8 -0
- package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/Resources/TYPHOON_SDK_CHINA_ANDROID.prefab +45 -0
- package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/Resources/TYPHOON_SDK_CHINA_ANDROID.prefab.meta +7 -0
- package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/Resources.meta +8 -0
- package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid.meta +8 -0
- package/Sources~/Package//345/270/270/347/224/250/346/211/223/345/214/205/351/205/215/347/275/256.unitypackage +0 -0
- package/package.json +1 -0
- package/package.json.meta +7 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.IO;
|
|
4
|
+
using System.Linq;
|
|
5
|
+
using System.Text;
|
|
6
|
+
using UnityEditor;
|
|
7
|
+
using UnityEngine;
|
|
8
|
+
|
|
9
|
+
namespace TyphoonUnitySDK
|
|
10
|
+
{
|
|
11
|
+
public enum ComplexType
|
|
12
|
+
{
|
|
13
|
+
Yes = 0,
|
|
14
|
+
No = 1,
|
|
15
|
+
Alt = 2,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public class UniEditor
|
|
19
|
+
{
|
|
20
|
+
/// <summary>
|
|
21
|
+
/// 常用打包配置
|
|
22
|
+
/// </summary>
|
|
23
|
+
public static string PackagePath_PublishSetting = $"{PathRoot}/Sources~/Package/常用打包配置.unitypackage";
|
|
24
|
+
|
|
25
|
+
/// <summary>
|
|
26
|
+
/// 开启Addressable模块支持
|
|
27
|
+
/// </summary>
|
|
28
|
+
public static readonly string DEFINE_TYPHOON_ADDRESSABLE_NAME = "TYPHOON_ADDRESSABLE";
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
/// <summary>
|
|
32
|
+
/// 插件包根目录
|
|
33
|
+
/// </summary>
|
|
34
|
+
public static string PathRoot
|
|
35
|
+
{
|
|
36
|
+
get
|
|
37
|
+
{
|
|
38
|
+
if (Directory.Exists("Assets/com.typhoon.unitysdk"))
|
|
39
|
+
{
|
|
40
|
+
return "Assets/com.typhoon.unitysdk";
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return "Packages/com.typhoon.unitysdk";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/// <summary>
|
|
48
|
+
/// 补充文件夹
|
|
49
|
+
/// </summary>
|
|
50
|
+
public static void CreateDirIfNotExist(string folder)
|
|
51
|
+
{
|
|
52
|
+
if (!Directory.Exists(folder))
|
|
53
|
+
{
|
|
54
|
+
Directory.CreateDirectory(folder);
|
|
55
|
+
AssetDatabase.Refresh();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// <summary>
|
|
60
|
+
/// 导入包
|
|
61
|
+
/// </summary>
|
|
62
|
+
public static void ImportPackage(string path, bool interactive = true)
|
|
63
|
+
{
|
|
64
|
+
LogInfo($"导入----{path}");
|
|
65
|
+
AssetDatabase.ImportPackage(path, interactive);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/// <summary>
|
|
69
|
+
/// 日志输出
|
|
70
|
+
/// </summary>
|
|
71
|
+
public static void LogInfo(string content)
|
|
72
|
+
{
|
|
73
|
+
Debug.Log($"<color=#3ac9f3>{content}</color>");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/// <summary>
|
|
77
|
+
/// 清理宏定义
|
|
78
|
+
/// </summary>
|
|
79
|
+
public static void ClearScriptingDefineSymbol(params string[] removes)
|
|
80
|
+
{
|
|
81
|
+
var currentTarget = EditorUserBuildSettings.selectedBuildTargetGroup;
|
|
82
|
+
|
|
83
|
+
if (currentTarget == BuildTargetGroup.Unknown)
|
|
84
|
+
{
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var definesString = PlayerSettings.GetScriptingDefineSymbolsForGroup(currentTarget).Trim();
|
|
89
|
+
var defines = definesString.Split(';');
|
|
90
|
+
|
|
91
|
+
bool changed = false;
|
|
92
|
+
definesString = string.Empty;
|
|
93
|
+
|
|
94
|
+
foreach (var define in removes)
|
|
95
|
+
{
|
|
96
|
+
if (defines.Contains(define))
|
|
97
|
+
{
|
|
98
|
+
changed = true;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
else
|
|
102
|
+
{
|
|
103
|
+
if (definesString.EndsWith(";", StringComparison.InvariantCulture) == false)
|
|
104
|
+
{
|
|
105
|
+
definesString += ";";
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
definesString += define;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (changed)
|
|
113
|
+
{
|
|
114
|
+
PlayerSettings.SetScriptingDefineSymbolsForGroup(currentTarget, definesString);
|
|
115
|
+
foreach (var element in removes)
|
|
116
|
+
{
|
|
117
|
+
Debug.Log($"<color=#51d364>移除宏定义:{element}</color>");
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/// <summary>
|
|
123
|
+
/// 添加宏定义
|
|
124
|
+
/// </summary>
|
|
125
|
+
public static void AppendScriptingDefineSymbol(params string[] append)
|
|
126
|
+
{
|
|
127
|
+
var currentTarget = EditorUserBuildSettings.selectedBuildTargetGroup;
|
|
128
|
+
|
|
129
|
+
if (currentTarget == BuildTargetGroup.Unknown)
|
|
130
|
+
{
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
var definesString = PlayerSettings.GetScriptingDefineSymbolsForGroup(currentTarget).Trim();
|
|
135
|
+
var defines = definesString.Split(';');
|
|
136
|
+
|
|
137
|
+
bool changed = false;
|
|
138
|
+
|
|
139
|
+
foreach (var define in append)
|
|
140
|
+
{
|
|
141
|
+
if (defines.Contains(define) == false)
|
|
142
|
+
{
|
|
143
|
+
if (definesString.EndsWith(";", StringComparison.InvariantCulture) == false)
|
|
144
|
+
{
|
|
145
|
+
definesString += ";";
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
definesString += define;
|
|
149
|
+
changed = true;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (changed)
|
|
154
|
+
{
|
|
155
|
+
PlayerSettings.SetScriptingDefineSymbolsForGroup(currentTarget, definesString);
|
|
156
|
+
foreach (var element in append)
|
|
157
|
+
{
|
|
158
|
+
Debug.Log($"<color=#51d364>添加宏定义:{element}</color>");
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/// <summary>
|
|
164
|
+
/// 反射获取类型
|
|
165
|
+
/// </summary>
|
|
166
|
+
public static Type GetType(string typeName)
|
|
167
|
+
{
|
|
168
|
+
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
|
169
|
+
foreach (var element in assemblies)
|
|
170
|
+
{
|
|
171
|
+
var types = element.GetTypes();
|
|
172
|
+
foreach (var type in types)
|
|
173
|
+
{
|
|
174
|
+
if (type.FullName == typeName)
|
|
175
|
+
{
|
|
176
|
+
return type;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/// <summary>
|
|
185
|
+
/// 反射获取子类类型
|
|
186
|
+
/// </summary>
|
|
187
|
+
public static List<Type> GetSubClasTypes(Type check)
|
|
188
|
+
{
|
|
189
|
+
var result = new List<Type>();
|
|
190
|
+
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
|
191
|
+
foreach (var element in assemblies)
|
|
192
|
+
{
|
|
193
|
+
var types = element.GetTypes();
|
|
194
|
+
foreach (var type in types)
|
|
195
|
+
{
|
|
196
|
+
if (type == check)
|
|
197
|
+
{
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
else if (type.IsSubclassOf(check))
|
|
201
|
+
{
|
|
202
|
+
result.Add(type);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return result;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
/// <summary>
|
|
212
|
+
/// 是否安装了Addressable
|
|
213
|
+
/// </summary>
|
|
214
|
+
public static bool HasAddressable()
|
|
215
|
+
{
|
|
216
|
+
return GetType("UnityEngine.AddressableAssets.Addressables") != null;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/// <summary>
|
|
220
|
+
/// 是否添加了addressable支持
|
|
221
|
+
/// </summary>
|
|
222
|
+
public static bool HasAddressableSupport()
|
|
223
|
+
{
|
|
224
|
+
#if TYPHOON_ADDRESSABLE
|
|
225
|
+
return true;
|
|
226
|
+
#endif
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
[MenuItem("TyphoonSDK/安装/Addressable 支持", priority = 100)]
|
|
232
|
+
public static void InstallAddressableSupport()
|
|
233
|
+
{
|
|
234
|
+
AppendScriptingDefineSymbol(DEFINE_TYPHOON_ADDRESSABLE_NAME);
|
|
235
|
+
AssetDatabase.Refresh();
|
|
236
|
+
AssetDatabase.SaveAssets();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
[MenuItem("TyphoonSDK/安装/Addressable 支持", true)]
|
|
240
|
+
public static bool InstallAddressableSupportValid()
|
|
241
|
+
{
|
|
242
|
+
return HasAddressable();
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
[MenuItem("TyphoonSDK/卸载/Addressable 支持", priority = 100)]
|
|
246
|
+
public static void UninstallAddressableSupport()
|
|
247
|
+
{
|
|
248
|
+
ShowMessageBox("卸载Addressable 支持,可能会导致一些配置丢失,请做好备份,仍然继续吗?", () =>
|
|
249
|
+
{
|
|
250
|
+
ClearScriptingDefineSymbol(DEFINE_TYPHOON_ADDRESSABLE_NAME);
|
|
251
|
+
AssetDatabase.Refresh();
|
|
252
|
+
AssetDatabase.SaveAssets();
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
[MenuItem("TyphoonSDK/卸载/Addressable 支持", true)]
|
|
257
|
+
public static bool UninstallAddressableSupportValid()
|
|
258
|
+
{
|
|
259
|
+
#if TYPHOON_ADDRESSABLE
|
|
260
|
+
return true;
|
|
261
|
+
#endif
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
/// <summary>
|
|
267
|
+
/// 弹出二次提示窗口
|
|
268
|
+
/// </summary>
|
|
269
|
+
public static void ShowMessageBox(string conent, Action yes, Action no = null)
|
|
270
|
+
{
|
|
271
|
+
if (EditorUtility.DisplayDialog("提示", conent, "是", "否"))
|
|
272
|
+
{
|
|
273
|
+
yes?.Invoke();
|
|
274
|
+
}
|
|
275
|
+
else
|
|
276
|
+
{
|
|
277
|
+
no?.Invoke();
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/// <summary>
|
|
282
|
+
/// 弹出二次提示窗口
|
|
283
|
+
/// </summary>
|
|
284
|
+
public static ComplexType ShowMessageBoxComplex(string conent, Action yes, Action alt, Action no = null)
|
|
285
|
+
{
|
|
286
|
+
var result = (ComplexType)EditorUtility.DisplayDialogComplex("提示", conent, "是", "否", "不再提示");
|
|
287
|
+
switch (result)
|
|
288
|
+
{
|
|
289
|
+
case ComplexType.Yes:
|
|
290
|
+
{
|
|
291
|
+
yes?.Invoke();
|
|
292
|
+
}
|
|
293
|
+
break;
|
|
294
|
+
case ComplexType.No:
|
|
295
|
+
{
|
|
296
|
+
no?.Invoke();
|
|
297
|
+
}
|
|
298
|
+
break;
|
|
299
|
+
case ComplexType.Alt:
|
|
300
|
+
{
|
|
301
|
+
alt?.Invoke();
|
|
302
|
+
}
|
|
303
|
+
break;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return result;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/// <summary>
|
|
310
|
+
/// 浏览签名文件
|
|
311
|
+
/// </summary>
|
|
312
|
+
public static string BrowseKeystoreFile()
|
|
313
|
+
{
|
|
314
|
+
var path = EditorUtility.OpenFilePanel("选择文件", "", "");
|
|
315
|
+
return FullPathToAssetPath(path);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/// <summary>
|
|
319
|
+
/// 全路径转资源路径
|
|
320
|
+
/// </summary>
|
|
321
|
+
public static string FullPathToAssetPath(string path)
|
|
322
|
+
{
|
|
323
|
+
if (string.IsNullOrEmpty(path))
|
|
324
|
+
{
|
|
325
|
+
return path;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
path = Path.GetFullPath(path);
|
|
329
|
+
path = path.Replace("\\", "/");
|
|
330
|
+
var pp = Path.GetDirectoryName(Application.dataPath);
|
|
331
|
+
pp = pp.Replace("\\", "/");
|
|
332
|
+
pp += "/";
|
|
333
|
+
Debug.Log(pp);
|
|
334
|
+
Debug.Log(path);
|
|
335
|
+
return path.Replace(pp, "");
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/// <summary>
|
|
339
|
+
/// 自动版本号
|
|
340
|
+
/// </summary>
|
|
341
|
+
public static string AutoVersionSting(string version)
|
|
342
|
+
{
|
|
343
|
+
if (string.IsNullOrEmpty(version))
|
|
344
|
+
{
|
|
345
|
+
return "1.0.0";
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
var strs = version.Split('.');
|
|
349
|
+
try
|
|
350
|
+
{
|
|
351
|
+
var current = int.Parse(strs.Last());
|
|
352
|
+
current += 1;
|
|
353
|
+
var sb = new StringBuilder();
|
|
354
|
+
for (int i = 0; i < strs.Length - 1; i++)
|
|
355
|
+
{
|
|
356
|
+
if (i != 0)
|
|
357
|
+
{
|
|
358
|
+
sb.Append(".");
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
sb.Append(strs[i]);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
sb.Append($".{current}");
|
|
365
|
+
return sb.ToString();
|
|
366
|
+
}
|
|
367
|
+
catch (Exception e)
|
|
368
|
+
{
|
|
369
|
+
Debug.LogError("无法识别版本号格式");
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
return version;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
/// <summary>
|
|
377
|
+
/// 复制文件夹
|
|
378
|
+
/// </summary>
|
|
379
|
+
public static void CopyFolder(string source, string dest)
|
|
380
|
+
{
|
|
381
|
+
// Debug.Log($"复制文件夹{source}-->{dest}");
|
|
382
|
+
if (!Directory.Exists(dest))
|
|
383
|
+
{
|
|
384
|
+
Directory.CreateDirectory(dest);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
string[] files = Directory.GetFiles(source);
|
|
388
|
+
foreach (string file in files)
|
|
389
|
+
{
|
|
390
|
+
string fileName = Path.GetFileName(file);
|
|
391
|
+
string destinationPath = Path.Combine(dest, fileName);
|
|
392
|
+
File.Copy(file, destinationPath, true);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
string[] subfolders = Directory.GetDirectories(source);
|
|
396
|
+
foreach (string subfolder in subfolders)
|
|
397
|
+
{
|
|
398
|
+
string folderName = Path.GetFileName(subfolder);
|
|
399
|
+
string destinationSubfolder = Path.Combine(dest, folderName);
|
|
400
|
+
CopyFolder(subfolder, destinationSubfolder);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/// <summary>
|
|
405
|
+
/// 尝试删除文件夹
|
|
406
|
+
/// </summary>
|
|
407
|
+
public static void TryDeleteFolder(string dir)
|
|
408
|
+
{
|
|
409
|
+
if (Directory.Exists(dir))
|
|
410
|
+
{
|
|
411
|
+
Directory.Delete(dir, true);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
/// <summary>
|
|
417
|
+
/// 路径是否为ascii,防止中文路径问题出现
|
|
418
|
+
/// </summary>
|
|
419
|
+
public static bool IsAsciiPath(string path)
|
|
420
|
+
{
|
|
421
|
+
byte[] bytes = Encoding.ASCII.GetBytes(path);
|
|
422
|
+
|
|
423
|
+
foreach (byte b in bytes)
|
|
424
|
+
{
|
|
425
|
+
if (b > 127) // 非ASCII字符的值大于127
|
|
426
|
+
return false;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
return true;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/// <summary>
|
|
433
|
+
/// 获取window用户名文件夹
|
|
434
|
+
/// </summary>
|
|
435
|
+
/// <returns></returns>
|
|
436
|
+
public static string GetWindowUserFolder()
|
|
437
|
+
{
|
|
438
|
+
return Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/// <summary>
|
|
442
|
+
/// gradle是否设置成功
|
|
443
|
+
/// </summary>
|
|
444
|
+
/// <returns></returns>
|
|
445
|
+
public static bool GradleIsMatch()
|
|
446
|
+
{
|
|
447
|
+
return !string.IsNullOrEmpty(Preferences.Default.GradlePath) &&
|
|
448
|
+
File.Exists($"{Preferences.Default.GradlePath}/gradle");
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "com.typhoon.unitysdk.editor",
|
|
3
|
+
"rootNamespace": "",
|
|
4
|
+
"references": [
|
|
5
|
+
"com.typhoon.unitysdk",
|
|
6
|
+
"Unity.Addressables",
|
|
7
|
+
"Unity.Addressables.Editor"
|
|
8
|
+
],
|
|
9
|
+
"includePlatforms": [
|
|
10
|
+
"Editor"
|
|
11
|
+
],
|
|
12
|
+
"excludePlatforms": [],
|
|
13
|
+
"allowUnsafeCode": false,
|
|
14
|
+
"overrideReferences": false,
|
|
15
|
+
"precompiledReferences": [],
|
|
16
|
+
"autoReferenced": true,
|
|
17
|
+
"defineConstraints": [],
|
|
18
|
+
"versionDefines": [],
|
|
19
|
+
"noEngineReferences": false
|
|
20
|
+
}
|
package/Editor.meta
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
|
|
3
|
+
namespace TyphoonUnitySDK
|
|
4
|
+
{
|
|
5
|
+
public class AndroidInstance : MonoBehaviour
|
|
6
|
+
{
|
|
7
|
+
public AndroidJavaObject AndroidJavaObject;
|
|
8
|
+
public static bool IsInUnity = false;
|
|
9
|
+
|
|
10
|
+
public static AndroidInstance CreateInstance()
|
|
11
|
+
{
|
|
12
|
+
var clone = new GameObject();
|
|
13
|
+
return clone.AddComponent<AndroidInstance>();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public void Initialize()
|
|
17
|
+
{
|
|
18
|
+
SdkDebug.Log("AndroidInstance Initialize...");
|
|
19
|
+
#if UNITY_EDITOR
|
|
20
|
+
IsInUnity = true;
|
|
21
|
+
#endif
|
|
22
|
+
if (IsInUnity)
|
|
23
|
+
{
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var androidClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
|
|
28
|
+
AndroidJavaObject = androidClass.GetStatic<AndroidJavaObject>("currentActivity");
|
|
29
|
+
SdkDebug.Log("AndroidInstance Initialize Done");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public void CallWithSession(SessionItem session)
|
|
33
|
+
{
|
|
34
|
+
SdkDebug.Log($"CallWithSession {session.MethodName} {session.SendData}");
|
|
35
|
+
//避免为空
|
|
36
|
+
var data = session.SendData.ToJson();
|
|
37
|
+
data = data ?? "";
|
|
38
|
+
AndroidJavaObject?.Call("receiveSessionFromUnity", session.MethodName, session.SessionId, data);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/// <summary>
|
|
42
|
+
/// 调用方法,无参
|
|
43
|
+
/// </summary>
|
|
44
|
+
public void Call(string method)
|
|
45
|
+
{
|
|
46
|
+
AndroidJavaObject?.Call(method);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/// <summary>
|
|
50
|
+
/// 调用方法,参1
|
|
51
|
+
/// </summary>
|
|
52
|
+
public void Call<T>(string method, T arg)
|
|
53
|
+
{
|
|
54
|
+
AndroidJavaObject?.Call(method, arg);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/// <summary>
|
|
58
|
+
/// 调用方法,参2
|
|
59
|
+
/// </summary>
|
|
60
|
+
public void Call<T1, T2>(string method, T1 arg, T2 arg2)
|
|
61
|
+
{
|
|
62
|
+
AndroidJavaObject?.Call(method, arg, arg2);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/// <summary>
|
|
66
|
+
/// 调用方法,参3
|
|
67
|
+
/// </summary>
|
|
68
|
+
public void Call<T1, T2, T3>(string method, T1 arg, T2 arg2, T3 arg3)
|
|
69
|
+
{
|
|
70
|
+
AndroidJavaObject?.Call(method, arg, arg2, arg3);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/// <summary>
|
|
74
|
+
/// 调用方法,带返回值,无参
|
|
75
|
+
/// </summary>
|
|
76
|
+
public TResult CallReturn<TResult>(string method)
|
|
77
|
+
{
|
|
78
|
+
if (IsInUnity)
|
|
79
|
+
{
|
|
80
|
+
return default(TResult);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return AndroidJavaObject.Call<TResult>(method);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/// <summary>
|
|
87
|
+
/// 调用方法,带返回值,参1
|
|
88
|
+
/// </summary>
|
|
89
|
+
public TResult CallReturn<T1, TResult>(string method, T1 arg)
|
|
90
|
+
{
|
|
91
|
+
if (IsInUnity)
|
|
92
|
+
{
|
|
93
|
+
return default(TResult);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return AndroidJavaObject.Call<TResult>(method, arg);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/// <summary>
|
|
100
|
+
/// 调用方法,带返回值,参2
|
|
101
|
+
/// </summary>
|
|
102
|
+
public TResult CallReturn<TResult, T1, T2>(string method, T1 arg, T2 arg2)
|
|
103
|
+
{
|
|
104
|
+
if (IsInUnity)
|
|
105
|
+
{
|
|
106
|
+
return default(TResult);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return AndroidJavaObject.Call<TResult>(method, arg, arg2);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/// <summary>
|
|
113
|
+
/// 调用方法,带返回值,参3
|
|
114
|
+
/// </summary>
|
|
115
|
+
public TResult CallReturn<TResult, T1, T2, T3>(string method, T1 arg, T2 arg2, T3 arg3)
|
|
116
|
+
{
|
|
117
|
+
if (IsInUnity)
|
|
118
|
+
{
|
|
119
|
+
return default(TResult);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return AndroidJavaObject.Call<TResult>(method, arg, arg2, arg3);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
namespace TyphoonUnitySDK
|
|
2
|
+
{
|
|
3
|
+
public enum AppChannel
|
|
4
|
+
{
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// 本地测试
|
|
7
|
+
/// </summary>
|
|
8
|
+
Test = 0,
|
|
9
|
+
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// 国内安卓
|
|
12
|
+
/// </summary>
|
|
13
|
+
ChinaAndroid = 1,
|
|
14
|
+
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// 国内IOS
|
|
17
|
+
/// </summary>
|
|
18
|
+
ChinaIOS = 2,
|
|
19
|
+
|
|
20
|
+
/// <summary>
|
|
21
|
+
/// Google商店版
|
|
22
|
+
/// </summary>
|
|
23
|
+
GooglePlay = 3,
|
|
24
|
+
|
|
25
|
+
/// <summary>
|
|
26
|
+
/// 海外IOS
|
|
27
|
+
/// </summary>
|
|
28
|
+
SeaIOS = 4,
|
|
29
|
+
|
|
30
|
+
/// <summary>
|
|
31
|
+
/// 抖音android
|
|
32
|
+
/// </summary>
|
|
33
|
+
DouyinAndroid = 5,
|
|
34
|
+
|
|
35
|
+
/// <summary>
|
|
36
|
+
/// 抖音IOS
|
|
37
|
+
/// </summary>
|
|
38
|
+
DouyinIOS = 6,
|
|
39
|
+
|
|
40
|
+
/// <summary>
|
|
41
|
+
/// 微信小游戏
|
|
42
|
+
/// </summary>
|
|
43
|
+
WxMini = 7,
|
|
44
|
+
|
|
45
|
+
/// <summary>
|
|
46
|
+
/// vivo小游戏
|
|
47
|
+
/// </summary>
|
|
48
|
+
VivoMini = 8,
|
|
49
|
+
|
|
50
|
+
/// <summary>
|
|
51
|
+
/// oppo小游戏
|
|
52
|
+
/// </summary>
|
|
53
|
+
OppoMini = 9,
|
|
54
|
+
}
|
|
55
|
+
}
|