Kaynağa Gözat

ui层级+鼠标防抖

lvjincheng 3 yıl önce
ebeveyn
işleme
0b9d3ea001

+ 4 - 17
Assets/BowArrow/Prefabs/Views/HomeView.prefab

@@ -2267,7 +2267,7 @@ RectTransform:
   m_GameObject: {fileID: 3572727387850533746}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1.0718696, y: 1.0718696, z: 1.0718696}
+  m_LocalScale: {x: 1, y: 1, z: 1}
   m_Children: []
   m_Father: {fileID: 7022781866214807768}
   m_RootOrder: 0
@@ -2680,9 +2680,9 @@ RectTransform:
   m_Father: {fileID: 3890223726825215840}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
-  m_AnchorMin: {x: 0, y: 0}
-  m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 0, y: 0}
+  m_AnchorMin: {x: 0, y: 1}
+  m_AnchorMax: {x: 0, y: 1}
+  m_AnchoredPosition: {x: 0, y: -20}
   m_SizeDelta: {x: 0, y: 40}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &5099759915330397004
@@ -5128,7 +5128,6 @@ GameObject:
   - component: {fileID: 7022781866214807766}
   - component: {fileID: 7022781866214807767}
   - component: {fileID: 7022781866214807771}
-  - component: {fileID: 6979062212254282906}
   m_Layer: 5
   m_Name: HomeView
   m_TagString: Untagged
@@ -5244,18 +5243,6 @@ MonoBehaviour:
   btnConnectBow: {fileID: 2317149572522622741}
   btnConnectArrow: {fileID: 6288584047694721992}
   friendTip: {fileID: 4438778746566285403}
---- !u!114 &6979062212254282906
-MonoBehaviour:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 7022781866214807764}
-  m_Enabled: 1
-  m_EditorHideFlags: 0
-  m_Script: {fileID: 11500000, guid: 7d5537aa9ca86e740ad36eafb2fda1a2, type: 3}
-  m_Name: 
-  m_EditorClassIdentifier: 
 --- !u!1 &7407283733132541178
 GameObject:
   m_ObjectHideFlags: 0

+ 0 - 13
Assets/BowArrow/Resources/Prefabs/Views/ChallengeOptionView.prefab

@@ -1071,7 +1071,6 @@ GameObject:
   - component: {fileID: 4507770291199562699}
   - component: {fileID: 4507770291199562696}
   - component: {fileID: 4507770291199562697}
-  - component: {fileID: 4507770291199562742}
   - component: {fileID: 2126783892981292974}
   m_Layer: 5
   m_Name: ChallengeOptionView
@@ -1165,18 +1164,6 @@ MonoBehaviour:
   m_BlockingMask:
     serializedVersion: 2
     m_Bits: 4294967295
---- !u!114 &4507770291199562742
-MonoBehaviour:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 4507770291199562740}
-  m_Enabled: 1
-  m_EditorHideFlags: 0
-  m_Script: {fileID: 11500000, guid: 7d5537aa9ca86e740ad36eafb2fda1a2, type: 3}
-  m_Name: 
-  m_EditorClassIdentifier: 
 --- !u!114 &2126783892981292974
 MonoBehaviour:
   m_ObjectHideFlags: 0

+ 1 - 14
Assets/BowArrow/Resources/Prefabs/Views/CourseView.prefab

@@ -508,7 +508,7 @@ RectTransform:
   m_GameObject: {fileID: 5822578836178350386}
   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1.2228259, y: 1.2228259, z: 1.2228259}
+  m_LocalScale: {x: 1, y: 1, z: 1}
   m_Children: []
   m_Father: {fileID: 5822578837464263678}
   m_RootOrder: 0
@@ -937,7 +937,6 @@ GameObject:
   - component: {fileID: 5822578837464263665}
   - component: {fileID: 5822578837464263664}
   - component: {fileID: 5822578837464263667}
-  - component: {fileID: 5822578837464263666}
   - component: {fileID: 5822578837464263679}
   m_Layer: 5
   m_Name: CourseView
@@ -1029,18 +1028,6 @@ MonoBehaviour:
   m_BlockingMask:
     serializedVersion: 2
     m_Bits: 4294967295
