少年修仙传客户端代码仓库
client_Hale
2019-03-05 14b71c04187ebaba3470ad35319cd104d63a1e98
6317 【前端】【2.0】场景化单机战斗
9个文件已修改
199 ■■■■ 已修改文件
Core/MapEditor/Behavior/Bhv_Evt_RefreshMonster.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/MapEditor/Behavior/Bhv_MapTrigger.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/MapEditor/Behavior/Bhv_MonsterData.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/MapEditor/Data/Event/MonsterData.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Actor/HeroBehaviour.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Stage/MapEditor/Game/ClientSceneManager.cs 153 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Stage/MapEditor/Game/EventRefreshNPCHandler.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI/Common/UI3DModelExhibition.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI/Common/UI3DModelFactory.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/MapEditor/Behavior/Bhv_Evt_RefreshMonster.cs
@@ -262,7 +262,7 @@
            _obj.transform.localScale = Vector3.one;
            var _monsterData = _obj.AddComponent<Bhv_MonsterData>();
            _monsterData.npcID = id;
            _monsterData.npcID = (uint)id;
            _monsterData.resName = name;
            return _monsterData;
Core/MapEditor/Behavior/Bhv_MapTrigger.cs
@@ -85,7 +85,10 @@
            EditorGUILayout.BeginVertical(guiSkin.box);
            EditorGUILayout.BeginHorizontal(GUILayout.Height(22));
            EditorGUI.indentLevel += 1;
            showDetail = EditorGUILayout.Foldout(showDetail, "  触发器ID:" + id, true, guiSkin.customStyles[3]);
            showDetail = EditorGUILayout.Foldout(showDetail, "", true, guiSkin.customStyles[3]);
            EditorGUILayout.LabelField("触发器ID:", guiSkin.customStyles[0], GUILayout.Height(22), GUILayout.Width(70));
            id = EditorGUILayout.IntField(id, guiSkin.textField, GUILayout.Height(22), GUILayout.Width(60));
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("查找", guiSkin.button, GUILayout.Width(60), GUILayout.Height(22)))
            {
                Selection.activeGameObject = gameObject;
Core/MapEditor/Behavior/Bhv_MonsterData.cs
@@ -6,7 +6,7 @@
    public class Bhv_MonsterData : MonoBehaviour
    {
        [HideInInspector]
        public int npcID;
        public uint npcID;
        [HideInInspector]
        public string resName;
        [HideInInspector]
@@ -26,7 +26,7 @@
        public void Load(BinaryReader br)
        {
            npcID = br.ReadInt32();
            npcID = br.ReadUInt32();
            ai = br.ReadByte();
            float _x = br.ReadSingle();
            float _y = br.ReadSingle();
Core/MapEditor/Data/Event/MonsterData.cs
@@ -6,13 +6,13 @@
    [System.Serializable]
    public class MonsterData
    {
        public int npcID;
        public uint npcID;
        public Vector3 position;
        public int ai;
        public void Load(BinaryReader br)
        {
            npcID = br.ReadInt32();
            npcID = br.ReadUInt32();
            ai = br.ReadByte();
            float _x = br.ReadSingle();
            float _y = br.ReadSingle();
Fight/Actor/HeroBehaviour.cs
@@ -897,11 +897,7 @@
                    var _clientNpc = _target as GA_NpcClientFightNorm;
                    if (_clientNpc.belongEventID != -1)
                    {
                        var _eventHandler = ClientSceneManager.Instance.GetEventHandler(_clientNpc.belongEventID) as EventRefreshNPCHandler;
                        if (_eventHandler != null)
                        {
                            _eventHandler.NpcDead(_clientNpc.NpcConfig.NPCID);
                        }
                        ClientSceneManager.Instance.NpcDead(_clientNpc.belongEventID, _clientNpc);
                    }
                    // 前期战斗只发送石头人的
                    //if (1000 == _target.NpcConfig.NPCID)
Fight/Stage/MapEditor/Game/ClientSceneManager.cs
@@ -9,12 +9,149 @@
    private List<TransferGroup> m_TransferGroupList = new List<TransferGroup>();
    private Dictionary<int, IEventHandler> m_EventHandlerDict = new Dictionary<int, IEventHandler>();
    private List<IEventHandler> m_ReadyRemoveEventHandlerList = new List<IEventHandler>();
    private Dictionary<int, uint> m_TriggerIDToMissionIDDict = new Dictionary<int, uint>();
    private List<int> m_ReadyRemoveTriggerList = new List<int>();
    private Dictionary<int, List<GActorNpcFight>> m_EventActorDict = new Dictionary<int, List<GActorNpcFight>>();
    private IEnumerator DelayUnTrigger(int id)
    {
        while (m_MapData == null)
        {
            yield return null;
        }
        Debug.LogFormat("=           结束触发: {0}             =", id);
        foreach (var _trigger in m_MapData.triggers)
        {
            if (_trigger.id != id)
            {
                continue;
            }
            if (_trigger.evevntIDs == null
             || _trigger.evevntIDs.Length == 0)
            {
                continue;
            }
            Debug.LogFormat("=           触发器有: {0} 个事件             =", _trigger.evevntIDs.Length);
            foreach (var _eventID in _trigger.evevntIDs)
            {
                if (!m_EventActorDict.ContainsKey(_eventID))
                {
                    continue;
                }
                if (m_EventActorDict[_eventID] == null
                 || m_EventActorDict[_eventID].Count == 0)
                {
                    continue;
                }
                Debug.LogFormat("=           残留有: {0} 个NPC             =", m_EventActorDict[_eventID].Count);
                foreach (var _npc in m_EventActorDict[_eventID])
                {
                    _npc.KillerServerInstID = PlayerDatas.Instance.PlayerId;
                    _npc.ActorInfo.serverDie = true;
                    GAMgr.Instance.ServerDie(_npc.ServerInstID);
                    GAMgr.Instance.DelayDie(_npc);
                    _npc.Die(PlayerDatas.Instance.PlayerId);
                }
                m_EventHandlerDict.Remove(_eventID);
            }
            break;
        }
    }
    public void NpcBorn(int eventID, GActorNpcFight npc)
    {
        if (!m_EventActorDict.ContainsKey(eventID))
        {
            m_EventActorDict.Add(eventID, new List<GActorNpcFight>());
        }
        if (!m_EventActorDict[eventID].Contains(npc))
        {
            m_EventActorDict[eventID].Add(npc);
            Debug.LogFormat("= 为事件: {0} 增加Npc: {1}", eventID, npc.ServerInstID);
        }
    }
    public void NpcDead(int eventID, GActorNpcFight npc)
    {
        if (eventID < 0 || npc == null)
        {
            return;
        }
        var _eventHandler = GetEventHandler(eventID) as EventRefreshNPCHandler;
        if (_eventHandler != null)
        {
            _eventHandler.NpcDead(npc.NpcConfig.NPCID);
        }
        if (m_EventActorDict.ContainsKey(eventID))
        {
            if (m_EventActorDict[eventID].Contains(npc))
            {
                m_EventActorDict[eventID].Remove(npc);
            }
        }
    }
    public void Handle_0820(H0820_tagMissionDict package)
    {
        m_ReadyRemoveTriggerList.Clear();
        foreach (var _triggerID in m_TriggerIDToMissionIDDict.Keys)
        {
            if (m_TriggerIDToMissionIDDict[_triggerID] == package.MissionID)
            {
                if (package.DictKey.Equals("state"))
                {
                    if (package.DictValue > 2)
                    {
                        m_ReadyRemoveTriggerList.Add(_triggerID);
                        SnxxzGame.Instance.StartCoroutine(DelayUnTrigger(_triggerID));
                    }
                }
            }
        }
        foreach (var _id in m_ReadyRemoveTriggerList)
        {
            m_TriggerIDToMissionIDDict.Remove(_id);
        }
        if (package.DictKey.Equals("riggerID"))
        {
            SnxxzGame.Instance.StartCoroutine(DelayTrigger((int)package.DictValue));
            int _triggerID = (int)package.DictValue;
            if (_triggerID == 0)
            {
                foreach (var _removeTriggerID in m_TriggerIDToMissionIDDict.Keys)
                {
                    SnxxzGame.Instance.StartCoroutine(DelayUnTrigger(_removeTriggerID));
                }
            }
            else
            {
                m_TriggerIDToMissionIDDict[_triggerID] = package.MissionID;
                SnxxzGame.Instance.StartCoroutine(DelayTrigger(package.MissionID, _triggerID));
            }
        }
        else if (package.DictKey.Equals("xinshou"))
        {
            if (package.DictValue == 0)
            {
                Debug.LogFormat("=           退出了前端模式             =");
            }
            else
            {
                Debug.LogFormat("=           进入了前端模式             =");
            }
        }
    }
@@ -76,8 +213,6 @@
            _eventHandler.UnInit();
            m_EventHandlerDict.Remove(_eventHandler.GetEventID());
        }
        m_ReadyRemoveEventHandlerList.Clear();
    }
    public IEventHandler GetEventHandler(int id)
@@ -106,12 +241,20 @@
        return Vector3.zero;
    }
    private IEnumerator DelayTrigger(int id)
    private IEnumerator DelayTrigger(uint missionID, int triggerID)
    {
        if (triggerID == 0)
        {
            yield return SnxxzGame.Instance.StartCoroutine(DelayUnTrigger(triggerID));
            yield break;
        }
        while (StageLoad.Instance.isLoading)
        {
            yield return null;
        }
        Debug.LogFormat("=           任务: {0} 触发: {1}             =", missionID, triggerID);
        if (m_MapData == null)
        {
@@ -126,7 +269,7 @@
        foreach (var _trigger in m_MapData.triggers)
        {
            if (_trigger.id != id)
            if (_trigger.id != triggerID)
            {
                continue;
            }
Fight/Stage/MapEditor/Game/EventRefreshNPCHandler.cs
@@ -87,9 +87,10 @@
        if (m_RefreshCount >= 0 && m_RefreshCount < m_Evt.monsters.Length)
        {
            var _data = m_Evt.monsters[m_RefreshCount];
            var _npc = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightNorm>((uint)_data.npcID, E_ActorGroup.Enemy);
            var _npc = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightNorm>(_data.npcID, E_ActorGroup.Enemy);
            _npc.Pos = _data.position;
            _npc.belongEventID = m_Evt.id;
            ClientSceneManager.Instance.NpcBorn(m_Evt.id, _npc);
        }
    }
@@ -99,9 +100,10 @@
        {
            foreach (var _data in m_Evt.monsters)
            {
                var _npc = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightNorm>((uint)_data.npcID, E_ActorGroup.Enemy);
                var _npc = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightNorm>(_data.npcID, E_ActorGroup.Enemy);
                _npc.Pos = _data.position;
                _npc.belongEventID = m_Evt.id;
                ClientSceneManager.Instance.NpcBorn(m_Evt.id, _npc);
            }
            m_RefreshCount = m_Evt.monsters.Length;
        }
UI/Common/UI3DModelExhibition.cs
@@ -26,7 +26,8 @@
        [SerializeField] UI3DModelInteractProcessor m_InteractProcessor;
        [SerializeField] ColorCorrectionCurves m_CameraColor;
        public bool interactable {
        public bool interactable
        {
            get { return m_Interactable; }
            set { m_Interactable = value; }
        }
@@ -35,7 +36,8 @@
        int m_HorseModelId = 0;
        GameObject horseModel = null;
        public GameObject NpcModelHorse {
        public GameObject NpcModelHorse
        {
            get { return horseModel; }
            set { horseModel = value; }
        }
@@ -44,7 +46,8 @@
        GameObject npcModel = null;
        SFXController m_NpcEffect;
        readonly List<SFXController> m_BindEffectList = new List<SFXController>();
        public GameObject NpcModelPet {
        public GameObject NpcModelPet
        {
            get { return npcModel; }
            set { npcModel = value; }
        }
@@ -70,8 +73,10 @@
        public static UI3DModelExhibition Instance { get; private set; }
        static UI3DModelExhibition m_InstanceClone1 = null;
        public static UI3DModelExhibition InstanceClone1 {
            get {
        public static UI3DModelExhibition InstanceClone1
        {
            get
            {
                if (m_InstanceClone1 == null)
                {
                    CreateCloneStage();
UI/Common/UI3DModelFactory.cs
@@ -353,7 +353,7 @@
    public static GameObject LoadUIWing(int _id)
    {
        var prefab = InstanceResourcesLoader.LoadModelRes(_id, true);
        var prefab = InstanceResourcesLoader.LoadModelRes(_id, false);
        if (prefab == null)
        {
            return null;
@@ -371,7 +371,7 @@
    public static void ReleaseUIWing(int _id, GameObject _model)
    {
        var prefab = InstanceResourcesLoader.LoadModelRes(_id, true);
        var prefab = InstanceResourcesLoader.LoadModelRes(_id, false);
        var pool = GameObjectPoolManager.Instance.RequestPool(prefab);
        var animator = _model.GetComponent<Animator>();
        if (animator != null)