修改同步交互

This commit is contained in:
YangHua 2023-11-16 12:23:02 +08:00
parent a693359e96
commit bd9960ba12
9 changed files with 217 additions and 15 deletions

View File

@ -14,6 +14,7 @@ GameObject:
- component: {fileID: 8716064937965754115} - component: {fileID: 8716064937965754115}
- component: {fileID: 8716064937965754114} - component: {fileID: 8716064937965754114}
- component: {fileID: 8716064937965754113} - component: {fileID: 8716064937965754113}
- component: {fileID: 2575056841547254902}
m_Layer: 0 m_Layer: 0
m_Name: Main Camera m_Name: Main Camera
m_TagString: Untagged m_TagString: Untagged
@ -203,7 +204,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8716064937965754120} m_GameObject: {fileID: 8716064937965754120}
m_Enabled: 0 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3} m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3}
m_Name: m_Name:
@ -274,3 +275,11 @@ MonoBehaviour:
isPlayer: 0 isPlayer: 0
selfAnimation: {fileID: 0} selfAnimation: {fileID: 0}
selfCamera: {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

View File

@ -542,6 +542,9 @@ public class View_Panel2 : XUIPanel
currentRoomData = await AsyncWebReq.Get<RSData.RoomSubjectData>("http://111.229.30.246:48888/Handler/Practice.ashx?action=querypracticesubject&PracticeId=" + roomItem.name); currentRoomData = await AsyncWebReq.Get<RSData.RoomSubjectData>("http://111.229.30.246:48888/Handler/Practice.ashx?action=querypracticesubject&PracticeId=" + roomItem.name);
currentRoomName = roomItem.name; currentRoomName = roomItem.name;
GlobalFlag.roomID = roomItem.name; GlobalFlag.roomID = roomItem.name;
GlobalFlag.practiceId = roomItem.name;
UIBootstrap.Instance.GetSceneData(GlobalFlag.practiceId);
Debug.Log(" roomItem.nameID==" + roomItem.name); Debug.Log(" roomItem.nameID==" + roomItem.name);
CreateSubjectItem(currentRoomData.data); CreateSubjectItem(currentRoomData.data);
}); });

View File

@ -2853,10 +2853,41 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
url: http://111.229.30.246:48888/Handler/Thinkingfile.ashx?action=all 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: editinformation:
state: 0 state: 0
message: message:
data: [] 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: [] traininginformations: []
--- !u!1 &1986907555 --- !u!1 &1986907555
GameObject: GameObject:

View File

@ -22,4 +22,129 @@ namespace PData
/// </summary> /// </summary>
public string data; public string data;
} }
[Serializable]
public class SenceInfo
{
/// <summary>
///
/// </summary>
public string Id;
/// <summary>
///
/// </summary>
public string PracticeId;
/// <summary>
/// 1025-2岗位
/// </summary>
public string Name;
/// <summary>
/// 岗位训练
/// </summary>
public string PracticeMode;
/// <summary>
///
/// </summary>
public string Icon;
/// <summary>
/// {"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"}]}]}
/// </summary>
public string VirtualPath;
/// <summary>
///
/// </summary>
public string SeatContent;
/// <summary>
/// [{"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}]
/// </summary>
public string DeviceContent;
/// <summary>
///
/// </summary>
public string SubjectContent;
/// <summary>
///
/// </summary>
public string OperateSupport;
/// <summary>
///
/// </summary>
public string CreateTime;
/// <summary>
///
/// </summary>
public string Memo;
/// <summary>
///
/// </summary>
public string UpdateTime;
/// <summary>
///
/// </summary>
public string IsDeleted;
/// <summary>
///
/// </summary>
public string EnvTime;
/// <summary>
/// 小雨
/// </summary>
public string EnvRain;
/// <summary>
/// 小雪
/// </summary>
public string EnvSnow;
/// <summary>
///
/// </summary>
public string EnvWindSpeed;
/// <summary>
/// 东
/// </summary>
public string EnvWindDir;
/// <summary>
///
/// </summary>
public string EnvLight;
/// <summary>
///
/// </summary>
public string Field_Decimal1;
/// <summary>
///
/// </summary>
public string Field_Decimal2;
/// <summary>
///
/// </summary>
public string Field_Decimal3;
/// <summary>
///
/// </summary>
public string Field_Char1;
/// <summary>
///
/// </summary>
public string Field_Char2;
/// <summary>
///
/// </summary>
public string Field_Char3;
}
[Serializable]
public class SceneRoot
{
/// <summary>
///
/// </summary>
public string state;
/// <summary>
///
/// </summary>
public string message;
/// <summary>
///
/// </summary>
public SenceInfo data;
}
} }

View File

@ -82,9 +82,14 @@ public class GameManager : MonoBehaviour
} }
public void OnBack() public void OnBack()
{ {
SceneManager.LoadScene("TEstSync"); SceneManager.LoadScene("TEstSync");
} }
private void OnDisable()
{
Debug.Log("OnDisable");
SyncCreateRoom.getroomusersRequset -= OnGetRoomUsers;
SyncCreateRoom.send2roomRequset -= OnOtherPlayerOnline;
}
} }

View File

@ -1,4 +1,5 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using PData;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
@ -6,7 +7,10 @@ using UnityEngine;
public class UIBootstrap : MonoSingleton<UIBootstrap> public class UIBootstrap : MonoSingleton<UIBootstrap>
{ {
public string url; public string url;
public string sceneInfoUrl;
public Editinformation editinformation = new Editinformation(); public Editinformation editinformation = new Editinformation();
public SceneRoot currentSceneInfo = new SceneRoot();
public List<Traininginformation> traininginformations = new List<Traininginformation>(); public List<Traininginformation> traininginformations = new List<Traininginformation>();
// Start is called before the first frame update // Start is called before the first frame update
@ -23,6 +27,15 @@ public class UIBootstrap : MonoSingleton<UIBootstrap>
AdamSync.SyncCreateRoom.getroomusersRequset += OnGetRoomsUsers; AdamSync.SyncCreateRoom.getroomusersRequset += OnGetRoomsUsers;
AdamSync.SyncCreateRoom.send2roomRequset += OnGetRoomsInfo; AdamSync.SyncCreateRoom.send2roomRequset += OnGetRoomsInfo;
} }
public async void GetSceneData(string roomId)
{
string _url = sceneInfoUrl + roomId;
Debug.LogError(_url);
currentSceneInfo = await AsyncWebReq.Get<SceneRoot>(_url);
}
public void OnGetRooms(string msg) public void OnGetRooms(string msg)
{ {
Debug.Log("OnGetRooms====" + msg); Debug.Log("OnGetRooms====" + msg);

View File

@ -6,4 +6,5 @@ public class GlobalFlag
{ {
public static UserInfo currentUser; public static UserInfo currentUser;
public static string roomID; public static string roomID;
public static string practiceId;
} }

View File

@ -1,6 +1,10 @@
using System.Collections; using HighlightingSystem;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
using UnityTemplateProjects;
namespace AdamSync namespace AdamSync
{ {
public class AsyncObjectBase : MonoBehaviour public class AsyncObjectBase : MonoBehaviour
@ -27,12 +31,18 @@ namespace AdamSync
isPlayer = _isPlayer; isPlayer = _isPlayer;
if (!_isPlayer) if (!_isPlayer)
{ {
Destroy(gameObject.GetComponent<Camera>());
Destroy(gameObject.GetComponent<SimpleCameraController>());
Destroy(gameObject.GetComponent<HighlightingRenderer>());
Destroy(gameObject.GetComponent<PostProcessLayer>());
Destroy(gameObject.GetComponent<AudioListener>());
} }
else else
{ {
//string palyerJoinRoom = "joinroom " + ""; //string palyerJoinRoom = "joinroom " + "";
//_ = SyncCreateRoom.SendMessageAsync(palyerJoinRoom); //_ = SyncCreateRoom.SendMessageAsync(palyerJoinRoom);
gameObject.tag = "MainCamera";
} }
} }
} }

View File

@ -10,16 +10,16 @@ namespace AdamSync
private void Start() private void Start()
{ {
//SyncCreateRoom.playerInfoRequset += ReceivePlayInfo; SyncCreateRoom.playerInfoRequset += ReceivePlayInfo;
//if (isPlayer) if (isPlayer)
//{ {
// StartCoroutine(SendMsg()); StartCoroutine(SendMsg());
//} }
//else else
//{ {
// //string msg = string.Format("send2room online," + GlobeFlag.userID + "," + GlobeFlag.userName + "," + GlobeFlag.roomID); //string msg = string.Format("send2room online," + GlobeFlag.userID + "," + GlobeFlag.userName + "," + GlobeFlag.roomID);
// //_ = SyncCreateRoom.SendMessageAsync(msg); //_ = SyncCreateRoom.SendMessageAsync(msg);
//} }
} }
private IEnumerator SendMsg() 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])); Vector3 temp = new Vector3(float.Parse(data[0]), float.Parse(data[1]), float.Parse(data[2]));
return temp; return temp;
} }
private void OnDisable()
{
Debug.Log("OnDisable");
StopAllCoroutines();
SyncCreateRoom.playerInfoRequset -= ReceivePlayInfo;
}
} }
} }