From f4a702e212d1853735f8dae399da69d23bfa510e Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 26 三月 2026 18:16:16 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into h5version
---
Main/System/UIBase/UIBase.cs | 128 +++++++++++-------------------------------
1 files changed, 33 insertions(+), 95 deletions(-)
diff --git a/Main/System/UIBase/UIBase.cs b/Main/System/UIBase/UIBase.cs
index b4e444f..0444e74 100644
--- a/Main/System/UIBase/UIBase.cs
+++ b/Main/System/UIBase/UIBase.cs
@@ -127,7 +127,8 @@
}
catch (Exception e)
{
- Debug.LogError($"{uiName}鐣岄潰鐨処nitComponentInternal鎶ラ敊: message: {e.Message} \nStackTrace: {e.StackTrace}");
+ Debug.LogError($"{uiName}鐣岄潰鐨処nitComponentInternal鎶ラ敊: {e.StackTrace}");
+ OperationLogCollect.Instance.BugReportSys(e.ToString(), "10002");
}
try
@@ -136,7 +137,8 @@
}
catch (Exception e)
{
- Debug.LogError($"{uiName}鐣岄潰鐨処nitComponent鎶ラ敊: message: {e.Message} \nStackTrace: {e.StackTrace}");
+ Debug.LogError($"{uiName}鐣岄潰鐨処nitComponent鎶ラ敊: {e.StackTrace}");
+ OperationLogCollect.Instance.BugReportSys(e.ToString(), "10002");
}
// 淇濆瓨鍘熷鍊肩敤浜庡姩鐢�
@@ -144,8 +146,9 @@
{
if (Screen.height / Screen.width > 1.8)//瀹藉睆闇�瑕侀�傞厤
{
- _rectTransform.offsetMax = new Vector2(0, -SafeHeightUp); //涓�
- _rectTransform.offsetMin = new Vector2(0, SafeHeightDown); //涓�
+ //涓婁笅鍚勯棿闅擲afeWidth
+ _rectTransform.offsetMax = new Vector2(0, -SafeHeightUp); //涓�
+ _rectTransform.offsetMin = new Vector2(0, SafeHeightDown); //涓�
}
originalPosition = _rectTransform.anchoredPosition;
}
@@ -175,7 +178,6 @@
{
//寤惰繜x甯у悗鍙偣鍑�,闃叉鐐瑰嚮杩囧揩绔嬪嵆鍏抽棴浜�
await UniTask.Delay(200);
- if (this == null) return; // destroyed during await
btnClickEmptyClose.enabled = true;
}
}
@@ -204,10 +206,10 @@
btnClickEmptyClose.enabled = false;
}
+
protected async void ExecuteNextFrame(Action _action)
{
await UniTask.DelayFrame(1);
- if (this == null) return; // destroyed during await
_action?.Invoke();
}
@@ -272,10 +274,7 @@
// 璁剧疆UI灞傜骇
public void SetSortingOrder(int order)
{
- if (canvas == null)
- canvas = GetComponent<Canvas>();
- if (canvas != null)
- canvas.sortingOrder = order;
+ canvas.sortingOrder = order;
}
protected virtual void OnPreOpen()
@@ -309,7 +308,8 @@
}
catch (Exception e)
{
- Debug.LogError($"{uiName}鐣岄潰鐨凮nPreOpen鎶ラ敊: message: {e.Message} \nStackTrace: {e.StackTrace}");
+ Debug.LogError($"{uiName}鐣岄潰鐨凮nPreOpen鎶ラ敊: {e.StackTrace}");
+ OperationLogCollect.Instance.BugReportSys(e.ToString(), "10002");
}
StopCurrentAnimation();
@@ -330,15 +330,11 @@
}
catch (Exception e)
{
- Debug.LogError($"{uiName}鐣岄潰鐨凮nOpen鎶ラ敊: message: {e.Message} \nStackTrace: {e.StackTrace}");
+ Debug.LogError($"{uiName}鐣岄潰鐨凮nOpen鎶ラ敊: {e.StackTrace}");
+ OperationLogCollect.Instance.BugReportSys(e.ToString(), "10002");
}
- ApplyClickEmptySpaceClose().Forget();
-
-#if UNITY_WEBGL
- // WebGL 璇婃柇锛氭娴� Image 缁勪欢鐨� sprite 鏄惁涓� null
- DiagCheckImageSprites();
-#endif
+ ApplyClickEmptySpaceClose();
ExecuteNextFrame(() =>
{
@@ -352,7 +348,8 @@
}
catch (Exception e)
{
- Debug.LogError($"{uiName}鐣岄潰鐨凬extFrameAfterOpen鎶ラ敊: message: {e.Message} \nStackTrace: {e.StackTrace}");
+ Debug.LogError($"{uiName}鐣岄潰鐨凬extFrameAfterOpen鎶ラ敊: {e.StackTrace}");
+ OperationLogCollect.Instance.BugReportSys(e.ToString(), "10002");
}
});
}
@@ -361,75 +358,6 @@
{
}
-
-#if UNITY_WEBGL
- /// <summary>
- /// WebGL 璇婃柇锛氭娴嬫墍鏈� Image 瀛愮粍浠剁殑 sprite 鐘舵�併��
- /// 鐢ㄤ簬鎺掓煡 WebGL 鏋勫缓涓� Image 璧勬簮涓㈠け鐨勯棶棰樸��
- /// </summary>
- private void DiagCheckImageSprites()
- {
- var images = GetComponentsInChildren<Image>(true);
- int nullCount = 0;
- int totalCount = images.Length;
- var sb = new System.Text.StringBuilder();
-
- foreach (var img in images)
- {
- if (img.sprite == null && img.overrideSprite == null)
- {
- // 璺宠繃 Color-only 鎴� mask 鐢ㄩ�旂殑 Image锛堟棤闇� sprite锛�
- if (img.type == Image.Type.Simple && img.color.a < 0.01f)
- continue;
-
- nullCount++;
- string path = GetTransformPath(img.transform);
- sb.AppendLine($" [NULL sprite] {path} (type={img.type}, raycast={img.raycastTarget})");
- }
- }
-
- var rawImages = GetComponentsInChildren<RawImage>(true);
- int rawNullCount = 0;
- foreach (var ri in rawImages)
- {
- if (ri.texture == null)
- {
- rawNullCount++;
- string path = GetTransformPath(ri.transform);
- sb.AppendLine($" [NULL texture] RawImage: {path}");
- }
- }
-
- if (nullCount > 0 || rawNullCount > 0)
- {
- Debug.LogWarning($"[UIBase][SpriteDiag] {uiName}: {nullCount}/{totalCount} Image sprites NULL, {rawNullCount} RawImage textures NULL\n{sb}");
- }
- else
- {
- Debug.Log($"[UIBase][SpriteDiag] {uiName}: All {totalCount} Image sprites OK");
- }
-
- // 妫�鏌� Canvas 鐘舵��
- if (canvas != null)
- {
- Debug.Log($"[UIBase][SpriteDiag] {uiName} Canvas: renderMode={canvas.renderMode}, worldCamera={(canvas.worldCamera != null ? canvas.worldCamera.name : "NULL")}, sortingOrder={canvas.sortingOrder}");
- }
- }
-
- private string GetTransformPath(Transform t)
- {
- string path = t.name;
- Transform parent = t.parent;
- int depth = 0;
- while (parent != null && parent != transform && depth < 10)
- {
- path = parent.name + "/" + path;
- parent = parent.parent;
- depth++;
- }
- return path;
- }
-#endif
// 鍏抽棴UI - 淇敼鍚庣殑鏂规硶
public void HandleClose()
@@ -446,7 +374,8 @@
}
catch (Exception e)
{
- Debug.LogError($"{uiName}鐣岄潰鐨凮nPreClose鎶ラ敊: message: {e.Message} \nStackTrace: {e.StackTrace}");
+ Debug.LogError($"{uiName}鐣岄潰鐨凮nPreClose鎶ラ敊: {e.StackTrace}");
+ OperationLogCollect.Instance.BugReportSys(e.ToString(), "10002");
}
StopCurrentAnimation();
@@ -467,7 +396,8 @@
}
catch (Exception e)
{
- Debug.LogError($"{uiName}鐣岄潰鐨凮nClose鎶ラ敊: message: {e.Message} \nStackTrace: {e.StackTrace}");
+ Debug.LogError($"{uiName}鐣岄潰鐨凮nClose鎶ラ敊: {e.StackTrace}");
+ OperationLogCollect.Instance.BugReportSys(e.ToString(), "10002");
}
if (closeAnimationType == UIAnimationType.None)
@@ -478,7 +408,8 @@
}
catch (Exception e)
{
- Debug.LogError($"{uiName}鐣岄潰鐨凜ompleteClose鎶ラ敊: message: {e.Message} \nStackTrace: {e.StackTrace}");
+ Debug.LogError($"{uiName}鐣岄潰鐨凜ompleteClose鎶ラ敊: {e.StackTrace}");
+ OperationLogCollect.Instance.BugReportSys(e.ToString(), "10002");
}
}
// 鍚﹀垯鍦ㄥ姩鐢诲畬鎴愬悗绂佺敤娓告垙瀵硅薄锛堝湪PlayCloseAnimation涓鐞嗭級
@@ -499,7 +430,6 @@
public async UniTask DelayCloseWindow(int delayTime = 30)
{
await UniTask.Delay(delayTime);
- if (this == null) return; // destroyed during await
CloseWindow();
}
@@ -564,6 +494,11 @@
public bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera)
{
return raycastTarget;
+ }
+
+ public CanvasGroup GetCanvasGroup()
+ {
+ return canvasGroup;
}
#region 鍔ㄧ敾鏂规硶
@@ -747,7 +682,8 @@
}
catch (System.Exception e)
{
- Debug.LogError($"鎾斁鎵撳紑鍔ㄧ敾鏃跺嚭閿�: message: {e.Message} \nStackTrace: {e.StackTrace}");
+ Debug.LogError($"鎾斁鎵撳紑鍔ㄧ敾鏃跺嚭閿�: {e.StackTrace}");
+ OperationLogCollect.Instance.BugReportSys(e.ToString(), "10002");
// 鍑洪敊鏃剁‘淇漊I鍙骞跺彲浜や簰
if (canvasGroup != null)
@@ -870,7 +806,8 @@
}
catch (Exception e)
{
- Debug.LogError($"{uiName}鐣岄潰鐨凜ompleteClose鎶ラ敊: message: {e.Message} \nStackTrace: {e.StackTrace}");
+ Debug.LogError($"{uiName}鐣岄潰鐨凜ompleteClose鎶ラ敊: {e.StackTrace}");
+ OperationLogCollect.Instance.BugReportSys(e.ToString(), "10002");
}
}
});
@@ -879,7 +816,8 @@
}
catch (System.Exception e)
{
- Debug.LogError($"鎾斁鍏抽棴鍔ㄧ敾鏃跺嚭閿�: message: {e.Message} \nStackTrace: {e.StackTrace}");
+ Debug.LogError($"鎾斁鍏抽棴鍔ㄧ敾鏃跺嚭閿�: {e.StackTrace}");
+ OperationLogCollect.Instance.BugReportSys(e.ToString(), "10002");
// 鍑洪敊鏃剁洿鎺ュ畬鎴愬叧闂�
isAnimating = false;
--
Gitblit v1.8.0