Compare commits

...

3 Commits

Author SHA1 Message Date
YangHua 618b5cf5d5 融合 2024-01-17 16:09:43 +08:00
YangHua 72f846932b 212 2024-01-17 16:08:56 +08:00
YangHua de255738a9 修改无人机属性 2024-01-17 16:06:45 +08:00
14 changed files with 103 additions and 80 deletions

View File

@ -310,6 +310,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d7c8a5e37f63c8e419e73f2c1b2ad41e, type: 3} m_Script: {fileID: 11500000, guid: d7c8a5e37f63c8e419e73f2c1b2ad41e, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
wrjModel: 0
pattern: 0 pattern: 0
interval: 5 interval: 5
equipmentCommon: {fileID: -7238547075891962512} equipmentCommon: {fileID: -7238547075891962512}

View File

@ -182,6 +182,7 @@ MonoBehaviour:
deviceID: deviceID:
isPlayer: 0 isPlayer: 0
isThinck: 0 isThinck: 0
wrjModel: 0
--- !u!1 &3625114603613546360 --- !u!1 &3625114603613546360
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -1 +1 @@
192.168.107.15:48888 127.0.0.1:48888

View File

@ -1 +1 @@
192.168.107.15 127.0.0.1

View File

@ -1860,15 +1860,15 @@ public class Scenariopage : MonoBehaviour
} }
properties.Clear();//清空链表 properties.Clear();//清空链表
} }
for (int i = 0; i < DragManager.Instance.deviceimages.Count; i++)//判断单例生成预设体 for (int i = 0; i < DragManager.Instance.devices.Count; i++)//判断单例生成预设体
{ {
int index = i; int index = i;
if (DragManager.Instance.deviceimages[i] != null) if (DragManager.Instance.devices[i] != null)
{ {
Propertypanl pro = Instantiate(propertypanl, Panel_making);//生成预设体对象 Propertypanl pro = Instantiate(propertypanl, Panel_making);//生成预设体对象
pro.Property(DragManager.Instance.deviceimages[i].name.Replace("(Clone)", ""), () => pro.Property(DragManager.Instance.devices[i].name.Replace("(Clone)", ""), () =>
{ {
Destroy(DragManager.Instance.deviceimages[index].gameObject);//删除 Destroy(DragManager.Instance.devices[index].gameObject);//删除
Destroy(pro.gameObject);//删除 Destroy(pro.gameObject);//删除
}); });
properties.Add(pro); properties.Add(pro);
@ -1891,15 +1891,15 @@ public class Scenariopage : MonoBehaviour
//想定文件下的保存按钮 //想定文件下的保存按钮
save_btn.onClick.AddListener(() => save_btn.onClick.AddListener(() =>
{ {
if (DragManager.Instance.deviceimages.Count > 0)//判断场景的模型是否为空 if (DragManager.Instance.devices.Count > 0)//判断场景的模型是否为空
{ {
for (int i = 0; i < DragManager.Instance.deviceimages.Count; i++) for (int i = 0; i < DragManager.Instance.devices.Count; i++)
{ {
if (DragManager.Instance.deviceimages[i] != null)//如果链表有模型就进入 if (DragManager.Instance.devices[i] != null)//如果链表有模型就进入
{ {
DragManager.Instance.deviceimages[i].GetComponent<Modeldata>().SetPos();//初始化获取模型对应位置的值 DragManager.Instance.devices[i].GetComponent<Modeldata>().SetPos();//初始化获取模型对应位置的值
DragManager.Instance.Addobj1(DragManager.Instance.deviceimages[i]);//就把对应的模型加到链表类里面 DragManager.Instance.Addobj1(DragManager.Instance.devices[i]);//就把对应的模型加到链表类里面
} }
} }
} }
@ -1907,16 +1907,16 @@ public class Scenariopage : MonoBehaviour
{ {
Passbyvalue();//把场景中天气插件的值传给接口 Passbyvalue();//把场景中天气插件的值传给接口
} }
if (DragManager.Instance.deviceimages.Count > 0)//判断模型列表个数是否大于零 if (DragManager.Instance.devices.Count > 0)//判断模型列表个数是否大于零
{ {
for (int i = 0; i < DragManager.Instance.deviceimages.Count; i++) for (int i = 0; i < DragManager.Instance.devices.Count; i++)
{ {
if (DragManager.Instance.deviceimages[i] != null)//如果链表里有一个物体就进去 if (DragManager.Instance.devices[i] != null)//如果链表里有一个物体就进去
{ {
Destroy(DragManager.Instance.deviceimages[i].gameObject);//删除链表有的物体 Destroy(DragManager.Instance.devices[i].gameObject);//删除链表有的物体
} }
} }
DragManager.Instance.deviceimages.Clear();//清空链表 DragManager.Instance.devices.Clear();//清空链表
} }
if (DragManager.Instance.modellist.Count > 0) if (DragManager.Instance.modellist.Count > 0)
{ {

View File

@ -219,8 +219,8 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 2132962759} - component: {fileID: 2132962759}
- component: {fileID: 2132962758}
- component: {fileID: 2132962760} - component: {fileID: 2132962760}
- component: {fileID: 2132962758}
m_Layer: 0 m_Layer: 0
m_Name: Net m_Name: Net
m_TagString: Untagged m_TagString: Untagged

View File

@ -16,8 +16,18 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
public string deviceID; public string deviceID;
public bool isPlayer = false; public bool isPlayer = false;
public bool isThinck = false; public bool isThinck = false;
public WRJModel wrjModel = WRJModel.;
public void OnBeginDrag(PointerEventData eventData) public void OnBeginDrag(PointerEventData eventData)
{ {
if (isDragWRJ)
{
if (DragManager.Instance.devices.Count == GameManager.Instance.wrjCount)
{
return;
}
}
if (model == null) if (model == null)
{ {
model = Instantiate(prefabItem); model = Instantiate(prefabItem);
@ -41,14 +51,18 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
{ {
if (!isThinck) if (!isThinck)
{ {
model.GetComponent<EquipmentCommon>().isPlayer = true; model.GetComponent<EquipmentCommon>().isPlayer = true;
model.GetComponent<EquipmentCommon>().isStartRehearsing = GlobalFlag.isStartRehearsing; model.GetComponent<EquipmentCommon>().isStartRehearsing = GlobalFlag.isStartRehearsing;
List<List_paraItem> temp = UIBootstrap.Instance.GetListParaItemById(deviceID); List<List_paraItem> temp = UIBootstrap.Instance.GetListParaItemById(deviceID);
model.GetComponent<EquipmentCommon>().FillInTheData(temp); model.GetComponent<EquipmentCommon>().FillInTheData(temp);
// if (model.GetComponent<UnmannedAerialVehicleManage>())
// model.GetComponent<UnmannedAerialVehicleManage>().wrjModel = wrjModel;
transform.SetAsLastSibling(); if (!isDragWRJ)
transform.localScale = Vector3.zero; {
transform.SetAsLastSibling();
transform.localScale = Vector3.zero;
}
} }
if (DragManager.Instance != null) if (DragManager.Instance != null)
{ {

View File

@ -10,7 +10,7 @@ using XFrame.Core.Utils;
public class DragManager : MonoSingleton<DragManager> public class DragManager : MonoSingleton<DragManager>
{ {
public List<Modelequipment> deviceimages1 = new List<Modelequipment>();//把最终场景中存在的模型放入链表当中 public List<Modelequipment> deviceimages1 = new List<Modelequipment>();//把最终场景中存在的模型放入链表当中
public List<GameObject> deviceimages = new List<GameObject>();//把最开始生成在场景中的模型存入链表 public List<GameObject> devices = new List<GameObject>();//把最开始生成在场景中的模型存入链表
public List<string> modellist = new List<string>();//存入最开始场景生成模型的名字 public List<string> modellist = new List<string>();//存入最开始场景生成模型的名字
public Dictionary<string,int> model = new Dictionary<string,int>(); public Dictionary<string,int> model = new Dictionary<string,int>();
@ -36,7 +36,7 @@ public class DragManager : MonoSingleton<DragManager>
//} //}
public void AddObj(GameObject obj) public void AddObj(GameObject obj)
{ {
deviceimages.Add(obj);//把生成的预设体放入链表当中 devices.Add(obj);//把生成的预设体放入链表当中
} }
public void Addobj1(GameObject obj) public void Addobj1(GameObject obj)
{ {

View File

@ -4,6 +4,7 @@ using RDate;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Tenkoku.Core; using Tenkoku.Core;
using UnityEngine; using UnityEngine;
using static InterfaceManager; using static InterfaceManager;
@ -27,7 +28,14 @@ public class GameManager : MonoSingleton<GameManager>
public GameObject Teacher; public GameObject Teacher;
public GameObject student; public GameObject student;
public GameObject posture; public GameObject posture;
public int wrjCount;
public List<SyncPlayerTransform> players = new List<SyncPlayerTransform>(); public List<SyncPlayerTransform> players = new List<SyncPlayerTransform>();
public DragController[] wrjDrags;
// Start is called before the first frame update // Start is called before the first frame update
private void Awake() private void Awake()
{ {
@ -45,18 +53,30 @@ public class GameManager : MonoSingleton<GameManager>
spt.gameObject.SetActive(true); spt.gameObject.SetActive(true);
spt.GetComponent<Camera>().cullingMask = ~(1 << 12); spt.GetComponent<Camera>().cullingMask = ~(1 << 12);
spt.GetComponent<Camera>().cullingMask = ~(1 << 15); spt.GetComponent<Camera>().cullingMask = ~(1 << 15);
if (UIBootstrap.Instance.GetDeviceByName("蜂群无人机").device_count > 0) AdamThinkDevicesData.DataItem diTemp = UIBootstrap.Instance.GetDeviceByName("蜂群无人机");
if (diTemp.device_count > 0)
{ {
for (int i = 0; i < UIBootstrap.Instance.GetDeviceByName("蜂群无人机").device_count; i++) wrjCount = diTemp.device_count;
for (int i = 0; i < wrjDrags.Length; i++)
{ {
DragController wrj = Instantiate(wrjDrag, dviceContent); wrjDrags[i].isPlayer = true;
wrj.isPlayer = true; wrjDrags[i].deviceID = UIBootstrap.Instance.GetDeviceByName("蜂群无人机").id;
wrj.deviceID = UIBootstrap.Instance.GetDeviceByName("蜂群无人机").id; }
}
for (int i = 0; i < diTemp.list_para.Count; i++)
{
if (diTemp.list_para[i].para_name.Contains("光学侦察能力") && diTemp.list_para[i].para_value == "1")
{
wrjDrags[0].gameObject.SetActive(false);
} }
} }
} }
else else
{ {
for (int i = 0; i < dviceContent.childCount; i++)
{
Destroy(dviceContent.GetChild(i).gameObject);
}
spt.transform.position = blueSpawnPos.position; spt.transform.position = blueSpawnPos.position;
spt.transform.eulerAngles = blueSpawnPos.eulerAngles; spt.transform.eulerAngles = blueSpawnPos.eulerAngles;
spt.gameObject.SetActive(true); spt.gameObject.SetActive(true);
@ -328,7 +348,7 @@ public class GameManager : MonoSingleton<GameManager>
SpawnDevice(hpDrag.prefabItem, deviceData.data[i]); SpawnDevice(hpDrag.prefabItem, deviceData.data[i]);
break; break;
case "频谱探测": case "频谱探测":
SpawnDevice(ppDrag.prefabItem,deviceData.data[i]); SpawnDevice(ppDrag.prefabItem, deviceData.data[i]);
break; break;
case "微波武器": case "微波武器":
SpawnDevice(wbDrag.prefabItem, deviceData.data[i]); SpawnDevice(wbDrag.prefabItem, deviceData.data[i]);
@ -355,7 +375,7 @@ public class GameManager : MonoSingleton<GameManager>
device.GetComponent<EquipmentCommon>().deviceID = data.id; device.GetComponent<EquipmentCommon>().deviceID = data.id;
device.GetComponent<EquipmentCommon>().FillInTheData(data.list_para); device.GetComponent<EquipmentCommon>().FillInTheData(data.list_para);
} }
private void OnGetRoomUsers(string obj) private void OnGetRoomUsers(string obj)
{ {
if (!string.IsNullOrWhiteSpace(obj)) if (!string.IsNullOrWhiteSpace(obj))
@ -400,8 +420,8 @@ public class GameManager : MonoSingleton<GameManager>
tenkokuModule.weather_SnowAmt = Mathf.Lerp(0f, 1f, float.Parse(UIBootstrap.Instance.currentSceneInfo.data.EnvSnow)); tenkokuModule.weather_SnowAmt = Mathf.Lerp(0f, 1f, float.Parse(UIBootstrap.Instance.currentSceneInfo.data.EnvSnow));
tenkokuModule.weather_WindAmt = Mathf.Lerp(0f, 1f, float.Parse(UIBootstrap.Instance.currentSceneInfo.data.EnvWindSpeed)); tenkokuModule.weather_WindAmt = Mathf.Lerp(0f, 1f, float.Parse(UIBootstrap.Instance.currentSceneInfo.data.EnvWindSpeed));
tenkokuModule.weather_WindDir = Mathf.Lerp(0f, 360f, float.Parse(UIBootstrap.Instance.currentSceneInfo.data.EnvWindDir)); tenkokuModule.weather_WindDir = Mathf.Lerp(0f, 360f, float.Parse(UIBootstrap.Instance.currentSceneInfo.data.EnvWindDir));
tenkokuModule.weather_OvercastAmt = Mathf.Lerp(0f, 1f, 1-(float.Parse(UIBootstrap.Instance.currentSceneInfo.data.EnvLight)/10)); tenkokuModule.weather_OvercastAmt = Mathf.Lerp(0f, 1f, 1 - (float.Parse(UIBootstrap.Instance.currentSceneInfo.data.EnvLight) / 10));
tenkokuModule.weather_humidity = Mathf.Lerp(0f, 1f,1- (float.Parse(UIBootstrap.Instance.currentSceneInfo.data.EnvWu) / 100)); tenkokuModule.weather_humidity = Mathf.Lerp(0f, 1f, 1 - (float.Parse(UIBootstrap.Instance.currentSceneInfo.data.EnvWu) / 100));
Debug.LogError(tenkokuModule.weather_humidity); Debug.LogError(tenkokuModule.weather_humidity);
Debug.LogError(tenkokuModule.weather_OvercastAmt); Debug.LogError(tenkokuModule.weather_OvercastAmt);
} }

View File

@ -9,7 +9,7 @@ using static InterfaceManager;
public class UIBootstrap : MonoSingleton<UIBootstrap> public class UIBootstrap : MonoSingleton<UIBootstrap>
{ {
//private string url = Url_GetAllThinkData; //private string url = Url_GetAllThinkData;
private string sceneInfoUrl = Url_GetSceneInfo; private string sceneInfoUrl;
public Editinformation editinformation = new Editinformation(); public Editinformation editinformation = new Editinformation();
public SceneRoot currentSceneInfo = new SceneRoot(); public SceneRoot currentSceneInfo = new SceneRoot();
public List<RSData.SubjectDataItem> subjectInfo = new List<RSData.SubjectDataItem>(); public List<RSData.SubjectDataItem> subjectInfo = new List<RSData.SubjectDataItem>();
@ -21,7 +21,8 @@ public class UIBootstrap : MonoSingleton<UIBootstrap>
// Start is called before the first frame update // Start is called before the first frame update
private async void Start() private async void Start()
{ {
Debug.Log(Url_GetAllThinkData); sceneInfoUrl = Url_GetSceneInfo;
Debug.LogError(Url_GetAllThinkData);
editinformation = await AsyncWebReq.Post<Editinformation>(Url_GetAllThinkData, null); editinformation = await AsyncWebReq.Post<Editinformation>(Url_GetAllThinkData, null);
for (int i = 0; i < editinformation.data.Count; i++) for (int i = 0; i < editinformation.data.Count; i++)
{ {

View File

@ -1,4 +1,5 @@
using System; using AdamSync;
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -16,18 +17,13 @@ public class AddConfing : MonoBehaviour
private void Awake() private void Awake()
{ {
StartCoroutine(GetSetting(ipSetting, (data) => string[] datas = ContectServer.ReadFromLocal("IPPort.txt").Split(':');
{ //Debug.Log(IP);
string[] datas= data.ToString().Split(':'); //Debug.Log(Port);
//Debug.Log(IP); //Debug.Log(Url_Action);
//Debug.Log(Port); IP = datas[0];
//Debug.Log(Url_Action); Port = datas[1];
IP = datas[0];
Port = datas[1];
//Debug.Log(IP);
//Debug.Log(Port);
//Debug.Log(Url_Action);
}));
} }

View File

@ -9,7 +9,7 @@ using Newtonsoft.Json.Linq;
public static class InterfaceManager public static class InterfaceManager
{ {
private static string _IP = "192.168.107.15"; private static string _IP;
public static string IP public static string IP
{ {
get { return _IP; } get { return _IP; }
@ -19,7 +19,7 @@ public static class InterfaceManager
_IP = value; _IP = value;
} }
} }
private static string _Port = "48888"; private static string _Port;
public static string Port public static string Port
{ {
get { return _Port; } get { return _Port; }
@ -100,7 +100,7 @@ public static class InterfaceManager
/// <summary> /// <summary>
/// 获取房间ID并添加房间 /// 获取房间ID并添加房间
/// </summary> /// </summary>
public static string Url_GetRoomID{get => IpAddress + "/Handler/Practice.ashx?action=add&Name=";} public static string Url_GetRoomID { get => IpAddress + "/Handler/Practice.ashx?action=add&Name="; }
/// <summary> /// <summary>
/// 更新房间状态 /// 更新房间状态
/// </summary> /// </summary>
@ -142,7 +142,7 @@ public static class InterfaceManager
using (System.IO.StreamReader reader = new System.IO.StreamReader(path)) { return reader.ReadToEnd(); } using (System.IO.StreamReader reader = new System.IO.StreamReader(path)) { return reader.ReadToEnd(); }
} }
public static IEnumerator GetBytes(string url, Action<string> callback) public static IEnumerator GetBytes(string url, Action<string> callback)
{ {
@ -221,10 +221,10 @@ public static class InterfaceManager
} }
} }
public static IEnumerator PostString(string url, WWWForm formdata, Dictionary<string, string> headers = null, Action<string> callback = null) public static IEnumerator PostString(string url, WWWForm formdata, Dictionary<string, string> headers = null, Action<string> callback = null)
{ {
@ -279,7 +279,7 @@ public static class InterfaceManager
} }
} }
public static IEnumerator GetString(string url, Dictionary<string, string> headers = null,int time=50,Action<string> callback = null) public static IEnumerator GetString(string url, Dictionary<string, string> headers = null, int time = 50, Action<string> callback = null)
{ {
while (true) while (true)
{ {

View File

@ -13,6 +13,7 @@ using Newtonsoft.Json;
/// </summary> /// </summary>
public class UnmannedAerialVehicle : MonoBehaviour public class UnmannedAerialVehicle : MonoBehaviour
{ {
public WRJModel wrjModel = WRJModel.;
/// <summary> /// <summary>
/// 所属无人机蜂群 /// 所属无人机蜂群
/// </summary> /// </summary>
@ -70,9 +71,6 @@ public class UnmannedAerialVehicle : MonoBehaviour
/// </summary> /// </summary>
public GameObject explodePrefab; public GameObject explodePrefab;
private void OnTriggerEnter(Collider other) private void OnTriggerEnter(Collider other)
{ {
@ -85,6 +83,16 @@ public class UnmannedAerialVehicle : MonoBehaviour
} }
} }
/// <summary>
/// 设置无人机类型
/// </summary>
/// <param name="wrjModel"></param>
public void SetWRJModel(WRJModel _wrjModel)
{
wrjModel = _wrjModel;
}
/// <summary> /// <summary>
/// 被攻击 /// 被攻击
/// </summary> /// </summary>

View File

@ -20,11 +20,12 @@ public enum WRJModel
/// </summary> /// </summary>
public class UnmannedAerialVehicleManage : MonoBehaviour public class UnmannedAerialVehicleManage : MonoBehaviour
{ {
public WRJModel wrjModel = WRJModel.;
/// <summary> /// <summary>
/// 无人机状态 /// 无人机状态
/// </summary> /// </summary>
public Pattern pattern = Pattern.; public Pattern pattern = Pattern.;
public WRJModel wrjModel = WRJModel.;
public static List<UnmannedAerialVehicleManage> unmannedAerialVehicleManages = new List<UnmannedAerialVehicleManage>(); public static List<UnmannedAerialVehicleManage> unmannedAerialVehicleManages = new List<UnmannedAerialVehicleManage>();
#region #region
private bool _isStartRehearsing = false; private bool _isStartRehearsing = false;
@ -149,25 +150,6 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
OnActivationChanged += OnActivationChangedHandler; OnActivationChanged += OnActivationChangedHandler;
} }
/// <summary>
/// 设置无人机类型
/// </summary>
/// <param name="wrjModel"></param>
public void SetWRJModel()
{
switch (wrjModel)
{
case WRJModel.:
Debug.Log("光学无人机");
break;
case WRJModel.:
Debug.Log("电子侦察无人机");
break;
case WRJModel.:
Debug.Log("自杀式无人机");
break;
}
}
[ContextMenu("Test")] [ContextMenu("Test")]
public void Test() public void Test()
@ -196,7 +178,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
break; break;
} }
var _unmannedAerialVehicle = unmannedAerialVehicles.FindAll(x => x != null); var _unmannedAerialVehicle = unmannedAerialVehicles.FindAll(x => x != null&&x.gameObject.activeInHierarchy);
if (_unmannedAerialVehicle.Count == 0) if (_unmannedAerialVehicle.Count == 0)
{ {
string nowData = string.Format("{0},{1}", "SetToBeDestroyed", equipmentCommon.deviceID); string nowData = string.Format("{0},{1}", "SetToBeDestroyed", equipmentCommon.deviceID);
@ -282,7 +264,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
isEngagedTarget = true; isEngagedTarget = true;
colliders1.ForEach(x => Debug.Log(x.transform.name)); colliders1.ForEach(x => Debug.Log(x.transform.name));
int _number = UnityEngine.Random.Range(0, colliders1.Count - 1); int _number = UnityEngine.Random.Range(0, colliders1.Count - 1);
List<UnmannedAerialVehicle> _unmannedAerialVehicles = unmannedAerialVehicles.FindAll(x => x != null); List<UnmannedAerialVehicle> _unmannedAerialVehicles = unmannedAerialVehicles.FindAll(x => x != null&&x.gameObject.activeInHierarchy);
SendMsg(colliders1[_number].transform); SendMsg(colliders1[_number].transform);
for (int i = 0; i < _unmannedAerialVehicles.Count; i++) for (int i = 0; i < _unmannedAerialVehicles.Count; i++)
{ {
@ -467,7 +449,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
unmannedAerialVehicles[i].dataLinkCommunicationFrequency = dataLinkCommunicationFrequency; unmannedAerialVehicles[i].dataLinkCommunicationFrequency = dataLinkCommunicationFrequency;
unmannedAerialVehicles[i].electronicReconnaissanceCapability = electronicReconnaissanceCapability; unmannedAerialVehicles[i].electronicReconnaissanceCapability = electronicReconnaissanceCapability;
unmannedAerialVehicles[i].opticalReconnaissanceCapability = opticalReconnaissanceCapability; unmannedAerialVehicles[i].opticalReconnaissanceCapability = opticalReconnaissanceCapability;
unmannedAerialVehicles[i].wrjModel = wrjModel;
} }
} }
} }