com.typhoon.unitysdk 1.0.42 → 1.0.44
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 +4 -1
- package/Editor/ApplyTool.cs +1 -0
- package/Editor/DouyinConfig.cs +13 -8
- package/Editor/GUIDrawer.cs +4 -1
- package/Editor/Preferences.cs +1 -1
- package/Editor/PublishWindow.cs +5 -5
- package/Editor/UniEditor.cs +34 -14
- package/Editor/WxMiniConfig.cs +4 -3
- package/Runtime/BaseSdk.cs +17 -2
- package/Runtime/Interface.cs +15 -3
- package/Runtime/KvMap.cs +13 -0
- package/Runtime/KvMap.cs.meta +11 -0
- package/Runtime/SdkDebug.cs +9 -0
- package/Runtime/SdkLite.cs +99 -9
- package/Runtime/SdkTestInUnity.cs +7 -5
- package/Runtime/SimulateOnShow.cs +30 -0
- package/Runtime/SimulateOnShow.cs.meta +11 -0
- package/Sources~/Package/Douyin.unitypackage +0 -0
- package/Sources~/Package/GooglePlay.unitypackage +0 -0
- package/Sources~/Package/VivoMini.unitypackage +0 -0
- package/Sources~/Package/WxMini.unitypackage +0 -0
- package/package.json +1 -1
|
@@ -228,8 +228,11 @@ namespace TyphoonUnitySDK
|
|
|
228
228
|
// AddressableAssetSettings.CleanPlayerContent(builder as IDataBuilder);
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
Debug.Log(
|
|
231
|
+
Debug.Log(
|
|
232
|
+
$"<color=#{SdkDebug.BlueHex}>使用profile:{settings.profileSettings.GetProfileName(profileId)}</color>");
|
|
232
233
|
|
|
234
|
+
Debug.Log(
|
|
235
|
+
$"<color=#{SdkDebug.BlueHex}>想要在AA构建前or后做点事情?任意Editor文件夹下创建class继承于TyphoonUnitySDK.OnBuildAAProcessor</color>");
|
|
233
236
|
//触发AA回调
|
|
234
237
|
var sub = GetSubClassTypes(typeof(OnBuildAAProcessor));
|
|
235
238
|
var match = new List<OnBuildAAProcessor>();
|
package/Editor/ApplyTool.cs
CHANGED
package/Editor/DouyinConfig.cs
CHANGED
|
@@ -52,17 +52,22 @@ namespace TyphoonUnitySDK
|
|
|
52
52
|
var tmpEnable = GUI.enabled;
|
|
53
53
|
GUI.enabled = true;
|
|
54
54
|
GUILayout.Space(6);
|
|
55
|
-
GUIDrawer.DrawKeynotes("①仅支持Unity版本:2019.4.35(逐步放弃),2021.3.14(最优,支持ASTC
|
|
56
|
-
GUIDrawer.DrawKeynotes(" 详细以官方文档地址为准,链接如下:");
|
|
55
|
+
GUIDrawer.DrawKeynotes("①仅支持Unity版本:2019.4.35(逐步放弃),2021.3.14(最优,支持ASTC压缩)");
|
|
57
56
|
var url = "https://bytedance.feishu.cn/docx/doxcnTTjZHp8J6HzdrSbWu1aK5b";
|
|
58
|
-
GUIDrawer.DrawUrlLink($" {url}", () => Application.OpenURL(url));
|
|
59
|
-
GUIDrawer.DrawKeynotes("
|
|
60
|
-
GUIDrawer.DrawKeynotes("
|
|
57
|
+
GUIDrawer.DrawUrlLink($" [官方说明] {url}", () => Application.OpenURL(url));
|
|
58
|
+
GUIDrawer.DrawKeynotes("②webgl不支持多线程,修改代码进行适配 (只发Android可忽略)");
|
|
59
|
+
GUIDrawer.DrawKeynotes("③录屏分享(必须接入)");
|
|
60
|
+
url = "https://auffm1e1gb.feishu.cn/docx/QiGldaOsWom8p4xGjchcTpm5nmh#R5wFdxUELo22n7xbg7jcmI53n0f";
|
|
61
|
+
GUIDrawer.DrawUrlLink($" [API文档] {url}", () => Application.OpenURL(url));
|
|
62
|
+
GUIDrawer.DrawKeynotes("④使用指定广告图标,注意广告规范");
|
|
61
63
|
url = "https://developer.open-douyin.com/docs/resource/zh-CN/mini-game/operation1/advertise/norms";
|
|
62
|
-
GUIDrawer.DrawUrlLink($" {url}", () => Application.OpenURL(url));
|
|
63
|
-
GUIDrawer.DrawKeynotes("
|
|
64
|
+
GUIDrawer.DrawUrlLink($" [官方说明] {url}", () => Application.OpenURL(url));
|
|
65
|
+
GUIDrawer.DrawKeynotes("⑤侧边栏复访(必须接入)");
|
|
64
66
|
url = "https://developer.open-douyin.com/docs/resource/zh-CN/mini-game/operation1/ability/-retention/sidebar#c6ed8ce0";
|
|
65
|
-
GUIDrawer.DrawUrlLink($" {url}", () => Application.OpenURL(url));
|
|
67
|
+
GUIDrawer.DrawUrlLink($" [官方说明] {url}", () => Application.OpenURL(url));
|
|
68
|
+
url = "https://auffm1e1gb.feishu.cn/docx/QiGldaOsWom8p4xGjchcTpm5nmh#K322dje8YoJ6psxM7XkcGs5zn6f";
|
|
69
|
+
GUIDrawer.DrawUrlLink($" [API文档] {url}", () => Application.OpenURL(url));
|
|
70
|
+
GUIDrawer.DrawKeynotes("⑥记得在抖音小游戏后台配置域名白名单(如果需要)");
|
|
66
71
|
GUILayout.Space(6);
|
|
67
72
|
GUI.enabled = tmpEnable;
|
|
68
73
|
return true;
|
package/Editor/GUIDrawer.cs
CHANGED
|
@@ -38,7 +38,9 @@ namespace TyphoonUnitySDK
|
|
|
38
38
|
if (_linkstyle == null)
|
|
39
39
|
{
|
|
40
40
|
_linkstyle = new GUIStyle(Styles.rlabel_italic);
|
|
41
|
-
_linkstyle.normal.textColor =
|
|
41
|
+
_linkstyle.normal.textColor = EditorGUIUtility.isProSkin
|
|
42
|
+
? new Color(0.71f, 0.27f, 0.91f, 1f)
|
|
43
|
+
: new Color(0.39f, 0.15f, 0.51f, 1f);
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
return _linkstyle;
|
|
@@ -96,6 +98,7 @@ namespace TyphoonUnitySDK
|
|
|
96
98
|
StyleTooltip.normal.textColor = EditorGUIUtility.isProSkin
|
|
97
99
|
? new Color(0.47f, 0.8f, 1f, 1f)
|
|
98
100
|
: new Color(0.04f, 0.31f, 0.57f, 1f);
|
|
101
|
+
StyleTooltip.richText = true;
|
|
99
102
|
GUILayout.TextArea(content, StyleTooltip, option);
|
|
100
103
|
}
|
|
101
104
|
|
package/Editor/Preferences.cs
CHANGED
|
@@ -27,7 +27,7 @@ namespace TyphoonUnitySDK
|
|
|
27
27
|
_instance = CreateInstance<Preferences>();
|
|
28
28
|
UniEditor.CreateDirIfNotExist(Path.GetDirectoryName(AssetPath));
|
|
29
29
|
AssetDatabase.CreateAsset(_instance, AssetPath);
|
|
30
|
-
Debug.Log($"<color=#
|
|
30
|
+
Debug.Log($"<color=#{SdkDebug.BlueHex}>生成:{AssetPath}</color>");
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
return _instance;
|
package/Editor/PublishWindow.cs
CHANGED
|
@@ -350,21 +350,21 @@ namespace TyphoonUnitySDK
|
|
|
350
350
|
|
|
351
351
|
if (clickApply)
|
|
352
352
|
{
|
|
353
|
-
Debug.Log($"<color=#
|
|
353
|
+
Debug.Log($"<color=#{SdkDebug.BlueHex}>应用...{_select}</color>");
|
|
354
354
|
_select.Apply();
|
|
355
|
-
Debug.Log($"<color=#
|
|
355
|
+
Debug.Log($"<color=#{SdkDebug.BlueHex}>应用完毕</color>");
|
|
356
356
|
}
|
|
357
357
|
|
|
358
358
|
if (clickBuildAA)
|
|
359
359
|
{
|
|
360
|
-
Debug.Log($"<color=#
|
|
360
|
+
Debug.Log($"<color=#{SdkDebug.BlueHex}>构建AA...</color>");
|
|
361
361
|
AddressableSupport.BuildAASource(_select);
|
|
362
|
-
Debug.Log($"<color=#
|
|
362
|
+
Debug.Log($"<color=#{SdkDebug.BlueHex}>构建AA结束</color>");
|
|
363
363
|
}
|
|
364
364
|
|
|
365
365
|
if (clickPublish)
|
|
366
366
|
{
|
|
367
|
-
Debug.Log($"<color=#
|
|
367
|
+
Debug.Log($"<color=#{SdkDebug.BlueHex}>发布...</color>");
|
|
368
368
|
_select.Publish();
|
|
369
369
|
}
|
|
370
370
|
|
package/Editor/UniEditor.cs
CHANGED
|
@@ -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用户名文件夹
|
|
@@ -121,7 +126,7 @@ namespace TyphoonUnitySDK
|
|
|
121
126
|
/// </summary>
|
|
122
127
|
public static void ImportPackage(string path, bool interactive = true)
|
|
123
128
|
{
|
|
124
|
-
Debug.Log($"<color=#
|
|
129
|
+
Debug.Log($"<color=#{SdkDebug.BlueHex}>导入----{path}</color>");
|
|
125
130
|
AssetDatabase.ImportPackage(path, interactive);
|
|
126
131
|
}
|
|
127
132
|
|
|
@@ -167,7 +172,7 @@ namespace TyphoonUnitySDK
|
|
|
167
172
|
PlayerSettings.SetScriptingDefineSymbolsForGroup(currentTarget, definesString);
|
|
168
173
|
foreach (var element in removes)
|
|
169
174
|
{
|
|
170
|
-
Debug.Log($"<color=#
|
|
175
|
+
Debug.Log($"<color=#{SdkDebug.BlueHex}>移除宏定义:{element}</color>");
|
|
171
176
|
}
|
|
172
177
|
}
|
|
173
178
|
}
|
|
@@ -208,7 +213,7 @@ namespace TyphoonUnitySDK
|
|
|
208
213
|
PlayerSettings.SetScriptingDefineSymbolsForGroup(currentTarget, definesString);
|
|
209
214
|
foreach (var element in append)
|
|
210
215
|
{
|
|
211
|
-
Debug.Log($"<color=#
|
|
216
|
+
Debug.Log($"<color=#{SdkDebug.BlueHex}>添加宏定义:{element}</color>");
|
|
212
217
|
}
|
|
213
218
|
}
|
|
214
219
|
}
|
|
@@ -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
|
}
|
package/Editor/WxMiniConfig.cs
CHANGED
|
@@ -49,6 +49,8 @@ namespace TyphoonUnitySDK
|
|
|
49
49
|
GUILayout.Space(6);
|
|
50
50
|
GUIDrawer.DrawKeynotes("①支持Unity版本:2019,2020,2021(推荐,支持ASTC压缩,坑最少)");
|
|
51
51
|
GUIDrawer.DrawKeynotes("②为EventSystem加上WxMiniTouchInputSupport组件,用于支持多点触控");
|
|
52
|
+
GUIDrawer.DrawKeynotes("③webgl不支持多线程,修改代码进行适配");
|
|
53
|
+
GUIDrawer.DrawKeynotes("④记得在微信公众平台后台配置域名白名单(如果需要)");
|
|
52
54
|
GUILayout.Space(6);
|
|
53
55
|
GUI.enabled = tmpEnable;
|
|
54
56
|
return true;
|
|
@@ -71,9 +73,8 @@ namespace TyphoonUnitySDK
|
|
|
71
73
|
arg.CDN = EditorGUILayout.TextField("CDN地址 (后台配白名单)", arg.CDN);
|
|
72
74
|
GUILayout.EndHorizontal();
|
|
73
75
|
GUIDrawer.DrawKeynotes($"支持与自定义变量组合,[变量名]作为占位符\n最终地址:{VariablePreset.Default.ParserToString(arg.CDN)}");
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
// GUILayout.Height(44));
|
|
76
|
+
GUIDrawer.DrawKeynotes(
|
|
77
|
+
$"<b>[ 注 意 ! ] </b>如果有远端资源需要动态下载,需要放在CDN地址的StreamingAssets下,参考路径:\n{VariablePreset.Default.ParserToString(arg.CDN)}/StreamingAssets/<资源文件,子目录资源文件>...\n非此地址下载的aa或ab资源不会常驻保存(每次重启游戏都会丢失,可能导致重复下载)造成CDN浪费");
|
|
77
78
|
GUILayout.Space(5);
|
|
78
79
|
return true;
|
|
79
80
|
}
|
package/Runtime/BaseSdk.cs
CHANGED
|
@@ -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
|
|
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");
|
|
@@ -222,5 +228,14 @@ namespace TyphoonUnitySDK
|
|
|
222
228
|
}
|
|
223
229
|
|
|
224
230
|
#endregion
|
|
231
|
+
|
|
232
|
+
#region 事件上报
|
|
233
|
+
|
|
234
|
+
public virtual void Track(string eventName, KvMap map)
|
|
235
|
+
{
|
|
236
|
+
//默认不处理
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
#endregion
|
|
225
240
|
}
|
|
226
241
|
}
|
package/Runtime/Interface.cs
CHANGED
|
@@ -7,7 +7,7 @@ namespace TyphoonUnitySDK
|
|
|
7
7
|
/// SDK全功能接口
|
|
8
8
|
/// </summary>
|
|
9
9
|
public interface ISdk : IOnCreate, IInitSdk, ILogin, IExitGame, IBannerAD, IVideoAD, IIntersAD, IFloatIconAD,
|
|
10
|
-
INativeAD, IRecordGame, IHttpGet, IHttpPost, ISideBarReturn, IShowToast
|
|
10
|
+
INativeAD, IRecordGame, IHttpGet, IHttpPost, ISideBarReturn, IShowToast,ITrack
|
|
11
11
|
{
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -155,8 +155,11 @@ namespace TyphoonUnitySDK
|
|
|
155
155
|
/// </summary>
|
|
156
156
|
public interface ISideBarReturn
|
|
157
157
|
{
|
|
158
|
-
|
|
159
|
-
|
|
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);
|
|
@@ -199,4 +202,13 @@ namespace TyphoonUnitySDK
|
|
|
199
202
|
}
|
|
200
203
|
|
|
201
204
|
#endregion
|
|
205
|
+
|
|
206
|
+
#region 事件上报
|
|
207
|
+
|
|
208
|
+
public interface ITrack
|
|
209
|
+
{
|
|
210
|
+
void Track(string eventName, KvMap map);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
#endregion
|
|
202
214
|
}
|
package/Runtime/KvMap.cs
ADDED
package/Runtime/SdkDebug.cs
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
using UnityEngine;
|
|
2
|
+
using UnityEngine.Scripting;
|
|
2
3
|
|
|
3
4
|
namespace TyphoonUnitySDK
|
|
4
5
|
{
|
|
5
6
|
/// <summary>
|
|
6
7
|
/// SDK 日志输出
|
|
7
8
|
/// </summary>
|
|
9
|
+
[Preserve]
|
|
8
10
|
public class SdkDebug
|
|
9
11
|
{
|
|
10
12
|
public static bool IsDebug = true;
|
|
11
13
|
public static string Prefix = "##typhoon-unity-sdk:";
|
|
12
14
|
|
|
15
|
+
#if UNITY_EDITOR
|
|
16
|
+
public static string BlueHex => UnityEditor.EditorGUIUtility.isProSkin ? "26ade9" : "092415";
|
|
17
|
+
#else
|
|
18
|
+
public static string BlueHex => "26ade9";
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
|
|
13
22
|
public static void Log(string message)
|
|
14
23
|
{
|
|
15
24
|
if (!IsDebug)
|
package/Runtime/SdkLite.cs
CHANGED
|
@@ -10,6 +10,32 @@ namespace TyphoonUnitySDK
|
|
|
10
10
|
/// </summary>
|
|
11
11
|
public partial class SdkLite : MonoSingleton<SdkLite>
|
|
12
12
|
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
/// 生命周期回调——监听小程序启动或切前台<para/>
|
|
15
|
+
/// 初始化完成后才会触发<para/>
|
|
16
|
+
/// 支持:微信小游戏,抖音小游戏,vivo小游戏<para/>
|
|
17
|
+
/// </summary>
|
|
18
|
+
public static event Action OnShow = null;
|
|
19
|
+
|
|
20
|
+
/// <summary>
|
|
21
|
+
/// 生命周期回调——监听小程序切后台<para/>
|
|
22
|
+
/// 初始化完成后才会触发<para/>
|
|
23
|
+
/// 支持:微信小游戏,抖音小游戏,vivo小游戏<para/>
|
|
24
|
+
/// </summary>
|
|
25
|
+
public static event Action OnHide = null;
|
|
26
|
+
|
|
27
|
+
//触发OnShow
|
|
28
|
+
public static void InvokeOnShow()
|
|
29
|
+
{
|
|
30
|
+
OnShow?.Invoke();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//触发OnHide
|
|
34
|
+
public static void InvokeOnHide()
|
|
35
|
+
{
|
|
36
|
+
OnHide?.Invoke();
|
|
37
|
+
}
|
|
38
|
+
|
|
13
39
|
/*绑定SDK实例*/
|
|
14
40
|
public static Dictionary<AppChannel, string> SDKBindings = new Dictionary<AppChannel, string>
|
|
15
41
|
{
|
|
@@ -40,6 +66,7 @@ namespace TyphoonUnitySDK
|
|
|
40
66
|
}
|
|
41
67
|
}
|
|
42
68
|
|
|
69
|
+
|
|
43
70
|
protected override void Init()
|
|
44
71
|
{
|
|
45
72
|
base.Init();
|
|
@@ -53,6 +80,7 @@ namespace TyphoonUnitySDK
|
|
|
53
80
|
private void CreateSDK()
|
|
54
81
|
{
|
|
55
82
|
#if UNITY_EDITOR
|
|
83
|
+
SimulateOnShow.Instance.Build();
|
|
56
84
|
return;
|
|
57
85
|
#endif
|
|
58
86
|
if (SDKBindings.TryGetValue(AppConfig.Channel, out var match))
|
|
@@ -204,7 +232,7 @@ namespace TyphoonUnitySDK
|
|
|
204
232
|
/// <param name="scene">广告场景</param>
|
|
205
233
|
/// <param name="success">成功回调,发放奖励</param>
|
|
206
234
|
/// <param name="fail">失败回调,返回失败原因</param>
|
|
207
|
-
public void ShowVideo(string scene, Action success, Action<string> fail)
|
|
235
|
+
public void ShowVideo(string scene, Action success, Action<string> fail = null)
|
|
208
236
|
{
|
|
209
237
|
Log($"ShowVideo:{scene}");
|
|
210
238
|
#if UNITY_EDITOR
|
|
@@ -280,8 +308,8 @@ namespace TyphoonUnitySDK
|
|
|
280
308
|
/// <summary>
|
|
281
309
|
/// 隐藏banner
|
|
282
310
|
/// </summary>
|
|
283
|
-
/// <param name="scene"
|
|
284
|
-
public void HideBanner(string scene)
|
|
311
|
+
/// <param name="scene">暂不作用,可以不传</param>
|
|
312
|
+
public void HideBanner(string scene = "")
|
|
285
313
|
{
|
|
286
314
|
#if UNITY_EDITOR
|
|
287
315
|
if (SdkTestInUnity.Instance.OpenInteractive)
|
|
@@ -625,11 +653,32 @@ namespace TyphoonUnitySDK
|
|
|
625
653
|
#region 侧边栏(抖音小游戏)
|
|
626
654
|
|
|
627
655
|
/// <summary>
|
|
628
|
-
///
|
|
656
|
+
/// 判断是否支持侧边栏功能,可以通过此接口判断是否开启侧边栏相关UI,请在登录完成后再调用
|
|
657
|
+
/// </summary>
|
|
658
|
+
public virtual bool IsSupportSideBar()
|
|
659
|
+
{
|
|
660
|
+
#if UNITY_EDITOR
|
|
661
|
+
switch (AppConfig.Channel)
|
|
662
|
+
{
|
|
663
|
+
case AppChannel.DouyinAndroid:
|
|
664
|
+
case AppChannel.DouyinIOS:
|
|
665
|
+
break;
|
|
666
|
+
default:
|
|
667
|
+
return false;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
return SdkTestInUnity.Instance.IsSupportSideBarResult;
|
|
671
|
+
#endif
|
|
672
|
+
return _sdk.IsSupportSideBar();
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
/// <summary>
|
|
677
|
+
/// 判断是否支持侧边栏,异步机制
|
|
629
678
|
/// </summary>
|
|
630
679
|
/// <param name="success">成功回调,表示支持该功能,可以显示入口</param>
|
|
631
680
|
/// <param name="fail">失败回调,表示不支持该功能,可以显示入口</param>
|
|
632
|
-
public virtual void
|
|
681
|
+
public virtual void CheckSideBarSupportFlag(Action success, Action<string> fail)
|
|
633
682
|
{
|
|
634
683
|
#if UNITY_EDITOR
|
|
635
684
|
switch (AppConfig.Channel)
|
|
@@ -649,12 +698,12 @@ namespace TyphoonUnitySDK
|
|
|
649
698
|
else
|
|
650
699
|
{
|
|
651
700
|
fail?.Invoke("not support");
|
|
652
|
-
Debug.Log("<color=#
|
|
701
|
+
Debug.Log($"<color=#{SdkDebug.BlueHex}> [SDK模拟] 是否支持侧边栏-回调结果==false,可从'TyphoonSDK/模拟测试'修改</color>");
|
|
653
702
|
}
|
|
654
703
|
|
|
655
704
|
return;
|
|
656
705
|
#endif
|
|
657
|
-
_sdk.
|
|
706
|
+
_sdk.CheckSideBarSupportFlag(success, fail);
|
|
658
707
|
}
|
|
659
708
|
|
|
660
709
|
/// <summary>
|
|
@@ -687,7 +736,7 @@ namespace TyphoonUnitySDK
|
|
|
687
736
|
}
|
|
688
737
|
|
|
689
738
|
fail?.Invoke("not support");
|
|
690
|
-
Debug.Log("<color=#
|
|
739
|
+
Debug.Log($"<color=#{SdkDebug.BlueHex}> [SDK模拟] 导航到侧边栏-回调结果==false,可从'TyphoonSDK/模拟测试'修改</color>");
|
|
691
740
|
}
|
|
692
741
|
|
|
693
742
|
return;
|
|
@@ -709,7 +758,7 @@ namespace TyphoonUnitySDK
|
|
|
709
758
|
{
|
|
710
759
|
if (!SdkTestInUnity.Instance.IsEnterFromSideBar)
|
|
711
760
|
{
|
|
712
|
-
Debug.Log("<color=#
|
|
761
|
+
Debug.Log($"<color=#{SdkDebug.BlueHex}> [SDK模拟] 侧边栏进入标记==false,可从'TyphoonSDK/模拟测试'修改</color>");
|
|
713
762
|
}
|
|
714
763
|
|
|
715
764
|
return SdkTestInUnity.Instance.IsEnterFromSideBar;
|
|
@@ -740,5 +789,46 @@ namespace TyphoonUnitySDK
|
|
|
740
789
|
}
|
|
741
790
|
|
|
742
791
|
#endregion
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
#region 事件上报
|
|
795
|
+
|
|
796
|
+
/// <summary>
|
|
797
|
+
/// 多项事件上报<para/>
|
|
798
|
+
/// 为了保证各渠道兼容性,注意[事件名][字段名]都使用英文+数字的形式
|
|
799
|
+
/// </summary>
|
|
800
|
+
/// <param name="eventName">事件名</param>
|
|
801
|
+
/// <param name="map">携带的数据集合</param>
|
|
802
|
+
public virtual void Track(string eventName, KvMap map)
|
|
803
|
+
{
|
|
804
|
+
#if UNITY_EDITOR
|
|
805
|
+
if (SdkTestInUnity.Instance.TrackLogFlag)
|
|
806
|
+
{
|
|
807
|
+
//开启日志
|
|
808
|
+
Debug.Log(
|
|
809
|
+
$"<color=#{SdkDebug.BlueHex}> [SDK模拟] Track [eventName]:{eventName} [map]:{map.ToXJson()} 可从'TyphoonSDK/模拟测试'中修改</color>");
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
return;
|
|
813
|
+
#endif
|
|
814
|
+
_sdk.Track(eventName, map);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
/// <summary>
|
|
818
|
+
/// 单项事件上报<para/>
|
|
819
|
+
/// </summary>
|
|
820
|
+
/// <param name="eventName">事件名</param>
|
|
821
|
+
/// <param name="field">字段名</param>
|
|
822
|
+
/// <param name="value">携带的数据(可为空)</param>
|
|
823
|
+
public virtual void Track(string eventName, string field, object value = null)
|
|
824
|
+
{
|
|
825
|
+
var map = new KvMap()
|
|
826
|
+
{
|
|
827
|
+
{ field, value }
|
|
828
|
+
};
|
|
829
|
+
Track(eventName, map);
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
#endregion
|
|
743
833
|
}
|
|
744
834
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
using System.IO;
|
|
2
2
|
using TyphoonUnitySDK;
|
|
3
|
-
|
|
3
|
+
using UnityEngine;
|
|
4
4
|
#if UNITY_EDITOR
|
|
5
5
|
using UnityEditor;
|
|
6
6
|
#endif
|
|
7
|
-
using UnityEngine;
|
|
8
|
-
using UnityEngine.Serialization;
|
|
9
7
|
|
|
10
8
|
public class SdkTestInUnity : ScriptableObject
|
|
11
9
|
{
|
|
@@ -18,13 +16,17 @@ public class SdkTestInUnity : ScriptableObject
|
|
|
18
16
|
[LabelOverride("视频广告flag")] public bool GetVideoFlagResult = true;
|
|
19
17
|
[LabelOverride("视频广告回调")] public bool ShowVideoResult = true;
|
|
20
18
|
|
|
21
|
-
[
|
|
19
|
+
[LabelOverride("模拟小游戏端onShow,onHide")] public bool SimulateInvokeOnShow = true;
|
|
20
|
+
|
|
21
|
+
[Header("抖音小游戏相关")] [LabelOverride("是否支持侧边栏-回调结果")]
|
|
22
22
|
public bool IsSupportSideBarResult = true;
|
|
23
23
|
|
|
24
24
|
[LabelOverride("导航到侧边栏-回调结果")] public bool NavigateToSideBarResult = true;
|
|
25
25
|
|
|
26
26
|
[LabelOverride("侧边栏进入标记")] public bool IsEnterFromSideBar = true;
|
|
27
27
|
|
|
28
|
+
[LabelOverride("事件上报Log")] public bool TrackLogFlag = true;
|
|
29
|
+
|
|
28
30
|
|
|
29
31
|
private static SdkTestInUnity _instance = null;
|
|
30
32
|
|
|
@@ -38,7 +40,7 @@ public class SdkTestInUnity : ScriptableObject
|
|
|
38
40
|
_instance = AssetDatabase.LoadAssetAtPath<SdkTestInUnity>(ASSET_PATH);
|
|
39
41
|
if (_instance == null)
|
|
40
42
|
{
|
|
41
|
-
_instance =
|
|
43
|
+
_instance = CreateInstance<SdkTestInUnity>();
|
|
42
44
|
var folder = Path.GetDirectoryName(ASSET_PATH);
|
|
43
45
|
if (!Directory.Exists(folder))
|
|
44
46
|
{
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
|
|
4
|
+
namespace TyphoonUnitySDK
|
|
5
|
+
{
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// 模拟小游戏端onShow,onHide
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class SimulateOnShow : MonoSingleton<SimulateOnShow>
|
|
10
|
+
{
|
|
11
|
+
#if UNITY_EDITOR
|
|
12
|
+
private void OnApplicationFocus(bool hasFocus)
|
|
13
|
+
{
|
|
14
|
+
if (SdkTestInUnity.Instance.SimulateInvokeOnShow)
|
|
15
|
+
{
|
|
16
|
+
if (hasFocus)
|
|
17
|
+
{
|
|
18
|
+
Debug.Log($"<color=#{SdkDebug.BlueHex}>[SDK模拟]onShow 可从'TyphoonSDK/模拟测试'修改</color>");
|
|
19
|
+
SdkLite.InvokeOnShow();
|
|
20
|
+
}
|
|
21
|
+
else
|
|
22
|
+
{
|
|
23
|
+
Debug.Log($"<color=#{SdkDebug.BlueHex}>[SDK模拟]onHide 可从'TyphoonSDK/模拟测试'修改</color>");
|
|
24
|
+
SdkLite.InvokeOnHide();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
#endif
|
|
29
|
+
}
|
|
30
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.0.
|
|
1
|
+
{"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.0.44","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"}}
|