com.typhoon.unitysdk 1.0.2

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 (207) hide show
  1. package/Editor/AddressableSupport.cs +269 -0
  2. package/Editor/AddressableSupport.cs.meta +11 -0
  3. package/Editor/ApplyTool.cs +315 -0
  4. package/Editor/ApplyTool.cs.meta +11 -0
  5. package/Editor/EditorIcons.cs +113 -0
  6. package/Editor/EditorIcons.cs.meta +11 -0
  7. package/Editor/ExportModule.cs +218 -0
  8. package/Editor/ExportModule.cs.meta +11 -0
  9. package/Editor/InstallModule.cs +38 -0
  10. package/Editor/InstallModule.cs.meta +11 -0
  11. package/Editor/Interactive/SDKInteractiveUI.prefab +3026 -0
  12. package/Editor/Interactive/SDKInteractiveUI.prefab.meta +7 -0
  13. package/Editor/Interactive/sdk_banner.png +0 -0
  14. package/Editor/Interactive/sdk_banner.png.meta +144 -0
  15. package/Editor/Interactive/sdk_close.png +0 -0
  16. package/Editor/Interactive/sdk_close.png.meta +120 -0
  17. package/Editor/Interactive/sdk_inters.png +0 -0
  18. package/Editor/Interactive/sdk_inters.png.meta +120 -0
  19. package/Editor/Interactive/sdk_white_4x4.png +0 -0
  20. package/Editor/Interactive/sdk_white_4x4.png.meta +120 -0
  21. package/Editor/Interactive/sdk_/345/244/261/350/264/245/350/277/224/345/233/236.png +0 -0
  22. package/Editor/Interactive/sdk_/345/244/261/350/264/245/350/277/224/345/233/236.png.meta +120 -0
  23. package/Editor/Interactive/sdk_/346/202/254/346/265/256/345/271/277/345/221/212.png +0 -0
  24. package/Editor/Interactive/sdk_/346/202/254/346/265/256/345/271/277/345/221/212.png.meta +120 -0
  25. package/Editor/Interactive/sdk_/346/210/220/345/212/237/350/277/224/345/233/236.png +0 -0
  26. package/Editor/Interactive/sdk_/346/210/220/345/212/237/350/277/224/345/233/236.png.meta +120 -0
  27. package/Editor/Interactive/sdk_/350/277/231/346/230/257/344/270/200/344/270/252/345/216/237/347/224/237/346/250/241/346/235/277.png +0 -0
  28. package/Editor/Interactive/sdk_/350/277/231/346/230/257/344/270/200/344/270/252/345/216/237/347/224/237/346/250/241/346/235/277.png.meta +120 -0
  29. package/Editor/Interactive/sdk_/350/277/231/346/230/257/344/270/200/344/270/252/346/217/222/351/241/265/345/271/277/345/221/212.png +0 -0
  30. package/Editor/Interactive/sdk_/350/277/231/346/230/257/344/270/200/344/270/252/346/217/222/351/241/265/345/271/277/345/221/212.png.meta +120 -0
  31. package/Editor/Interactive/sdk_/350/277/231/346/230/257/344/270/200/344/270/252/350/247/206/351/242/221/345/271/277/345/221/212.png +0 -0
  32. package/Editor/Interactive/sdk_/350/277/231/346/230/257/344/270/200/344/270/252/350/247/206/351/242/221/345/271/277/345/221/212.png.meta +120 -0
  33. package/Editor/Interactive.meta +8 -0
  34. package/Editor/OnApplyProcessor.cs +22 -0
  35. package/Editor/OnApplyProcessor.cs.meta +11 -0
  36. package/Editor/OnBuildAAProcessor.cs +12 -0
  37. package/Editor/OnBuildAAProcessor.cs.meta +11 -0
  38. package/Editor/OnPublicProcessor.cs +12 -0
  39. package/Editor/OnPublicProcessor.cs.meta +11 -0
  40. package/Editor/OriginalStyles.cs +708 -0
  41. package/Editor/OriginalStyles.cs.meta +11 -0
  42. package/Editor/Preferences.cs +43 -0
  43. package/Editor/Preferences.cs.meta +11 -0
  44. package/Editor/PreferencesWindow.cs +178 -0
  45. package/Editor/PreferencesWindow.cs.meta +11 -0
  46. package/Editor/PropertyInspectorEditor.cs +6 -0
  47. package/Editor/PropertyInspectorEditor.cs.meta +11 -0
  48. package/Editor/PublishProcess.cs +13 -0
  49. package/Editor/PublishProcess.cs.meta +11 -0
  50. package/Editor/PublishResult.cs +17 -0
  51. package/Editor/PublishResult.cs.meta +11 -0
  52. package/Editor/PublishSetting.cs +111 -0
  53. package/Editor/PublishSetting.cs.meta +11 -0
  54. package/Editor/PublishSettingGUIDrawer.cs +412 -0
  55. package/Editor/PublishSettingGUIDrawer.cs.meta +11 -0
  56. package/Editor/PublishSettingInspector.cs +29 -0
  57. package/Editor/PublishSettingInspector.cs.meta +11 -0
  58. package/Editor/PublishTool.cs +137 -0
  59. package/Editor/PublishTool.cs.meta +11 -0
  60. package/Editor/PublishVivoBatSetting.cs +62 -0
  61. package/Editor/PublishVivoBatSetting.cs.meta +11 -0
  62. package/Editor/PublishVivoBatSettingInspector.cs +371 -0
  63. package/Editor/PublishVivoBatSettingInspector.cs.meta +11 -0
  64. package/Editor/PublishVivoBatSettingWindow.cs +69 -0
  65. package/Editor/PublishVivoBatSettingWindow.cs.meta +11 -0
  66. package/Editor/PublishWindow.cs +364 -0
  67. package/Editor/PublishWindow.cs.meta +11 -0
  68. package/Editor/SdkFont.otf +0 -0
  69. package/Editor/SdkFont.otf.meta +21 -0
  70. package/Editor/SdkTestInUnityEditor.cs +20 -0
  71. package/Editor/SdkTestInUnityEditor.cs.meta +11 -0
  72. package/Editor/SdkTestInUnityWindow.cs +37 -0
  73. package/Editor/SdkTestInUnityWindow.cs.meta +11 -0
  74. package/Editor/Skin.guiskin +2673 -0
  75. package/Editor/Skin.guiskin.meta +8 -0
  76. package/Editor/Skins.cs +26 -0
  77. package/Editor/Skins.cs.meta +11 -0
  78. package/Editor/StyleEditorWindow.cs +23 -0
  79. package/Editor/StyleEditorWindow.cs.meta +11 -0
  80. package/Editor/Styles.cs +52 -0
  81. package/Editor/Styles.cs.meta +11 -0
  82. package/Editor/StylesExtension.cs +25 -0
  83. package/Editor/StylesExtension.cs.meta +11 -0
  84. package/Editor/Texture/btn_active.png +0 -0
  85. package/Editor/Texture/btn_active.png.meta +120 -0
  86. package/Editor/Texture/btn_blue_active.png +0 -0
  87. package/Editor/Texture/btn_blue_active.png.meta +120 -0
  88. package/Editor/Texture/btn_blue_hover.png +0 -0
  89. package/Editor/Texture/btn_blue_hover.png.meta +120 -0
  90. package/Editor/Texture/btn_blue_normal.png +0 -0
  91. package/Editor/Texture/btn_blue_normal.png.meta +120 -0
  92. package/Editor/Texture/btn_green_active.png +0 -0
  93. package/Editor/Texture/btn_green_active.png.meta +120 -0
  94. package/Editor/Texture/btn_green_hover.png +0 -0
  95. package/Editor/Texture/btn_green_hover.png.meta +120 -0
  96. package/Editor/Texture/btn_green_normal.png +0 -0
  97. package/Editor/Texture/btn_green_normal.png.meta +120 -0
  98. package/Editor/Texture/btn_hover.png +0 -0
  99. package/Editor/Texture/btn_hover.png.meta +120 -0
  100. package/Editor/Texture/btn_normal.png +0 -0
  101. package/Editor/Texture/btn_normal.png.meta +120 -0
  102. package/Editor/Texture/btn_yellow_active.png +0 -0
  103. package/Editor/Texture/btn_yellow_active.png.meta +120 -0
  104. package/Editor/Texture/btn_yellow_hover.png +0 -0
  105. package/Editor/Texture/btn_yellow_hover.png.meta +120 -0
  106. package/Editor/Texture/btn_yellow_normal.png +0 -0
  107. package/Editor/Texture/btn_yellow_normal.png.meta +120 -0
  108. package/Editor/Texture/icon_android.png +0 -0
  109. package/Editor/Texture/icon_android.png.meta +120 -0
  110. package/Editor/Texture/icon_douyin.png +0 -0
  111. package/Editor/Texture/icon_douyin.png.meta +120 -0
  112. package/Editor/Texture/icon_download.png +0 -0
  113. package/Editor/Texture/icon_download.png.meta +120 -0
  114. package/Editor/Texture/icon_error.png +0 -0
  115. package/Editor/Texture/icon_error.png.meta +144 -0
  116. package/Editor/Texture/icon_extension.png +0 -0
  117. package/Editor/Texture/icon_extension.png.meta +120 -0
  118. package/Editor/Texture/icon_googleplay.png +0 -0
  119. package/Editor/Texture/icon_googleplay.png.meta +120 -0
  120. package/Editor/Texture/icon_html5.png +0 -0
  121. package/Editor/Texture/icon_html5.png.meta +120 -0
  122. package/Editor/Texture/icon_import.png +0 -0
  123. package/Editor/Texture/icon_import.png.meta +144 -0
  124. package/Editor/Texture/icon_ios.png +0 -0
  125. package/Editor/Texture/icon_ios.png.meta +120 -0
  126. package/Editor/Texture/icon_oppo.png +0 -0
  127. package/Editor/Texture/icon_oppo.png.meta +120 -0
  128. package/Editor/Texture/icon_refresh.png +0 -0
  129. package/Editor/Texture/icon_refresh.png.meta +120 -0
  130. package/Editor/Texture/icon_save.png +0 -0
  131. package/Editor/Texture/icon_save.png.meta +120 -0
  132. package/Editor/Texture/icon_success.png +0 -0
  133. package/Editor/Texture/icon_success.png.meta +144 -0
  134. package/Editor/Texture/icon_vivo.png +0 -0
  135. package/Editor/Texture/icon_vivo.png.meta +120 -0
  136. package/Editor/Texture/icon_wechat.png +0 -0
  137. package/Editor/Texture/icon_wechat.png.meta +120 -0
  138. package/Editor/Texture/tex_select.png +0 -0
  139. package/Editor/Texture/tex_select.png.meta +120 -0
  140. package/Editor/Texture.meta +8 -0
  141. package/Editor/UniEditor.cs +451 -0
  142. package/Editor/UniEditor.cs.meta +11 -0
  143. package/Editor/com.typhoon.unitysdk.editor.asmdef +20 -0
  144. package/Editor/com.typhoon.unitysdk.editor.asmdef.meta +7 -0
  145. package/Editor.meta +8 -0
  146. package/Runtime/AndroidInstance.cs +125 -0
  147. package/Runtime/AndroidInstance.cs.meta +11 -0
  148. package/Runtime/AppChannel.cs +55 -0
  149. package/Runtime/AppChannel.cs.meta +11 -0
  150. package/Runtime/AppConfig.cs +28 -0
  151. package/Runtime/AppConfig.cs.meta +11 -0
  152. package/Runtime/AppConfigAsset.cs +50 -0
  153. package/Runtime/AppConfigAsset.cs.meta +11 -0
  154. package/Runtime/BannerPosition.cs +11 -0
  155. package/Runtime/BannerPosition.cs.meta +11 -0
  156. package/Runtime/BaseSdk.cs +78 -0
  157. package/Runtime/BaseSdk.cs.meta +11 -0
  158. package/Runtime/Extension.cs +58 -0
  159. package/Runtime/Extension.cs.meta +11 -0
  160. package/Runtime/Interface.cs +115 -0
  161. package/Runtime/Interface.cs.meta +11 -0
  162. package/Runtime/MonoSingleton.cs +76 -0
  163. package/Runtime/MonoSingleton.cs.meta +11 -0
  164. package/Runtime/Resources/TYPHOON_SDK_TEST.prefab +45 -0
  165. package/Runtime/Resources/TYPHOON_SDK_TEST.prefab.meta +7 -0
  166. package/Runtime/Resources.meta +8 -0
  167. package/Runtime/SDKInteractiveUI.cs +353 -0
  168. package/Runtime/SDKInteractiveUI.cs.meta +11 -0
  169. package/Runtime/SdkDebug.cs +23 -0
  170. package/Runtime/SdkDebug.cs.meta +11 -0
  171. package/Runtime/SdkTestInUnity.cs +45 -0
  172. package/Runtime/SdkTestInUnity.cs.meta +11 -0
  173. package/Runtime/SessionItem.cs +72 -0
  174. package/Runtime/SessionItem.cs.meta +11 -0
  175. package/Runtime/SimpleMap.cs +11 -0
  176. package/Runtime/SimpleMap.cs.meta +11 -0
  177. package/Runtime/TestSdk.cs +22 -0
  178. package/Runtime/TestSdk.cs.meta +11 -0
  179. package/Runtime/TyphoonSdk.cs +407 -0
  180. package/Runtime/TyphoonSdk.cs.meta +11 -0
  181. package/Runtime/TyphoonSdkCallback.cs +48 -0
  182. package/Runtime/TyphoonSdkCallback.cs.meta +11 -0
  183. package/Runtime/VersionType.cs +33 -0
  184. package/Runtime/VersionType.cs.meta +11 -0
  185. package/Runtime/com.typhoon.unitysdk.asmdef +3 -0
  186. package/Runtime/com.typhoon.unitysdk.asmdef.meta +7 -0
  187. package/Runtime.meta +8 -0
  188. package/Sources~/ChinaAndroid/Assets/Plugins/Android/AndroidManifest.xml +18 -0
  189. package/Sources~/ChinaAndroid/Assets/Plugins/Android/AndroidManifest.xml.meta +7 -0
  190. package/Sources~/ChinaAndroid/Assets/Plugins/Android/libs/sdk_plug-release.aar +0 -0
  191. package/Sources~/ChinaAndroid/Assets/Plugins/Android/libs/sdk_plug-release.aar.meta +32 -0
  192. package/Sources~/ChinaAndroid/Assets/Plugins/Android/libs/unity_app-release.aar +0 -0
  193. package/Sources~/ChinaAndroid/Assets/Plugins/Android/libs/unity_app-release.aar.meta +32 -0
  194. package/Sources~/ChinaAndroid/Assets/Plugins/Android/libs/unity_launcher-release.aar +0 -0
  195. package/Sources~/ChinaAndroid/Assets/Plugins/Android/libs/unity_launcher-release.aar.meta +32 -0
  196. package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/ChinaAndroidSdk.cs +154 -0
  197. package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/ChinaAndroidSdk.cs.meta +11 -0
  198. package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/Editor/PublishChinaAndroidAAR.cs +56 -0
  199. package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/Editor/PublishChinaAndroidAAR.cs.meta +11 -0
  200. package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/Editor.meta +8 -0
  201. package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/Resources/TYPHOON_SDK_CHINA_ANDROID.prefab +45 -0
  202. package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/Resources/TYPHOON_SDK_CHINA_ANDROID.prefab.meta +7 -0
  203. package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/Resources.meta +8 -0
  204. package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid.meta +8 -0
  205. package/Sources~/Package//345/270/270/347/224/250/346/211/223/345/214/205/351/205/215/347/275/256.unitypackage +0 -0
  206. package/package.json +1 -0
  207. package/package.json.meta +7 -0
