com.typhoon.unitysdk 1.0.41 → 1.0.43

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.
@@ -89,6 +89,7 @@ namespace TyphoonUnitySDK
89
89
 
90
90
  match.Apply(setting);
91
91
  InvokeOnApplyEnd(setting);
92
+ Debug.Log($"<color=#3ac9f3>想在应用前or后做点事情?任意Editor文件夹下创建class继承TyphoonUnitySDK.OnApplyProcessor实现接口</color>");
92
93
  }
93
94
  }
94
95
 
@@ -141,7 +142,6 @@ namespace TyphoonUnitySDK
141
142
  PlayerSettings.Android.minSdkVersion = setting.MinApiVersion;
142
143
  PlayerSettings.Android.targetSdkVersion = setting.TargetApiVersion;
143
144
 
144
-
145
145
 
146
146
  //覆写GraphicsAPI
147
147
  if (setting.GraphicsAPIs.Length > 0)
@@ -206,7 +206,7 @@ namespace TyphoonUnitySDK
206
206
 
207
207
  PlayerSettings.WebGL.exceptionSupport = setting.ExceptionSupport;
208
208
  PlayerSettings.WebGL.debugSymbols = setting.WebglDebugSymbols;
209
-
209
+
210
210
  //覆写AA参数
211
211
  AddressableSupport.ModifyAAProfileAndVariables(setting);
212
212
  //写入App config
@@ -423,6 +423,25 @@ namespace TyphoonUnitySDK
423
423
  };
424
424
 
425
425
 
426
+ //重新注入脚本
427
+ public static void ReimportScript(HashSet<string> files)
428
+ {
429
+ var match = new HashSet<string>();
430
+ foreach (var file in files)
431
+ {
432
+ if (file.EndsWith(".cs"))
433
+ {
434
+ match.Add(file);
435
+ }
436
+ }
437
+
438
+ foreach (var path in match)
439
+ {
440
+ AssetDatabase.ImportAsset(path, ImportAssetOptions.Default);
441
+ }
442
+ }
443
+
444
+
426
445
  /*应用ChinaAndroid*/
427
446
  public class ApplyChinaAndroid : IApply
428
447
  {
@@ -439,8 +458,7 @@ namespace TyphoonUnitySDK
439
458
  ClearFilesInDirectory(folder, manifest);
440
459
  }
441
460
 
442
- AssetDatabase.ImportAsset($"Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid",
443
- ImportAssetOptions.ImportRecursive);
461
+ ReimportScript(manifest);
444
462
  AssetDatabase.Refresh();
445
463
  }
446
464
  }
@@ -478,8 +496,7 @@ namespace TyphoonUnitySDK
478
496
  ClearFilesInDirectory(folder, manifest);
479
497
  }
480
498
 
481
- AssetDatabase.ImportAsset($"Assets/Typhoon_Gen/TyphoonSDK/Runtime/WxMini",
482
- ImportAssetOptions.ImportRecursive);
499
+ ReimportScript(manifest);
483
500
  AssetDatabase.Refresh();
484
501
  }
485
502
  }
@@ -500,8 +517,7 @@ namespace TyphoonUnitySDK
500
517
  ClearFilesInDirectory(folder, manifest);
501
518
  }
502
519
 
503
- AssetDatabase.ImportAsset($"Assets/Typhoon_Gen/TyphoonSDK/Runtime/Douyin",
504
- ImportAssetOptions.ImportRecursive);
520
+ ReimportScript(manifest);
505
521
  AssetDatabase.Refresh();
506
522
  }
507
523
  }
@@ -522,8 +538,7 @@ namespace TyphoonUnitySDK
522
538
  ClearFilesInDirectory(folder, manifest);
523
539
  }
524
540
 
525
- AssetDatabase.ImportAsset($"Assets/Typhoon_Gen/TyphoonSDK/Runtime/GooglePlay",
526
- ImportAssetOptions.ImportRecursive);
541
+ ReimportScript(manifest);
527
542
  AssetDatabase.Refresh();
528
543
  }
529
544
  }
@@ -546,8 +561,7 @@ namespace TyphoonUnitySDK
546
561
  ClearFilesInDirectory(folder, manifest);
547
562
  }
548
563
 
549
- AssetDatabase.ImportAsset($"Assets/Typhoon_Gen/TyphoonSDK/Runtime/VivoMini",
550
- ImportAssetOptions.ImportRecursive);
564
+ ReimportScript(manifest);
551
565
  AssetDatabase.Refresh();
552
566
  }
553
567
  }
@@ -70,6 +70,11 @@ namespace TyphoonUnitySDK
70
70
  /// </summary>
