com.typhoon.unitysdk 1.0.37 → 1.0.39

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.
@@ -95,7 +95,9 @@ namespace TyphoonUnitySDK
95
95
  #region 初始化SDK
96
96
 
97
97
  /// <summary>
98
- /// 初始化sdk
98
+ /// 初始化sdk(必接)<para></para>
99
+ /// 在成功回调后再执行登录<para></para>
100
+ /// 登录API:<seealso cref="Login"/>
99
101
  /// </summary>
100
102
  public void InitSdk(Action success, Action<string> fail)
101
103
  {
@@ -114,7 +116,9 @@ namespace TyphoonUnitySDK
114
116
  #region 登录
115
117
 
116
118
  /// <summary>
117
- /// 登录
119
+ /// 登录(必接)<para></para>
120
+ /// 请完成初始化并且成功后再调用<para></para>
121
+ /// 初始化API:<seealso cref="InitSdk"/>
118
122
  /// </summary>
119
123
  public void Login(Action success, Action<string> fail)
120
124
  {
@@ -179,7 +183,9 @@ namespace TyphoonUnitySDK
179
183
  #region 视频广告
180
184
 
181
185
  /// <summary>
182
- /// 获取视频广告加载标记
186
+ /// 获取视频广告加载标记<para/>
187
+ /// true:视频广告完成加载<para/>
188
+ /// false:视频广告未完成加载<para/>
183
189
  /// </summary>
184
190
  public bool GetVideoFlag()
185
191
  {
@@ -193,7 +199,7 @@ namespace TyphoonUnitySDK
193
199
  }
194
200
 
195
201
  /// <summary>
196
- /// 视频广告
202
+ /// 展示视频广告
197
203
  /// </summary>
198
204
  /// <param name="scene">广告场景</param>
199
205
  /// <param name="success">成功回调,发放奖励</param>
@@ -229,7 +235,7 @@ namespace TyphoonUnitySDK
229
235
  #region 插页广告
230
236
 
231
237
  /// <summary>
232
- /// 插页广告
238
+ /// 展示插页广告
233
239
  /// </summary>
234
240
  /// <param name="scene">广告场景</param>
235
241
  public void ShowInters(string scene)
@@ -373,9 +379,9 @@ namespace TyphoonUnitySDK
373
379
  #region 发布版本号
374
380
 
375
381
  /// <summary>
376
- /// 发布版本号
382
+ /// 获取发布版本号<para/>
383
+ /// 此为内部维护版本号,在发布窗口中进行设置,可显示在loading页中,方便区分包体内容所属什么迭代版本的阶段,避免传错包等问题
377
384
  /// </summary>
378
- /*获取发布版本号信息*/
379
385
  public virtual string GetPublishVersion()
380
386
  {
381
387
  var result = AppConfig.Version;
@@ -472,67 +478,68 @@ namespace TyphoonUnitySDK
472
478
  #region 录屏分享
473
479
 
474
480
  /// <summary>
475
- /// 是否支持录屏分享
481
+ /// 是否支持录屏分享(抖音小游戏)
476
482
  /// </summary>
477
- public bool CanRecordGame()
483
+ public bool IsSupportGameRecord()
478
484
  {
479
485
  #if UNITY_EDITOR
480
486
  return SimulateRecordGame.Instance.CanRecord();
481
487
  #endif
482
- return _sdk.CanRecordGame();
488
+ return _sdk.IsSupportGameRecord();
483
489
  }
484
490
 
485
491
  /// <summary>
486
- /// 开启录屏
492
+ /// 开启游戏录屏(抖音小游戏)
487
493
  /// </summary>
488
494
  /// <param name="isRecordAudio">包含音频</param>
489
495
  /// <param name="maxRecordTimeSec">最大录屏时长</param>
490
496
  /// <param name="onStart">开始回调</param>
491
497
  /// <param name="onError">错误回调</param>
492
498
  /// <param name="onComplete">完成回调</param>
493
- public void StartRecordGame(bool isRecordAudio = true, int maxRecordTimeSec = 600, Action onStart = null,
499
+ public void StartGameRecord(bool isRecordAudio = true, int maxRecordTimeSec = 600, Action onStart = null,
494
500
  Action<string> onError = null, Action<string> onComplete = null)
495
501
  {
496
502
  #if UNITY_EDITOR
497
503
  SimulateRecordGame.Instance.StartRecord(onStart);
498
504
  return;
499
505
  #endif
500
- _sdk.StartRecordGame(isRecordAudio, maxRecordTimeSec, onStart, onError, onComplete);
506
+ _sdk.StartGameRecord(isRecordAudio, maxRecordTimeSec, onStart, onError, onComplete);
501
507
  }
502
508
 
503
509
  /// <summary>
504
- /// 停止录制
510
+ /// 结束游戏录制(抖音小游戏)
505
511
  /// </summary>
506
512
  /// <param name="complete">完成回调,返回videopath</param>
507
513
  /// <param name="onError">错误回调</param>
508
514
  /// <param name="clips">自定义剪辑片段,单位毫秒</param>
509
515
  /// <param name="autoMerge">自动合并</param>
510
- public void StopRecordGame(Action<string> complete = null, Action<string> onError = null,
516
+ public void StopGameRecord(Action<string> complete = null, Action<string> onError = null,
511
517
  List<TimeClip> clips = null, bool autoMerge = true)
512
518
  {
513
519
  #if UNITY_EDITOR
514
520
  SimulateRecordGame.Instance.StopRecord(complete);
515
521
  return;
516
522
  #endif
517
- _sdk.StopRecordGame(complete, onError, clips, autoMerge);
523
+ _sdk.StopGameRecord(complete, onError, clips, autoMerge);
518
524
  }
519
525
 
520
526
  /// <summary>
521
- /// 获取录屏时长
527
+ /// 获取录屏时长(抖音小游戏)
522
528
  /// </summary>
523
- public float GetRecordDuration()
529
+ public float GetGameRecordDuration()
524
530
  {
525
531
  #if UNITY_EDITOR
526
532
  return SimulateRecordGame.Instance.GetDuration();
527
533
  #endif
528
- return _sdk.GetRecordDuration();
534
+ return _sdk.GetGameRecordDuration();
529
535
  }
530
536
 
531
537
 
532
538
  /// <summary>
533
- /// 是否可以分享录屏
539
+ /// 是否可以分享录屏(抖音小游戏)<para/>
540
+ /// 当为true可以激活分享按钮
534
541
  /// </summary>
535
- public bool CanShareRecordGame()
542
+ public bool CanShareGameRecord()
536
543
  {
537
544
  #if UNITY_EDITOR
538
545
  return SimulateRecordGame.Instance.CanShare();
@@ -545,10 +552,10 @@ namespace TyphoonUnitySDK
545
552
  /// </summary>
546
553
  /// <param name="title">标题</param>
547
554
  /// <param name="topics">话题</param>
548
- /// <param name="success">成功回调</param>
555
+ /// <param name="success">成功回调,可以下发奖励</param>
549
556
  /// <param name="fail">失败回调</param>
550
557
  /// <param name="cancel">取消回调</param>
551
- public void ShareRecordGame(string title, List<string> topics, Action success, Action<string> fail = null,
558
+ public void ShareGameRecord(string title, List<string> topics, Action success, Action<string> fail = null,
552
559
  Action cancel = null)
553
560
  {
554
561
  #if UNITY_EDITOR
@@ -558,10 +565,32 @@ namespace TyphoonUnitySDK
558
565
  _sdk.ShareRecordGame(title, topics, success, fail, cancel);
559
566
  }
560
567
 
568
+
569
+ /// <summary>
570
+ /// 清理游戏录屏(抖音小游戏)
571
+ /// </summary>
572
+ public void ClearGameRecord()
573
+ {
574
+ #if UNITY_EDITOR
575
+ SimulateRecordGame.Instance.ClearRecord();
576
+ return;
577
+ #endif
578
+ _sdk.ClearGameRecord();
579
+ }
580
+
561
581
  #endregion
562
582
 
563
583
  #region Http请求
564
584
 
585
+ /// <summary>
586
+ /// http post 请求
587
+ /// </summary>
588
+ /// <param name="url">地址</param>
589
+ /// <param name="data">传输的数据</param>
590
+ /// <param name="success">成功回调</param>
591
+ /// <param name="fail">失败回调</param>
592
+ /// <param name="header">请求头</param>
593
+ /// <param name="timeOut">超时时间</param>
565
594
  public virtual void HttpPost(string url, string data, Action<HttpPostSuccessResult> success,
566
595
  Action<string> fail,
567
596
  Dictionary<string, string> header = null, int timeOut = 60)
@@ -573,7 +602,14 @@ namespace TyphoonUnitySDK
573
602
  _sdk?.HttpPost(url, data, success, fail, header, timeOut);
574
603
  }
575
604
 
576
-
605
+ /// <summary>
606
+ /// http get 请求
607
+ /// </summary>
608
+ /// <param name="url">地址</param>
609
+ /// <param name="success">成功回调</param>
610
+ /// <param name="fail">失败回调</param>
611
+ /// <param name="header">请求头</param>
612
+ /// <param name="timeOut">超时时间</param>
577
613
  public virtual void HttpGet(string url, Action<HttpGetSuccessResult> success, Action<string> fail,
578
614
  Dictionary<string, string> header = null, int timeOut = 60)
579
615
  {
@@ -585,5 +621,124 @@ namespace TyphoonUnitySDK
585
621
  }
586
622
 
587
623
  #endregion
624
+
625
+ #region 侧边栏(抖音小游戏)
626
+
627
+ /// <summary>
628
+ /// 判断是否支持侧边栏,可以通过此接口判断是否开启侧边栏奖励入口
629
+ /// </summary>
630
+ /// <param name="success">成功回调,表示支持该功能,可以显示入口</param>
631
+ /// <param name="fail">失败回调,表示不支持该功能,可以显示入口</param>
632
+ public virtual void IsSupportSideBar(Action success, Action<string> fail)
633
+ {
634
+ #if UNITY_EDITOR
635
+ switch (AppConfig.Channel)
636
+ {
637
+ case AppChannel.DouyinAndroid:
638
+ case AppChannel.DouyinIOS:
639
+ break;
640
+ default:
641
+ fail?.Invoke($"[{AppConfig.Channel}]渠道不支持侧边栏功能");
642
+ return;
643
+ }
644
+
645
+ if (SdkTestInUnity.Instance.IsSupportSideBarResult)
646
+ {
647
+ success?.Invoke();
648
+ }
649
+ else
650
+ {
651
+ fail?.Invoke("not support");
652
+ Debug.Log("<color=#e53e30> [SDK模拟] 是否支持侧边栏-回调结果==false,可从'TyphoonSDK/模拟测试'修改</color>");
653
+ }
654
+
655
+ return;
656
+ #endif
657
+ _sdk.IsSupportSideBar(success, fail);
658
+ }
659
+
660
+ /// <summary>
661
+ /// 帮用户跳转到侧边栏
662
+ /// </summary>
663
+ /// <param name="success">跳转成功回调</param>
664
+ /// <param name="fail">跳转失败回调,内部会做提示</param>
665
+ public virtual void NavigateToSideBar(Action success, Action<string> fail, bool showFailToast = true)
666
+ {
667
+ #if UNITY_EDITOR
668
+ switch (AppConfig.Channel)
669
+ {
670
+ case AppChannel.DouyinAndroid:
671
+ case AppChannel.DouyinIOS:
672
+ break;
673
+ default:
674
+ fail?.Invoke($"[{AppConfig.Channel}]渠道不支持侧边栏功能");
675
+ return;
676
+ }
677
+
678
+ if (SdkTestInUnity.Instance.NavigateToSideBarResult)
679
+ {
680
+ success?.Invoke();
681
+ }
682
+ else
683
+ {
684
+ if (showFailToast)
685
+ {
686
+ ShowToast("跳转失败,可主动从侧边栏访问本游戏后领奖");
687
+ }
688
+
689
+ fail?.Invoke("not support");
690
+ Debug.Log("<color=#e53e30> [SDK模拟] 导航到侧边栏-回调结果==false,可从'TyphoonSDK/模拟测试'修改</color>");
691
+ }
692
+
693
+ return;
694
+ #endif
695
+ _sdk.NavigateToSideBar(success, fail);
696
+ }
697
+
698
+ /// <summary>
699
+ /// 是否从侧边栏进入
700
+ /// 当为true,满足侧边栏奖励下发条件,激活领取奖励按钮
701
+ /// </summary>
702
+ public virtual bool IsEnterFromSideBar()
703
+ {
704
+ #if UNITY_EDITOR
705
+ switch (AppConfig.Channel)
706
+ {
707
+ case AppChannel.DouyinAndroid:
708
+ case AppChannel.DouyinIOS:
709
+ {
710
+ if (!SdkTestInUnity.Instance.IsEnterFromSideBar)
711
+ {
712
+ Debug.Log("<color=#e53e30> [SDK模拟] 侧边栏进入标记==false,可从'TyphoonSDK/模拟测试'修改</color>");
713
+ }
714
+
715
+ return SdkTestInUnity.Instance.IsEnterFromSideBar;
716
+ }
717
+ }
718
+
719
+ return false;
720
+ #endif
721
+ return _sdk.IsEnterFromSideBar();
722
+ }
723
+
724
+ #endregion
725
+
726
+ #region Toast
727
+
728
+ /// <summary>
729
+ /// 显示Toast,类似于android的toast
730
+ /// 根据渠道不同显示的形式不同,请规避显示长文本,主要用于简短提示
731
+ /// </summary>
732
+ /// <param name="message">信息</param>
733
+ public virtual void ShowToast(string message)
734
+ {
735
+ #if UNITY_EDITOR
736
+ Toast.Instance.Show(message);
737
+ return;
738
+ #endif
739
+ _sdk.ShowToast(message);
740
+ }
741
+
742
+ #endregion
588
743
  }
589
744
  }
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.0.37","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.39","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"}}