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,269 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using UnityEditor;
|
|
4
|
+
using UnityEditor.AddressableAssets.Build;
|
|
5
|
+
#if TYPHOON_ADDRESSABLE
|
|
6
|
+
using UnityEditor.AddressableAssets;
|
|
7
|
+
using UnityEditor.AddressableAssets.Settings;
|
|
8
|
+
using UnityEngine;
|
|
9
|
+
using UnityEngine.AddressableAssets;
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
namespace TyphoonUnitySDK
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
/// addressable 支持
|
|
16
|
+
/// </summary>
|
|
17
|
+
public partial class AddressableSupport
|
|
18
|
+
{
|
|
19
|
+
/// <summary>
|
|
20
|
+
/// 弹出菜单,选择Profile
|
|
21
|
+
/// </summary>
|
|
22
|
+
public static void PopUpProfileSelectorMenu(PublishSetting publish)
|
|
23
|
+
{
|
|
24
|
+
#if TYPHOON_ADDRESSABLE
|
|
25
|
+
var settings = AddressableAssetSettingsDefaultObject.Settings;
|
|
26
|
+
if (settings == null)
|
|
27
|
+
{
|
|
28
|
+
Debug.LogError("找不到Settings");
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var menu = new GenericMenu();
|
|
33
|
+
var profileSettings = settings.profileSettings;
|
|
34
|
+
foreach (var element in profileSettings.GetAllProfileNames())
|
|
35
|
+
{
|
|
36
|
+
menu.AddItem(new GUIContent(element), false, () =>
|
|
37
|
+
{
|
|
38
|
+
publish.AAUseProfile = element;
|
|
39
|
+
EditorUtility.SetDirty(publish);
|
|
40
|
+
AssetDatabase.SaveAssets();
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
menu.ShowAsContext();
|
|
45
|
+
#endif
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/// <summary>
|
|
50
|
+
/// 是否创建了默认设置
|
|
51
|
+
/// </summary>
|
|
52
|
+
public static bool HasDefaultSettings()
|
|
53
|
+
{
|
|
54
|
+
#if TYPHOON_ADDRESSABLE
|
|
55
|
+
var settings = AddressableAssetSettingsDefaultObject.Settings;
|
|
56
|
+
return settings != null;
|
|
57
|
+
#endif
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/// <summary>
|
|
62
|
+
/// 设置AA相关参数
|
|
63
|
+
/// </summary>
|
|
64
|
+
public static void ModifyAAProfileAndVariables(PublishSetting publish)
|
|
65
|
+
{
|
|
66
|
+
if (!publish.AASupportEnable)
|
|
67
|
+
{
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (!HasDefaultSettings())
|
|
72
|
+
{
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
#if TYPHOON_ADDRESSABLE
|
|
77
|
+
var settings = AddressableAssetSettingsDefaultObject.Settings;
|
|
78
|
+
//激活profile
|
|
79
|
+
settings.activeProfileId =
|
|
80
|
+
settings.profileSettings.GetProfileId(publish.AAUseProfile);
|
|
81
|
+
ModifyVariable(publish);
|
|
82
|
+
#endif
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/// <summary>
|
|
86
|
+
/// 设置参数
|
|
87
|
+
/// </summary>
|
|
88
|
+
public static void SetVariable(PublishSetting publish, string variableName, string value, bool save = false)
|
|
89
|
+
{
|
|
90
|
+
#if TYPHOON_ADDRESSABLE
|
|
91
|
+
if (string.IsNullOrEmpty(publish.AAUseProfile))
|
|
92
|
+
{
|
|
93
|
+
Debug.LogError("未关联profile");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
var success = SetVariable(publish.AAUseProfile, variableName, value);
|
|
98
|
+
EditorUtility.SetDirty(AddressableAssetSettingsDefaultObject.Settings);
|
|
99
|
+
if (save && success)
|
|
100
|
+
{
|
|
101
|
+
AssetDatabase.SaveAssets();
|
|
102
|
+
}
|
|
103
|
+
#endif
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/// <summary>
|
|
107
|
+
/// 修改AA参数
|
|
108
|
+
/// </summary>
|
|
109
|
+
public static void ModifyVariable(PublishSetting publish)
|
|
110
|
+
{
|
|
111
|
+
#if TYPHOON_ADDRESSABLE
|
|
112
|
+
var modifies = publish.AAVariableModify;
|
|
113
|
+
foreach (var modify in modifies)
|
|
114
|
+
{
|
|
115
|
+
SetVariable(publish.AAUseProfile, modify.VariableName, modify.VariableValue);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
EditorUtility.SetDirty(AddressableAssetSettingsDefaultObject.Settings);
|
|
119
|
+
#endif
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/// <summary>
|
|
123
|
+
/// 设置参数
|
|
124
|
+
/// </summary>
|
|
125
|
+
public static bool SetVariable(string profileName, string variableName, string value)
|
|
126
|
+
{
|
|
127
|
+
#if TYPHOON_ADDRESSABLE
|
|
128
|
+
try
|
|
129
|
+
{
|
|
130
|
+
var settings = AddressableAssetSettingsDefaultObject.Settings;
|
|
131
|
+
var profileId = settings.profileSettings.GetProfileId(profileName);
|
|
132
|
+
settings.profileSettings.SetValue(profileId, variableName, value);
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
catch (Exception e)
|
|
136
|
+
{
|
|
137
|
+
Debug.LogError($"设置aa参数失败,profile:{profileName} vaiableName:{variableName} value:{value}");
|
|
138
|
+
}
|
|
139
|
+
#endif
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/// <summary>
|
|
144
|
+
/// 是否包含Profile
|
|
145
|
+
/// </summary>
|
|
146
|
+
public static bool ContainProfile(string profile)
|
|
147
|
+
{
|
|
148
|
+
#if TYPHOON_ADDRESSABLE
|
|
149
|
+
try
|
|
150
|
+
{
|
|
151
|
+
if (string.IsNullOrEmpty(profile))
|
|
152
|
+
{
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
var settings = AddressableAssetSettingsDefaultObject.Settings;
|
|
157
|
+
return settings.profileSettings.GetAllProfileNames().Contains(profile);
|
|
158
|
+
}
|
|
159
|
+
catch (Exception e)
|
|
160
|
+
{
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
#endif
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/// <summary>
|
|
168
|
+
/// 一键构建AA
|
|
169
|
+
/// </summary>
|
|
170
|
+
public static void BuildAASource(PublishSetting publish)
|
|
171
|
+
{
|
|
172
|
+
#if TYPHOON_ADDRESSABLE
|
|
173
|
+
if (!HasDefaultSettings())
|
|
174
|
+
{
|
|
175
|
+
throw new Exception("未初始化Addresable");
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
//选择激活的参数
|
|
179
|
+
var settings = AddressableAssetSettingsDefaultObject.Settings;
|
|
180
|
+
var profileId = settings.activeProfileId;
|
|
181
|
+
if (publish.AASupportEnable && ContainProfile(publish.AAUseProfile))
|
|
182
|
+
{
|
|
183
|
+
profileId = settings.profileSettings.GetProfileId(publish.AAUseProfile);
|
|
184
|
+
settings.activeProfileId = profileId;
|
|
185
|
+
foreach (var element in publish.AAVariableModify)
|
|
186
|
+
{
|
|
187
|
+
SetVariable(profileId, element.VariableName, element.VariableValue);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
EditorUtility.SetDirty(settings);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
foreach (var builder in settings.DataBuilders)
|
|
194
|
+
{
|
|
195
|
+
AddressableAssetSettings.CleanPlayerContent(builder as IDataBuilder);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
UniEditor.LogInfo($"profile:{settings.profileSettings.GetProfileName(profileId)}");
|
|
199
|
+
|
|
200
|
+
//触发AA回调
|
|
201
|
+
var sub = UniEditor.GetSubClasTypes(typeof(OnBuildAAProcessor));
|
|
202
|
+
var match = new List<OnBuildAAProcessor>();
|
|
203
|
+
foreach (var type in sub)
|
|
204
|
+
{
|
|
205
|
+
var instance = Activator.CreateInstance(type) as OnBuildAAProcessor;
|
|
206
|
+
match.Add(instance);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
foreach (var processor in match)
|
|
210
|
+
{
|
|
211
|
+
processor.OnBeforeBuild(publish);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
AddressableAssetSettings.BuildPlayerContent();
|
|
215
|
+
|
|
216
|
+
foreach (var processor in match)
|
|
217
|
+
{
|
|
218
|
+
processor.OnAfterBuild(publish);
|
|
219
|
+
}
|
|
220
|
+
#endif
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/// <summary>
|
|
224
|
+
/// 获取可能参数名
|
|
225
|
+
/// </summary>
|
|
226
|
+
public static List<string> GetVariables()
|
|
227
|
+
{
|
|
228
|
+
#if TYPHOON_ADDRESSABLE
|
|
229
|
+
var settings = AddressableAssetSettingsDefaultObject.Settings;
|
|
230
|
+
return settings.profileSettings.GetVariableNames();
|
|
231
|
+
#endif
|
|
232
|
+
var result = new List<string>();
|
|
233
|
+
return result;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
/// <summary>
|
|
238
|
+
/// 获取属性名
|
|
239
|
+
/// </summary>
|
|
240
|
+
public static string GetVariableValue(string variableName)
|
|
241
|
+
{
|
|
242
|
+
#if TYPHOON_ADDRESSABLE
|
|
243
|
+
try
|
|
244
|
+
{
|
|
245
|
+
var settings = AddressableAssetSettingsDefaultObject.Settings;
|
|
246
|
+
return settings.profileSettings.GetValueByName(settings.activeProfileId, variableName);
|
|
247
|
+
}
|
|
248
|
+
finally
|
|
249
|
+
{
|
|
250
|
+
}
|
|
251
|
+
#endif
|
|
252
|
+
return string.Empty;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
#if TYPHOON_ADDRESSABLE
|
|
256
|
+
/// <summary>
|
|
257
|
+
/// 快捷打开Addressable窗口
|
|
258
|
+
/// </summary>
|
|
259
|
+
[MenuItem("Window/Addressable Window", priority = 3)]
|
|
260
|
+
public static void OpenAddressableWindow()
|
|
261
|
+
{
|
|
262
|
+
var type = UniEditor.GetType("UnityEditor.AddressableAssets.GUI.AddressableAssetsWindow");
|
|
263
|
+
var window = UnityEditor.EditorWindow.GetWindow(type);
|
|
264
|
+
window.titleContent = new GUIContent("Addressables Groups");
|
|
265
|
+
window.Show();
|
|
266
|
+
}
|
|
267
|
+
#endif
|
|
268
|
+
}
|
|
269
|
+
}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using System.IO;
|
|
5
|
+
using UnityEditor;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
|
|
8
|
+
namespace TyphoonUnitySDK
|
|
9
|
+
{
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// 应用接口
|
|
12
|
+
/// </summary>
|
|
13
|
+
public interface IApply
|
|
14
|
+
{
|
|
15
|
+
void Apply(PublishSetting setting);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/// <summary>
|
|
19
|
+
/// 应用配置流程
|
|
20
|
+
/// </summary>
|
|
21
|
+
public class ApplyTool
|
|
22
|
+
{
|
|
23
|
+
//绑定
|
|
24
|
+
public static Dictionary<AppChannel, IApply> Applies = new Dictionary<AppChannel, IApply>()
|
|
25
|
+
{
|
|
26
|
+
{ AppChannel.ChinaAndroid, new ApplyChinaAndroid() },
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
/// <summary>
|
|
31
|
+
/// 应用配置
|
|
32
|
+
/// </summary>
|
|
33
|
+
public static void Apply(PublishSetting setting)
|
|
34
|
+
{
|
|
35
|
+
var done = SwitchPlatformTo(setting.BuildTarget);
|
|
36
|
+
if (done)
|
|
37
|
+
{
|
|
38
|
+
//修改参数
|
|
39
|
+
switch (setting.BuildTarget)
|
|
40
|
+
{
|
|
41
|
+
case BuildTarget.Android:
|
|
42
|
+
{
|
|
43
|
+
ModifyAndroidPlayerSetting(setting);
|
|
44
|
+
UniEditor.LogInfo("//TODO//根据发布模式导入更换资源包");
|
|
45
|
+
}
|
|
46
|
+
break;
|
|
47
|
+
case BuildTarget.iOS:
|
|
48
|
+
{
|
|
49
|
+
ModifyIOSSetting(setting);
|
|
50
|
+
UniEditor.LogInfo("//TODO//根据发布模式导入更换资源包");
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
case BuildTarget.WebGL:
|
|
54
|
+
{
|
|
55
|
+
ModifyWebglSetting(setting);
|
|
56
|
+
UniEditor.LogInfo("//TODO//根据发布模式导入更换资源包");
|
|
57
|
+
}
|
|
58
|
+
break;
|
|
59
|
+
default:
|
|
60
|
+
Debug.LogError($"未处理的类型:{EditorUserBuildSettings.activeBuildTarget}");
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
InvokeOnApplyStart(setting);
|
|
65
|
+
if (!Applies.TryGetValue(setting.Channel, out var match))
|
|
66
|
+
{
|
|
67
|
+
Debug.LogError($"未处理Apply:{setting.Channel}");
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
match.Apply(setting);
|
|
72
|
+
InvokeOnApplyEnd(setting);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/// <summary>
|
|
77
|
+
/// 修改android平台参数
|
|
78
|
+
/// </summary>
|
|
79
|
+
public static void ModifyAndroidPlayerSetting(PublishSetting setting)
|
|
80
|
+
{
|
|
81
|
+
PlayerSettings.SetScriptingBackend(BuildTargetGroup.Android, setting.ScriptingImplementation);
|
|
82
|
+
PlayerSettings.stripEngineCode = setting.StripEngineCode;
|
|
83
|
+
PlayerSettings.SetManagedStrippingLevel(BuildTargetGroup.Android, setting.StrippingLevel);
|
|
84
|
+
|
|
85
|
+
if (!string.IsNullOrWhiteSpace(setting.PackageName))
|
|
86
|
+
{
|
|
87
|
+
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, setting.PackageName);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (string.IsNullOrEmpty(setting.KeystoreName) && setting.EnableSignature)
|
|
91
|
+
{
|
|
92
|
+
if (!File.Exists(setting.KeystoreName))
|
|
93
|
+
{
|
|
94
|
+
throw new Exception($"找不到签名文件:{setting.KeystoreName}");
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
#if UNITY_2019_1_OR_NEWER
|
|
99
|
+
PlayerSettings.Android.useCustomKeystore = setting.EnableSignature;
|
|
100
|
+
PlayerSettings.Android.keyaliasName = setting.KeystoreName;
|
|
101
|
+
PlayerSettings.Android.keystorePass = setting.KeystorePassword;
|
|
102
|
+
PlayerSettings.Android.keyaliasName = setting.KeyAliasName;
|
|
103
|
+
PlayerSettings.Android.keyaliasPass = setting.KeyAliasPassword;
|
|
104
|
+
#endif
|
|
105
|
+
|
|
106
|
+
PlayerSettings.Android.targetArchitectures = 0;
|
|
107
|
+
if (setting.ArmV7)
|
|
108
|
+
{
|
|
109
|
+
PlayerSettings.Android.targetArchitectures |= AndroidArchitecture.ARMv7;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (SupportArm64(setting) && setting.ArmV64)
|
|
113
|
+
{
|
|
114
|
+
PlayerSettings.Android.targetArchitectures |= AndroidArchitecture.ARM64;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (PlayerSettings.Android.targetArchitectures == 0)
|
|
118
|
+
{
|
|
119
|
+
PlayerSettings.Android.targetArchitectures |= AndroidArchitecture.ARMv7;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
PlayerSettings.Android.minSdkVersion = setting.MinApiVersion;
|
|
123
|
+
PlayerSettings.Android.targetSdkVersion = setting.TargetApiVersion;
|
|
124
|
+
|
|
125
|
+
//覆写GraphicsAPI
|
|
126
|
+
if (setting.GraphicsAPIs.Length > 0)
|
|
127
|
+
{
|
|
128
|
+
PlayerSettings.SetUseDefaultGraphicsAPIs(BuildTarget.Android, false);
|
|
129
|
+
PlayerSettings.SetGraphicsAPIs(BuildTarget.Android, setting.GraphicsAPIs);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
//覆写AA参数
|
|
133
|
+
AddressableSupport.ModifyAAProfileAndVariables(setting);
|
|
134
|
+
//写入App config
|
|
135
|
+
WriteAppConfig(setting);
|
|
136
|
+
UniEditor.LogInfo("//TODO//导入资源包...");
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/// <summary>
|
|
140
|
+
/// 修改IOS平台参数
|
|
141
|
+
/// </summary>
|
|
142
|
+
public static void ModifyIOSSetting(PublishSetting setting)
|
|
143
|
+
{
|
|
144
|
+
PlayerSettings.SetScriptingBackend(BuildTargetGroup.iOS, setting.ScriptingImplementation);
|
|
145
|
+
PlayerSettings.stripEngineCode = setting.StripEngineCode;
|
|
146
|
+
PlayerSettings.SetManagedStrippingLevel(BuildTargetGroup.iOS, setting.StrippingLevel);
|
|
147
|
+
//覆写AA参数
|
|
148
|
+
AddressableSupport.ModifyAAProfileAndVariables(setting);
|
|
149
|
+
//写入App config
|
|
150
|
+
WriteAppConfig(setting);
|
|
151
|
+
UniEditor.LogInfo("//TODO//导入资源包...");
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/// <summary>
|
|
155
|
+
/// 修改webgl平台参数
|
|
156
|
+
/// </summary>
|
|
157
|
+
public static void ModifyWebglSetting(PublishSetting setting)
|
|
158
|
+
{
|
|
159
|
+
PlayerSettings.SetScriptingBackend(BuildTargetGroup.WebGL, setting.ScriptingImplementation);
|
|
160
|
+
PlayerSettings.stripEngineCode = setting.StripEngineCode;
|
|
161
|
+
PlayerSettings.SetManagedStrippingLevel(BuildTargetGroup.WebGL, setting.StrippingLevel);
|
|
162
|
+
if (setting.GraphicsAPIs.Length > 0)
|
|
163
|
+
{
|
|
164
|
+
PlayerSettings.SetUseDefaultGraphicsAPIs(BuildTarget.WebGL, false);
|
|
165
|
+
PlayerSettings.SetGraphicsAPIs(BuildTarget.WebGL, setting.GraphicsAPIs);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (setting.OverrideWebglCompressionFormat)
|
|
169
|
+
{
|
|
170
|
+
PlayerSettings.WebGL.compressionFormat = setting.CompressionFormat;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (setting.OverrideWebglTemplate)
|
|
174
|
+
{
|
|
175
|
+
switch (setting.WebglTemplate)
|
|
176
|
+
{
|
|
177
|
+
case WebGlTemplate.Default:
|
|
178
|
+
PlayerSettings.WebGL.template = "APPLICATION:Default";
|
|
179
|
+
break;
|
|
180
|
+
case WebGlTemplate.Minimal:
|
|
181
|
+
PlayerSettings.WebGL.template = "APPLICATION:Minimal";
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
//覆写AA参数
|
|
187
|
+
AddressableSupport.ModifyAAProfileAndVariables(setting);
|
|
188
|
+
//写入App config
|
|
189
|
+
WriteAppConfig(setting);
|
|
190
|
+
UniEditor.LogInfo("//TODO//导入资源包...");
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/// <summary>
|
|
194
|
+
/// 切换平台
|
|
195
|
+
/// </summary>
|
|
196
|
+
public static bool SwitchPlatformTo(BuildTarget buildTarget)
|
|
197
|
+
{
|
|
198
|
+
if (EditorUserBuildSettings.activeBuildTarget == buildTarget)
|
|
199
|
+
{
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
else
|
|
203
|
+
{
|
|
204
|
+
var isSwitch = false;
|
|
205
|
+
UniEditor.ShowMessageBox($"切换平台->{buildTarget.ToString()} ?",
|
|
206
|
+
() => { isSwitch = true; });
|
|
207
|
+
if (isSwitch)
|
|
208
|
+
{
|
|
209
|
+
switch (buildTarget)
|
|
210
|
+
{
|
|
211
|
+
case BuildTarget.Android:
|
|
212
|
+
{
|
|
213
|
+
return EditorUserBuildSettings.SwitchActiveBuildTargetAsync(BuildTargetGroup.Android,
|
|
214
|
+
buildTarget);
|
|
215
|
+
}
|
|
216
|
+
case BuildTarget.iOS:
|
|
217
|
+
{
|
|
218
|
+
return EditorUserBuildSettings.SwitchActiveBuildTargetAsync(BuildTargetGroup.iOS,
|
|
219
|
+
buildTarget);
|
|
220
|
+
}
|
|
221
|
+
case BuildTarget.WebGL:
|
|
222
|
+
{
|
|
223
|
+
return EditorUserBuildSettings.SwitchActiveBuildTargetAsync(BuildTargetGroup.WebGL,
|
|
224
|
+
buildTarget);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
default:
|
|
228
|
+
throw new Exception($"未处理的类型:{buildTarget}");
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
/// <summary>
|
|
238
|
+
/// 写入App config
|
|
239
|
+
/// </summary>
|
|
240
|
+
public static void WriteAppConfig(PublishSetting setting)
|
|
241
|
+
{
|
|
242
|
+
AppConfigAsset.Instance.Channel = setting.Channel;
|
|
243
|
+
AppConfigAsset.Instance.Version = setting.VersionString;
|
|
244
|
+
AppConfigAsset.Instance.VersionType = setting.VersionType;
|
|
245
|
+
AppConfigAsset.Instance.PublishTime = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
246
|
+
EditorUtility.SetDirty(AppConfigAsset.Instance);
|
|
247
|
+
AssetDatabase.SaveAssets();
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/// <summary>
|
|
251
|
+
/// 是否支持Arm64
|
|
252
|
+
/// </summary>
|
|
253
|
+
public static bool SupportArm64(PublishSetting setting) =>
|
|
254
|
+
setting.ScriptingImplementation == ScriptingImplementation.IL2CPP;
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
/// <summary>
|
|
258
|
+
/// 应用前执行
|
|
259
|
+
/// </summary>
|
|
260
|
+
public static void InvokeOnApplyStart(PublishSetting setting)
|
|
261
|
+
{
|
|
262
|
+
var sub = UniEditor.GetSubClasTypes(typeof(OnApplyProcessor));
|
|
263
|
+
var match = new List<OnApplyProcessor>();
|
|
264
|
+
foreach (var type in sub)
|
|
265
|
+
{
|
|
266
|
+
match.Add(Activator.CreateInstance(type) as OnApplyProcessor);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
foreach (var processor in match)
|
|
270
|
+
{
|
|
271
|
+
processor.OnBeforeApply(setting);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
/// <summary>
|
|
277
|
+
/// 应用后执行
|
|
278
|
+
/// </summary>
|
|
279
|
+
public static void InvokeOnApplyEnd(PublishSetting setting)
|
|
280
|
+
{
|
|
281
|
+
var sub = UniEditor.GetSubClasTypes(typeof(OnApplyProcessor));
|
|
282
|
+
var match = new List<OnApplyProcessor>();
|
|
283
|
+
foreach (var type in sub)
|
|
284
|
+
{
|
|
285
|
+
match.Add(Activator.CreateInstance(type) as OnApplyProcessor);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
foreach (var processor in match)
|
|
289
|
+
{
|
|
290
|
+
processor.OnAfterApply(setting);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
//引入模块
|
|
296
|
+
public static void ImportModule(string module)
|
|
297
|
+
{
|
|
298
|
+
var from = $"{UniEditor.PathRoot}/Sources~/{module}/Assets";
|
|
299
|
+
UniEditor.CopyFolder(from, "Assets");
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
public class ApplyChinaAndroid : IApply
|
|
304
|
+
{
|
|
305
|
+
public void Apply(PublishSetting setting)
|
|
306
|
+
{
|
|
307
|
+
//删除文件夹
|
|
308
|
+
UniEditor.TryDeleteFolder("Assets/Plugins/Android");
|
|
309
|
+
UniEditor.TryDeleteFolder("Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid");
|
|
310
|
+
ImportModule("ChinaAndroid");
|
|
311
|
+
AssetDatabase.Refresh();
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|