com.typhoon.unitysdk 1.1.22 → 1.1.25
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 +16 -1
- package/Editor/ApplyTool.cs +36 -2
- package/Editor/EditorIcons.cs +4 -0
- package/Editor/ExportModule.cs +24 -0
- package/Editor/PublishProcess.cs +1 -0
- package/Editor/PublishResult.cs +6 -1
- package/Editor/PublishSetting.cs +2 -0
- package/Editor/PublishSettingGUIDrawer.cs +21 -2
- package/Editor/PublishTool.cs +3 -2
- package/Editor/PublishWindow.cs +15 -0
- package/Editor/Texture/icon_yandex_games.png +0 -0
- package/Editor/Texture/icon_yandex_games.png.meta +147 -0
- package/Editor/UniEditor.cs +88 -28
- package/Editor/YandexGamesConfig.cs +100 -0
- package/Editor/{EditorKit.cs.meta → YandexGamesConfig.cs.meta} +11 -11
- package/Runtime/AppChannel.cs +8 -0
- package/Runtime/BaseSdk.cs +7 -0
- package/Runtime/GamePauser.cs +16 -0
- package/Runtime/Interface.cs +11 -3
- package/Runtime/SdkLite.cs +32 -0
- package/Runtime/SdkTestInUnity.cs +7 -0
- package/Runtime/YandexGamesLifecycle.cs +41 -0
- package/Runtime/YandexGamesLifecycle.cs.meta +11 -0
- package/Sources~/Package/HuaweiHarmony.unitypackage +0 -0
- package/Sources~/Package/YandexGames.unitypackage +0 -0
- package/Sources~/Package/YandexGames.unitypackage.manifest +541 -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 -1
- package/Editor/EditorKit.cs +0 -67
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
# 更新日志
|
|
2
|
+
## [1.1.25] - 2025-12-31
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## [1.1.24] - 2025-12-31
|
|
6
|
+
|
|
7
|
+
### 新增
|
|
8
|
+
* 新增yandex games渠道
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## [1.1.23] - 2025-10-26
|
|
12
|
+
|
|
13
|
+
### 优化
|
|
14
|
+
* 调整鸿蒙发布目录
|
|
15
|
+
|
|
16
|
+
|
|
2
17
|
## [1.1.22] - 2025-10-25
|
|
3
18
|
|
|
4
|
-
### 优化
|
|
19
|
+
### 优化
|
|
5
20
|
* 优化gradle路径获取,取preference的gradle路径
|
|
6
21
|
* 优化发布名称使其更有意义
|
|
7
22
|
|
package/Editor/ApplyTool.cs
CHANGED
|
@@ -35,6 +35,7 @@ namespace TyphoonUnitySDK
|
|
|
35
35
|
{ AppChannel.MiniGame, new ApplyMiniGame() },
|
|
36
36
|
{ AppChannel.XiZhongYou, new ApplyXiZhongYou() },
|
|
37
37
|
{ AppChannel.HuaweiHarmony, new ApplyHuaweiHarmony() },
|
|
38
|
+
{ AppChannel.YandexGames, new ApplyYandexGames() }
|
|
38
39
|
};
|
|
39
40
|
|
|
40
41
|
|
|
@@ -67,6 +68,7 @@ namespace TyphoonUnitySDK
|
|
|
67
68
|
MiniGameWebglConfig.Default.Save();
|
|
68
69
|
XiZhongYouConfig.Default.Save();
|
|
69
70
|
HuaweiHarmonyConfig.Default.Save();
|
|
71
|
+
YandexGamesConfig.Default.Save();
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
/// <summary>
|
|
@@ -590,8 +592,8 @@ namespace TyphoonUnitySDK
|
|
|
590
592
|
|
|
591
593
|
public static void SetWebGLLightmapEncoding(BuildTargetGroup group, LightmapEncoding encoding)
|
|
592
594
|
{
|
|
593
|
-
var typeLightEncodingQ =
|
|
594
|
-
var method =
|
|
595
|
+
var typeLightEncodingQ = UniEditor.GetType("UnityEditor.LightmapEncodingQuality");
|
|
596
|
+
var method = UniEditor.GetMethod(typeof(PlayerSettings), "SetLightmapEncodingQualityForPlatformGroup",
|
|
595
597
|
BindingFlags.Static | BindingFlags.NonPublic);
|
|
596
598
|
method.Invoke(null, new object[]
|
|
597
599
|
{
|
|
@@ -614,6 +616,7 @@ namespace TyphoonUnitySDK
|
|
|
614
616
|
"Assets/VIVO-GAME-SDK",
|
|
615
617
|
"Assets/KS-WASM-SDK",
|
|
616
618
|
"Assets/Plugins/KSWASM",
|
|
619
|
+
"Assets/PluginYourGames",
|
|
617
620
|
};
|
|
618
621
|
|
|
619
622
|
|
|
@@ -896,5 +899,36 @@ namespace TyphoonUnitySDK
|
|
|
896
899
|
AssetDatabase.SaveAssets();
|
|
897
900
|
}
|
|
898
901
|
}
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
/*YandexGames*/
|
|
905
|
+
public class ApplyYandexGames : IApply
|
|
906
|
+
{
|
|
907
|
+
public void Apply(PublishSetting setting)
|
|
908
|
+
{
|
|
909
|
+
UniEditor.AppendScriptingDefineSymbol(BuildTargetGroup.WebGL, new[]
|
|
910
|
+
{
|
|
911
|
+
"YandexGamesPlatform_yg", "PLUGIN_YG_2", "TMP_YG2", "NJSON_YG2", "InterstitialAdv_yg",
|
|
912
|
+
"RewardedAdv_yg", "StickyAdv_yg", "Authorization_yg", "Storage_yg", "NJSON_STORAGE_YG2",
|
|
913
|
+
"Localization_yg"
|
|
914
|
+
});
|
|
915
|
+
var pack = UniEditor.PackagePath_YandexGames;
|
|
916
|
+
Debug.Log($"导入... {pack}");
|
|
917
|
+
ImportUnityPackage(pack);
|
|
918
|
+
var manifest_path = $"{pack}.manifest";
|
|
919
|
+
Debug.Log($"读取资源清单...{manifest_path}");
|
|
920
|
+
var manifest = ReadManifest(manifest_path);
|
|
921
|
+
Debug.Log($"清理多余文件...");
|
|
922
|
+
foreach (var folder in MaybeFolder)
|
|
923
|
+
{
|
|
924
|
+
ClearFilesInDirectory(folder, manifest);
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
ReimportScript(manifest);
|
|
928
|
+
AssetDatabase.Refresh();
|
|
929
|
+
EditorUtility.SetDirty(AppConfigAsset.Instance);
|
|
930
|
+
AssetDatabase.SaveAssets();
|
|
931
|
+
}
|
|
932
|
+
}
|
|
899
933
|
}
|
|
900
934
|
}
|
package/Editor/EditorIcons.cs
CHANGED
|
@@ -113,6 +113,10 @@ namespace TyphoonUnitySDK
|
|
|
113
113
|
public static Texture icon_wechat =>
|
|
114
114
|
__icon_wechat
|
|
115
115
|
?? AssetDatabase.LoadAssetAtPath<Texture>($"{FolderPath}/icon_wechat.png");
|
|
116
|
+
private static Texture __icon_yandex_games = null;
|
|
117
|
+
public static Texture icon_yandex_games =>
|
|
118
|
+
__icon_yandex_games
|
|
119
|
+
?? AssetDatabase.LoadAssetAtPath<Texture>($"{FolderPath}/icon_yandex_games.png");
|
|
116
120
|
private static Texture __light_active = null;
|
|
117
121
|
public static Texture light_active =>
|
|
118
122
|
__light_active
|
package/Editor/ExportModule.cs
CHANGED
|
@@ -236,6 +236,30 @@ namespace TyphoonUnitySDK
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
|
|
239
|
+
[MenuItem("TyphoonSDK/开发者/导出-YandexGames.unitypackage")]
|
|
240
|
+
public static void ExportYandexGames()
|
|
241
|
+
{
|
|
242
|
+
var manifest = new List<string>()
|
|
243
|
+
{
|
|
244
|
+
"Assets/Typhoon_Gen/TyphoonSDK/Runtime/YandexGames",
|
|
245
|
+
"Assets/PluginYourGames",
|
|
246
|
+
"Assets/WebGLTemplates",
|
|
247
|
+
};
|
|
248
|
+
if (!MakeSureExport(manifest))
|
|
249
|
+
{
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (!CheckMissFiles(manifest))
|
|
254
|
+
{
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
ExportUnityPackage(manifest, UniEditor.PackagePath_YandexGames, out var detail);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
239
263
|
[MenuItem("TyphoonSDK/开发者/导出-AATool.unitypackage")]
|
|
240
264
|
public static void ExportAATool()
|
|
241
265
|
{
|
package/Editor/PublishProcess.cs
CHANGED
package/Editor/PublishResult.cs
CHANGED
|
@@ -52,10 +52,15 @@ namespace TyphoonUnitySDK
|
|
|
52
52
|
/// Oppo生成的rpk路径
|
|
53
53
|
/// </summary>
|
|
54
54
|
public string OppoMiniRpkPath;
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
/// <summary>
|
|
57
57
|
/// 微游发布生成的项目路径
|
|
58
58
|
/// </summary>
|
|
59
59
|
public string MiniGameProj { get; set; }
|
|
60
|
+
|
|
61
|
+
/// <summary>
|
|
62
|
+
/// YandexGames发布生成的项目路径
|
|
63
|
+
/// </summary>
|
|
64
|
+
public string YandexGamesProj { get; set; }
|
|
60
65
|
}
|
|
61
66
|
}
|
package/Editor/PublishSetting.cs
CHANGED
|
@@ -65,9 +65,28 @@ namespace TyphoonUnitySDK
|
|
|
65
65
|
{ nameof(PublishSetting.KuaishouWebglGUIFoldout), DrawProperty_KuaiShouWebglGUIFoldout },
|
|
66
66
|
{ nameof(PublishSetting.MiniGameGUIFoldout), DrawProperty_MiniGameGUIFoldout },
|
|
67
67
|
{ nameof(PublishSetting.XiZhongYouGUIFoldout), DrawProperty_XiZhongYouGUIFoldout },
|
|
68
|
-
{ nameof(PublishSetting.HuaweiHarmonyGUIFoldout), DrawProperty_HuaweiHarmonyGUIFoldout }
|
|
68
|
+
{ nameof(PublishSetting.HuaweiHarmonyGUIFoldout), DrawProperty_HuaweiHarmonyGUIFoldout },
|
|
69
|
+
{ nameof(PublishSetting.YandexGamesGUIFoldout), DrawProperty_YandexGamesGUIFoldout }
|
|
69
70
|
};
|
|
70
71
|
|
|
72
|
+
private static bool DrawProperty_YandexGamesGUIFoldout(PublishSetting arg)
|
|
73
|
+
{
|
|
74
|
+
if (arg.Channel != AppChannel.YandexGames)
|
|
75
|
+
{
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
GUILayout.Space(10);
|
|
80
|
+
arg.YandexGamesGUIFoldout =
|
|
81
|
+
GUIDrawer.DrawFoldout("YandexGames", arg.YandexGamesGUIFoldout, GUILayout.Height(26));
|
|
82
|
+
if (arg.YandexGamesGUIFoldout)
|
|
83
|
+
{
|
|
84
|
+
YandexGamesConfigGUIDrawer.DrawGUI();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
|
|
71
90
|
private static bool DrawProperty_LightmapEncoding(PublishSetting setting)
|
|
72
91
|
{
|
|
73
92
|
if (setting.BuildTarget == BuildTarget.WebGL && setting.OverrideLightEncoding)
|
|
@@ -108,7 +127,7 @@ namespace TyphoonUnitySDK
|
|
|
108
127
|
|
|
109
128
|
GUILayout.Space(10);
|
|
110
129
|
arg.ChinaAndroidGUIFoldout =
|
|
111
|
-
GUIDrawer.DrawFoldout("
|
|
130
|
+
GUIDrawer.DrawFoldout("Android-China", arg.ChinaAndroidGUIFoldout, GUILayout.Height(26));
|
|
112
131
|
if (arg.ChinaAndroidGUIFoldout)
|
|
113
132
|
{
|
|
114
133
|
ChinaAndroidConfigGUIDrawer.DrawGUI();
|
package/Editor/PublishTool.cs
CHANGED
|
@@ -31,7 +31,8 @@ namespace TyphoonUnitySDK
|
|
|
31
31
|
{ PublishProcess.OppoMini, "TyphoonUnitySDK.PublishOppoMini" },
|
|
32
32
|
{ PublishProcess.MiniGame, "TyphoonUnitySDK.PublishMiniGame" },
|
|
33
33
|
{ PublishProcess.XiZhongYou, "TyphoonUnitySDK.PublishXiZhongYou" },
|
|
34
|
-
{ PublishProcess.HuaweiHarmony, "TyphoonUnitySDK.PublishHuaweiHarmony" }
|
|
34
|
+
{ PublishProcess.HuaweiHarmony, "TyphoonUnitySDK.PublishHuaweiHarmony" },
|
|
35
|
+
{ PublishProcess.YandexGames, "TyphoonUnitySDK.PublishYandexGames" },
|
|
35
36
|
};
|
|
36
37
|
|
|
37
38
|
/// <summary>
|
|
@@ -63,7 +64,7 @@ namespace TyphoonUnitySDK
|
|
|
63
64
|
Debug.LogError($"未关联发布流程:{setting.PublishProcess}");
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
Type publishClass = UniEditor.
|
|
67
|
+
Type publishClass = UniEditor.GetTypeOrDefault(className);
|
|
67
68
|
if (publishClass == null)
|
|
68
69
|
{
|
|
69
70
|
throw new Exception($"发布失败,找不到发布实现类:{className},检查是否未应用配置");
|
package/Editor/PublishWindow.cs
CHANGED
|
@@ -55,6 +55,8 @@ namespace TyphoonUnitySDK
|
|
|
55
55
|
return EditorIcons.icon_minigame;
|
|
56
56
|
case AppChannel.HuaweiHarmony:
|
|
57
57
|
return EditorIcons.icon_huawei;
|
|
58
|
+
case AppChannel.YandexGames:
|
|
59
|
+
return EditorIcons.icon_yandex_games;
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
return null;
|
|
@@ -116,10 +118,23 @@ namespace TyphoonUnitySDK
|
|
|
116
118
|
win.minSize = new Vector2(860, 640);
|
|
117
119
|
win.titleContent = new GUIContent("发布");
|
|
118
120
|
win.Show();
|
|
121
|
+
|
|
119
122
|
//自动检查新版本
|
|
120
123
|
UniEditor.AutoCheckNewVersion();
|
|
121
124
|
}
|
|
122
125
|
|
|
126
|
+
public static void Open(PublishSetting setting)
|
|
127
|
+
{
|
|
128
|
+
var win = GetWindow<PublishWindow>();
|
|
129
|
+
win.minSize = new Vector2(860, 640);
|
|
130
|
+
win.titleContent = new GUIContent("发布");
|
|
131
|
+
win.Show();
|
|
132
|
+
win._select = setting;
|
|
133
|
+
//自动检查新版本
|
|
134
|
+
UniEditor.AutoCheckNewVersion();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
123
138
|
private void OnEnable()
|
|
124
139
|
{
|
|
125
140
|
ReloadSettings();
|
|
Binary file
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: d98723f880d81d44dabc4bbfbf2d8189
|
|
3
|
+
TextureImporter:
|
|
4
|
+
internalIDToNameTable: []
|
|
5
|
+
externalObjects: {}
|
|
6
|
+
serializedVersion: 12
|
|
7
|
+
mipmaps:
|
|
8
|
+
mipMapMode: 0
|
|
9
|
+
enableMipMap: 1
|
|
10
|
+
sRGBTexture: 1
|
|
11
|
+
linearTexture: 0
|
|
12
|
+
fadeOut: 0
|
|
13
|
+
borderMipMap: 0
|
|
14
|
+
mipMapsPreserveCoverage: 0
|
|
15
|
+
alphaTestReferenceValue: 0.5
|
|
16
|
+
mipMapFadeDistanceStart: 1
|
|
17
|
+
mipMapFadeDistanceEnd: 3
|
|
18
|
+
bumpmap:
|
|
19
|
+
convertToNormalMap: 0
|
|
20
|
+
externalNormalMap: 0
|
|
21
|
+
heightScale: 0.25
|
|
22
|
+
normalMapFilter: 0
|
|
23
|
+
isReadable: 0
|
|
24
|
+
streamingMipmaps: 0
|
|
25
|
+
streamingMipmapsPriority: 0
|
|
26
|
+
vTOnly: 0
|
|
27
|
+
ignoreMasterTextureLimit: 0
|
|
28
|
+
grayScaleToAlpha: 0
|
|
29
|
+
generateCubemap: 6
|
|
30
|
+
cubemapConvolution: 0
|
|
31
|
+
seamlessCubemap: 0
|
|
32
|
+
textureFormat: 1
|
|
33
|
+
maxTextureSize: 2048
|
|
34
|
+
textureSettings:
|
|
35
|
+
serializedVersion: 2
|
|
36
|
+
filterMode: 1
|
|
37
|
+
aniso: 1
|
|
38
|
+
mipBias: 0
|
|
39
|
+
wrapU: 0
|
|
40
|
+
wrapV: 0
|
|
41
|
+
wrapW: 0
|
|
42
|
+
nPOTScale: 1
|
|
43
|
+
lightmap: 0
|
|
44
|
+
compressionQuality: 50
|
|
45
|
+
spriteMode: 0
|
|
46
|
+
spriteExtrude: 1
|
|
47
|
+
spriteMeshType: 1
|
|
48
|
+
alignment: 0
|
|
49
|
+
spritePivot: {x: 0.5, y: 0.5}
|
|
50
|
+
spritePixelsToUnits: 100
|
|
51
|
+
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
|
52
|
+
spriteGenerateFallbackPhysicsShape: 1
|
|
53
|
+
alphaUsage: 1
|
|
54
|
+
alphaIsTransparency: 1
|
|
55
|
+
spriteTessellationDetail: -1
|
|
56
|
+
textureType: 0
|
|
57
|
+
textureShape: 1
|
|
58
|
+
singleChannelComponent: 0
|
|
59
|
+
flipbookRows: 1
|
|
60
|
+
flipbookColumns: 1
|
|
61
|
+
maxTextureSizeSet: 0
|
|
62
|
+
compressionQualitySet: 0
|
|
63
|
+
textureFormatSet: 0
|
|
64
|
+
ignorePngGamma: 0
|
|
65
|
+
applyGammaDecoding: 0
|
|
66
|
+
cookieLightType: 0
|
|
67
|
+
platformSettings:
|
|
68
|
+
- serializedVersion: 3
|
|
69
|
+
buildTarget: DefaultTexturePlatform
|
|
70
|
+
maxTextureSize: 2048
|
|
71
|
+
resizeAlgorithm: 0
|
|
72
|
+
textureFormat: -1
|
|
73
|
+
textureCompression: 1
|
|
74
|
+
compressionQuality: 50
|
|
75
|
+
crunchedCompression: 0
|
|
76
|
+
allowsAlphaSplitting: 0
|
|
77
|
+
overridden: 0
|
|
78
|
+
androidETC2FallbackOverride: 0
|
|
79
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
80
|
+
- serializedVersion: 3
|
|
81
|
+
buildTarget: Standalone
|
|
82
|
+
maxTextureSize: 2048
|
|
83
|
+
resizeAlgorithm: 0
|
|
84
|
+
textureFormat: -1
|
|
85
|
+
textureCompression: 1
|
|
86
|
+
compressionQuality: 50
|
|
87
|
+
crunchedCompression: 0
|
|
88
|
+
allowsAlphaSplitting: 0
|
|
89
|
+
overridden: 0
|
|
90
|
+
androidETC2FallbackOverride: 0
|
|
91
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
92
|
+
- serializedVersion: 3
|
|
93
|
+
buildTarget: iPhone
|
|
94
|
+
maxTextureSize: 2048
|
|
95
|
+
resizeAlgorithm: 0
|
|
96
|
+
textureFormat: -1
|
|
97
|
+
textureCompression: 1
|
|
98
|
+
compressionQuality: 50
|
|
99
|
+
crunchedCompression: 0
|
|
100
|
+
allowsAlphaSplitting: 0
|
|
101
|
+
overridden: 0
|
|
102
|
+
androidETC2FallbackOverride: 0
|
|
103
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
104
|
+
- serializedVersion: 3
|
|
105
|
+
buildTarget: WebGL
|
|
106
|
+
maxTextureSize: 2048
|
|
107
|
+
resizeAlgorithm: 0
|
|
108
|
+
textureFormat: -1
|
|
109
|
+
textureCompression: 1
|
|
110
|
+
compressionQuality: 50
|
|
111
|
+
crunchedCompression: 0
|
|
112
|
+
allowsAlphaSplitting: 0
|
|
113
|
+
overridden: 0
|
|
114
|
+
androidETC2FallbackOverride: 0
|
|
115
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
116
|
+
- serializedVersion: 3
|
|
117
|
+
buildTarget: Android
|
|
118
|
+
maxTextureSize: 2048
|
|
119
|
+
resizeAlgorithm: 0
|
|
120
|
+
textureFormat: -1
|
|
121
|
+
textureCompression: 1
|
|
122
|
+
compressionQuality: 50
|
|
123
|
+
crunchedCompression: 0
|
|
124
|
+
allowsAlphaSplitting: 0
|
|
125
|
+
overridden: 0
|
|
126
|
+
androidETC2FallbackOverride: 0
|
|
127
|
+
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
128
|
+
spriteSheet:
|
|
129
|
+
serializedVersion: 2
|
|
130
|
+
sprites: []
|
|
131
|
+
outline: []
|
|
132
|
+
physicsShape: []
|
|
133
|
+
bones: []
|
|
134
|
+
spriteID:
|
|
135
|
+
internalID: 0
|
|
136
|
+
vertices: []
|
|
137
|
+
indices:
|
|
138
|
+
edges: []
|
|
139
|
+
weights: []
|
|
140
|
+
secondaryTextures: []
|
|
141
|
+
nameFileIdTable: {}
|
|
142
|
+
spritePackingTag:
|
|
143
|
+
pSDRemoveMatte: 0
|
|
144
|
+
pSDShowRemoveMatteOption: 0
|
|
145
|
+
userData:
|
|
146
|
+
assetBundleName:
|
|
147
|
+
assetBundleVariant:
|
package/Editor/UniEditor.cs
CHANGED
|
@@ -5,6 +5,7 @@ using System.Globalization;
|
|
|
5
5
|
using System.IO;
|
|
6
6
|
using System.Linq;
|
|
7
7
|
using System.Net.Http;
|
|
8
|
+
using System.Reflection;
|
|
8
9
|
using System.Text;
|
|
9
10
|
using System.Text.RegularExpressions;
|
|
10
11
|
using System.Threading.Tasks;
|
|
@@ -91,6 +92,11 @@ namespace TyphoonUnitySDK
|
|
|
91
92
|
/// </summary>
|
|
92
93
|
public static string PackagePath_HuaweiHarmony = $"{PathRoot}/Sources~/Package/HuaweiHarmony.unitypackage";
|
|
93
94
|
|
|
95
|
+
/// <summary>
|
|
96
|
+
/// YandexGames 资源包
|
|
97
|
+
/// </summary>
|
|
98
|
+
public static string PackagePath_YandexGames = $"{PathRoot}/Sources~/Package/YandexGames.unitypackage";
|
|
99
|
+
|
|
94
100
|
|
|
95
101
|
/// <summary>
|
|
96
102
|
/// Toast模块
|
|
@@ -175,18 +181,34 @@ namespace TyphoonUnitySDK
|
|
|
175
181
|
return;
|
|
176
182
|
}
|
|
177
183
|
|
|
178
|
-
|
|
184
|
+
ClearScriptingDefineSymbol(currentTarget, removes);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/// <summary>
|
|
188
|
+
/// 添加宏定义
|
|
189
|
+
/// </summary>
|
|
190
|
+
public static void AppendScriptingDefineSymbol(params string[] append)
|
|
191
|
+
{
|
|
192
|
+
var currentTarget = EditorUserBuildSettings.selectedBuildTargetGroup;
|
|
193
|
+
if (currentTarget == BuildTargetGroup.Unknown)
|
|
194
|
+
{
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
AppendScriptingDefineSymbol(currentTarget, append);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/// <summary>
|
|
202
|
+
/// 添加宏定义
|
|
203
|
+
/// </summary>
|
|
204
|
+
public static void AppendScriptingDefineSymbol(BuildTargetGroup targetGroup, params string[] append)
|
|
205
|
+
{
|
|
206
|
+
var definesString = PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup).Trim();
|
|
179
207
|
var defines = definesString.Split(';');
|
|
180
208
|
bool changed = false;
|
|
181
|
-
|
|
182
|
-
foreach (var define in removes)
|
|
209
|
+
foreach (var define in append)
|
|
183
210
|
{
|
|
184
|
-
if (defines.Contains(define))
|
|
185
|
-
{
|
|
186
|
-
changed = true;
|
|
187
|
-
continue;
|
|
188
|
-
}
|
|
189
|
-
else
|
|
211
|
+
if (defines.Contains(define) == false)
|
|
190
212
|
{
|
|
191
213
|
if (definesString.EndsWith(";", StringComparison.InvariantCulture) == false)
|
|
192
214
|
{
|
|
@@ -194,36 +216,37 @@ namespace TyphoonUnitySDK
|
|
|
194
216
|
}
|
|
195
217
|
|
|
196
218
|
definesString += define;
|
|
219
|
+
changed = true;
|
|
197
220
|
}
|
|
198
221
|
}
|
|
199
222
|
|
|
200
223
|
if (changed)
|
|
201
224
|
{
|
|
202
|
-
PlayerSettings.SetScriptingDefineSymbolsForGroup(
|
|
203
|
-
foreach (var element in
|
|
225
|
+
PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, definesString);
|
|
226
|
+
foreach (var element in append)
|
|
204
227
|
{
|
|
205
|
-
Debug.Log($"<color=#{SdkDebug.BlueHex}
|
|
228
|
+
Debug.Log($"<color=#{SdkDebug.BlueHex}>添加宏定义:{element}</color>");
|
|
206
229
|
}
|
|
207
230
|
}
|
|
208
231
|
}
|
|
209
232
|
|
|
210
233
|
/// <summary>
|
|
211
|
-
///
|
|
234
|
+
/// 清理宏定义
|
|
212
235
|
/// </summary>
|
|
213
|
-
public static void
|
|
236
|
+
public static void ClearScriptingDefineSymbol(BuildTargetGroup targetGroup, params string[] removes)
|
|
214
237
|
{
|
|
215
|
-
var
|
|
216
|
-
if (currentTarget == BuildTargetGroup.Unknown)
|
|
217
|
-
{
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
var definesString = PlayerSettings.GetScriptingDefineSymbolsForGroup(currentTarget).Trim();
|
|
238
|
+
var definesString = PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup).Trim();
|
|
222
239
|
var defines = definesString.Split(';');
|
|
223
240
|
bool changed = false;
|
|
224
|
-
|
|
241
|
+
definesString = string.Empty;
|
|
242
|
+
foreach (var define in removes)
|
|
225
243
|
{
|
|
226
|
-
if (defines.Contains(define)
|
|
244
|
+
if (defines.Contains(define))
|
|
245
|
+
{
|
|
246
|
+
changed = true;
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
else
|
|
227
250
|
{
|
|
228
251
|
if (definesString.EndsWith(";", StringComparison.InvariantCulture) == false)
|
|
229
252
|
{
|
|
@@ -231,24 +254,24 @@ namespace TyphoonUnitySDK
|
|
|
231
254
|
}
|
|
232
255
|
|
|
233
256
|
definesString += define;
|
|
234
|
-
changed = true;
|
|
235
257
|
}
|
|
236
258
|
}
|
|
237
259
|
|
|
238
260
|
if (changed)
|
|
239
261
|
{
|
|
240
|
-
PlayerSettings.SetScriptingDefineSymbolsForGroup(
|
|
241
|
-
foreach (var element in
|
|
262
|
+
PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, definesString);
|
|
263
|
+
foreach (var element in removes)
|
|
242
264
|
{
|
|
243
|
-
Debug.Log($"<color=#{SdkDebug.BlueHex}
|
|
265
|
+
Debug.Log($"<color=#{SdkDebug.BlueHex}>移除宏定义:{element}</color>");
|
|
244
266
|
}
|
|
245
267
|
}
|
|
246
268
|
}
|
|
247
269
|
|
|
270
|
+
|
|
248
271
|
/// <summary>
|
|
249
272
|
/// 反射获取类型
|
|
250
273
|
/// </summary>
|
|
251
|
-
public static Type
|
|
274
|
+
public static Type GetTypeOrDefault(string typeName)
|
|
252
275
|
{
|
|
253
276
|
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
|
254
277
|
foreach (var element in assemblies)
|
|
@@ -263,6 +286,22 @@ namespace TyphoonUnitySDK
|
|
|
263
286
|
return null;
|
|
264
287
|
}
|
|
265
288
|
|
|
289
|
+
public static Type GetType(string fullName)
|
|
290
|
+
{
|
|
291
|
+
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
|
292
|
+
foreach (var assembly in assemblies)
|
|
293
|
+
{
|
|
294
|
+
var type = assembly.GetType(fullName);
|
|
295
|
+
if (type != null)
|
|
296
|
+
{
|
|
297
|
+
return type;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
throw new Exception($"找不到 type :{fullName}");
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
|
|
266
305
|
/// <summary>
|
|
267
306
|
/// 反射获取子类类型
|
|
268
307
|
/// </summary>
|
|
@@ -1197,5 +1236,26 @@ namespace TyphoonUnitySDK
|
|
|
1197
1236
|
// 打开 Preferences 窗口并定位到 External Tools 页面
|
|
1198
1237
|
SettingsService.OpenUserPreferences("Preferences/External Tools");
|
|
1199
1238
|
}
|
|
1239
|
+
|
|
1240
|
+
public static MethodInfo GetMethod(Type type, string methodName, BindingFlags bindingFlags)
|
|
1241
|
+
{
|
|
1242
|
+
if (type == null)
|
|
1243
|
+
{
|
|
1244
|
+
throw new ArgumentNullException(nameof(type));
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
if (string.IsNullOrEmpty(methodName))
|
|
1248
|
+
{
|
|
1249
|
+
throw new ArgumentNullException(nameof(methodName));
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
MethodInfo methodInfo = type.GetMethod(methodName, bindingFlags);
|
|
1253
|
+
if (methodInfo == null)
|
|
1254
|
+
{
|
|
1255
|
+
throw new InvalidOperationException($"Method '{methodName}' not found in type '{type.FullName}'.");
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
return methodInfo;
|
|
1259
|
+
}
|
|
1200
1260
|
}
|
|
1201
1261
|
}
|