---- !u!114 &5822578837464263666
-MonoBehaviour:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 5822578837464263669}
-  m_Enabled: 1
-  m_EditorHideFlags: 0
-  m_Script: {fileID: 11500000, guid: 7d5537aa9ca86e740ad36eafb2fda1a2, type: 3}
-  m_Name: 
-  m_EditorClassIdentifier: 
 --- !u!114 &5822578837464263679
 MonoBehaviour:
   m_ObjectHideFlags: 0

+ 0 - 13
Assets/BowArrow/Resources/Prefabs/Views/RoleSelectView.prefab

@@ -1499,7 +1499,6 @@ GameObject:
   - component: {fileID: 4507770291199562699}
   - component: {fileID: 4507770291199562696}
   - component: {fileID: 4507770291199562697}
-  - component: {fileID: 4507770291199562742}
   - component: {fileID: 4507770291199562743}
   m_Layer: 5
   m_Name: RoleSelectView
@@ -1595,18 +1594,6 @@ MonoBehaviour:
   m_BlockingMask:
     serializedVersion: 2
     m_Bits: 4294967295
---- !u!114 &4507770291199562742
-MonoBehaviour:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 4507770291199562740}
-  m_Enabled: 1
-  m_EditorHideFlags: 0
-  m_Script: {fileID: 11500000, guid: 7d5537aa9ca86e740ad36eafb2fda1a2, type: 3}
-  m_Name: 
-  m_EditorClassIdentifier: 
 --- !u!114 &4507770291199562743
 MonoBehaviour:
   m_ObjectHideFlags: 0

+ 7 - 20
Assets/BowArrow/Resources/Prefabs/Views/SetUpView.prefab

@@ -2124,9 +2124,9 @@ RectTransform:
   m_Father: {fileID: 243481542007038700}
   m_RootOrder: 3
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
-  m_AnchorMin: {x: 0, y: 0}
-  m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 129.20532, y: 0}
+  m_AnchorMin: {x: 0, y: 1}
+  m_AnchorMax: {x: 0, y: 1}
+  m_AnchoredPosition: {x: 105, y: -15}
   m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 0, y: 0.5}
 --- !u!222 &2075870506722154811
@@ -2461,9 +2461,9 @@ RectTransform:
   m_Father: {fileID: 243481542007038700}
   m_RootOrder: 1
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
-  m_AnchorMin: {x: 0, y: 0}
-  m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 45, y: 0}
+  m_AnchorMin: {x: 0, y: 1}
+  m_AnchorMax: {x: 0, y: 1}
+  m_AnchoredPosition: {x: 45, y: -15}
   m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 0, y: 0.5}
 --- !u!222 &4646865985747465999
@@ -3336,7 +3336,6 @@ GameObject:
   - component: {fileID: 8963406415416676179}
   - component: {fileID: 8963406415416676178}
   - component: {fileID: 8963406415416676013}
-  - component: {fileID: 8963406415416676012}
   - component: {fileID: 8963406415416676177}
   m_Layer: 5
   m_Name: SetUpView
@@ -3429,18 +3428,6 @@ MonoBehaviour:
   m_BlockingMask:
     serializedVersion: 2
     m_Bits: 4294967295
---- !u!114 &8963406415416676012
-MonoBehaviour:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 8963406415416676015}
-  m_Enabled: 1
-  m_EditorHideFlags: 0
-  m_Script: {fileID: 11500000, guid: 7d5537aa9ca86e740ad36eafb2fda1a2, type: 3}
-  m_Name: 
-  m_EditorClassIdentifier: 
 --- !u!114 &8963406415416676177
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -5069,7 +5056,7 @@ RectTransform:
   m_GameObject: {fileID: 8963406417100636762}
   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1.0281655, y: 1.0281655, z: 1.0281655}
+  m_LocalScale: {x: 1, y: 1, z: 1}
   m_Children: []
   m_Father: {fileID: 8963406415416676176}
   m_RootOrder: 0

+ 1 - 14
Assets/BowArrow/Resources/Prefabs/Views/ShopView.prefab

@@ -1622,7 +1622,7 @@ RectTransform:
   m_GameObject: {fileID: 638615969873357894}
   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1.1175702, y: 1.1175702, z: 1.1175702}
+  m_LocalScale: {x: 1, y: 1, z: 1}
   m_Children: []
   m_Father: {fileID: 638615970608789911}
   m_RootOrder: 0
