com.typhoon.unitysdk 1.1.4 → 1.1.5

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/Editor/ApplyTool.cs +44 -6
  3. package/Editor/CheckPayCallBack/CheckCallBackScript.cs +24 -0
  4. package/Editor/CheckPayCallBack/CheckCallBackScript.cs.meta +11 -0
  5. package/Editor/CheckPayCallBack/OnPayCallBack.template +26 -0
  6. package/Editor/CheckPayCallBack/OnPayCallBack.template.meta +7 -0
  7. package/Editor/CheckPayCallBack.meta +8 -0
  8. package/Editor/EditorIcons.cs +4 -0
  9. package/Editor/EditorKit.cs.meta +11 -11
  10. package/Editor/ExportModule.cs +21 -3
  11. package/Editor/KuaiShouWebglConfig.cs.meta +11 -11
  12. package/Editor/LightmapEncoding.cs.meta +11 -11
  13. package/Editor/MiniGameWebglConfig.cs +172 -0
  14. package/Editor/MiniGameWebglConfig.cs.meta +11 -0
  15. package/Editor/PublishProcess.cs +1 -0
  16. package/Editor/PublishSetting.cs +32 -4
  17. package/Editor/PublishSettingGUIDrawer.cs +92 -7
  18. package/Editor/PublishTool.cs +1 -0
  19. package/Editor/PublishWindow.cs +2 -0
  20. package/Editor/SdkTestInUnityWindow.cs +2 -1
  21. package/Editor/Texture/icon_kuaishou.png.meta +166 -166
  22. package/Editor/Texture/icon_minigame.png +0 -0
  23. package/Editor/Texture/icon_minigame.png.meta +145 -0
  24. package/Editor/UniEditor.cs +7 -10
  25. package/Runtime/AppChannel.cs +4 -0
  26. package/Runtime/BaseSdk.cs +67 -1
  27. package/Runtime/Extension.cs +0 -2
  28. package/Runtime/IapProductType.cs +8 -0
  29. package/Runtime/IapProductType.cs.meta +11 -0
  30. package/Runtime/Interface.cs +36 -2
  31. package/Runtime/LabelOverride.cs +20 -4
  32. package/Runtime/PayCallBackExtraInfo.cs +12 -0
  33. package/Runtime/PayCallBackExtraInfo.cs.meta +11 -0
  34. package/Runtime/PayCallBackResult.cs +19 -0
  35. package/Runtime/PayCallBackResult.cs.meta +11 -0
  36. package/Runtime/RequestProductInfoResult.cs +37 -0
  37. package/Runtime/RequestProductInfoResult.cs.meta +11 -0
  38. package/Runtime/SdkDebug.cs +1 -1
  39. package/Runtime/SdkLite.cs +61 -17
  40. package/Runtime/SdkTestInUnity.cs +72 -12
  41. package/Runtime/SimulateOnShow.cs +5 -0
  42. package/Runtime/TyphoonSdkCallback.cs +29 -18
  43. package/Sources~/Package/ChinaAndroid.unitypackage +0 -0
  44. package/Sources~/Package/GooglePlay.unitypackage +0 -0
  45. package/Sources~/Package/MiniGame.unitypackage +0 -0
  46. package/Sources~/Package/MiniGame.unitypackage.manifest +40 -0
  47. package/Sources~/Package//345/270/270/347/224/250/346/211/223/345/214/205/351/205/215/347/275/256.unitypackage +0 -0
  48. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,7 +1,13 @@
1
1
  # 更新日志
2
+ ## [1.1.5] - 2025-08-05
3
+
4
+ ### 新增
5
+ * 新增微游渠道
6
+
7
+
2
8
  ## [1.1.4] - 2024-12-06
3
9
 
4
- ### 修复
10
+ ### 修复
5
11
  * unity 测试适配广告不传参数时报错
6
12
 
7
13
 
@@ -32,6 +32,7 @@ namespace TyphoonUnitySDK
32
32
  { AppChannel.VivoMini, new ApplyVivoMini() },
