diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index c686218..b68b1e8 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -251,12 +251,12 @@ PrefabInstance: - target: {fileID: 1265597271646066058, guid: aad59b329c27c57428a3ddbb1205a7ab, type: 3} propertyPath: m_RootOrder - value: 3 + value: 2 objectReference: {fileID: 0} - target: {fileID: 1265597271646066058, guid: aad59b329c27c57428a3ddbb1205a7ab, type: 3} propertyPath: m_AnchorMax.x - value: 0.5 + value: 1 objectReference: {fileID: 0} - target: {fileID: 1265597271646066058, guid: aad59b329c27c57428a3ddbb1205a7ab, type: 3} @@ -266,7 +266,7 @@ PrefabInstance: - target: {fileID: 1265597271646066058, guid: aad59b329c27c57428a3ddbb1205a7ab, type: 3} propertyPath: m_AnchorMin.x - value: 0.5 + value: 1 objectReference: {fileID: 0} - target: {fileID: 1265597271646066058, guid: aad59b329c27c57428a3ddbb1205a7ab, type: 3} @@ -321,7 +321,7 @@ PrefabInstance: - target: {fileID: 1265597271646066058, guid: aad59b329c27c57428a3ddbb1205a7ab, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: -500 objectReference: {fileID: 0} - target: {fileID: 1265597271646066058, guid: aad59b329c27c57428a3ddbb1205a7ab, type: 3} @@ -801,6 +801,8 @@ MonoBehaviour: hose: {fileID: 0} annotationInfo: {fileID: 0} LoadingPanel: {fileID: 1824487987} + characters: [] + yBot: {fileID: 0} --- !u!114 &1133822278 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/ANet/DeviceFollowTarget.cs b/Assets/Scripts/ANet/DeviceFollowTarget.cs index 849539d..8267513 100644 --- a/Assets/Scripts/ANet/DeviceFollowTarget.cs +++ b/Assets/Scripts/ANet/DeviceFollowTarget.cs @@ -7,6 +7,7 @@ using UnityEngine.UI; public class DeviceFollowTarget : MonoBehaviour { + public List spList = new List(); public Transform target; public Camera uiCamera; private float offset_Y = 2.5f; @@ -21,10 +22,16 @@ public class DeviceFollowTarget : MonoBehaviour MessageDispatcher.SendMessage("FLOORNUMBER", target.GetComponent().floorId, "Floor"); Camera.main.GetComponent().SetCameraView(target.position, 15); - //if (target) - //{ - // target.GetComponent().ShowList(); - //} + if (target && target.GetComponent()) + { + DevicePanelManager.Instance.NowClickObject = target.GetComponent(); + if (!target.GetComponent()) + { + target.gameObject.AddComponent(); + } + if (!GetComponent()) + gameObject.AddComponent(); + } } private Vector2 WorldPosToUIPos(Vector3 worldPos) @@ -42,10 +49,18 @@ public class DeviceFollowTarget : MonoBehaviour GetComponent().anchoredPosition = WorldPosToUIPos(new Vector3(target.transform.position.x, target.transform.position.y + offset_Y, target.transform.position.z)); } + if (GetComponent()) + { + if (target && DevicePanelManager.Instance.NowClickObject != target.GetComponent()) + { + Destroy(GetComponent()); + } + } } public void SetTarget(DeviceObj deviceObj) { target = deviceObj.transform; } + } diff --git a/Assets/Scripts/ANet/DeviceLumos.cs b/Assets/Scripts/ANet/DeviceLumos.cs new file mode 100644 index 0000000..28fca04 --- /dev/null +++ b/Assets/Scripts/ANet/DeviceLumos.cs @@ -0,0 +1,69 @@ +using UnityEngine; +using UnityEngine.UI; + +[DisallowMultipleComponent] +public class DeviceLumos : MonoBehaviour +{ + public Color NormalColor = Color.white; + public Color TargetColor = Color.red; + + private float time; + private bool LumosReady; + public float Interval = 0.3f; + + private void Awake() + { + if (GetComponent()) + { + NormalColor = GetComponent().material.color; + TargetColor = Color.red; + } + else if (GetComponent()) + { + NormalColor = GetComponent().color; + TargetColor = Color.green; + } + } + private void LateUpdate() + { + time += Time.deltaTime; + if (time > Interval) + { + time = 0.0f; + LumosReady = !LumosReady; + } + if (GetComponent()) + { + if (LumosReady) + { + GetComponent().material.SetColor("_Color", NormalColor); + } + else + { + GetComponent().material.SetColor("_Color", TargetColor); + } + } + else if (GetComponent()) + { + if (LumosReady) + { + GetComponent().color = NormalColor; + } + else + { + GetComponent().color = TargetColor; + } + } + } + private void OnDestroy() + { + if (GetComponent()) + { + GetComponent().material.SetColor("_Color", NormalColor); + } + else if (GetComponent()) + { + GetComponent().color = NormalColor; + } + } +} diff --git a/Assets/Scripts/ANet/DeviceLumos.cs.meta b/Assets/Scripts/ANet/DeviceLumos.cs.meta new file mode 100644 index 0000000..c6d791d --- /dev/null +++ b/Assets/Scripts/ANet/DeviceLumos.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2c0daed4e09401f4dbf0bc6021761e17 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ANet/DeviceObj.cs b/Assets/Scripts/ANet/DeviceObj.cs index 473093c..f341366 100644 --- a/Assets/Scripts/ANet/DeviceObj.cs +++ b/Assets/Scripts/ANet/DeviceObj.cs @@ -18,7 +18,7 @@ public class DeviceObj : MonoBehaviour void Start() { MessageDispatcher.AddListener("DeviceMenuChanged", DeviceMenuChanged); - MessageDispatcher.AddListener("FLOORNUMBER", FloorChanged, "Floor"); + MessageDispatcher.AddListener("FloorChanged", FloorChanged); } private void FloorChanged(IMessage obj) @@ -54,7 +54,7 @@ public class DeviceObj : MonoBehaviour private void OnDestroy() { MessageDispatcher.RemoveListener("DeviceMenuChanged", DeviceMenuChanged); - MessageDispatcher.RemoveListener("FLOORNUMBER", FloorChanged, "Floor"); + MessageDispatcher.RemoveListener("FloorChanged", FloorChanged); } private void Update() { @@ -70,6 +70,13 @@ public class DeviceObj : MonoBehaviour Destroy(gameObject); } } + if (GetComponent()) + { + if (DevicePanelManager.Instance.NowClickObject != this) + { + Destroy(GetComponent()); + } + } //if (BindType == DevicePanelManager.Instance.MenuType) //{ // if (!isShow) diff --git a/Assets/Scripts/ANet/Prefabs/DeviceInfo.prefab b/Assets/Scripts/ANet/Prefabs/DeviceInfo.prefab index 7bbb1dd..14d87ef 100644 --- a/Assets/Scripts/ANet/Prefabs/DeviceInfo.prefab +++ b/Assets/Scripts/ANet/Prefabs/DeviceInfo.prefab @@ -827,9 +827,9 @@ RectTransform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 1, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: -500, y: 0} m_SizeDelta: {x: 300, y: 400} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1265597271646066060 diff --git a/Assets/Scripts/ANet/Prefabs/Devices.prefab b/Assets/Scripts/ANet/Prefabs/Devices.prefab index 47055a0..6444529 100644 --- a/Assets/Scripts/ANet/Prefabs/Devices.prefab +++ b/Assets/Scripts/ANet/Prefabs/Devices.prefab @@ -902,9 +902,9 @@ RectTransform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: -400, y: 0} + m_AnchorMin: {x: 1, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: -150, y: 0} m_SizeDelta: {x: 300, y: 400} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1265597271646066060 diff --git a/Assets/Scripts/ANet/Prefabs/Icon.prefab b/Assets/Scripts/ANet/Prefabs/Icon.prefab index 0abf89d..319654f 100644 --- a/Assets/Scripts/ANet/Prefabs/Icon.prefab +++ b/Assets/Scripts/ANet/Prefabs/Icon.prefab @@ -88,6 +88,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 0526089f5df3b684ca63d3fcae2ba54f, type: 3} m_Name: m_EditorClassIdentifier: + spList: [] target: {fileID: 0} uiCamera: {fileID: 0} --- !u!114 &-3378482227028537232 diff --git a/Assets/Scripts/FloorController.cs b/Assets/Scripts/FloorController.cs index adbbf8d..c67446c 100644 --- a/Assets/Scripts/FloorController.cs +++ b/Assets/Scripts/FloorController.cs @@ -1,9 +1,9 @@ -using UnityEngine; +using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.UI; using UniRx; - +using AX.MessageSystem; public class FloorController : MonoBehaviour { public string Prefix = ""; @@ -38,30 +38,30 @@ public class FloorController : MonoBehaviour GetComponent().OnValueChangedAsObservable() .Subscribe(value => OnValueChanged(value)); } - private void InitData(bool value) + private void InitData(bool value) { AssetManager.Instance.SetLoadingPanel(true); var floorname = this.name; FloorNum = int.Parse(floorname.Substring(5)); - Addressables.LoadAssetAsync(Prefix + "nei" + FloorNum).Completed+=handle=> - { - var prefab = handle.Result; - var shinei = Instantiate(prefab, AssetManager.Instance.ShiNei.transform); - shinei.name = shinei.name.Replace("(Clone)", ""); - if (isFireCompartment) - FireCompartments = shinei.transform.Find("FireCompartments").transform; - if (isFireDoor) - FireDoors = shinei.transform.Find("FireDoors").transform; - if (isFireShutter) - FireShutters = shinei.transform.Find("FireShutters").transform; - if (isHydrant) - Hydrants = shinei.transform.Find("Hydrants").transform; - isInit = true; - AssetManager.Instance.SetLoadingPanel(false); - OnChange(value); - }; - - + Addressables.LoadAssetAsync(Prefix + "nei" + FloorNum).Completed += handle => + { + var prefab = handle.Result; + var shinei = Instantiate(prefab, AssetManager.Instance.ShiNei.transform); + shinei.name = shinei.name.Replace("(Clone)", ""); + if (isFireCompartment) + FireCompartments = shinei.transform.Find("FireCompartments").transform; + if (isFireDoor) + FireDoors = shinei.transform.Find("FireDoors").transform; + if (isFireShutter) + FireShutters = shinei.transform.Find("FireShutters").transform; + if (isHydrant) + Hydrants = shinei.transform.Find("Hydrants").transform; + isInit = true; + AssetManager.Instance.SetLoadingPanel(false); + OnChange(value); + }; + + } private void OnValueChanged(bool value) { @@ -78,6 +78,8 @@ public class FloorController : MonoBehaviour { OnFloorChanged(!value); FloorShortcuts.Instance.CurrentNumber = FloorNum; + if (value) + MessageDispatcher.SendMessage("FloorChanged", FloorNum); //防火分区 if (isFireCompartment && FireCompartments != null) @@ -228,26 +230,26 @@ public class FloorController : MonoBehaviour { m_Equipments.gameObject.SetChildrenActive(true); - m_Equipments.SetChildren(obj => obj.isRendering=true); + m_Equipments.SetChildren(obj => obj.isRendering = true); } else { if (i != 0) { - - if (i > FloorNum) + + if (i > FloorNum) { m_Equipments.SetChildren(obj => obj.Hide()); } - else + else { - m_Equipments.gameObject.SetChildrenActive(true); - if(i == FloorNum) - m_Equipments.SetChildren(obj => obj.isRendering=true); + m_Equipments.gameObject.SetChildrenActive(true); + if (i == FloorNum) + m_Equipments.SetChildren(obj => obj.isRendering = true); else - m_Equipments.SetChildren(obj => obj.isRendering=false); + m_Equipments.SetChildren(obj => obj.isRendering = false); } }