lvjincheng 4 年之前
父節點
當前提交
77ba5e7298

+ 2 - 2
Assets/BowArrow/Scripts/Manager/HomeMgr.cs

@@ -23,12 +23,12 @@ public class HomeMgr : MonoBehaviour
     #region 从主页到游戏场景,再回来时,恢复之前的页面
         static HashSet<MonoBehaviour> curCacheViews = new HashSet<MonoBehaviour>();
 
-        public void CacheView(MonoBehaviour view) {
+        public static void CacheView(MonoBehaviour view) {
             GameObject.DontDestroyOnLoad(view);
             curCacheViews.Add(view);
         }
 
-        public void RemoveCacheView(MonoBehaviour view) {
+        public static void RemoveCacheView(MonoBehaviour view) {
             curCacheViews.Remove(view);
         }
 

+ 2 - 2
Assets/BowArrow/Scripts/View/ChallengeOptionView.cs

@@ -6,11 +6,11 @@ using UnityEngine.SceneManagement;
 public class ChallengeOptionView : MonoBehaviour
 {
     void Start() {
-        HomeMgr.ins.CacheView(this);
+        HomeMgr.CacheView(this);
     }
 
     void OnDestroy() {
-        HomeMgr.ins.RemoveCacheView(this);
+        HomeMgr.RemoveCacheView(this);
     }
 
     public void StartGame(int gameType) {

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

@@ -6,11 +6,11 @@ using UnityEngine.SceneManagement;
 public class GameStartView : MonoBehaviour
 {
     void Start() {
-        HomeMgr.ins.CacheView(this);
+        HomeMgr.CacheView(this);
     }
 
     void OnDestroy() {
-        HomeMgr.ins.RemoveCacheView(this);
+        HomeMgr.RemoveCacheView(this);
     }
 
     public void GoTo(string target) {

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

@@ -82,6 +82,8 @@ public class HomeView : MonoBehaviour
                 GameObject.Instantiate(GameObject.Find("WindowViews").transform.Find("GameStartView").gameObject).SetActive(true);
                 break;
             case "联机游戏":
+                GlobalData.pkMatchType = PKMatchType.OnlinePK;
+                GameObject.Instantiate(GameObject.Find("WindowViews").transform.Find("PKGameOptionView").gameObject).SetActive(true);
                 break;
             case "好友":
                 break;

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

@@ -6,11 +6,11 @@ using UnityEngine.SceneManagement;
 public class PKGameOptionView : MonoBehaviour
 {
     void Start() {
-        HomeMgr.ins.CacheView(this);
+        HomeMgr.CacheView(this);
     }
 
     void OnDestroy() {
-        HomeMgr.ins.RemoveCacheView(this);
+        HomeMgr.RemoveCacheView(this);
     }
 
     public void GoTo(string target) {
@@ -18,6 +18,7 @@ public class PKGameOptionView : MonoBehaviour
         switch (target)
         {
             case "双人闯关":
+                if (GlobalData.pkMatchType == PKMatchType.OnlinePK) return;
                 GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/ChallengeOptionView"));
                 break;
             case "静止靶":

+ 2 - 2
Assets/BowArrow/Scripts/View/RoleSelectView.cs

@@ -10,14 +10,14 @@ public class RoleSelectView : MonoBehaviour
 
     void Start()
     {
-        HomeMgr.ins.CacheView(this);
+        HomeMgr.CacheView(this);
         GlobalData.localPK_playerRoleIDs[0] = 0;
         RenderPlayer(0);
         RenderPlayer(1);
     }
 
     void OnDestroy() {
-        HomeMgr.ins.RemoveCacheView(this);
+        HomeMgr.RemoveCacheView(this);
     }
 
     void RenderPlayer(int playerIndex) {