33
33
  { AppChannel.OppoMini, new ApplyOppoMini() },
34
34
  { AppChannel.KuaiShouWebgl, new ApplyKuaiShouWebgl() },
35
+ { AppChannel.MiniGame, new ApplyMiniGame() },
35
36
  };
36
37
 
37
38
 
@@ -60,6 +61,8 @@ namespace TyphoonUnitySDK
60
61
  VariablePreset.Default.Save();
61
62
  OppoMiniConfig.Default.Save();
62
63
  ChinaAndroidConfig.Default.Save();
64
+ KuaiShouWebglConfig.Default.Save();
65
+ MiniGameWebglConfig.Default.Save();
63
66
  }
64
67
 
65
68
  /// <summary>
@@ -121,7 +124,6 @@ namespace TyphoonUnitySDK
121
124
  PlayerSettings.SetScriptingBackend(BuildTargetGroup.Android, setting.ScriptingImplementation);
122
125
  PlayerSettings.stripEngineCode = setting.StripEngineCode;
123
126
  PlayerSettings.SetManagedStrippingLevel(BuildTargetGroup.Android, setting.StrippingLevel);
124
-
125
127
  if (!string.IsNullOrWhiteSpace(setting.PackageName))
126
128
  {
127
129
  PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, setting.PackageName);
@@ -142,7 +144,6 @@ namespace TyphoonUnitySDK
142
144
  PlayerSettings.Android.keyaliasName = setting.KeyAliasName;
143
145
  PlayerSettings.Android.keyaliasPass = setting.KeyAliasPassword;
144
146
  #endif
145
-
146
147
  PlayerSettings.Android.targetArchitectures = 0;
147
148
  if (setting.ArmV7)
148
149
  {
@@ -162,7 +163,6 @@ namespace TyphoonUnitySDK
162
163
  PlayerSettings.Android.minSdkVersion = setting.MinApiVersion;
163
164
  PlayerSettings.Android.targetSdkVersion = setting.TargetApiVersion;
164
165
 
165
-
166
166
  //覆写GraphicsAPI
167
167
  if (setting.GraphicsAPIs.Length > 0)
168
168
  {
@@ -209,9 +209,9 @@ namespace TyphoonUnitySDK
209
209
  if (setting.OverrideWebglCompressionFormat)
210
210
  {
211
211
  PlayerSettings.WebGL.compressionFormat = setting.CompressionFormat;
212
+ PlayerSettings.WebGL.decompressionFallback = setting.DecompressionFallback;
212
213
  }
213
214
 
214
-
215
215
  if (setting.OverrideWebglTemplate)
216
216
  {
217
217
  switch (setting.WebglTemplate)
@@ -222,6 +222,10 @@ namespace TyphoonUnitySDK
222
222
  case WebGlTemplate.Minimal:
223
223
  PlayerSettings.WebGL.template = "APPLICATION:Minimal";
224
224
  break;
225
+ case WebGlTemplate.MiniGame:
226
+ PlayerSettings.WebGL.template = "MiniGame";
227
+ AssetDatabase.ImportAsset("Assets/WebGLTemplates/MiniGame", ImportAssetOptions.ForceUpdate);
228
+ break;
225
229
  }
226
230
  }
227
231
 
@@ -230,16 +234,27 @@ namespace TyphoonUnitySDK
230
234
  SetWebGLLightmapEncoding(BuildTargetGroup.WebGL, setting.LightmapEncoding);
231
235
  }
232
236
 
237
+ if (setting.CanEditWebglCanvasSize())
238
+ {
239
+ PlayerSettings.defaultWebScreenWidth = setting.WebGLCanvasWidth;
240
+ PlayerSettings.defaultWebScreenHeight = setting.WebGLCanvasHeight;
241
+ }
242
+
233
243
  PlayerSettings.WebGL.exceptionSupport = setting.ExceptionSupport;
234
244
  PlayerSettings.WebGL.debugSymbols = setting.WebglDebugSymbols;
235
245
  PlayerSettings.WebGL.dataCaching = setting.WebglDataCaching;
246
+
236
247
  // PlayerSettings.lightmapEncoding = LightmapEncodingQuality.Normal;
237
248
 
238
249
  //覆写AA参数
239
250
  AddressableSupport.ModifyAAProfileAndVariables(setting);
240
251
  //写入App config
241
252
  WriteAppConfig(setting);
253
+ AssetDatabase.Refresh();
254
+ AssetDatabase.SaveAssets();
255
+ EditorApplication.ExecuteMenuItem("File/Save Project");
242
256
  // Debug.Log($"<color=#3ac9f3>//TODO//导入资源包...</color>");
257
+ Debug.Log("Current WebGL Template: " + PlayerSettings.WebGL.template);
243
258
  }
244
259
 
245
260
  /// <summary>
@@ -275,7 +290,6 @@ namespace TyphoonUnitySDK
275
290
  return EditorUserBuildSettings.SwitchActiveBuildTargetAsync(BuildTargetGroup.WebGL,
276
291
  buildTarget);
277
292
  }
278
-
279
293
  default:
280
294
  throw new Exception($"未处理的类型:{buildTarget}");
281
295
  }
@@ -300,7 +314,6 @@ namespace TyphoonUnitySDK
300
314
  AppConfigAsset.Instance.DouyinVideoId = DouyinConfig.Default.VideoId;
301
315
  AppConfigAsset.Instance.DouyinIntersId = DouyinConfig.Default.IntersId;
302
316
  AppConfigAsset.Instance.DouyinBannerId = DouyinConfig.Default.BannerId;
303
-
304
317
  EditorUtility.SetDirty(AppConfigAsset.Instance);
305
318
  AssetDatabase.SaveAssets();
306
319
  }
@@ -655,6 +668,7 @@ namespace TyphoonUnitySDK
655
668
  }
656
669
 
657
670
 
671
+ /*kuai shou*/
658
672
  public class ApplyKuaiShouWebgl : IApply
659
673
  {
660
674
  public void Apply(PublishSetting setting)
@@ -681,5 +695,29 @@ namespace TyphoonUnitySDK
681
695
  AssetDatabase.SaveAssets();
682
696
  }
683
697
  }
698
+
699
+ /*mini game*/
700
+ public class ApplyMiniGame : IApply
701
+ {
702
+ public void Apply(PublishSetting setting)
703
+ {
704
+ var pack = UniEditor.PackagePath_MiniGame;
705
+ Debug.Log($"导入... {pack}");
706
+ ImportUnityPackage(pack);
707
+ var manifest_path = $"{pack}.manifest";
708
+ Debug.Log($"读取资源清单...{manifest_path}");
709
+ var manifest = ReadManifest(manifest_path);
710
+ Debug.Log($"清理多余文件...");
711
+ foreach (var folder in MaybeFolder)
712
+ {
713
+ ClearFilesInDirectory(folder, manifest);
714
+ }
715
+
716
+ ReimportScript(manifest);
717
+ AssetDatabase.Refresh();
718
+ EditorUtility.SetDirty(AppConfigAsset.Instance);
719
+ AssetDatabase.SaveAssets();
720
+ }
721
+ }
684
722
  }
685
723
  }
