This commit is contained in:
王志勋 2023-11-19 23:06:53 +08:00
commit d28ff6ea5d
5 changed files with 62 additions and 16 deletions

View File

@ -531,8 +531,9 @@ public class View_Panel2 : XUIPanel
public RSData.RoomSubjectData currentRoomData = new RSData.RoomSubjectData();
public void CreateRoomBase(string roomId, string name)
public void CreateRoomBase(string _roomId, string name)
{
string roomId = _roomId.Split(',')[0];
GameObject roomItem = GameObject.Instantiate(root_pan, place);
roomItem.name = roomId;
roomItem.transform.Find("Text").GetComponent<Text>().text = name;
@ -543,6 +544,7 @@ public class View_Panel2 : XUIPanel
currentRoomName = roomItem.name;
GlobalFlag.roomID = roomItem.name;
GlobalFlag.practiceId = roomItem.name;
GlobalFlag.currentThinkId = _roomId.Split(',')[1];
UIBootstrap.Instance.GetSceneData(GlobalFlag.practiceId);
Debug.Log(" roomItem.nameID==" + roomItem.name);
@ -755,7 +757,7 @@ public class View_Panel2 : XUIPanel
ReturnRoomID returnRoomId = await AsyncWebReq.Post<ReturnRoomID>("http://111.229.30.246:48888/Handler/Practice.ashx?action=add&Name=" + currentRoomName + "&MissionModel=" + currentMissionModel + "&ThinkingId=" + currentThinkingId + "&AccountsInfo=" + accountInfo, null);
if (returnRoomId.state)
{
CreateRoomBase(returnRoomId.data, currentRoomName);
CreateRoomBase(returnRoomId.data+","+currentThinkingId, currentRoomName);
//创建房间
string RoomName = "createroom " + returnRoomId.data;

View File

@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 1113159741}
m_IndirectSpecularColor: {r: 0.17215174, g: 0.30464625, b: 0.5979567, a: 1}
m_IndirectSpecularColor: {r: 0.16215044, g: 0.3062308, b: 0.67089945, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
@ -48295,6 +48295,7 @@ MonoBehaviour:
wrjDrag: {fileID: 3625114603376075994, guid: 504e1e72e287c0740a66218ad23fbd0e, type: 3}
ldDrag: {fileID: 5970882834628802619, guid: beb8d369a0f07564994bb270fef9a929, type: 3}
hpDrag: {fileID: 3438159622267457516, guid: d24981e1d16301c47a2c5d83b9d4e456, type: 3}
wxdDrag: {fileID: 3438159622267457516, guid: 57c5ff12282ea37439abe26b94bc93b3, type: 3}
Teacher: {fileID: 754191141}
student: {fileID: 1862065805184089353}
--- !u!4 &1436809530
@ -62187,7 +62188,7 @@ MonoBehaviour:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
randSeed: 36344203
randSeed: 41044140
isDoingTransition: 0
minimumHeight: 0
--- !u!114 &1820978574

View File

@ -12,7 +12,8 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
public HuoPaoController[] huoPaoCtrls;
public Text modelname_text;
public bool isDragWRJ = true;
public string deviceID;
private Weaponitemone weaponitemones = new Weaponitemone();
public void OnBeginDrag(PointerEventData eventData)
{
if (model == null)
@ -32,14 +33,15 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
}
}
public void OnEndDrag(PointerEventData eventData)
public async void OnEndDrag(PointerEventData eventData)
{
if (model != null)
{
if (isDragWRJ)
{
model.GetComponent<UnmannedAerialVehicleManage>().isStartRehearsing = GlobalFlag.isStartRehearsing;
weaponitemones = await AsyncWebReq.Post<Weaponitemone>("http://172.16.1.254:48888/Handler/Thinkingfile.ashx?action=querydevicepara&think_device_id=" + deviceID, null);
model.GetComponent<UnmannedAerialVehicleManage>().FillInTheData(weaponitemones);
//for (int i = 0; i < huoPaoCtrls.Length; i++)
//{
// huoPaoCtrls[i].wrjs.Add(model);
@ -50,7 +52,7 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
{
DragManager.Instance.AddObj(model);//把对应模型传入链表
//DragManager.Instance.Addobj1(model);//
//model.GetComponent<Modeldata>().SetPos();//重新获取该模型的位置的值
//model.GetComponent<Modeldata>().SetPos();//重新获取该模型的位置的值
DragManager.Instance.Addtext(modelname_text.text);//把对应名字存入链表
}
model = null;

View File

@ -1,4 +1,5 @@
using AdamSync;
using Boo.Lang;
using System;
using System.Collections;
using System.Collections.Generic;
@ -12,9 +13,9 @@ public class GameManager : MonoBehaviour
{
public SyncPlayerTransform playerTransformPrefab;
public Transform spawnPos;
public List<ulong> userIds = new List<ulong>();
public System.Collections.Generic.List<ulong> userIds = new System.Collections.Generic.List<ulong>();
public TenkokuModule tenkokuModule;
public List<ModelInfo> modelsInfo = new List<ModelInfo>();
public System.Collections.Generic.List<ModelInfo> modelsInfo = new System.Collections.Generic.List<ModelInfo>();
public Transform dviceContent;
public GameObject wrjDrag;
public GameObject ldDrag;
@ -22,6 +23,7 @@ public class GameManager : MonoBehaviour
public GameObject wxdDrag;
public GameObject Teacher;
public GameObject student;
public Weaponitem weaponitem = new Weaponitem();
// Start is called before the first frame update
private void Awake()
{
@ -36,7 +38,7 @@ public class GameManager : MonoBehaviour
student.gameObject.SetActive(true);
}
GetAllWeapons();
SyncCreateRoom.getroomusersRequset += OnGetRoomUsers;
SyncCreateRoom.send2roomRequset += OnOtherPlayerOnline;
@ -50,19 +52,54 @@ public class GameManager : MonoBehaviour
if (UIBootstrap.Instance.GetRoleByIDPracticeId(GlobalFlag.practiceSeatId) == "0")
{
spt.GetComponent<Camera>().cullingMask = ~(1 << 11);
GameObject wrj = Instantiate(wrjDrag, dviceContent);
for (int i = 0; i < GetDeviceByName("蜂群无人机").Count; i++)
{
GameObject wrj = Instantiate(wrjDrag, dviceContent);
wrj.GetComponent<DragController>().deviceID = GetDeviceByName("蜂群无人机")[i].id;
}
}
else
{
spt.GetComponent<Camera>().cullingMask = ~(1 << 12);
GameObject ld = Instantiate(ldDrag, dviceContent);
GameObject hp = Instantiate(hpDrag, dviceContent);
GameObject wzd = Instantiate(wxdDrag, dviceContent);
for (int i = 0; i < GetDeviceByName("探测雷达").Count; i++)
{
GameObject ld = Instantiate(ldDrag, dviceContent);
ld.GetComponent<DragController>().deviceID = GetDeviceByName("探测雷达")[i].id;
}
for (int i = 0; i < GetDeviceByName("激光火控平台").Count; i++)
{
GameObject hp = Instantiate(hpDrag, dviceContent);
hp.GetComponent<DragController>().deviceID = GetDeviceByName("激光火控平台")[i].id;
}
for (int i = 0; i < GetDeviceByName("地面无线电干扰").Count; i++)
{
GameObject wxd = Instantiate(wxdDrag, dviceContent);
wxd.GetComponent<DragController>().deviceID = GetDeviceByName("地面无线电干扰")[i].id;
}
}
userIds.Add(ulong.Parse(GlobalFlag.currentUser.user_id));
tenkokuModule.mainCamera = spt.transform;
}
private async void GetAllWeapons()
{
weaponitem = await AsyncWebReq.Post<Weaponitem>("http://172.16.1.254:48888/Handler/Thinkingfile.ashx?action=querydevice&think_id=" + GlobalFlag.currentThinkId, null);
}
public System.Collections.Generic.List<DataItem1> GetDeviceByName(string deviceName)
{
System.Collections.Generic.List<DataItem1> detaIteml = new System.Collections.Generic.List<DataItem1>();
for (int i = 0; i < weaponitem.data.Count; i++)
{
if (weaponitem.data[i].device_name == deviceName)
detaIteml.Add(weaponitem.data[i]);
}
return detaIteml;
}
public void Start()
{
SetWeatherValue();
@ -171,7 +208,7 @@ public class GameManager : MonoBehaviour
Debug.Log(info);
if (info.Length > 0 && !string.IsNullOrWhiteSpace(info))
{
modelsInfo = Jsonanalyze.FromJson<List<ModelInfo>>(info);
modelsInfo = Jsonanalyze.FromJson<System.Collections.Generic.List<ModelInfo>>(info);
for (int i = 0; i < modelsInfo.Count; i++)
{
GameObject obj = Resources.Load<GameObject>(modelsInfo[i].str);

View File

@ -12,4 +12,8 @@ public class GlobalFlag
///是否正在预演
/// </summary>
public static bool isStartRehearsing;
/// <summary>
/// 当前想定ID
/// </summary>
public static string currentThinkId;
}