添加当前想定ID获取的逻辑
This commit is contained in:
parent
f23049efb0
commit
9b546eef9b
|
|
@ -531,8 +531,9 @@ public class View_Panel2 : XUIPanel
|
||||||
|
|
||||||
public RSData.RoomSubjectData currentRoomData = new RSData.RoomSubjectData();
|
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);
|
GameObject roomItem = GameObject.Instantiate(root_pan, place);
|
||||||
roomItem.name = roomId;
|
roomItem.name = roomId;
|
||||||
roomItem.transform.Find("Text").GetComponent<Text>().text = name;
|
roomItem.transform.Find("Text").GetComponent<Text>().text = name;
|
||||||
|
|
@ -543,6 +544,7 @@ public class View_Panel2 : XUIPanel
|
||||||
currentRoomName = roomItem.name;
|
currentRoomName = roomItem.name;
|
||||||
GlobalFlag.roomID = roomItem.name;
|
GlobalFlag.roomID = roomItem.name;
|
||||||
GlobalFlag.practiceId = roomItem.name;
|
GlobalFlag.practiceId = roomItem.name;
|
||||||
|
GlobalFlag.currentThinkId = _roomId.Split(',')[1];
|
||||||
UIBootstrap.Instance.GetSceneData(GlobalFlag.practiceId);
|
UIBootstrap.Instance.GetSceneData(GlobalFlag.practiceId);
|
||||||
|
|
||||||
Debug.Log(" roomItem.nameID==" + roomItem.name);
|
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);
|
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)
|
if (returnRoomId.state)
|
||||||
{
|
{
|
||||||
CreateRoomBase(returnRoomId.data, currentRoomName);
|
CreateRoomBase(returnRoomId.data+","+currentThinkingId, currentRoomName);
|
||||||
//创建房间
|
//创建房间
|
||||||
string RoomName = "createroom " + returnRoomId.data;
|
string RoomName = "createroom " + returnRoomId.data;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,8 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
|
||||||
public HuoPaoController[] huoPaoCtrls;
|
public HuoPaoController[] huoPaoCtrls;
|
||||||
public Text modelname_text;
|
public Text modelname_text;
|
||||||
public bool isDragWRJ = true;
|
public bool isDragWRJ = true;
|
||||||
|
public string deviceID;
|
||||||
|
private Weaponitemone weaponitemones = new Weaponitemone();
|
||||||
public void OnBeginDrag(PointerEventData eventData)
|
public void OnBeginDrag(PointerEventData eventData)
|
||||||
{
|
{
|
||||||
if (model == null)
|
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 (model != null)
|
||||||
{
|
{
|
||||||
if (isDragWRJ)
|
if (isDragWRJ)
|
||||||
{
|
{
|
||||||
model.GetComponent<UnmannedAerialVehicleManage>().isStartRehearsing = GlobalFlag.isStartRehearsing;
|
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++)
|
//for (int i = 0; i < huoPaoCtrls.Length; i++)
|
||||||
//{
|
//{
|
||||||
// huoPaoCtrls[i].wrjs.Add(model);
|
// huoPaoCtrls[i].wrjs.Add(model);
|
||||||
|
|
@ -50,7 +52,7 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
|
||||||
{
|
{
|
||||||
DragManager.Instance.AddObj(model);//把对应模型传入链表
|
DragManager.Instance.AddObj(model);//把对应模型传入链表
|
||||||
//DragManager.Instance.Addobj1(model);//
|
//DragManager.Instance.Addobj1(model);//
|
||||||
//model.GetComponent<Modeldata>().SetPos();//重新获取该模型的位置的值
|
//model.GetComponent<Modeldata>().SetPos();//重新获取该模型的位置的值
|
||||||
DragManager.Instance.Addtext(modelname_text.text);//把对应名字存入链表
|
DragManager.Instance.Addtext(modelname_text.text);//把对应名字存入链表
|
||||||
}
|
}
|
||||||
model = null;
|
model = null;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using AdamSync;
|
using AdamSync;
|
||||||
|
using Boo.Lang;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
@ -12,9 +13,9 @@ public class GameManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
public SyncPlayerTransform playerTransformPrefab;
|
public SyncPlayerTransform playerTransformPrefab;
|
||||||
public Transform spawnPos;
|
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 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 Transform dviceContent;
|
||||||
public GameObject wrjDrag;
|
public GameObject wrjDrag;
|
||||||
public GameObject ldDrag;
|
public GameObject ldDrag;
|
||||||
|
|
@ -22,6 +23,7 @@ public class GameManager : MonoBehaviour
|
||||||
public GameObject wxdDrag;
|
public GameObject wxdDrag;
|
||||||
public GameObject Teacher;
|
public GameObject Teacher;
|
||||||
public GameObject student;
|
public GameObject student;
|
||||||
|
public Weaponitem weaponitem = new Weaponitem();
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
|
|
@ -36,7 +38,7 @@ public class GameManager : MonoBehaviour
|
||||||
student.gameObject.SetActive(true);
|
student.gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GetAllWeapons();
|
||||||
|
|
||||||
SyncCreateRoom.getroomusersRequset += OnGetRoomUsers;
|
SyncCreateRoom.getroomusersRequset += OnGetRoomUsers;
|
||||||
SyncCreateRoom.send2roomRequset += OnOtherPlayerOnline;
|
SyncCreateRoom.send2roomRequset += OnOtherPlayerOnline;
|
||||||
|
|
@ -50,19 +52,54 @@ public class GameManager : MonoBehaviour
|
||||||
if (UIBootstrap.Instance.GetRoleByIDPracticeId(GlobalFlag.practiceSeatId) == "0")
|
if (UIBootstrap.Instance.GetRoleByIDPracticeId(GlobalFlag.practiceSeatId) == "0")
|
||||||
{
|
{
|
||||||
spt.GetComponent<Camera>().cullingMask = ~(1 << 11);
|
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
|
else
|
||||||
{
|
{
|
||||||
spt.GetComponent<Camera>().cullingMask = ~(1 << 12);
|
spt.GetComponent<Camera>().cullingMask = ~(1 << 12);
|
||||||
GameObject ld = Instantiate(ldDrag, dviceContent);
|
for (int i = 0; i < GetDeviceByName("探测雷达").Count; i++)
|
||||||
GameObject hp = Instantiate(hpDrag, dviceContent);
|
{
|
||||||
GameObject wzd = Instantiate(wxdDrag, dviceContent);
|
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));
|
userIds.Add(ulong.Parse(GlobalFlag.currentUser.user_id));
|
||||||
tenkokuModule.mainCamera = spt.transform;
|
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()
|
public void Start()
|
||||||
{
|
{
|
||||||
SetWeatherValue();
|
SetWeatherValue();
|
||||||
|
|
@ -171,7 +208,7 @@ public class GameManager : MonoBehaviour
|
||||||
Debug.Log(info);
|
Debug.Log(info);
|
||||||
if (info.Length > 0 && !string.IsNullOrWhiteSpace(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++)
|
for (int i = 0; i < modelsInfo.Count; i++)
|
||||||
{
|
{
|
||||||
GameObject obj = Resources.Load<GameObject>(modelsInfo[i].str);
|
GameObject obj = Resources.Load<GameObject>(modelsInfo[i].str);
|
||||||
|
|
|
||||||
|
|
@ -12,4 +12,8 @@ public class GlobalFlag
|
||||||
///是否正在预演
|
///是否正在预演
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool isStartRehearsing;
|
public static bool isStartRehearsing;
|
||||||
|
/// <summary>
|
||||||
|
/// 当前想定ID
|
||||||
|
/// </summary>
|
||||||
|
public static string currentThinkId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue