From 6206bec3f62745d5bf454a5ec6e7ffb94e5ee239 Mon Sep 17 00:00:00 2001
From: YangHua <1475658476@qq.com>
Date: Fri, 17 Nov 2023 15:02:24 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=A6=E5=91=98=E5=B8=AD?=
 =?UTF-8?q?=E4=BD=8D=E5=88=A4=E5=AE=9A=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Assets/Temp/Scripts/View_Panel2.cs            |  9 +++----
 Assets/Zion/Scripts/Adam/GameManager.cs       | 24 +++++++++++++++++++
 Assets/Zion/Scripts/Adam/UIBootstrap.cs       | 22 ++++++++++++++++-
 .../Adam/Utility/Sync/AsyncObjectBase.cs      |  4 ++--
 ProjectSettings/TagManager.asset              |  4 ++--
 5 files changed, 54 insertions(+), 9 deletions(-)

diff --git a/Assets/Temp/Scripts/View_Panel2.cs b/Assets/Temp/Scripts/View_Panel2.cs
index 7e3c904f..1f723d83 100644
--- a/Assets/Temp/Scripts/View_Panel2.cs
+++ b/Assets/Temp/Scripts/View_Panel2.cs
@@ -356,7 +356,6 @@ public class View_Panel2 : XUIPanel
                 }
                 else
                 {
-
                     ced.subjectID = currentSubjectID;
                     ced.SeatID = currentSeatID;
                     ced.account = currentAccount;
@@ -484,12 +483,10 @@ public class View_Panel2 : XUIPanel
         start_training_btn.onClick.AddListener(() =>
         {
             GameMain.model = false;
-            SceneManager.LoadScene("AdamTraining_pilot_terminal_panl 1");
+            //SceneManager.LoadScene("AdamTraining_pilot_terminal_panl 1");
             //加入房间
             string RoomName = "joinroom " + currentRoomName;
             _ = AdamSync.SyncCreateRoom.SendMessageAsync(RoomName);
-
-
         });
         ///进入导调
         entering_key_btn.onClick.AddListener(() =>
@@ -613,6 +610,7 @@ public class View_Panel2 : XUIPanel
     /// <param name="sdi"></param>
     public void CreateSubjectInfo(List<RSData.SubjectDataItem> sdi)
     {
+        UIBootstrap.Instance.GetSubjectInfo(sdi);
         DestorySubjectSeatInfo();
         List<Toggle> allToggles = new List<Toggle>();
         bool isAssigned = false;
@@ -726,6 +724,7 @@ public class View_Panel2 : XUIPanel
         if (upsd.state)
         {
             submitInstruct.text = "提交成功";
+
         }
         else
         {
@@ -733,6 +732,8 @@ public class View_Panel2 : XUIPanel
         }
         currentSubjectInfo = await AsyncWebReq.Get<RSData.SubjectInfo>("http://111.229.30.246:48888/Handler/Practice.ashx?action=querypracticeseat&PracticeId=" + currentDIPracticeID + "&PracticeSubjectId=" + currentDISubjectID);
         CreateSubjectInfo(currentSubjectInfo.data);
+
+        UIBootstrap.Instance.GetSubjectInfo(currentSubjectInfo.data );
     }
 
 
diff --git a/Assets/Zion/Scripts/Adam/GameManager.cs b/Assets/Zion/Scripts/Adam/GameManager.cs
index b85f755f..d5a97445 100644
--- a/Assets/Zion/Scripts/Adam/GameManager.cs
+++ b/Assets/Zion/Scripts/Adam/GameManager.cs
@@ -24,6 +24,14 @@ public class GameManager : MonoBehaviour
         spt.gameObject.transform.position = spawnPos.position;
         spt.gameObject.transform.eulerAngles = spawnPos.eulerAngles;
         spt.SetPlayerInfo(ulong.Parse(GlobalFlag.currentUser.user_id), GlobalFlag.currentUser.login_name, ulong.Parse(GlobalFlag.roomID), true);
+        if (UIBootstrap.Instance.GetRoleByIDPracticeId(GlobalFlag.roomID) == "0")
+        {
+            spt.GetComponent<Camera>().cullingMask = ~(1 << 11);
+        }
+        else
+        {
+            spt.GetComponent<Camera>().cullingMask = ~(1 << 12);
+        }
         userIds.Add(ulong.Parse(GlobalFlag.currentUser.user_id));
         tenkokuModule.mainCamera = spt.transform;
     }
@@ -61,6 +69,14 @@ public class GameManager : MonoBehaviour
                     spt.gameObject.transform.position = spawnPos.position;
                     spt.gameObject.transform.eulerAngles = spawnPos.eulerAngles;
                     spt.SetPlayerInfo(ulong.Parse(data[1]), data[2], ulong.Parse(data[3]), false);
+                    if (UIBootstrap.Instance.GetRoleByIDPracticeId(data[3]) == "0")
+                    {
+                        spt.GetComponent<Camera>().cullingMask = ~(1 << 11);
+                    }
+                    else
+                    {
+                        spt.GetComponent<Camera>().cullingMask = ~(1 << 12);
+                    }
                 }
                 break;
             case "offline":