@@ -0,0 +1,353 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.IO;
4
+ using UnityEngine;
5
+ using UnityEngine.UI;
6
+ #if UNITY_EDITOR
7
+ using UnityEditor;
8
+ #endif
9
+
10
+ namespace TyphoonUnitySDK
11
+ {
12
+ /// <summary>
13
+ /// Unity交互式测试
14
+ /// </summary>
15
+ public class SDKInteractiveUI : MonoSingleton<SDKInteractiveUI>
16
+ {
17
+ public static string PathRoot
18
+ {
19
+ get
20
+ {
21
+ if (Directory.Exists("Assets/com.typhoon.unitysdk"))
22
+ {
23
+ return "Assets/com.typhoon.unitysdk";
24
+ }
25
+
26
+ return "Packages/com.typhoon.unitysdk";
27
+ }
28
+ }
29
+
30
+ /// <summary>
31
+ /// 横竖屏模式
32
+ /// </summary>
33
+ public enum ScreenMode
34
+ {
35
+ Landscape,
36
+ Portrait,
37
+ }
38
+
39
+ public ScreenMode Mode;
40
+
41
+ public BannerView Banner = new BannerView();
42
+ public IntersView Inters = new IntersView();
43
+ public VideoView Video = new VideoView();
44
+ public NativeView Native = new NativeView();
45
+ public FloatIconView FloatIcon = new FloatIconView();
46
+
47
+
48
+ protected override void Init()
49
+ {
50
+ base.Init();
51
+ DontDestroyOnLoad(gameObject);
52
+ Mode = Screen.width - Screen.height > 0 ? ScreenMode.Landscape : ScreenMode.Portrait;
53
+ Debug.Log($" {Screen.width},{Screen.height}");
54
+
55
+ //加载资源
56
+ #if UNITY_EDITOR
57
+ var path = $"{PathRoot}/Editor/Interactive/SDKInteractiveUI.prefab";
58
+ var source =
59
+ AssetDatabase.LoadAssetAtPath<GameObject>(path);
60
+ var clone = Instantiate(source);
61
+ Initialize(clone, Mode);
62
+ #endif
63
+ }
64
+
65
+ public void Initialize(GameObject source, ScreenMode mode)
66
+ {
67
+ DontDestroyOnLoad(source);
68
+ var root = source.transform;
69
+ var canvasScaler = root.GetComponent<CanvasScaler>();
70
+ canvasScaler.referenceResolution =
71
+ mode == ScreenMode.Landscape ? new Vector2(1920, 1080) : new Vector2(1080, 1920);
72
+ canvasScaler.matchWidthOrHeight = mode == ScreenMode.Landscape ? 1 : 0;
73
+ Banner.Initialize(root);
74
+ Video.Initialize(root);
75
+ Inters.Initialize(root);
76
+ Native.Initialize(root);
77
+ FloatIcon.Initialize(root);
78
+ }
79
+
80
+ public static void SetViewValid(CanvasGroup canvasGroup, bool isOn)
81
+ {
82
+ canvasGroup.alpha = isOn ? 1 : 0;
83
+ canvasGroup.blocksRaycasts = isOn;
84
+ }
85
+
86
+ public void ShowBanner(BannerPosition position)
87
+ {
88
+ Banner.Show(position);
89
+ }
90
+
91
+ public void HideBanner()
92
+ {
93
+ Banner.Hide();
94
+ }
95
+
96
+ public void ShowInters()
97
+ {
98
+ Inters.Show();
99
+ }
100
+
101
+ public void ShowVideo(Action success, Action<string> fail)
102
+ {
103
+ Video.Show(success, () => fail("fail"));
104
+ }
105
+
106
+
107
+ public void ShowFlatIcon(string scene, float spx, float spy)
108
+ {
109
+ FloatIcon.Show(scene, spx, spy);
110
+ }
111
+
112
+
113
+ public void HideFloatIcon(string scene)
114
+ {
115
+ FloatIcon.Hide(scene);
116
+ }
117
+
118
+ public void ShowNative()
119
+ {
120
+ Native.Show();
121
+ }
122
+
123
+ public void HideNative()
124
+ {
125
+ Native.Hide();
126
+ }
127
+
128
+ #region banner
129
+
130
+ public class BannerView
131
+ {
132
+ public CanvasGroup View;
133
+ public CanvasGroup Bottom;
134
+ public CanvasGroup Top;
135
+ public Button BtnCloseBottom;
136
+ public Button BtnCloseTop;
137
+
138
+ public void Initialize(Transform root)
139
+ {
140
+ View = root.Find("Banner").GetComponent<CanvasGroup>();
141
+ Bottom = root.Find("Banner/BannerBottom").GetComponent<CanvasGroup>();
142
+ Top = root.Find("Banner/BannerTop").GetComponent<CanvasGroup>();
143
+ BtnCloseBottom = root.Find("Banner/BannerBottom/BtnClose").GetComponent<Button>();
144
+ BtnCloseTop = root.Find("Banner/BannerTop/BtnClose").GetComponent<Button>();
145
+ BtnCloseBottom.onClick.AddListener(Hide);
146
+ BtnCloseTop.onClick.AddListener(Hide);
147
+ Hide();
148
+ }
149
+
150
+ public void Show(BannerPosition position)
151
+ {
152
+ SetViewValid(View, true);
153
+ SetViewValid(Bottom, position == BannerPosition.Bottom);
154
+ SetViewValid(Top, position == BannerPosition.Top);
155
+ }
156
+
157
+ public void Hide()
158
+ {
159
+ SetViewValid(View, false);
160
+ }
161
+ }
162
+
163
+ #endregion
164
+
165
+ #region inters
166
+
167
+ public class IntersView
168
+ {
169
+ public CanvasGroup View;
170
+ public Button BtnClose;
171
+
172
+ public void Initialize(Transform root)
173
+ {
174
+ View = root.Find("Inters").GetComponent<CanvasGroup>();
175
+ BtnClose = root.Find("Inters/Layout/BtnClose").GetComponent<Button>();
176
+ BtnClose.onClick.AddListener(Hide);
177
+ Hide();
178
+ }
179
+
180
+ public void Show()
181
+ {
182
+ SetViewValid(View, true);
183
+ }
184
+
185
+ public void Hide()
186
+ {
187
+ SetViewValid(View, false);
188
+ }
189
+ }
190
+
191
+ #endregion
192
+
193
+ #region Video
194
+
195
+ public class VideoView
196
+ {
197
+ public CanvasGroup View;
198
+ public Button BtnSuccess;
199
+ public Button BtnFail;
200
+ public Action OnSuccess;
201
+ public Action OnFail;
202
+
203
+ public void Initialize(Transform root)
204
+ {
205
+ View = root.Find("Video").GetComponent<CanvasGroup>();
206
+ BtnSuccess = root.Find("Video/BtnSuccess").GetComponent<Button>();
207
+ BtnFail = root.Find("Video/BtnFail").GetComponent<Button>();
208
+ BtnSuccess.onClick.AddListener(OnClickSuccess);
209
+ BtnFail.onClick.AddListener(OnClickFail);
210
+ Hide();
211
+ }
212
+
213
+ public void OnClickSuccess()
214
+ {
215
+ Hide();
216
+ OnSuccess?.Invoke();
217
+ }
218
+
219
+ public void OnClickFail()
220
+ {
221
+ Hide();
222
+ OnFail?.Invoke();
223
+ }
224
+
225
+ public void Show(Action success, Action fail)
226
+ {
227
+ OnSuccess = success;
228
+ OnFail = fail;
229
+ SetViewValid(View, true);
230
+ }
231
+
232
+
233
+ public void Hide()
234
+ {
235
+ SetViewValid(View, false);
236
+ }
237
+ }
238
+
239
+ #endregion
240
+
241
+ #region FloatIcon
242
+
243
+ public class FloatIconView
244
+ {
245
+ public Transform View;
246
+ public Dictionary<string, FloatIconItem> Items = new Dictionary<string, FloatIconItem>();
247
+ public GameObject Prefab;
248
+ public Transform RangeMin;
249
+ public Transform RangeMax;
250
+
251
+ public void Initialize(Transform root)
252
+ {
253
+ View = root;
254
+ Prefab = root.Find("FloatIcon").gameObject;
255
+ RangeMin = root.Find("RangeMin");
256
+ RangeMax = root.Find("RangeMax");
257
+ var prefabView = Prefab.GetComponent<CanvasGroup>();
258
+ SetViewValid(prefabView, false);
259
+ }
260
+
261
+ public void Show(string scene, float spx, float spy)
262
+ {
263
+ var x = Mathf.Lerp(RangeMin.position.x, RangeMax.position.x, spx);
264
+ var y = Mathf.Lerp(RangeMin.position.y, RangeMax.position.y, spy);
265
+ var pos = new Vector3(x, y, View.transform.position.z);
266
+ if (Items.TryGetValue(scene, out var match))
267
+ {
268
+ match.Show(pos);
269
+ }
270
+ else
271
+ {
272
+ var clone = Instantiate(Prefab, View);
273
+ var item = FloatIconItem.Create(scene, clone);
274
+ Items.Add(scene, item);
275
+ item.Show(pos);
276
+ }
277
+ }
278
+
279
+ public void Hide(string scene)
280
+ {
281
+ if (Items.TryGetValue(scene, out var match))
282
+ {
283
+ match.Hide();
284
+ }
285
+ }
286
+ }
287
+
288
+ public class FloatIconItem
289
+ {
290
+ public string SceneName;
291
+ public CanvasGroup View;
292
+ public Button BtnClose;
293
+
294
+ public static FloatIconItem Create(string scene, GameObject prefab)
295
+ {
296
+ var result = new FloatIconItem();
297
+ result.SceneName = scene;
298
+ result.View = prefab.GetComponent<CanvasGroup>();
299
+ result.Initialize();
300
+ return result;
301
+ }
302
+
303
+ public void Initialize()
304
+ {
305
+ BtnClose = View.gameObject.GetComponentInChildren<Button>();
306
+ BtnClose.onClick.AddListener(Hide);
307
+ }
308
+
309
+
310
+ public void Hide()
311
+ {
312
+ SetViewValid(View, false);
313
+ }
314
+
315
+
316
+ public void Show(Vector3 pos)
317
+ {
318
+ View.transform.position = pos;
319
+ SetViewValid(View, true);
320
+ }
321
+ }
322
+
323
+ #endregion
324
+
325
+ #region Native
326
+
327
+ public class NativeView
328
+ {
329
+ public CanvasGroup View;
330
+ public Button BtnClose;
331
+
332
+ public void Initialize(Transform root)
333
+ {
334
+ View = root.Find("Native").GetComponent<CanvasGroup>();
335
+ BtnClose = root.Find("Native/Mask/BtnClose").GetComponent<Button>();
336
+ BtnClose.onClick.AddListener(Hide);
337
+ Hide();
338
+ }
339
+
340
+ public void Show()
341
+ {
342
+ SetViewValid(View, true);
343
+ }
344
+
345
+ public void Hide()
346
+ {
347
+ SetViewValid(View, false);
348
+ }
349
+ }
350
+
351
+ #endregion
352
+ }
353
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 67dcdd39c6f5c2f4fb1b6bff4176a20b
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,23 @@
1
+ using UnityEngine;
2
+
3
+ namespace TyphoonUnitySDK
4
+ {
5
+ /// <summary>
6
+ /// SDK 日志输出
7
+ /// </summary>
8
+ public class SdkDebug
9
+ {
10
+ public static bool IsDebug = true;
11
+ public static string Prefix = "##typhoon-unity-sdk:";
12
+
13
+ public static void Log(string message)
14
+ {
15
+ if (!IsDebug)
16
+ {
17
+ return;
18
+ }
19
+
20
+ Debug.Log($"{Prefix}{message}");
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 917e90f3d015efa41b2f18bf5e006d57
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,45 @@
1
+ using System.IO;
2
+
3
+ #if UNITY_EDITOR
4
+ using UnityEditor;
5
+ #endif
6
+ using UnityEngine;
7
+
8
+ public class SdkTestInUnity : ScriptableObject
9
+ {
10
+ private const string ASSET_PATH = "Assets/Typhoon_Gen/TyphoonSDK/Editor/SdkTestInUnity.asset";
11
+
12
+ [Header("登录回调")] public bool LoginResult = true;
13
+ [Header("是否支持ExitGame")] public bool IsSupportExitGame = true;
14
+ [Header("开启交互式测试")] public bool OpenInteractive = true;
15
+ [Header("视频广告回调")] public bool ShowVideoResult = true;
16
+
17
+ private static SdkTestInUnity _instance = null;
18
+
19
+ public static SdkTestInUnity Instance
20
+ {
21
+ get
22
+ {
23
+ #if UNITY_EDITOR
24
+ if (_instance == null)
25
+ {
26
+ _instance = AssetDatabase.LoadAssetAtPath<SdkTestInUnity>(ASSET_PATH);
27
+ if (_instance == null)
28
+ {
29
+ _instance = ScriptableObject.CreateInstance<SdkTestInUnity>();
30
+ var folder = Path.GetDirectoryName(ASSET_PATH);
31
+ if (!Directory.Exists(folder))
32
+ {
33
+ Directory.CreateDirectory(folder);
34
+ AssetDatabase.Refresh();
35
+ }
36
+
37
+ AssetDatabase.CreateAsset(_instance, ASSET_PATH);
38
+ AssetDatabase.Refresh();
39
+ }
40
+ }
41
+ #endif
42
+ return _instance;
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 4399a68b09288de4da43388787dd4fed
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,72 @@
1
+ using Newtonsoft.Json.Linq;
2
+ using System;
3
+ using System.Collections.Generic;
4
+
5
+ namespace TyphoonUnitySDK
6
+ {
7
+ [Serializable]
8
+ public class SessionItem
9
+ {
10
+ #region 静态
11
+
12
+ /*session map*/
13
+ public static Dictionary<long, SessionItem> SessionsMap = new Dictionary<long, SessionItem>();
14
+
15
+ /*处理回调*/
16
+ public static void Invoke(long session, string json)
17
+ {
18
+ if (SessionsMap.TryGetValue(session, out var match))
19
+ {
20
+ match.OnExecute?.Invoke(json);
21
+ match.Dispose();
22
+ }
23
+ }
24
+
25
+
26
+ public static long _sessionId = 0;
27
+
28
+ #endregion
29
+
30
+ /*SessionID*/
31
+ public readonly long SessionId;
32
+
33
+ /*方法名*/
34
+ public readonly string MethodName;
35
+
36
+ /*数据*/
37
+ private object _sendData;
38
+
39
+ /*回调*/
40
+ private Action<string> _onExecute;
41
+
42
+ public object SendData => _sendData;
43
+
44
+ /*回调逻辑*/
45
+ public Action<string> OnExecute => _onExecute;
46
+
47
+ public SessionItem(string method, object sendData, Action<string> cb)
48
+ {
49
+ _sessionId += 1;
50
+ SessionId = _sessionId;
51
+ MethodName = method;
52
+ _sendData = sendData;
53
+ _onExecute = cb;
54
+ if (_onExecute != null)
55
+ {
56
+ //有回调,绑定到SessionsMap
57
+ SessionsMap.Add(SessionId, this);
58
+ }
59
+ }
60
+
61
+ public long GetSession()
62
+ {
63
+ return SessionId;
64
+ }
65
+
66
+ public void Dispose()
67
+ {
68
+ _sendData = null;
69
+ _onExecute = null;
70
+ }
71
+ }
72
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: aebcc63dc92e29d498e66925343f7747
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,11 @@
1
+ using System.Collections.Generic;
2
+
3
+ namespace TyphoonUnitySDK
4
+ {
5
+ /// <summary>
6
+ /// 简单键值
7
+ /// </summary>
8
+ public class SimpleMap : Dictionary<string, object>
9
+ {
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 6b133edd5a1d82d46ad53cb85b9873ee
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,22 @@
1
+ using System;
2
+
3
+ namespace TyphoonUnitySDK
4
+ {
5
+ public class TestSdk : BaseSdk
6
+ {
7
+ public override void OnCreate()
8
+ {
9
+ DontDestroyOnLoad(gameObject);
10
+ }
11
+
12
+ public override void InitSdk(Action success, Action<string> fail)
13
+ {
14
+ success?.Invoke();
15
+ }
16
+
17
+ public override void Login(Action success, Action<string> fail)
18
+ {
19
+ success?.Invoke();
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: c2fd32a072371b04b84c786471b7723a
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: