From bd9960ba1254021096f8b9ceea92745b09ab4e61 Mon Sep 17 00:00:00 2001 From: YangHua <1475658476@qq.com> Date: Thu, 16 Nov 2023 12:23:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8C=E6=AD=A5=E4=BA=A4?= =?UTF-8?q?=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/GameAssets/Prefebs/Main Camera.prefab | 11 +- Assets/Temp/Scripts/View_Panel2.cs | 3 + Assets/Zion/Scenes/SampleScene.unity | 31 +++++ Assets/Zion/Scripts/Adam/Data/PracticeData.cs | 125 ++++++++++++++++++ Assets/Zion/Scripts/Adam/GameManager.cs | 7 +- Assets/Zion/Scripts/Adam/UIBootstrap.cs | 13 ++ .../Zion/Scripts/Adam/Utility/GlobalFlag.cs | 1 + .../Adam/Utility/Sync/AsyncObjectBase.cs | 14 +- .../Adam/Utility/Sync/SyncPlayerTransform.cs | 27 ++-- 9 files changed, 217 insertions(+), 15 deletions(-) diff --git a/Assets/GameAssets/Prefebs/Main Camera.prefab b/Assets/GameAssets/Prefebs/Main Camera.prefab index 52038a9b..2cf09417 100644 --- a/Assets/GameAssets/Prefebs/Main Camera.prefab +++ b/Assets/GameAssets/Prefebs/Main Camera.prefab @@ -14,6 +14,7 @@ GameObject: - component: {fileID: 8716064937965754115} - component: {fileID: 8716064937965754114} - component: {fileID: 8716064937965754113} + - component: {fileID: 2575056841547254902} m_Layer: 0 m_Name: Main Camera m_TagString: Untagged @@ -203,7 +204,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8716064937965754120} - m_Enabled: 0 + m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3} m_Name: @@ -274,3 +275,11 @@ MonoBehaviour: isPlayer: 0 selfAnimation: {fileID: 0} selfCamera: {fileID: 0} +--- !u!81 &2575056841547254902 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8716064937965754120} + m_Enabled: 1 diff --git a/Assets/Temp/Scripts/View_Panel2.cs b/Assets/Temp/Scripts/View_Panel2.cs index 5f57c625..a536a7e3 100644 --- a/Assets/Temp/Scripts/View_Panel2.cs +++ b/Assets/Temp/Scripts/View_Panel2.cs @@ -542,6 +542,9 @@ public class View_Panel2 : XUIPanel currentRoomData = await AsyncWebReq.Get("http://111.229.30.246:48888/Handler/Practice.ashx?action=querypracticesubject&PracticeId=" + roomItem.name); currentRoomName = roomItem.name; GlobalFlag.roomID = roomItem.name; + GlobalFlag.practiceId = roomItem.name; + UIBootstrap.Instance.GetSceneData(GlobalFlag.practiceId); + Debug.Log(" roomItem.nameID==" + roomItem.name); CreateSubjectItem(currentRoomData.data); }); diff --git a/Assets/Zion/Scenes/SampleScene.unity b/Assets/Zion/Scenes/SampleScene.unity index 9bb98672..ee8e8589 100644 --- a/Assets/Zion/Scenes/SampleScene.unity +++ b/Assets/Zion/Scenes/SampleScene.unity @@ -2853,10 +2853,41 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: url: http://111.229.30.246:48888/Handler/Thinkingfile.ashx?action=all + sceneInfoUrl: http://111.229.30.246:48888/Handler/Thinkingfile.ashx?action=practicethink&Id= editinformation: state: 0 message: data: [] + currentSceneInfo: + state: + message: + data: + Id: + PracticeId: + Name: + PracticeMode: + Icon: + VirtualPath: + SeatContent: + DeviceContent: + SubjectContent: + OperateSupport: + CreateTime: + Memo: + UpdateTime: + IsDeleted: + EnvTime: + EnvRain: + EnvSnow: + EnvWindSpeed: + EnvWindDir: + EnvLight: + Field_Decimal1: + Field_Decimal2: + Field_Decimal3: + Field_Char1: + Field_Char2: + Field_Char3: traininginformations: [] --- !u!1 &1986907555 GameObject: diff --git a/Assets/Zion/Scripts/Adam/Data/PracticeData.cs b/Assets/Zion/Scripts/Adam/Data/PracticeData.cs index 5ef828ab..b659a2db 100644 --- a/Assets/Zion/Scripts/Adam/Data/PracticeData.cs +++ b/Assets/Zion/Scripts/Adam/Data/PracticeData.cs @@ -22,4 +22,129 @@ namespace PData /// public string data; } + [Serializable] + public class SenceInfo + { + /// + /// + /// + public string Id; + /// + /// + /// + public string PracticeId; + /// + /// 1025-2岗位 + /// + public string Name; + /// + /// 岗位训练 + /// + public string PracticeMode; + /// + /// + /// + public string Icon; + /// + /// {"Id":"1698214124511","Name":"1025-2","PracticeMode":"岗位训练","subjectsInfo":[{"subjectId":"1698025133871","subjectName":"1023-1红蓝对抗","index":0,"stepInfo":"","SubTime":60,"seatInfo":"","mode":"红蓝对抗","earth":"丘陵","seatInfos":[{"seatId":"1698025248056001","seatName":"1#士兵","seatno":"0","role":"0"},{"seatId":"1698025248056002","seatName":"1#官员","seatno":"1","role":"1"},{"seatId":"1698025266203001","seatName":"2#士兵","seatno":"2","role":"0"},{"seatId":"1698025266203002","seatName":"2#官员","seatno":"3","role":"1"}],"TrainDestList":[{"TrainId":"1698025248056","TrainDest":"目标一","TrainGrade":"1","redseatIds":"1698025248056001","blueseatIds":"1698025248056002"},{"TrainId":"1698025266203","TrainDest":"目标二","TrainGrade":"2","redseatIds":"1698025266203001","blueseatIds":"1698025266203002"}]},{"subjectId":"1698025159822","subjectName":"1023-2集团对抗","index":1,"stepInfo":"","SubTime":40,"seatInfo":"","mode":"集团对抗","earth":"城市","seatInfos":[{"seatId":"1698025318422001","seatName":"1#士兵","seatno":"0","role":"0"},{"seatId":"1698025318422002","seatName":"1#士兵","seatno":"1","role":"1"},{"seatId":"1698025329169001","seatName":"1#官员","seatno":"2","role":"0"},{"seatId":"1698025329169002","seatName":"1#官员","seatno":"3","role":"1"}],"TrainDestList":[{"TrainId":"1698025318422","TrainDest":"集团1","TrainGrade":"1","redseatIds":"1698025318422001","blueseatIds":"1698025318422002"},{"TrainId":"1698025329169","TrainDest":"集团2","TrainGrade":"2","redseatIds":"1698025329169001","blueseatIds":"1698025329169002"}]}]} + /// + public string VirtualPath; + /// + /// + /// + public string SeatContent; + /// + /// [{"str":"model/SM_AE86","x":-5.88842773,"y":-32.6212769,"z":113.438477},{"str":"model/大众","x":8.938171,"y":-33.06848,"z":74.17969},{"str":"model/大众","x":19.5197144,"y":-33.06848,"z":68.78735},{"str":"model/SM_AE86","x":46.3676758,"y":-33.06848,"z":69.92505},{"str":"model/三间瓦屋1","x":-5.338318,"y":-33.06848,"z":53.07483},{"str":"model/三间瓦屋1","x":64.49866,"y":-33.06848,"z":61.64807},{"str":"model/三间瓦屋4","x":34.37964,"y":-33.06848,"z":91.09241},{"str":"model/二层小楼","x":27.3535156,"y":-33.06848,"z":54.17163},{"str":"model/Broadleaf_Mobile","x":7.203125,"y":-33.06848,"z":116.509888},{"str":"model/Black_Gum_Desktop","x":0.152832031,"y":-33.06848,"z":89.27905}] + /// + public string DeviceContent; + /// + /// + /// + public string SubjectContent; + /// + /// + /// + public string OperateSupport; + /// + /// + /// + public string CreateTime; + /// + /// + /// + public string Memo; + /// + /// + /// + public string UpdateTime; + /// + /// + /// + public string IsDeleted; + /// + /// + /// + public string EnvTime; + /// + /// 小雨 + /// + public string EnvRain; + /// + /// 小雪 + /// + public string EnvSnow; + /// + /// + /// + public string EnvWindSpeed; + /// + /// 东 + /// + public string EnvWindDir; + /// + /// + /// + public string EnvLight; + /// + /// + /// + public string Field_Decimal1; + /// + /// + /// + public string Field_Decimal2; + /// + /// + /// + public string Field_Decimal3; + /// + /// + /// + public string Field_Char1; + /// + /// + /// + public string Field_Char2; + /// + /// + /// + public string Field_Char3; + } + [Serializable] + public class SceneRoot + { + /// + /// + /// + public string state; + /// + /// + /// + public string message; + /// + /// + /// + public SenceInfo data; + } + } \ No newline at end of file diff --git a/Assets/Zion/Scripts/Adam/GameManager.cs b/Assets/Zion/Scripts/Adam/GameManager.cs index 3999b92f..23cfe188 100644 --- a/Assets/Zion/Scripts/Adam/GameManager.cs +++ b/Assets/Zion/Scripts/Adam/GameManager.cs @@ -82,9 +82,14 @@ public class GameManager : MonoBehaviour } - public void OnBack() { SceneManager.LoadScene("TEstSync"); } + private void OnDisable() + { + Debug.Log("OnDisable"); + SyncCreateRoom.getroomusersRequset -= OnGetRoomUsers; + SyncCreateRoom.send2roomRequset -= OnOtherPlayerOnline; + } } diff --git a/Assets/Zion/Scripts/Adam/UIBootstrap.cs b/Assets/Zion/Scripts/Adam/UIBootstrap.cs index aa1d783b..22cc2256 100644 --- a/Assets/Zion/Scripts/Adam/UIBootstrap.cs +++ b/Assets/Zion/Scripts/Adam/UIBootstrap.cs @@ -1,4 +1,5 @@ using Newtonsoft.Json; +using PData; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -6,7 +7,10 @@ using UnityEngine; public class UIBootstrap : MonoSingleton { public string url; + public string sceneInfoUrl; public Editinformation editinformation = new Editinformation(); + public SceneRoot currentSceneInfo = new SceneRoot(); + public List traininginformations = new List(); // Start is called before the first frame update @@ -23,6 +27,15 @@ public class UIBootstrap : MonoSingleton AdamSync.SyncCreateRoom.getroomusersRequset += OnGetRoomsUsers; AdamSync.SyncCreateRoom.send2roomRequset += OnGetRoomsInfo; } + + + public async void GetSceneData(string roomId) + { + string _url = sceneInfoUrl + roomId; + Debug.LogError(_url); + currentSceneInfo = await AsyncWebReq.Get(_url); + } + public void OnGetRooms(string msg) { Debug.Log("OnGetRooms====" + msg); diff --git a/Assets/Zion/Scripts/Adam/Utility/GlobalFlag.cs b/Assets/Zion/Scripts/Adam/Utility/GlobalFlag.cs index bbca6d0f..7138c8ad 100644 --- a/Assets/Zion/Scripts/Adam/Utility/GlobalFlag.cs +++ b/Assets/Zion/Scripts/Adam/Utility/GlobalFlag.cs @@ -6,4 +6,5 @@ public class GlobalFlag { public static UserInfo currentUser; public static string roomID; + public static string practiceId; } diff --git a/Assets/Zion/Scripts/Adam/Utility/Sync/AsyncObjectBase.cs b/Assets/Zion/Scripts/Adam/Utility/Sync/AsyncObjectBase.cs index 803dca9c..ca384eab 100644 --- a/Assets/Zion/Scripts/Adam/Utility/Sync/AsyncObjectBase.cs +++ b/Assets/Zion/Scripts/Adam/Utility/Sync/AsyncObjectBase.cs @@ -1,6 +1,10 @@ -using System.Collections; +using HighlightingSystem; +using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.Rendering.PostProcessing; +using UnityTemplateProjects; + namespace AdamSync { public class AsyncObjectBase : MonoBehaviour @@ -27,12 +31,18 @@ namespace AdamSync isPlayer = _isPlayer; if (!_isPlayer) { - + Destroy(gameObject.GetComponent()); + Destroy(gameObject.GetComponent()); + Destroy(gameObject.GetComponent()); + Destroy(gameObject.GetComponent()); + Destroy(gameObject.GetComponent()); } else { //string palyerJoinRoom = "joinroom " + ""; //_ = SyncCreateRoom.SendMessageAsync(palyerJoinRoom); + gameObject.tag = "MainCamera"; + } } } diff --git a/Assets/Zion/Scripts/Adam/Utility/Sync/SyncPlayerTransform.cs b/Assets/Zion/Scripts/Adam/Utility/Sync/SyncPlayerTransform.cs index 87a67304..c5e6ef61 100644 --- a/Assets/Zion/Scripts/Adam/Utility/Sync/SyncPlayerTransform.cs +++ b/Assets/Zion/Scripts/Adam/Utility/Sync/SyncPlayerTransform.cs @@ -10,16 +10,16 @@ namespace AdamSync private void Start() { - //SyncCreateRoom.playerInfoRequset += ReceivePlayInfo; - //if (isPlayer) - //{ - // StartCoroutine(SendMsg()); - //} - //else - //{ - // //string msg = string.Format("send2room online," + GlobeFlag.userID + "," + GlobeFlag.userName + "," + GlobeFlag.roomID); - // //_ = SyncCreateRoom.SendMessageAsync(msg); - //} + SyncCreateRoom.playerInfoRequset += ReceivePlayInfo; + if (isPlayer) + { + StartCoroutine(SendMsg()); + } + else + { + //string msg = string.Format("send2room online," + GlobeFlag.userID + "," + GlobeFlag.userName + "," + GlobeFlag.roomID); + //_ = SyncCreateRoom.SendMessageAsync(msg); + } } private IEnumerator SendMsg() @@ -53,6 +53,11 @@ namespace AdamSync Vector3 temp = new Vector3(float.Parse(data[0]), float.Parse(data[1]), float.Parse(data[2])); return temp; } - + private void OnDisable() + { + Debug.Log("OnDisable"); + StopAllCoroutines(); + SyncCreateRoom.playerInfoRequset -= ReceivePlayInfo; + } } }