From 41b7ac248a158284e8baf79e30d2d4070a0f9d51 Mon Sep 17 00:00:00 2001 From: "DESKTOP-KFV16CV\\cyt" <2268162076@qq.com> Date: Thu, 27 Aug 2020 15:41:10 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E5=87=BA=E6=97=B6=E6=B8=85=E7=A9=BA?= =?UTF-8?q?=E4=BD=9C=E6=88=98=E9=83=A8=E7=BD=B2=E9=87=8C=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/ExitBack.cs | 1 + Assets/Scripts/Common/EntitiesManager/EntitiesManager.cs | 5 ++++- Assets/Scripts/Common/EquipSystem/View/UIViewBag.cs | 1 + Assets/Scripts/Common/EquipSystem/View/UIViewEquipLib.cs | 1 + .../Common/OperationalPreparation/FireEnginesData.cs | 6 ++++++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Assets/ExitBack.cs b/Assets/ExitBack.cs index 16c1f7c..3d986a0 100644 --- a/Assets/ExitBack.cs +++ b/Assets/ExitBack.cs @@ -7,6 +7,7 @@ public class ExitBack : MonoBehaviour // Start is called before the first frame update void Start() { + FireEnginesData.Instance.FireEnginesDataResert(); EntitiesManager.Instance.Reset();//跳转场景时要清空实体管理器中的对象 //UIManager.ResertUIManager(); //重置选择 diff --git a/Assets/Scripts/Common/EntitiesManager/EntitiesManager.cs b/Assets/Scripts/Common/EntitiesManager/EntitiesManager.cs index 7917cd4..924e84c 100644 --- a/Assets/Scripts/Common/EntitiesManager/EntitiesManager.cs +++ b/Assets/Scripts/Common/EntitiesManager/EntitiesManager.cs @@ -96,7 +96,10 @@ public class EntitiesManager /// public void AddEntity(long id, GameObject go) { - entityMap.Add(id,go); + if (!entityMap.ContainsKey(id)) + { + entityMap.Add(id,go); + } BaseGameObjInfo baseGameObjInfo = go.GetComponent(); CloneObjType type; diff --git a/Assets/Scripts/Common/EquipSystem/View/UIViewBag.cs b/Assets/Scripts/Common/EquipSystem/View/UIViewBag.cs index 438bf10..0f69aa6 100644 --- a/Assets/Scripts/Common/EquipSystem/View/UIViewBag.cs +++ b/Assets/Scripts/Common/EquipSystem/View/UIViewBag.cs @@ -36,6 +36,7 @@ public class UIViewBag : UIView { public override void OnDestroy() { base.OnDestroy(); + MessageDispatcher.RemoveListener("REFRESH_UIVIEW_BAG", RefreshUI); ButtonClose.OnClicked -= ButtonClose_OnClicked; ButtonDelete.OnClicked -= ButtonDelete_OnClicked; ButtonClear.OnClicked -= ButtonClear_OnClicked; diff --git a/Assets/Scripts/Common/EquipSystem/View/UIViewEquipLib.cs b/Assets/Scripts/Common/EquipSystem/View/UIViewEquipLib.cs index 95a4568..61d4abf 100644 --- a/Assets/Scripts/Common/EquipSystem/View/UIViewEquipLib.cs +++ b/Assets/Scripts/Common/EquipSystem/View/UIViewEquipLib.cs @@ -69,6 +69,7 @@ public class UIViewEquipLib : UIView public override void OnDestroy() { base.OnDestroy(); + MessageDispatcher.RemoveListener("REFRESH_UIVIEW_EQUIPLIB", RefreshUI); CommitButton.OnClicked -= CommitButon_OnClicked; ButtonClose.OnClicked -= ButtonClose_OnClicked; } diff --git a/Assets/Scripts/Common/OperationalPreparation/FireEnginesData.cs b/Assets/Scripts/Common/OperationalPreparation/FireEnginesData.cs index c5a6f7a..0e62c0c 100644 --- a/Assets/Scripts/Common/OperationalPreparation/FireEnginesData.cs +++ b/Assets/Scripts/Common/OperationalPreparation/FireEnginesData.cs @@ -110,4 +110,10 @@ public class FireEnginesData { return Persons; } + public void FireEnginesDataResert() + { + + Persons.Clear(); + DeptCars.Clear(); + } }