Browse Source

修复小地图设置面板的按钮与小地图控制不匹配

蓝色星空 1 year ago
parent
commit
4679b65336
2 changed files with 6 additions and 11 deletions
  1. 2 10
      Assets/Scripts/Blue/Controller/SetPos/MinMapPos.cs
  2. 4 1
      Assets/Scripts/SettingPanel.cs

+ 2 - 10
Assets/Scripts/Blue/Controller/SetPos/MinMapPos.cs

@@ -33,8 +33,10 @@ public class MinMapPos : AbstractController
         }
     }
     private bool patch = true;
+
     private void Update()
     {
+        //其他地方有引用小地图,控制了开关;统一由IMinMapService控制
         if (value == 0 && patch)
         {
             if (MinMapCanvas.activeSelf == true)
@@ -43,15 +45,5 @@ public class MinMapPos : AbstractController
                 patch = false;
             }
         }
-        /*
-        else if (value == 1 && patch)
-        {
-            if (MinMapCanvas.activeSelf == false)
-            {
-                MinMapCanvas.SetActive(true);
-                patch = false;
-            }
-        }
-        */
     }
 }

+ 4 - 1
Assets/Scripts/SettingPanel.cs

@@ -29,7 +29,10 @@ public class SettingPanel : AbstractController
         MinMap.onValueChanged.AddListener(OnMinMapValueChange);
         LuJIng.onValueChanged.AddListener(OnLuJIngValueChange);
     }
-
+    private void OnEnable()
+    {
+        MinMap.isOn = this.GetService<IMinMapService>().setMinMap == 1 ? true : false;
+    }
     public void Init()
     {
         CreateLines();