com.typhoon.unitysdk 1.1.14 → 1.1.15

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/CHANGELOG.md CHANGED
@@ -1,7 +1,13 @@
1
1
  # 更新日志
2
- ## [1.1.14] - 2025-08-09
2
+ ## [1.1.15] - 2025-08-09
3
3
 
4
4
  ### 修复
5
+ * 修复测试参数bug
6
+
7
+
8
+ ## [1.1.14] - 2025-08-09
9
+
10
+ ### 修复
5
11
  * 修复sdktestunity构建时间不对时的bug
6
12
 
7
13
 
@@ -18,7 +18,18 @@ namespace TyphoonUnitySDK
18
18
  public static Color Blue = new Color(0.02f, 0.49f, 0.84f, 0.8f);
19
19
  public static Color DarkBlue = new Color(0.05f, 0.33f, 0.61f, 1f);
20
20
 
21
- public static float HOLD_TIME = SdkTestInUnity.Instance.InteractiveHoldCloseTime;
21
+ public static float HOLD_TIME
22
+ {
23
+ get
24
+ {
25
+ if (SdkTestInUnity.HasInstance())
26
+ {
27
+ return SdkTestInUnity.Instance.InteractiveHoldCloseTime;
28
+ }
29
+
30
+ return 1.2f;
31
+ }
32
+ }
22
33
 
23
34
  public static string PathRoot => RuntimeUtil.GetPathRoot();
24
35
 
@@ -229,7 +240,6 @@ namespace TyphoonUnitySDK
229
240
  DrawViewTxtLabel(rectClose, "关闭");
230
241
  //悬停/关闭
231
242
  HoldHide(rectClose, ref HoldTime, Hide);
232
-
233
243
  var rectTitle = view;
234
244
  rectTitle.width = 300;
235
245
  rectTitle.height = 66;
@@ -292,15 +302,12 @@ namespace TyphoonUnitySDK
292
302
  var process = 1 - Mathf.Clamp01((CloseTime - Time.realtimeSinceStartup) / DURATION);
293
303
  var center = Vector2.Lerp(startCenter, endCenter, process);
294
304
  rectToast.center = center;
295
-
296
305
  var rectOutline = rectToast;
297
306
  rectOutline.width += 8;
298
307
  rectOutline.height += 8;
299
308
  rectOutline.center = rectToast.center;
300
-
301
309
  EditorGUI.DrawRect(rectOutline, DarkBlue);
302
310
  EditorGUI.DrawRect(rectToast, Blue);
303
-
304
311
  _labelStyle.fontSize = (int)(Mathf.Min(rectToast.width * 0.5f / Length, 48));
305
312
  GUI.Label(rectToast, $"弹出插页:{Scene}", _labelStyle);
306
313
  if (Time.realtimeSinceStartup > CloseTime)
@@ -360,29 +367,24 @@ namespace TyphoonUnitySDK
360
367
  rectYes.width = 346;
361
368
  rectYes.height = 80;
362
369
  rectYes.center = rect.center;
363
-
364
370
  var rectNo = rectYes;
365
371
  rectNo.y = rectYes.yMax;
366
372
  rectNo.y += 40;
367
-
368
373
  var rectTitle = rectYes;
369
374
  rectTitle.y = rectYes.yMin - rectTitle.height;
370
375
  rectTitle.y -= 40;
371
376
  var center = rectTitle.center;
372
377
  rectTitle.width = 500;
373
378
  rectTitle.center = center;
374
-
375
379
  var rectBg = new Rect();
376
380
  rectBg.width = rectTitle.width;
377
381
  rectBg.height = rectNo.yMax - rectTitle.yMin;
378
382
  rectBg.width += 20;
379
383
  rectBg.height += 20;
380
384
  rectBg.center = rect.center;
381
-
382
385
  EditorGUI.DrawRect(rect, Color.black * 0.7f);
383
386
  EditorGUI.DrawRect(rectBg, Blue);
384
387
 
385
-
386
388
  //失败返回
387
389
  DrawViewTxtLabel(rectYes, "成功返回");
388
390
  DrawViewTxtLabel(rectNo, "失败返回");
@@ -552,7 +554,6 @@ namespace TyphoonUnitySDK
552
554
  rectClose.y += 10;
553
555
  DrawViewTxtLabel(rectClose, "关闭");
554
556
  HoldHide(rectClose, ref HoldTime, Hide);
555
-
556
557
  var rectTitle = imageRect;
557
558
  rectTitle.width = 400;
558
559
  rectTitle.height = 128;