71
71
  public static readonly string APPLY_HISTORY = ".typhoon/typhoon_sdk_apply_history.txt";
72
72
 
73
+ /// <summary>
74
+ /// 说明文档
75
+ /// </summary>
76
+ public static string DOC_URL = "https://auffm1e1gb.feishu.cn/docx/QiGldaOsWom8p4xGjchcTpm5nmh";
77
+
73
78
 
74
79
  /// <summary>
75
80
  /// 获取windows用户名文件夹
@@ -683,17 +688,6 @@ namespace TyphoonUnitySDK
683
688
  return result.ToArray();
684
689
  }
685
690
 
686
- // /// <summary>
687
- // /// 执行批处理
688
- // /// </summary>
689
- // public static void RunBat(string path, string args = "", Action complete = null)
690
- // {
691
- // using (var process = Process.Start("explorer", $"\"{Path.GetFullPath(path)}\" {args}"))
692
- // {
693
- // }
694
- //
695
- // }
696
-
697
691
 
698
692
  /// <summary>
699
693
  /// 执行批处理
@@ -758,5 +752,31 @@ namespace TyphoonUnitySDK
758
752
  Alphaleonis.Win32.Filesystem.File.Delete(path, true);
759
753
  }
760
754
  }
755
+
756
+
757
+ [MenuItem("TyphoonSDK/说明文档", priority = -10000)]
758
+ public static void OpenDoc()
759
+ {
760
+ Application.OpenURL(DOC_URL);
761
+ }
762
+
763
+
764
+ [MenuItem("TyphoonSDK/打开.typhoonoutput", priority = -10000)]
765
+ public static void OpenOutPutFolder()
766
+ {
767
+ var file = $".typhoonoutput/.md";
768
+ if (!File.Exists(file))
769
+ {
770
+ var dir = Path.GetDirectoryName(file);
771
+ if (!Directory.Exists(dir))
772
+ {
773
+ Directory.CreateDirectory(dir);
774
+ }
775
+
776
+ File.WriteAllText(file, "");
777
+ }
778
+
779
+ EditorUtility.RevealInFinder(file);
780
+ }
761
781
  }
762
782
  }
@@ -65,7 +65,7 @@ namespace TyphoonUnitySDK
65
65
  }
66
66
 
67
67
  /*隐藏banner*/
68
- public virtual void HideBanner(string scene)
68
+ public virtual void HideBanner(string scene = "")
69
69
  {
70
70
  }
71
71
 
@@ -194,7 +194,13 @@ namespace TyphoonUnitySDK
194
194
 
195
195
  #region 侧边栏复访(抖音小游戏)
196
196
 
197
- public virtual void IsSupportSideBar(Action success, Action<string> fail)
197
+ public virtual bool IsSupportSideBar()
198
+ {
199
+ //默认不支持
200
+ return false;
201
+ }
202
+
203
+ public virtual void CheckSideBarSupportFlag(Action success, Action<string> fail)
198
204
  {
199
205
  //默认不支持
200
206
  fail?.Invoke("no support in this channel");
@@ -155,8 +155,11 @@ namespace TyphoonUnitySDK
155
155
  /// </summary>
156
156
  public interface ISideBarReturn
157
157
  {
158
- //是都支持侧边栏
159
- void IsSupportSideBar(Action success, Action<string> fail);
158
+ //是否支持侧边栏
159
+ bool IsSupportSideBar();
160
+
161
+ //检查侧边栏支持flag
162
+ void CheckSideBarSupportFlag(Action success, Action<string> fail);
160
163
 
161
164
  //导航到侧边栏
162
165
  void NavigateToSideBar(Action success, Action<string> fail);
@@ -6,9 +6,9 @@ using UnityEngine;
6
6
  namespace TyphoonUnitySDK
7
7
  {
8
8
  /// <summary>
9
- /// Typhoon SDK
9
+ /// Typhoon SDK 实例
10
10
  /// </summary>
11
- public partial class TyphoonSdk : MonoSingleton<TyphoonSdk>
11
+ public partial class SdkLite : MonoSingleton<SdkLite>
12
12
  {
13
13
  /*绑定SDK实例*/
14
14
  public static Dictionary<AppChannel, string> SDKBindings = new Dictionary<AppChannel, string>
@@ -204,7 +204,7 @@ namespace TyphoonUnitySDK
204
204
  /// <param name="scene">广告场景</param>
205
205
  /// <param name="success">成功回调,发放奖励</param>
206
206
  /// <param name="fail">失败回调,返回失败原因</param>
207
- public void ShowVideo(string scene, Action success, Action<string> fail)
207
+ public void ShowVideo(string scene, Action success, Action<string> fail = null)
208
208
  {
209
209
  Log($"ShowVideo:{scene}");
210
210
  #if UNITY_EDITOR
@@ -280,8 +280,8 @@ namespace TyphoonUnitySDK
280
280
  /// <summary>
281
281
  /// 隐藏banner
282
282
  /// </summary>
283
- /// <param name="scene"></param>
284
- public void HideBanner(string scene)
283
+ /// <param name="scene">暂不作用,可以不传</param>
284
+ public void HideBanner(string scene = "")
285
285
  {
286
286
  #if UNITY_EDITOR
287
287
  if (SdkTestInUnity.Instance.OpenInteractive)
@@ -625,11 +625,32 @@ namespace TyphoonUnitySDK
625
625
  #region 侧边栏(抖音小游戏)
626
626
 
627
627
  /// <summary>
628
- /// 判断是否支持侧边栏,可以通过此接口判断是否开启侧边栏奖励入口
628
+ /// 判断是否支持侧边栏功能,可以通过此接口判断是否开启侧边栏相关UI,请在登录完成后再调用
629
+ /// </summary>
630
+ public virtual bool IsSupportSideBar()
631
+ {
632
+ #if UNITY_EDITOR
633
+ switch (AppConfig.Channel)
634
+ {
635
+ case AppChannel.DouyinAndroid:
636
+ case AppChannel.DouyinIOS:
637
+ break;
638
+ default:
639
+ return false;
640
+ }
641
+
642
+ return SdkTestInUnity.Instance.IsSupportSideBarResult;
643
+ #endif
644
+ return _sdk.IsSupportSideBar();
645
+ }
646
+
647
+
648
+ /// <summary>
649
+ /// 判断是否支持侧边栏,异步机制
629
650
  /// </summary>
630
651
  /// <param name="success">成功回调,表示支持该功能,可以显示入口</param>
631
652
  /// <param name="fail">失败回调,表示不支持该功能,可以显示入口</param>
632
- public virtual void IsSupportSideBar(Action success, Action<string> fail)
653
+ public virtual void CheckSideBarSupportFlag(Action success, Action<string> fail)
633
654
  {
634
655
  #if UNITY_EDITOR
635
656
  switch (AppConfig.Channel)
@@ -654,7 +675,7 @@ namespace TyphoonUnitySDK
654
675
 
655
676
  return;
656
677
  #endif
657
- _sdk.IsSupportSideBar(success, fail);
678
+ _sdk.CheckSideBarSupportFlag(success, fail);
658
679
  }
659
680
 
660
681
  /// <summary>
@@ -41,9 +41,9 @@ namespace TyphoonUnitySDK
41
41
  case AppChannel.ChinaAndroid:
42
42
  if (Input.GetKeyDown(KeyCode.Escape))
43
43
  {
44
- if (TyphoonSdk.Instance.IsSupportExitGame())
44
+ if (SdkLite.Instance.IsSupportExitGame())
45
45
  {
46
- TyphoonSdk.Instance.ExitGame();
46
+ SdkLite.Instance.ExitGame();
47
47
  }
48
48
  }
49
49
 
@@ -22,8 +22,11 @@ namespace TyphoonUnitySDK
22
22
  if (type.Name.Contains("WXTouchInputOverride"))
23
23
  {
24
24
  Debug.Log("补充WXTouchInputOverride组件");
25
+ #if !UNITY_EDITOR
25
26
  //补充WXTouchInputOverride组件
26
27
  gameObject.AddComponent(type);
28
+ #endif
29
+
27
30
  break;
28
31
  }
29
32
  }
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.0.41","description":"","unity":"2018.1","type":"tool","hideInEditor":false,"author":{"name":"Jan Zhang","email":"","url":""},"changelogUrl":"","documentationUrl":"","keywords":["typhoon"],"license":"","licensesUrl":"","customDependencies":[{"PackageName":"com.unity.nuget.newtonsoft-json","Value":"2.0.0"}],"dependencies":{"com.unity.nuget.newtonsoft-json":"2.0.0"}}
1
+ {"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.0.43","description":"","unity":"2018.1","type":"tool","hideInEditor":false,"author":{"name":"Jan Zhang","email":"","url":""},"changelogUrl":"","documentationUrl":"","keywords":["typhoon"],"license":"","licensesUrl":"","customDependencies":[{"PackageName":"com.unity.nuget.newtonsoft-json","Value":"2.0.0"}],"dependencies":{"com.unity.nuget.newtonsoft-json":"2.0.0"}}
File without changes