@@ -2334,7 +2334,6 @@ GameObject:
   - component: {fileID: 638615970608789904}
   - component: {fileID: 638615970608789905}
   - component: {fileID: 638615970608789906}
-  - component: {fileID: 638615970608789907}
   - component: {fileID: 638615970608789910}
   m_Layer: 5
   m_Name: ShopView
@@ -2434,18 +2433,6 @@ MonoBehaviour:
   m_BlockingMask:
     serializedVersion: 2
     m_Bits: 4294967295
---- !u!114 &638615970608789907
-MonoBehaviour:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 638615970608789916}
-  m_Enabled: 1
-  m_EditorHideFlags: 0
-  m_Script: {fileID: 11500000, guid: 7d5537aa9ca86e740ad36eafb2fda1a2, type: 3}
-  m_Name: 
-  m_EditorClassIdentifier: 
 --- !u!114 &638615970608789910
 MonoBehaviour:
   m_ObjectHideFlags: 0

+ 12 - 7
Assets/BowArrow/Scripts/Expand/SB_EventSystem.cs

@@ -89,7 +89,7 @@ public class SB_EventSystem : MonoBehaviour
         Quaternion nowAxisQuat;
         bool hasAxisQuat;
         public void MoveSimulateMouse(Quaternion axisQuat) {
-            if (clickCooling) { //点击就是射出,射出会产生抖动,防止接收抖动后的数据
+            if (IsClickMouseCooling()) { //点击就是射出,射出会产生抖动,防止接收抖动后的数据
                 hasAxisQuat = false;
                 return;
             } 
@@ -147,13 +147,18 @@ public class SB_EventSystem : MonoBehaviour
     #endregion 模拟鼠标移动
 
     //点击鼠标
-    bool clickCooling = false; //防止高频连续多次点击
+    float _lastClickMouseTime = -100;
+    void RecordClickMouseTime() {
+        _lastClickMouseTime = Time.realtimeSinceStartup;
+    }
+    bool IsClickMouseCooling() { //防止高频连续多次点击
+        return Time.realtimeSinceStartup - _lastClickMouseTime < 1;
+    }
     public void ClickMouse() {
-        if (clickCooling) return;
-        clickCooling = true;
-        DoTweenUtil.CallDelay(0.3f, () => {
-            clickCooling = false;
-        });
+        AimHandler.ins._9Axis.axisCSBridge.o09AxisCS.OnShot(100, 100, 100000);
+        bool isCooling = IsClickMouseCooling();
+        RecordClickMouseTime();
+        if (isCooling) return;
         simulateMouse.ClickMousePointer();
     }
 

+ 7 - 1
Assets/BowArrow/Scripts/View/ChallengeOptionView.cs

@@ -8,11 +8,13 @@ public class ChallengeOptionView : MonoBehaviour, MenuBackInterface
     void Start() {
         HomeMgr.CacheView(this);
         PersistenHandler.ins?.menuBackCtr.views.Add(this);
+        TopBarView.NeedShowIt(this);
     }
 
     void OnDestroy() {
         HomeMgr.RemoveCacheView(this);
         PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+        TopBarView.DontNeedShowIt(this);
     }
 
     public void StartGame(int gameType) {
@@ -23,7 +25,11 @@ public class ChallengeOptionView : MonoBehaviour, MenuBackInterface
             else if (gameType == 4) newGameType = 11;
             else if (gameType == 5) newGameType = 12;
             GlobalDataTemp.matchGameType = newGameType;
-            GameObject.Instantiate(SceneResMgr.ins.GetPrefab("PKMatchView"));
+            JC.Unity.UI.CanvasUtils.PlusSortOrder(
+                gameObject,
+                GameObject.Instantiate(SceneResMgr.ins.GetPrefab("PKMatchView")), 
+                1
+            );
             return;   
         }
         if (GlobalDataTemp.pkMatchType == PKMatchType.LocalPK) {

+ 12 - 2
Assets/BowArrow/Scripts/View/GameStartView.cs

@@ -11,12 +11,14 @@ public class GameStartView : MonoBehaviour, MenuBackInterface
         ins = this;
         PersistenHandler.ins?.menuBackCtr.views.Add(this);
         HomeMgr.CacheView(this);
+        TopBarView.NeedShowIt(this);
     }
 
     void OnDestroy() {
         if (ins == this) ins = null;
         PersistenHandler.ins?.menuBackCtr.views.Remove(this);
         HomeMgr.RemoveCacheView(this);
+        TopBarView.DontNeedShowIt(this);
     }
     
     public bool OnMenuBack() {
@@ -30,7 +32,11 @@ public class GameStartView : MonoBehaviour, MenuBackInterface
         {
             case "闯关":
                 GlobalDataTemp.pkMatchType = PKMatchType.None;
-                GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/ChallengeOptionView"));
+                JC.Unity.UI.CanvasUtils.PlusSortOrder(
+                    gameObject,
+                    GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/ChallengeOptionView")),
+                    1
+                );
                 break;
             case "限时":
                 GlobalData.pkMatchType = PKMatchType.None;
@@ -39,7 +45,11 @@ public class GameStartView : MonoBehaviour, MenuBackInterface
                 break;
             case "PK":
                 GlobalDataTemp.pkMatchType = PKMatchType.LocalPK;
-                GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/RoleSelectView"));
+                JC.Unity.UI.CanvasUtils.PlusSortOrder(
+                    gameObject,
+                    GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/RoleSelectView")),
+                    1
+                );
                 break;
             default:
                 break;

+ 2 - 0
Assets/BowArrow/Scripts/View/HomeView.cs

@@ -32,6 +32,7 @@ public class HomeView : MonoBehaviour
 
         BluetoothHolder.Init();
         AudioMgr.Init();
+        TopBarView.NeedShowIt(this);
         if (ShootCheck.ins) ShootCheck.ins.AdjustNormalOrHightMode();
 
         if (LoginMgr.myUserInfo.id > 0) {
@@ -46,6 +47,7 @@ public class HomeView : MonoBehaviour
     void OnDestroy()
     {
         if (ins == this) ins = null;
+        TopBarView.DontNeedShowIt(this);
     }
 
     void Update() {

+ 12 - 2
Assets/BowArrow/Scripts/View/PKGameOptionView.cs

@@ -8,11 +8,13 @@ public class PKGameOptionView : MonoBehaviour, MenuBackInterface
     void Start() {
         HomeMgr.CacheView(this);
         PersistenHandler.ins?.menuBackCtr.views.Add(this);
+        TopBarView.NeedShowIt(this);
     }
 
     void OnDestroy() {
         HomeMgr.RemoveCacheView(this);
         PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+        TopBarView.DontNeedShowIt(this);
     }
 
     public bool OnMenuBack() {
@@ -25,12 +27,20 @@ public class PKGameOptionView : MonoBehaviour, MenuBackInterface
         switch (target)
         {
             case "双人闯关":
-                GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/ChallengeOptionView"));
+                JC.Unity.UI.CanvasUtils.PlusSortOrder(
+                    gameObject,
+                    GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/ChallengeOptionView")),
+                    1
+                );
                 break;
             case "静止靶":
                 if (GlobalDataTemp.pkMatchType == PKMatchType.OnlinePK) {
                     GlobalDataTemp.matchGameType = 9;
-                    GameObject.Instantiate(SceneResMgr.ins.GetPrefab("PKMatchView"));
+                    JC.Unity.UI.CanvasUtils.PlusSortOrder(
+                        gameObject,
+                        GameObject.Instantiate(SceneResMgr.ins.GetPrefab("PKMatchView")),
+                        1
+                    );
                 } else if (GlobalDataTemp.pkMatchType == PKMatchType.LocalPK) {
                     GlobalData.pkMatchType = GlobalDataTemp.pkMatchType;
                     GameMgr.gameType = 2;

+ 2 - 0
Assets/BowArrow/Scripts/View/PKMatchView.cs

@@ -20,6 +20,7 @@ public class PKMatchView : MonoBehaviour, MenuBackInterface
     {
         HomeMgr.CacheView(this);
         PersistenHandler.ins?.menuBackCtr.views.Add(this);
+        TopBarView.NeedShowIt(this);
 
         Sprite avatar = RoleMgr.GetAvatar(LoginMgr.myUserInfo.avatarID);
         string nickname = LoginMgr.myUserInfo.nickname;
@@ -31,6 +32,7 @@ public class PKMatchView : MonoBehaviour, MenuBackInterface
     {
         HomeMgr.RemoveCacheView(this);
         PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+        TopBarView.DontNeedShowIt(this);
     }
 
     public bool OnMenuBack() {

+ 7 - 1
Assets/BowArrow/Scripts/View/RoleSelectView.cs

@@ -12,6 +12,7 @@ public class RoleSelectView : MonoBehaviour, MenuBackInterface
     {
         HomeMgr.CacheView(this);
         PersistenHandler.ins?.menuBackCtr.views.Add(this);
+        TopBarView.NeedShowIt(this);
 
         GlobalData.localPK_playerRoleIDs[0] = LoginMgr.myUserInfo.avatarID;
         RenderPlayer(0);
@@ -21,6 +22,7 @@ public class RoleSelectView : MonoBehaviour, MenuBackInterface
     void OnDestroy() {
         HomeMgr.RemoveCacheView(this);
         PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+        TopBarView.DontNeedShowIt(this);
     }
 
     public bool OnMenuBack() {
@@ -70,6 +72,10 @@ public class RoleSelectView : MonoBehaviour, MenuBackInterface
 
     public void StartGame() {
         AudioMgr.ins.PlayBtn();
-        GameObject.Instantiate(SceneResMgr.ins.GetPrefab("PKGameOptionView"));
+        JC.Unity.UI.CanvasUtils.PlusSortOrder(
+            gameObject,
+            GameObject.Instantiate(SceneResMgr.ins.GetPrefab("PKGameOptionView")),
+            1
+        );
     }
 }

+ 6 - 2
Assets/BowArrow/Scripts/View/SetUpView1.cs

@@ -30,12 +30,14 @@ public class SetUpView1 : MonoBehaviour, MenuBackInterface
 
     public void GoToGameSetupView() {
         AudioMgr.ins.PlayBtn();
-        GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/SetUpView"), Vector3.zero, new Quaternion());
+        GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/SetUpView"));
+        JC.Unity.UI.CanvasUtils.PlusSortOrder(gameObject, o, 1);
     }
 
     public void GoToGameCourse() {
         AudioMgr.ins.PlayBtn();
-        GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/CourseView"));
+        GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/CourseView"));
+        JC.Unity.UI.CanvasUtils.PlusSortOrder(gameObject, o, 1);
     }
 
     public void AboutUs() {
@@ -46,12 +48,14 @@ public class SetUpView1 : MonoBehaviour, MenuBackInterface
     public void GoToUserAgreement() {
         AudioMgr.ins.PlayBtn();
         GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/AgreementView"));
+        JC.Unity.UI.CanvasUtils.PlusSortOrder(gameObject, o, 1);
         o.GetComponent<AgreementView>().EnterUserAgreement();
     }
 
     public void GoToPrivacyAgreement() {
         AudioMgr.ins.PlayBtn();
         GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/AgreementView"));
+        JC.Unity.UI.CanvasUtils.PlusSortOrder(gameObject, o, 1);
         o.GetComponent<AgreementView>().EnterPrivacyAgreement();
     }
 

+ 2 - 0
Assets/BowArrow/Scripts/View/ShopView.cs

@@ -18,6 +18,7 @@ public class ShopView : MonoBehaviour, MenuBackInterface
     void Start() {
         ins = this;
         PersistenHandler.ins?.menuBackCtr.views.Add(this);
+        TopBarView.NeedShowIt(this);
 
         InitOptions();
     }
@@ -26,6 +27,7 @@ public class ShopView : MonoBehaviour, MenuBackInterface
     {
         if (ins == this) ins = null;
         PersistenHandler.ins?.menuBackCtr.views.Remove(this);
+        TopBarView.DontNeedShowIt(this);
     }
 
     public bool OnMenuBack() {

+ 70 - 8
Assets/BowArrow/Scripts/View/TopBarView.cs

@@ -8,9 +8,22 @@ public class TopBarView : MonoBehaviour
     [SerializeField] Text[] itemValueTexts;
     [SerializeField] Button[] itemPlusButtons;
     int[] itemValues = {-1, -1, -1};
+    
+    public static TopBarView ins;
+    
+    public void Awake()
+    {
+        ins = this;
+    }
+
+    public void OnDestroy()
+    {
+        if (ins == this) ins = null;
+    }
 
     void Start()
     {
+        CheckNeedShowWhenInit();
         if (CommonConfig.needToExamine) {
             Transform tf = transform.Find("TopBar");
             for (int i = 0; i < tf.childCount; i++) {
@@ -27,25 +40,74 @@ public class TopBarView : MonoBehaviour
             itemValues[0] = LoginMgr.myUserInfo.diamond;
             itemValueTexts[0].text = itemValues[0].ToString();
         }
-        if (itemValues[1] != LoginMgr.myUserInfo.coin) {
-            itemValues[1] = LoginMgr.myUserInfo.coin;
-            itemValueTexts[1].text = itemValues[1].ToString();
+        // if (itemValues[1] != LoginMgr.myUserInfo.coin) {
+        //     itemValues[1] = LoginMgr.myUserInfo.coin;
+        //     itemValueTexts[1].text = itemValues[1].ToString();
+        // }
+        // if (itemValues[2] != LoginMgr.myUserInfo.integral) {
+        //     itemValues[2] = LoginMgr.myUserInfo.integral;
+        //     itemValueTexts[2].text = itemValues[2].ToString();
+        // }
+    }
+
+
+
+
+    static HashSet<MonoBehaviour> _needShowItLockers = new HashSet<MonoBehaviour>();
+    public static void NeedShowIt(MonoBehaviour locker) {
+        _needShowItLockers.Add(locker);
+        #if UNITY_EDITOR
+        Debug.LogWarning("NeedShowIt, NowCount=" + _needShowItLockers.Count);
+        #endif
+        try {
+            ins.ResetCanvasSortOrder();
+            if (!ins.gameObject.activeSelf) ins.gameObject.SetActive(true);
         }
-        if (itemValues[2] != LoginMgr.myUserInfo.integral) {
-            itemValues[2] = LoginMgr.myUserInfo.integral;
-            itemValueTexts[2].text = itemValues[2].ToString();
+        catch (System.Exception) {}
+    }
+    public static void DontNeedShowIt(MonoBehaviour locker) {
+        _needShowItLockers.Remove(locker);
+        #if UNITY_EDITOR
+        Debug.LogWarning("DontNeedShowIt, NowCount=" + _needShowItLockers.Count);
+        #endif
+        try {
+            ins.ResetCanvasSortOrder();
+            if (ins.gameObject.activeSelf && _needShowItLockers.Count == 0) ins.gameObject.SetActive(false);
+        }
+        catch (System.Exception) {}
+    }
+    public void CheckNeedShowWhenInit() {
+        if (_needShowItLockers.Count > 0) {
+            ins.ResetCanvasSortOrder();
+            ins.gameObject.SetActive(true);
+        } else {
+            ins.gameObject.SetActive(false);
         }
     }
+    void ResetCanvasSortOrder()
+    {
+        int maxOrder = 0;
+        foreach (var item in _needShowItLockers) {
+            int sortOrder = item.GetComponent<Canvas>().sortingOrder;
+            if (sortOrder > maxOrder) maxOrder = sortOrder;
+        }
+        GetComponent<Canvas>().sortingOrder = maxOrder + 1;
+    }
+
+
+
 
     public void GoToSetup() {
         AudioMgr.ins.PlayBtn();
-        GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/SetUpView1"), Vector3.zero, new Quaternion());
+        GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/SetUpView1"), Vector3.zero, new Quaternion());
+        JC.Unity.UI.CanvasUtils.PlusSortOrder(gameObject, o, 1);
     }
 
     public void GoToShop()
     {
         AudioMgr.ins.PlayBtn();
         if (ShopView.ins) return;
-        GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/ShopView"));
+        GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/ShopView"));
+        JC.Unity.UI.CanvasUtils.PlusSortOrder(gameObject, o, 1);
     }
 }

+ 6 - 0
Assets/JC/Untiy/UI/BackgroundAdapter.cs

@@ -33,6 +33,12 @@ namespace JC.Unity.UI {
             return rectTransform.position + deltaPos;
         }
     }   
+    public class CanvasUtils
+    {
+        public static void PlusSortOrder(GameObject src, GameObject des, int plusValue) {
+            des.GetComponent<Canvas>().sortingOrder = src.GetComponent<Canvas>().sortingOrder + plusValue;
+        }
+    }
     [ExecuteAlways]
     public class BackgroundAdapter : MonoBehaviour
     {