diff --git a/Assets/Resources/DeviceBtn/WXD.prefab b/Assets/Resources/DeviceBtn/地面无线电干扰.prefab similarity index 100% rename from Assets/Resources/DeviceBtn/WXD.prefab rename to Assets/Resources/DeviceBtn/地面无线电干扰.prefab diff --git a/Assets/Resources/DeviceBtn/WXD.prefab.meta b/Assets/Resources/DeviceBtn/地面无线电干扰.prefab.meta similarity index 100% rename from Assets/Resources/DeviceBtn/WXD.prefab.meta rename to Assets/Resources/DeviceBtn/地面无线电干扰.prefab.meta diff --git a/Assets/Resources/DeviceBtn/WBWQ.prefab b/Assets/Resources/DeviceBtn/微波武器.prefab similarity index 100% rename from Assets/Resources/DeviceBtn/WBWQ.prefab rename to Assets/Resources/DeviceBtn/微波武器.prefab diff --git a/Assets/Resources/DeviceBtn/WBWQ.prefab.meta b/Assets/Resources/DeviceBtn/微波武器.prefab.meta similarity index 100% rename from Assets/Resources/DeviceBtn/WBWQ.prefab.meta rename to Assets/Resources/DeviceBtn/微波武器.prefab.meta diff --git a/Assets/Resources/DeviceBtn/LeiDa.prefab b/Assets/Resources/DeviceBtn/探测雷达.prefab similarity index 100% rename from Assets/Resources/DeviceBtn/LeiDa.prefab rename to Assets/Resources/DeviceBtn/探测雷达.prefab diff --git a/Assets/Resources/DeviceBtn/LeiDa.prefab.meta b/Assets/Resources/DeviceBtn/探测雷达.prefab.meta similarity index 100% rename from Assets/Resources/DeviceBtn/LeiDa.prefab.meta rename to Assets/Resources/DeviceBtn/探测雷达.prefab.meta diff --git a/Assets/Resources/DeviceBtn/HuoPao.prefab b/Assets/Resources/DeviceBtn/激光火控平台.prefab similarity index 100% rename from Assets/Resources/DeviceBtn/HuoPao.prefab rename to Assets/Resources/DeviceBtn/激光火控平台.prefab diff --git a/Assets/Resources/DeviceBtn/HuoPao.prefab.meta b/Assets/Resources/DeviceBtn/激光火控平台.prefab.meta similarity index 100% rename from Assets/Resources/DeviceBtn/HuoPao.prefab.meta rename to Assets/Resources/DeviceBtn/激光火控平台.prefab.meta diff --git a/Assets/Resources/DeviceBtn/PPTC.prefab b/Assets/Resources/DeviceBtn/频谱探测.prefab similarity index 100% rename from Assets/Resources/DeviceBtn/PPTC.prefab rename to Assets/Resources/DeviceBtn/频谱探测.prefab diff --git a/Assets/Resources/DeviceBtn/PPTC.prefab.meta b/Assets/Resources/DeviceBtn/频谱探测.prefab.meta similarity index 100% rename from Assets/Resources/DeviceBtn/PPTC.prefab.meta rename to Assets/Resources/DeviceBtn/频谱探测.prefab.meta diff --git a/Assets/StreamingAssets/IPPort.txt b/Assets/StreamingAssets/IPPort.txt index 298829e4..aad86cc0 100644 --- a/Assets/StreamingAssets/IPPort.txt +++ b/Assets/StreamingAssets/IPPort.txt @@ -1 +1 @@ -127.0.0.1:48888 \ No newline at end of file +192.168.97.15:48888 \ No newline at end of file diff --git a/Assets/StreamingAssets/confing.txt b/Assets/StreamingAssets/confing.txt index e56ea71e..580a6ef8 100644 --- a/Assets/StreamingAssets/confing.txt +++ b/Assets/StreamingAssets/confing.txt @@ -1 +1 @@ -127.0.0.1 \ No newline at end of file +192.168.97.15 \ No newline at end of file diff --git a/Assets/Temp/Scripts/Backpack.cs b/Assets/Temp/Scripts/Backpack.cs new file mode 100644 index 00000000..b29b2e3f --- /dev/null +++ b/Assets/Temp/Scripts/Backpack.cs @@ -0,0 +1,99 @@ +using AdamSync; +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Events; +using UnityEngine.Networking; +using static InterfaceManager; + +public class Backpack : MonoBehaviour +{ + public UnityEvent oneClickEvent;//unity事件 + public UnityEvent doubleClickEvent;//unity事件 + public float time; + public float lascktime; + public float itemtime = 0.2f; + public int count; + public bool isCount = true; + + public Mastermanagement mastermanagement; + public string Id; + void Start() + { + + } + + + void Update() + { + if (Input.GetMouseButtonDown(1)) + { + time = 0.2f; + if (Time.realtimeSinceStartup - lascktime < itemtime) + { + count = 2; + } + else + { + count = 1; + } + } + if (Input.GetMouseButtonUp(1)) + { + isCount = false; + lascktime = Time.realtimeSinceStartup; + } + if (!isCount) + { + time -= Time.deltaTime; + if (time <= 0) + { + if (count == 2) + { + OnRay(); + doubleClickEvent?.Invoke(); + } + else + { + oneClickEvent?.Invoke(); + } + isCount = true; + } + } + } + + private void OnRay() + { + Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); + RaycastHit hit; + if (Physics.Raycast(ray, out hit, 1000)) + { + if (hit.collider.gameObject.tag == "AttackTarget") + { + mastermanagement.Onobj(hit.collider.gameObject); + mastermanagement.Remove(hit.collider.gameObject); + Id = hit.collider.gameObject.GetComponent().deviceID; + Deletedevice(); + } + } + } + + private void Deletedevice() + { + if (string.IsNullOrEmpty(Id)) + { + return; + } + string nowData = string.Format("{0},{1}", "SetToBeDestroyedTwo", Id); + _ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData)); + + WWWForm headers = new WWWForm(); + headers.AddField("id", Id); + StartCoroutine(PostString(Url_Deletepracticedevicedetail, headers, data => + { + Id = null; + Debug.Log(data); + })); + } +} diff --git a/Assets/Temp/Scripts/Backpack.cs.meta b/Assets/Temp/Scripts/Backpack.cs.meta new file mode 100644 index 00000000..699ca180 --- /dev/null +++ b/Assets/Temp/Scripts/Backpack.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 13182b39a85857f4f833a669ab1e3daf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Temp/Scripts/Mastermanagement.cs b/Assets/Temp/Scripts/Mastermanagement.cs new file mode 100644 index 00000000..72c8a568 --- /dev/null +++ b/Assets/Temp/Scripts/Mastermanagement.cs @@ -0,0 +1,77 @@ +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +public class Mastermanagement : MonoBehaviour +{ + + public List dragControllers = new List();//用于存UI元素 + public List weapongames = new List();//用于存储场景中的物体 + void Awake() + { + + } + void Start() + { + StartCoroutine(WaitGetAllDevice()); + } + + private IEnumerator WaitGetAllDevice() + { + yield return new WaitForSeconds(0.01f); + weapongames = DeviceManager.Instance.GetPlayerDecive1(); + if (weapongames != null) + { + for (int i = 0; i < weapongames.Count; i++) + { + Noobj(weapongames[i]); + } + } + } + + + void Update() + { + + } + //初始化场景的设备 + public void Noobj(GameObject game) + { + for (int i = 0; i < dragControllers.Count; i++) + { + if (dragControllers[i].gameObject.name == game.name) + { + dragControllers[i].gameObject.SetActive(false); + } + } + } + //判断链表的名字是否有相等的 + public void Onobj(GameObject game) + { + for (int i = 0; i < dragControllers.Count; i++) + { + if (dragControllers[i].gameObject.name == game.name) + { + dragControllers[i].gameObject.SetActive(true); + } + } + } + //给列表添加游戏物体 + public void OnAdd(GameObject obj) + { + if (!weapongames.Contains(obj)) + { + weapongames.Add(obj); + } + } + //给游戏删除物体 + public void Remove(GameObject obj) + { + if (weapongames.Contains(obj)) + { + weapongames.Remove(obj); + Destroy(obj); + } + } +} diff --git a/Assets/Temp/Scripts/Mastermanagement.cs.meta b/Assets/Temp/Scripts/Mastermanagement.cs.meta new file mode 100644 index 00000000..b13f95ba --- /dev/null +++ b/Assets/Temp/Scripts/Mastermanagement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f60413c586ad1224eacda56f97097b97 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Zion/Scenes/AdamTraining_pilot_terminal_panl 1.unity b/Assets/Zion/Scenes/AdamTraining_pilot_terminal_panl 1.unity index ab8dcac9..1dd7aeea 100644 --- a/Assets/Zion/Scenes/AdamTraining_pilot_terminal_panl 1.unity +++ b/Assets/Zion/Scenes/AdamTraining_pilot_terminal_panl 1.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 1113159741} - m_IndirectSpecularColor: {r: 0.1623278, g: 0.30647233, b: 0.67099607, a: 1} + m_IndirectSpecularColor: {r: 0.16234788, g: 0.30616665, b: 0.6691998, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -6652,6 +6652,7 @@ MonoBehaviour: isPlayer: 0 isThinck: 0 wrjModel: 0 + mastermanagement: {fileID: 0} --- !u!224 &138577124 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 1586417955185665353, guid: 18a1ad49a084edc44b006d5905c6d928, @@ -6671,6 +6672,8 @@ GameObject: - component: {fileID: 147647009} - component: {fileID: 147647008} - component: {fileID: 147647012} + - component: {fileID: 147647013} + - component: {fileID: 147647014} m_Layer: 5 m_Name: Canvas m_TagString: Untagged @@ -6780,6 +6783,44 @@ MonoBehaviour: m_EditorClassIdentifier: secne1: {fileID: 284678593} secne2: {fileID: 1862065805184089352} +--- !u!114 &147647013 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 147647007} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f60413c586ad1224eacda56f97097b97, type: 3} + m_Name: + m_EditorClassIdentifier: + dragControllers: [] + weapongames: [] +--- !u!114 &147647014 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 147647007} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 13182b39a85857f4f833a669ab1e3daf, type: 3} + m_Name: + m_EditorClassIdentifier: + oneClickEvent: + m_PersistentCalls: + m_Calls: [] + doubleClickEvent: + m_PersistentCalls: + m_Calls: [] + time: 0 + lascktime: 0 + itemtime: 0.2 + count: 0 + isCount: 1 + mastermanagement: {fileID: 147647013} --- !u!1 &150755764 GameObject: m_ObjectHideFlags: 0 @@ -49404,6 +49445,7 @@ MonoBehaviour: - {fileID: 609129006} - {fileID: 745447508} - {fileID: 1213021907} + mastermanagement: {fileID: 147647013} --- !u!4 &1436809530 Transform: m_ObjectHideFlags: 0 @@ -63570,7 +63612,7 @@ MonoBehaviour: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 - randSeed: 256023359 + randSeed: -1014665484 isDoingTransition: 0 minimumHeight: 0 --- !u!114 &1820978574 diff --git a/Assets/Zion/Scripts/Adam/DeviceManager.cs b/Assets/Zion/Scripts/Adam/DeviceManager.cs index 482abb4a..c83abc01 100644 --- a/Assets/Zion/Scripts/Adam/DeviceManager.cs +++ b/Assets/Zion/Scripts/Adam/DeviceManager.cs @@ -93,6 +93,22 @@ public class DeviceManager : MonoSingleton } return temp.Count; } + /// + /// 获取所以当前玩家的设备 + /// + /// + public List GetPlayerDecive1() + { + List temp = new List(); + for (int i = 0; i < devices.Count; i++) + { + if (devices[i] != null && devices[i].isPlayer) + { + temp.Add(devices[i].gameObject); + } + } + return temp; + } /// /// 获取光学无人机和自杀式无人机 diff --git a/Assets/Zion/Scripts/Adam/DragController.cs b/Assets/Zion/Scripts/Adam/DragController.cs index 1b001c2c..bcdf413c 100644 --- a/Assets/Zion/Scripts/Adam/DragController.cs +++ b/Assets/Zion/Scripts/Adam/DragController.cs @@ -19,6 +19,12 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler, public WRJModel wrjModel = WRJModel.无人机; + public Mastermanagement mastermanagement; + + void Start() + { + mastermanagement = GameObject.Find("Canvas").GetComponent(); + } public void OnBeginDrag(PointerEventData eventData) { if (isDragWRJ) @@ -59,8 +65,11 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler, model.GetComponent().FillInTheData(temp); if (!isDragWRJ) { - transform.SetAsLastSibling(); - transform.localScale = Vector3.zero; + //transform.SetAsLastSibling(); + //transform.localScale = Vector3.zero; + model.name = gameObject.name; + mastermanagement.OnAdd(model); + gameObject.SetActive(false); } } if (DragManager.Instance != null) diff --git a/Assets/Zion/Scripts/Adam/GameManager.cs b/Assets/Zion/Scripts/Adam/GameManager.cs index ad381756..4d882060 100644 --- a/Assets/Zion/Scripts/Adam/GameManager.cs +++ b/Assets/Zion/Scripts/Adam/GameManager.cs @@ -35,9 +35,9 @@ public class GameManager : MonoSingleton public DragController[] wrjDrags; + public Mastermanagement mastermanagement; - - // Start is called before the first frame update + // Start is called before the first frame update private void Awake() { SyncCreateRoom.getroomusersRequset += OnGetRoomUsers; @@ -60,7 +60,7 @@ public class GameManager : MonoSingleton wrjCount = diTemp.device_count; for (int i = 0; i < wrjDrags.Length; i++) { - wrjDrags[i].isPlayer = true; + wrjDrags[i].isPlayer = true; wrjDrags[i].deviceID = UIBootstrap.Instance.GetDeviceByName("蜂群无人机").id; } } @@ -89,6 +89,7 @@ public class GameManager : MonoSingleton { DragController ld = Instantiate(ldDrag, dviceContent); ld.deviceID = UIBootstrap.Instance.GetDeviceByName("探测雷达").id; + mastermanagement.dragControllers.Add(ld); } } if (UIBootstrap.Instance.GetDeviceByName("激光火控平台").device_count > 0) @@ -97,6 +98,7 @@ public class GameManager : MonoSingleton { DragController hp = Instantiate(hpDrag, dviceContent); hp.deviceID = UIBootstrap.Instance.GetDeviceByName("激光火控平台").id; + mastermanagement.dragControllers.Add(hp); } } if (UIBootstrap.Instance.GetDeviceByName("地面无线电干扰").device_count > 0) @@ -105,6 +107,7 @@ public class GameManager : MonoSingleton { DragController wxd = Instantiate(wxdDrag, dviceContent); wxd.deviceID = UIBootstrap.Instance.GetDeviceByName("地面无线电干扰").id; + mastermanagement.dragControllers.Add(wxd); } } if (UIBootstrap.Instance.GetDeviceByName("微波武器").device_count > 0) @@ -113,6 +116,7 @@ public class GameManager : MonoSingleton { DragController wxd = Instantiate(wbDrag, dviceContent); wxd.deviceID = UIBootstrap.Instance.GetDeviceByName("微波武器").id; + mastermanagement.dragControllers.Add(wxd); } } if (UIBootstrap.Instance.GetDeviceByName("频谱探测").device_count > 0) @@ -121,6 +125,7 @@ public class GameManager : MonoSingleton { DragController wxd = Instantiate(ppDrag, dviceContent); wxd.deviceID = UIBootstrap.Instance.GetDeviceByName("频谱探测").id; + mastermanagement.dragControllers.Add(wxd); } } } diff --git a/Assets/Zion/Scripts/InterfaceManager.cs b/Assets/Zion/Scripts/InterfaceManager.cs index dc3c54cc..6173d4b1 100644 --- a/Assets/Zion/Scripts/InterfaceManager.cs +++ b/Assets/Zion/Scripts/InterfaceManager.cs @@ -134,6 +134,10 @@ public static class InterfaceManager /// 查询房间作战日志 /// public static string Url_Querypracticelog { get => IpAddress + "/Handler/Practice.ashx?action=querypracticelog&PracticeId="; } + /// + /// 删除设备 + /// + public static string Url_delete { get => IpAddress + "/Handler/Thinkingfile.ashx?action=deletedevice"; } #endregion diff --git a/Assets/Zion/Scripts/ModelFunction/EquipmentCommon.cs b/Assets/Zion/Scripts/ModelFunction/EquipmentCommon.cs index f6f0687a..30ef82a0 100644 --- a/Assets/Zion/Scripts/ModelFunction/EquipmentCommon.cs +++ b/Assets/Zion/Scripts/ModelFunction/EquipmentCommon.cs @@ -303,7 +303,9 @@ public class EquipmentCommon : MonoBehaviour Bao.SetActive(true); Destroy(transform.gameObject); break; - + case "SetToBeDestroyedTwo"://设备被收回 + Destroy(transform.gameObject); + break; default: break; } diff --git a/Assets/Zion/Scripts/ModelFunction/LaserFireControlPlatform/LaserFireControlPlatformManger.cs b/Assets/Zion/Scripts/ModelFunction/LaserFireControlPlatform/LaserFireControlPlatformManger.cs index 9441ce3f..68bc519c 100644 --- a/Assets/Zion/Scripts/ModelFunction/LaserFireControlPlatform/LaserFireControlPlatformManger.cs +++ b/Assets/Zion/Scripts/ModelFunction/LaserFireControlPlatform/LaserFireControlPlatformManger.cs @@ -215,7 +215,7 @@ public class LaserFireControlPlatformManger : MonoBehaviour { return; } - if (hit.transform.gameObject.tag == "AttackTarget" && hit.transform.gameObject.name == "激光火控平台(Clone)") + if (hit.transform.gameObject.tag == "AttackTarget" && hit.transform.GetComponent()) { Transform canvas = GameObject.Find("Canvas").transform; if (canvas) diff --git a/Assets/Zion/Scripts/ModelFunction/TerrestrialRadioInterference/TerrestrialRadioInterferenceManger.cs b/Assets/Zion/Scripts/ModelFunction/TerrestrialRadioInterference/TerrestrialRadioInterferenceManger.cs index cf2b6850..1efcbe0d 100644 --- a/Assets/Zion/Scripts/ModelFunction/TerrestrialRadioInterference/TerrestrialRadioInterferenceManger.cs +++ b/Assets/Zion/Scripts/ModelFunction/TerrestrialRadioInterference/TerrestrialRadioInterferenceManger.cs @@ -140,7 +140,7 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour { return; } - if (hit.transform.tag == "AttackTarget" && hit.transform.gameObject.name == "地面无线电干扰(Clone)") + if (hit.transform.tag == "AttackTarget" && hit.transform.GetComponent()) { Conversionfrequency.Instance.terrestrialRadioInterferenceManger = hit.transform.GetComponent(); Conversionfrequency.Instance.transform.position = Camera.main.WorldToScreenPoint(hit.point);