@@ -572,7 +573,6 @@ namespace TyphoonUnitySDK
572
573
  private void OnGUI()
573
574
  {
574
575
  #if UNITY_EDITOR
575
-
576
576
  var mode = GetMode();
577
577
  var rect = new Rect(0, 0, Screen.width, Screen.height);
578
578
  Banner.OnGUI(rect, mode);
@@ -89,80 +89,37 @@ public class SdkTestInUnity : ScriptableObject
89
89
  };
90
90
 
91
91
 
92
- // private static SdkTestInUnity _instance = null;
93
- //
94
- // public static SdkTestInUnity Instance
95
- // {
96
- // get
97
- // {
98
- // #if UNITY_EDITOR
99
- // if (_instance == null)
100
- // {
101
- // _instance = AssetDatabase.LoadAssetAtPath<SdkTestInUnity>(ASSET_PATH);
102
- // if (_instance == null)
103
- // {
104
- // _instance = CreateInstance<SdkTestInUnity>();
105
- // var folder = Path.GetDirectoryName(ASSET_PATH);
106
- // if (!Directory.Exists(folder))
107
- // {
108
- // Directory.CreateDirectory(folder);
109
- // AssetDatabase.Refresh();
110
- // }
111
- //
112
- // AssetDatabase.CreateAsset(_instance, ASSET_PATH);
113
- // AssetDatabase.Refresh();
114
- // }
115
- // }
116
- // #endif
117
- // return _instance;
118
- // }
119
- // }
120
-
121
92
  private static SdkTestInUnity _instance = null;
122
- private static bool _initialized = false;
93
+ private static object _lock = new object();
94
+ public static bool HasInstance() => _instance != null;
123
95
 
124
96
  public static SdkTestInUnity Instance
125
97
  {
126
98
  get
127
99
  {
128
100
  #if UNITY_EDITOR
129
- if (!_initialized)
101
+ if (_instance == null)
130
102
  {
131
- _initialized = true;
132
- InitializeInstance();
103
+ _instance = AssetDatabase.LoadAssetAtPath<SdkTestInUnity>(ASSET_PATH);
104
+ lock (_lock)
105
+ {
106
+ if (_instance == null)
107
+ {
108
+ _instance = CreateInstance<SdkTestInUnity>();
109
+ var folder = Path.GetDirectoryName(ASSET_PATH);
110
+ if (!Directory.Exists(folder))
111
+ {
112
+ Directory.CreateDirectory(folder);
113
+ AssetDatabase.Refresh();
114
+ }
115
+
116
+ AssetDatabase.CreateAsset(_instance, ASSET_PATH);
117
+ AssetDatabase.Refresh();
118
+ }
119
+ }
133
120
  }
134
121
  #endif
135
122
  return _instance;
136
123
  }
137
124
  }
138
-
139
-
140
- #if UNITY_EDITOR
141
- private static void InitializeInstance()
142
- {
143
- if (_instance != null) return;
144
- _instance = AssetDatabase.LoadAssetAtPath<SdkTestInUnity>(ASSET_PATH);
145
- if (_instance == null)
146
- {
147
- _instance = CreateInstance<SdkTestInUnity>();
148
- var folder = Path.GetDirectoryName(ASSET_PATH);
149
- if (!Directory.Exists(folder))
150
- {
151
- Directory.CreateDirectory(folder);
152
- AssetDatabase.Refresh();
153
- }
154
-
155
- AssetDatabase.CreateAsset(_instance, ASSET_PATH);
156
- AssetDatabase.SaveAssets();
157
- AssetDatabase.Refresh();
158
- }
159
- }
160
-
161
- [InitializeOnLoadMethod]
162
- private static void EditorInitialize()
163
- {
164
- // 确保在编辑器加载时初始化,但不会在静态构造函数里触发
165
- InitializeInstance();
166
- }
167
- #endif
168
125
  }
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.1.14","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"}],"version_log":"## [1.1.14] - 2025-08-09\r\n\r\n### 修复\n* 修复sdktestunity构建时间不对时的bug\r\n\r\n","major_flag":false,"write_time_stamp":1754672927000,"others":{"items":[]},"dependencies":{"com.unity.nuget.newtonsoft-json":"2.0.0"}}
1
+ {"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.1.15","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"}],"version_log":"## [1.1.15] - 2025-08-09\r\n\r\n### 修复\n* 修复测试参数bug\r\n\r\n","major_flag":false,"write_time_stamp":1754673872000,"others":{"items":[]},"dependencies":{"com.unity.nuget.newtonsoft-json":"2.0.0"}}