Browse Source

从主场景退出再次进入演练时清空各种静态数据以及清空各种事件

develop
曹衍涛 4 years ago
parent
commit
afa83b548c
  1. 2
      Assets/Scenes/DummyScene.unity
  2. 14
      Assets/Scripts/Common/EquipSystem/EquipManager.cs
  3. 22
      Assets/Scripts/Common/EquipSystem/MyFrame/UIManager.cs
  4. 2
      Assets/Scripts/Common/EquipSystem/MyFrame/UIView.cs
  5. 11
      Assets/Scripts/Common/GameObjectSelect/ObjSelectCtrl.cs
  6. 6
      Assets/Scripts/Common/HelpClasses/WaterSource.cs
  7. 12
      Assets/Scripts/Common/InputSystem/InputManager/InputManager.cs
  8. 6
      Assets/Scripts/Common/NetworkSystem/NetWorkSync/HAND_OVER_SYNC.cs
  9. 8
      Assets/Scripts/Common/Tools/SnowConnonController.cs
  10. 6
      Assets/Scripts/DongYouLiQing/BaseCommander/WaterFightFire/FireFightNormal.cs
  11. 15
      Assets/Scripts/DongYouLiQing/LeadGroup/ExitDrillButton.cs

2
Assets/Scenes/DummyScene.unity

@ -171,7 +171,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!114 &546100756
MonoBehaviour:
m_ObjectHideFlags: 0

14
Assets/Scripts/Common/EquipSystem/EquipManager.cs

@ -33,6 +33,20 @@ public class EquipManager : Singleton<EquipManager>
{
MovingWaterGun.SubscribeToText(text).AddTo(this);
}
public void ResetEquipmanage()
{
foreach (var item in ClientFireManBags)
{
item.EquipData = null;
item.OnAddEquip = null;
}
ClientFireManBags.Clear();
MovingWaterGun = new IntReactiveProperty();
SnowstormGun = new IntReactiveProperty();
FireFightingRobot = new IntReactiveProperty();
WaterBag = new IntReactiveProperty();
CurrentSelectedBag = null;
}
/// <summary>
/// 暴风雪炮绑定数据UGUI
/// </summary>

22
Assets/Scripts/Common/EquipSystem/MyFrame/UIManager.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
@ -49,7 +50,10 @@ public static class UIManager
public static void RegisterUI<T>(string prefabPath)
where T : UIView
{
UIPath.Add(typeof(T).ToString(), prefabPath);
if (!UIPath.ContainsKey(typeof(T).ToString()))
{
UIPath.Add(typeof(T).ToString(), prefabPath);
}
}
public static string Normalize(string name)
{
@ -247,6 +251,20 @@ public static class UIManager
Views.Remove(viewName);
}
}
public static void resert()
{
if (templates.Count>0)
{
templates.Clear();
}
if (Views.Count>0)
{
Views.Clear();
}
if (UIPath.Count>0)
{
UIPath.Clear();
}
}
}

2
Assets/Scripts/Common/EquipSystem/MyFrame/UIView.cs

@ -39,7 +39,7 @@ public abstract class UIView : MonoBehaviour
public virtual void Hide()
{
//显示的情况下才隐藏
if (gameObject.activeSelf)
if (gameObject!=null&&gameObject.activeSelf)
{
gameObject.SetActive(false);
if (OnHide != null)

11
Assets/Scripts/Common/GameObjectSelect/ObjSelectCtrl.cs

@ -230,12 +230,15 @@ public class ObjSelectCtrl : MonoBehaviour
DoDisSelect(SelectedObjs.selectedObj);
SelectedObjs.selectedObj = null;
}
for (int i = SelectedObjs.selectedCharacters.Count - 1; i >= 0; i--)
if (SelectedObjs.selectedCharacters.Count>0)
{
DoDisSelect(SelectedObjs.selectedCharacters[i]);
SelectedObjs.selectedCharacters.Remove(SelectedObjs.selectedCharacters[i]);
for (int i = SelectedObjs.selectedCharacters.Count - 1; i >= 0; i--)
{
DoDisSelect(SelectedObjs.selectedCharacters[i]);
SelectedObjs.selectedCharacters.Remove(SelectedObjs.selectedCharacters[i]);
}
}
}
private void SetLayerRecursively(GameObject obj, int newLayer)

6
Assets/Scripts/Common/HelpClasses/WaterSource.cs

@ -240,9 +240,9 @@ public class WaterSource : MonoBehaviour
void OnDestroy()
{
MessageDispatcher.AddListener("WATERCAR_BIND_CURTAINHOSE", ConnectWaterCurtain);
MessageDispatcher.AddListener("WATERCAR_DESTORY_CURTAINHOSE", DelectWaterCurtain);
MessageDispatcher.AddListener("HOSE_CONNECT_OR_DELECT", ConnectOrDelectWaterHose);
MessageDispatcher.RemoveListener("WATERCAR_BIND_CURTAINHOSE", ConnectWaterCurtain);
MessageDispatcher.RemoveListener("WATERCAR_DESTORY_CURTAINHOSE", DelectWaterCurtain);
MessageDispatcher.RemoveListener("HOSE_CONNECT_OR_DELECT", ConnectOrDelectWaterHose);
// MessageDispatcher.RemoveListener("FLOW_CHANGE", TotalFlowChange);
GetRealtimeConsume.getAllRealtimeConsume -= addMyRealtimeConsume;
//GetAllUsed.getAllUsedAmount -= addMyUsed;

12
Assets/Scripts/Common/InputSystem/InputManager/InputManager.cs

@ -94,7 +94,19 @@ public class InputManager : MonoBehaviour
fireDeployCameraManager = GameObject.Find("FireDeployCamera").GetComponent<FireDeployCameraManager>();
}
public static void ResertInputmanage()
{
skill=false;
AutoArm=false;
cloneObjType = CloneObjType.None;
selectedFireDeployObjId = -1;
IsGuidance = false;
GuidanceList.Clear();
fireDeployPrivateToolType = FireDeployPrivateToolType.None;
fireCarEngine = null;
org = null;
}
void Start()
{
sceneType = SceneType.;

6
Assets/Scripts/Common/NetworkSystem/NetWorkSync/HAND_OVER_SYNC.cs

@ -77,4 +77,10 @@ public class HAND_OVER_SYNC : NetworkMessageBehaviour
{
}
protected override void OnDestroy()
{
base.OnDestroy();
OnHandOverPower = null;
OnReceivePower = null;
}
}

8
Assets/Scripts/Common/Tools/SnowConnonController.cs

@ -204,6 +204,7 @@ public class SnowConnonController : MonoBehaviour
if (info.gameObjID == basegameInfo.gameObjID)
{
paotong.transform.localEulerAngles = info.VrotateVec;
transform.localEulerAngles = info.HrotateVec;
}
}
}
@ -416,12 +417,14 @@ public class SnowConnonController : MonoBehaviour
public void Left()
{
Debug.Log("left");
transform.Rotate(0, -10, 0);
RotateSync();
}
public void Right()
{
Debug.Log("right");
transform.Rotate(0, 10, 0);
RotateSync();
}
void RotateSync()
{
@ -429,6 +432,7 @@ public class SnowConnonController : MonoBehaviour
arg.SendUserID = CurrentUserInfo.mySelf.Id;
arg.gameObjID = basegameInfo.gameObjID;
arg.VrotateVec = paotong.transform.localEulerAngles;
arg.HrotateVec = transform.localEulerAngles;
NetworkManager.Default.SendAsync("SNOWCANNON_ROTATE_SYNC", arg);
}
public void Resert()

6
Assets/Scripts/DongYouLiQing/BaseCommander/WaterFightFire/FireFightNormal.cs

@ -74,7 +74,11 @@ public class FireFightNormal : MonoBehaviour
//从字典中移除该普通火
if (baseinfo.gameObjType == CloneObjType.fireNormal)
{
SpreadFireController.fireStruckContainDic[baseinfo.gameObjID].Remove(this);
if (SpreadFireController.fireStruckContainDic.ContainsKey(baseinfo.gameObjID))
{
SpreadFireController.fireStruckContainDic[baseinfo.gameObjID].Remove(this);
}
}
//主火(普通火)只隐藏不删除
Straightwater.Clear();

15
Assets/Scripts/DongYouLiQing/LeadGroup/ExitDrillButton.cs

@ -43,7 +43,22 @@ public class ExitDrillButton : BaseButton
}
UserData user = CurrentUserInfo.room.FindUserById(CurrentUserInfo.mySelf.Id);
user.IsReady = false;
//重置房间
CurrentUserInfo.room = null;
//重置选择
if (SelectedObjs.selectedObj!=null)
{
SelectedObjs.selectedObj = null;
}
if (SelectedObjs.selectedCharacters.Count>0)
{
SelectedObjs.selectedCharacters.Clear();
}
//重置装备信息
EquipManager.Instance.ResetEquipmanage();
//重置inputmanage 变量
InputManager.ResertInputmanage();
NetworkManager.Default.SendAsync("ROOM_LEAVE_SYNC", data);
SceneManager.LoadScene(GoTo.RolesSelection.ToString());
}

Loading…
Cancel
Save