@@ -84,6 +100,14 @@ public class GameManager : MonoBehaviour
                 spt.SetPlayerInfo(ulong.Parse(userInfo[0]), userInfo[1], ulong.Parse(userInfo[2]), false);
                 spt.transform.position = new Vector3(spawnPos.position.x + index * 0.5f, spawnPos.position.y, spawnPos.position.z + index * 0.5f);
                 spt.transform.eulerAngles = spawnPos.eulerAngles;
+                if (UIBootstrap.Instance.GetRoleByIDPracticeId(userInfo[2]) == "0")
+                {
+                    spt.GetComponent<Camera>().cullingMask = ~(1 << 11);
+                }
+                else
+                {
+                    spt.GetComponent<Camera>().cullingMask = ~(1 << 12);
+                }
                 userIds.Add(ulong.Parse(userInfo[0]));
             }
         }
diff --git a/Assets/Zion/Scripts/Adam/UIBootstrap.cs b/Assets/Zion/Scripts/Adam/UIBootstrap.cs
index f0d50718..e09be6a1 100644
--- a/Assets/Zion/Scripts/Adam/UIBootstrap.cs
+++ b/Assets/Zion/Scripts/Adam/UIBootstrap.cs
@@ -10,7 +10,7 @@ public class UIBootstrap : MonoSingleton<UIBootstrap>
     public string sceneInfoUrl;
     public Editinformation editinformation = new Editinformation();
     public SceneRoot currentSceneInfo = new SceneRoot();
-
+    public List<RSData.SubjectDataItem> subjectInfo = new List<RSData.SubjectDataItem>();
     public List<Traininginformation> traininginformations = new List<Traininginformation>();
 
     // Start is called before the first frame update
@@ -34,7 +34,27 @@ public class UIBootstrap : MonoSingleton<UIBootstrap>
         string _url = sceneInfoUrl + roomId;
         //Debug.LogError(_url);
         currentSceneInfo = await AsyncWebReq.Get<SceneRoot>(_url);
+
     }
+    public void GetSubjectInfo(List<RSData.SubjectDataItem> sdi)
+    {
+        subjectInfo = sdi;
+    }
+
+
+    public string GetRoleByIDPracticeId(string practiceID)
+    {
+        for (int i = 0; i < subjectInfo.Count; i++)
+        {
+            if (subjectInfo[i].SeatId == practiceID)
+            {
+                return subjectInfo[i].Role;
+            }
+        }
+        return "0";
+    }
+
+
 
     public void OnGetRooms(string msg)
     {
diff --git a/Assets/Zion/Scripts/Adam/Utility/Sync/AsyncObjectBase.cs b/Assets/Zion/Scripts/Adam/Utility/Sync/AsyncObjectBase.cs
index ca384eab..942e76e3 100644
--- a/Assets/Zion/Scripts/Adam/Utility/Sync/AsyncObjectBase.cs
+++ b/Assets/Zion/Scripts/Adam/Utility/Sync/AsyncObjectBase.cs
@@ -31,11 +31,11 @@ namespace AdamSync
             isPlayer = _isPlayer;
             if (!_isPlayer)
             {
-                Destroy(gameObject.GetComponent<Camera>());
-                Destroy(gameObject.GetComponent<SimpleCameraController>());
                 Destroy(gameObject.GetComponent<HighlightingRenderer>());
+                Destroy(gameObject.GetComponent<SimpleCameraController>());
                 Destroy(gameObject.GetComponent<PostProcessLayer>());
                 Destroy(gameObject.GetComponent<AudioListener>());
+                Destroy(gameObject.GetComponent<Camera>());
             }
             else
             {
diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset
index 4b55f94e..2b5bfb54 100644
--- a/ProjectSettings/TagManager.asset
+++ b/ProjectSettings/TagManager.asset
@@ -17,8 +17,8 @@ TagManager:
   - Ground
   - WRJ
   - HuoPao
-  - 
-  - 
+  - Red
+  - Blue
   - 
   - 
   -