@@ -0,0 +1,24 @@
1
+ using System.IO;
2
+ using UnityEditor;
3
+ using UnityEngine;
4
+
5
+ namespace TyphoonUnitySDK
6
+ {
7
+ public static class CheckCallBackScript
8
+ {
9
+ private const string TEMPLATE_PAY_CALL_BACK_FILE =
10
+ "Assets/com.typhoon.unitysdk/Editor/CheckPayCallBack/OnPayCallBack.template";
11
+
12
+ [InitializeOnLoadMethod]
13
+ public static void OnInitialize()
14
+ {
15
+ var path = "Assets/Typhoon_Gen/TyphoonSDK/OnPayCallback.cs";
16
+ if (!File.Exists(path))
17
+ {
18
+ File.Copy(TEMPLATE_PAY_CALL_BACK_FILE, path, true);
19
+ Debug.Log($"生成 {path}");
20
+ AssetDatabase.Refresh();
21
+ }
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 9cb71c4b3ec12b044a70dcc2a94bf845
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,26 @@
1
+ using System.Collections;
2
+ using System.Collections.Generic;
3
+ using UnityEngine;
4
+ using UnityEngine.Scripting;
5
+ namespace TyphoonUnitySDK
6
+ {
7
+ [Preserve]
8
+ public class OnPayCallBack : IOnPayCallback
9
+ {
10
+ /// <summary>
11
+ /// 支付回调
12
+ /// </summary>
13
+ /// <param name="product">商品id</param>
14
+ /// <param name="state">true=支付成功,可发货</param>
15
+ /// <param name="extraInfo">拓展信息</param>
16
+ public void OnPayCallback(string product, bool state, PayCallBackExtraInfo extraInfo)
17
+ {
18
+ if (!state)
19
+ {
20
+ //支付失败无法进行发货
21
+ return;
22
+ }
23
+ //TODO//支付成功,进行发货,商品ID=product
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: a26c177baedbd39439d3c138293a1489
3
+ DefaultImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 8071b310b4ebd4f428b10234720da11c
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -76,6 +76,10 @@ namespace TyphoonUnitySDK
76
76
  public static Texture icon_kuaishou =>
77
77
  __icon_kuaishou
78
78
  ?? AssetDatabase.LoadAssetAtPath<Texture>($"{FolderPath}/icon_kuaishou.png");
79
+ private static Texture __icon_minigame = null;
80
+ public static Texture icon_minigame =>
81
+ __icon_minigame
82
+ ?? AssetDatabase.LoadAssetAtPath<Texture>($"{FolderPath}/icon_minigame.png");
79
83
  private static Texture __icon_oppo = null;
80
84
  public static Texture icon_oppo =>
81
85
  __icon_oppo ?? AssetDatabase.LoadAssetAtPath<Texture>($"{FolderPath}/icon_oppo.png");
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: 5945480f0f58ae842a093a2536428362
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: 5945480f0f58ae842a093a2536428362
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -24,7 +24,6 @@ namespace TyphoonUnitySDK
24
24
  "Assets/Plugins/Android/AndroidManifest.xml",
25
25
  "Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid",
26
26
  };
27
-
28
27
  if (!MakeSureExport(manifest))
29
28
  {
30
29
  return;
@@ -171,6 +170,27 @@ namespace TyphoonUnitySDK
171
170
  ExportUnityPackage(manifest, UniEditor.PackagePath_KuaiShouWebgl, out var detail);
172
171
  }
173
172
 
173
+ [MenuItem("TyphoonSDK/开发者/导出-MiniGame.unitypackage")]
174
+ public static void ExporMiniGame()
175
+ {
176
+ var manifest = new List<string>()
177
+ {
178
+ "Assets/Typhoon_Gen/TyphoonSDK/Runtime/MiniGame",
179
+ "Assets/WebGLTemplates",
180
+ };
181
+ if (!MakeSureExport(manifest))
182
+ {
183
+ return;
184
+ }
185
+
186
+ if (!CheckMissFiles(manifest))
187
+ {
188
+ return;
189
+ }
190
+
191
+ ExportUnityPackage(manifest, UniEditor.PackagePath_MiniGame, out var detail);
192
+ }
193
+
174
194
 
175
195
  /// <summary>
176
196
  /// 导出清单文件到模块
@@ -313,7 +333,6 @@ namespace TyphoonUnitySDK
313
333
  $".typhoonbackup/{Path.GetFileNameWithoutExtension(path)}-{DateTime.Now.ToString("yyyyMMddHHmmss")}{Path.GetExtension(path)}";
314
334
  var dir = Path.GetDirectoryName(backup);
315
335
  UniEditor.CreateDirIfNotExist(dir);
316
-
317
336
  if (File.Exists(path))
318
337
  {
319
338
  Debug.Log($"备份:{path}-->{backup}");
@@ -389,7 +408,6 @@ namespace TyphoonUnitySDK
389
408
  }
390
409
  }
391
410
 
392
-
393
411
  var backup =
394
412
  $".typhoonbackup/{Path.GetFileNameWithoutExtension(savePath)}-{DateTime.Now.ToString("yyyyMMddHHmmss")}{Path.GetExtension(savePath)}";
395
413
  var manifestPath = $"{savePath}.manifest";
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: 8a6c0147c4cb1dc4db7b7e244cd740aa
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: 8a6c0147c4cb1dc4db7b7e244cd740aa
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: f5dd898cf3a800f409e7b9f04c0368fc
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: f5dd898cf3a800f409e7b9f04c0368fc
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,172 @@
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 static class MiniGameWebglConfigGUIDrawer
12
+ {
13
+ public static Dictionary<string, Func<MiniGameWebglConfig, bool>> OverrideDrawGUIConfig =
14
+ new Dictionary<string, Func<MiniGameWebglConfig, bool>>()
15
+ {
16
+ { "m_Script", DrawProperty_m_Script },
17
+ { nameof(MiniGameWebglConfig.VersionName), DrawProperty_VersionName },
18
+ { nameof(MiniGameWebglConfig.VersionCode), DrawProperty_VersionCode },
19
+ };
20
+
21
+
22
+ // private static bool DrawProperty_CDN(MiniGameWebglConfig arg)
23
+ // {
24
+ // GUILayout.Space(10);
25
+ // GUILayout.BeginHorizontal();
26
+ // arg.CDN = EditorGUILayout.TextField("CDN地址 (后台配白名单)", arg.CDN);
27
+ // GUILayout.EndHorizontal();
28
+ // GUIDrawer.DrawKeynotes("支持与自定义变量,版本号拼接,填入'[版本号]'或'[变量名]'使用");
29
+ // GUIDrawer.DrawKeynotes($"最终地址:{arg.GetFinalCDN()}");
30
+ // return true;
31
+ // }
32
+
33
+ // private static bool DrawProperty_AppId(MiniGameWebglConfig arg)
34
+ // {
35
+ // arg.AppId = EditorGUILayout.TextField("appid (问运营)", arg.AppId);
36
+ // return true;
37
+ // }
38
+
39
+ private static bool DrawProperty_m_Script(MiniGameWebglConfig arg)
40
+ {
41
+ var tmpEnable = GUI.enabled;
42
+ GUI.enabled = true;
43
+ GUILayout.Space(6);
44
+ GUIDrawer.DrawKeynotes("①支持Unity版本:2021.3.x,2021.3.40f(推荐,支持ASTC压缩,坑最少)");
45
+ GUIDrawer.DrawKeynotes("②webgl不支持多线程,修改代码进行适配");
46
+ GUIDrawer.DrawKeynotes("③若打包出错,手动设置PlayerSettings下webgl模板设置为Default,非Minimal");
47
+ GUILayout.Space(6);
48
+ GUI.enabled = tmpEnable;
49
+ return true;
50
+ }
51
+
52
+ private static bool DrawProperty_VersionName(MiniGameWebglConfig arg)
53
+ {
54
+ GUILayout.Space(10);
55
+ GUILayout.Label("版本信息", Styles.BoldLabel);
56
+ arg.VersionName = EditorGUILayout.TextField("版本名", arg.VersionName);
57
+ return true;
58
+ }
59
+
60
+ private static bool DrawProperty_VersionCode(MiniGameWebglConfig arg)
61
+ {
62
+ arg.VersionCode = EditorGUILayout.IntField("版本号", arg.VersionCode);
63
+ GUILayout.Label("", GUILayout.Height(24));
64
+ var last = GUILayoutUtility.GetLastRect();
65
+ var rectBtn = last;
66
+ rectBtn.width = 120;
67
+ rectBtn.y += 2;
68
+ rectBtn.x = last.xMax - rectBtn.width;
69
+ rectBtn.x -= 2;
70
+ if (GUI.Button(rectBtn, "自动版本号", Styles.Square.BtnBlue))
71
+ {
72
+ arg.VersionCode += 1;
73
+ try
74
+ {
75
+ var elements = arg.VersionName.Split('.').ToList();
76
+ var num = int.Parse(elements.Last());
77
+ num += 1;
78
+ elements[elements.Count - 1] = num.ToString();
79
+ var versionName = new StringBuilder();
80
+ for (var i = 0; i < elements.Count; i++)
81
+ {
82
+ var e = elements[i];
83
+ versionName.Append(e);
84
+ if (i != elements.Count - 1)
85
+ {
86
+ versionName.Append(".");
87
+ }
88
+ }
89
+
90
+ arg.VersionName = versionName.ToString();
91
+ }
92
+ catch (Exception e)
93
+ {
94
+ arg.VersionName = "0.0.1";
95
+ }
96
+
97
+ GUI.FocusControl("");
98
+ }
99
+
100
+ return true;
101
+ }
102
+
103
+ public static void DrawGUI()
104
+ {
105
+ var config = MiniGameWebglConfig.Default;
106
+ GUIDrawer.DrawProperty(config, (property) =>
107
+ {
108
+ if (OverrideDrawGUIConfig.TryGetValue(property, out var match))
109
+ {
110
+ return match.Invoke(config);
111
+ }
112
+
113
+ return false;
114
+ });
115
+ }
116
+ }
117
+
118
+ public class MiniGameWebglConfig : ScriptableObject, ISaveConfigPipeline
119
+ {
120
+ private static string ConfigPath = "Assets/Typhoon_Gen/TyphoonSDK/Editor/MinigameWebglConfig.asset";
121
+
122
+ private static MiniGameWebglConfig _instance = null;
123
+
124
+ public static MiniGameWebglConfig Default
125
+ {
126
+ get
127
+ {
128
+ if (_instance == null)
129
+ {
130
+ _instance = AssetDatabase.LoadAssetAtPath<MiniGameWebglConfig>(ConfigPath);
131
+ }
132
+
133
+ if (_instance == null)
134
+ {
135
+ _instance = CreateInstance<MiniGameWebglConfig>();
136
+ var folder = Path.GetDirectoryName(ConfigPath);
137
+ if (!Directory.Exists(folder))
138
+ {
139
+ Directory.CreateDirectory(folder);
140
+ AssetDatabase.Refresh();
141
+ }
142
+
143
+ AssetDatabase.CreateAsset(_instance, ConfigPath);
144
+ }
145
+
146
+ return _instance;
147
+ }
148
+ }
149
+
150
+
151
+ public string VersionName = "0.0.1"; //版本名
152
+ public int VersionCode = 1; //版本号
153
+
154
+
155
+ // public string GetFinalCDN()
156
+ // {
157
+ // var result = CDN.Replace("[版本号]", VersionCode.ToString());
158
+ // return VariablePreset.Default.ParserToString(result);
159
+ // }
160
+
161
+ public void SaveConfig()
162
+ {
163
+ Save();
164
+ }
165
+
166
+ public void Save()
167
+ {
168
+ EditorUtility.SetDirty(this);
169
+ AssetDatabase.SaveAssets();
170
+ }
171
+ }
172
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 48bccf40f6fa38148b22ac7ef01bf661
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -16,5 +16,6 @@ namespace TyphoonUnitySDK
16
16
  VivoMini, //vivo小游戏
17
17
  OppoMini, //oppo小游戏
18
18
  KuaiShouWebgl, //快手WEBGL
19
+ MiniGame, //微游
19
20
  }
20
21
  }
@@ -30,6 +30,7 @@ namespace TyphoonUnitySDK
30
30
  {
31
31
  Default,
32
32
  Minimal,
33
+ MiniGame,
33
34
  }
34
35
 
35
36
 
@@ -39,7 +40,8 @@ namespace TyphoonUnitySDK
39
40
  [CreateAssetMenu]
40
41
  public class PublishSetting : ScriptableObject
41
42
  {
42
- [Header("基础")] public BuildTarget BuildTarget;
43
+ [Header("基础")]
44
+ public BuildTarget BuildTarget;
43
45
 
44
46
  public GraphicsDeviceType[] GraphicsAPIs;
45
47
  public ScriptingImplementation ScriptingImplementation = ScriptingImplementation.IL2CPP;
@@ -59,23 +61,27 @@ namespace TyphoonUnitySDK
59
61
  public bool ArmV64 = true;
60
62
 
61
63
 
62
- [Header("渠道包名信息")] public AppChannel Channel = AppChannel.Test;
64
+ [Header("渠道包名信息")]
65
+ public AppChannel Channel = AppChannel.Test;
63
66
  public PublishProcess PublishProcess = PublishProcess.Apk;
64
67
  public string PackageName = "com.rgame.app";
65
68
  public string VersionString = "1.0.0";
66
69
  public VersionType VersionType = VersionType.Release;
67
70
 
68
71
 
69
- [Header("签名")] public bool EnableSignature = false;
72
+ [Header("签名")]
73
+ public bool EnableSignature = false;
70
74
  public string KeystoreName;
71
75
  public string KeystorePassword;
72
76
  public string KeyAliasName;
73
77
  public string KeyAliasPassword;
74
78
 
75
- [Header("Webgl")] public bool OverrideWebglTemplate = false;
79
+ [Header("Webgl")]
80
+ public bool OverrideWebglTemplate = false;
76
81
  public WebGlTemplate WebglTemplate = WebGlTemplate.Minimal;
77
82
  public bool OverrideWebglCompressionFormat = false;
78
83
  public WebGLCompressionFormat CompressionFormat = WebGLCompressionFormat.Disabled;
84
+ public bool DecompressionFallback = false;
79
85
  public WebGLExceptionSupport ExceptionSupport = WebGLExceptionSupport.FullWithoutStacktrace;
80
86
  public bool WebglDataCaching = true;
81
87
  public bool WebglDebugSymbols = false;
@@ -98,6 +104,12 @@ namespace TyphoonUnitySDK
98
104
  public bool PresetModifyEnable = false;
99
105
  public List<VariableModify> PresetModify = new List<VariableModify>();
100
106
 
107
+ //webgl 画布宽度
108
+ public int WebGLCanvasWidth = 960;
109
+ //webgl 画布高度
110
+ public int WebGLCanvasHeight = 600;
111
+
112
+
101
113
  /*微信拓展配置*/
102
114
  public bool WxMiniGUIFoldout = true;
103
115
 
@@ -115,6 +127,8 @@ namespace TyphoonUnitySDK
115
127
 
116
128
  //快手小游戏webgl
117
129
  public bool KuaishouWebglGUIFoldout = true;
130
+ //mini gmae webgl
131
+ public bool MiniGameGUIFoldout = true;
118
132
 
119
133
 
120
134
  //使用配置
@@ -138,6 +152,20 @@ namespace TyphoonUnitySDK
138
152
  return UniEditor.HasAddressableSupport() & AASupportEnable;
139
153
  }
140
154
 
155
+ /// <summary>
156
+ /// 是否支持调整画布大小
157
+ /// </summary>
158
+ public bool CanEditWebglCanvasSize()
159
+ {
160
+ switch (Channel)
161
+ {
162
+ case AppChannel.MiniGame:
163
+ return true;
164
+ }
165
+
166
+ return false;
167
+ }
168
+
141
169
  /*保存*/
142
170
  public void Save()
143
171
  {