少年修仙传客户端代码仓库
client_linchunjie
2019-03-12 2a7cba1a672dd99f591b284127b1bf5c7292e4a4
Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
11个文件已修改
167 ■■■■ 已修改文件
Core/AI/NavmeshPathFind/PathFinder.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Actor/HeroBehaviour.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Actor/Skill/Skill.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Actor/State/SMB/SMB_Base.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Actor/State/SMB/STM_BaseAttack.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Actor/UserInputHandler.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/GameActor/GA_Hero.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/MapTransferUtility.cs 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Stage/MapEditor/Game/ClientSceneManager.cs 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Stage/MapEditor/Game/EventRefreshNPCHandler.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Stage/MapEditor/Game/TransferGroup.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/AI/NavmeshPathFind/PathFinder.cs
@@ -22,7 +22,7 @@
        NavMesh.CalculatePath(source, dest, -1, _path);
        if (_path.corners != null && _path.corners.Length > 0)
        {
            return true;
            return MathUtility.DistanceSqrtXZ(dest, _path.corners[_path.corners.Length - 1]) < 0.01f;
        }
        return false;
    }
Fight/Actor/HeroBehaviour.cs
@@ -707,6 +707,7 @@
                CB405_tagCMSuperAtk _b405 = null;
                if (!ClientDungeonStageUtility.isClientDungeon
                 && !ClientSceneManager.Instance.IsClientFightMode
#if UNITY_EDITOR
                 && !RuntimeLogUtility.TEST_CLIENT_PVP
#endif
Fight/Actor/Skill/Skill.cs
@@ -185,6 +185,7 @@
              || PlayerDatas.Instance.baseData.MapID == 52020
              || userSID != PlayerDatas.Instance.PlayerId
              || ClientDungeonStageUtility.isClientDungeon
              || ClientSceneManager.Instance.IsClientFightMode
#if UNITY_EDITOR
              || RuntimeLogUtility.TEST_CLIENT_PVP
#endif
Fight/Actor/State/SMB/SMB_Base.cs
@@ -92,7 +92,8 @@
    protected void AddToNpcPosList(GActorFight attacker, GActorFight target, int bodyControlId, Vector3 direction, List<NPCPos> npcPosList)
    {
        // Debug.LogFormat("{0} attack {1} ==================== 0", attacker.GetType().ToString(), target.GetType().ToString());
        if (PreFightMission.Instance.IsFinished() == false)
        if (!PreFightMission.Instance.IsFinished()
         || ClientSceneManager.Instance.IsClientFightMode)
        {
            return;
        }
@@ -106,7 +107,7 @@
            return;
        }
        if (AttackHandler.CheckPull(attacker, target, bodyControlId) == false)
        if (!AttackHandler.CheckPull(attacker, target, bodyControlId))
        {
            return;
        }
Fight/Actor/State/SMB/STM_BaseAttack.cs
@@ -724,8 +724,9 @@
        if (m_NpcPosList.Count > 0)
        {
            if (!ClientDungeonStageUtility.isClientDungeon
             && !ClientSceneManager.Instance.IsClientFightMode
#if UNITY_EDITOR
            && !RuntimeLogUtility.TEST_CLIENT_PVP
             && !RuntimeLogUtility.TEST_CLIENT_PVP
#endif
            )
            {
Fight/Actor/UserInputHandler.cs
@@ -131,6 +131,8 @@
                OnCirclePanelTouched();
            }
            MapTransferUtility.Instance.Clear();
            // 是否是可以移动的状态
            _direction = CameraController.Instance.transform.TransformDirection(_direction);
            _direction.y = 0;
Fight/GameActor/GA_Hero.cs
@@ -8,6 +8,7 @@
{
    public static Vector3 MapOffset;
    public static bool s_MapSwitching = false;
    public static bool s_Flying = false;
    //public static bool s_MapSwitching
    //{
    //    get
Fight/MapTransferUtility.cs
@@ -19,11 +19,14 @@
        Fight,
    }
    private E_MapTransferDoType m_MapTransferType;
    public E_MapTransferDoType MapTransferDoType {
        get {
    public E_MapTransferDoType MapTransferDoType
    {
        get
        {
            return m_MapTransferType;
        }
        set {
        set
        {
            m_MapTransferType = value;
#if UNITY_EDITOR
            // Debug.LogFormat("设置方式: {0}", m_MapTransferType);
@@ -122,7 +125,8 @@
    #endregion
    #region npc
    public int NpcID {
    public int NpcID
    {
        get; set;
    }
    #endregion
@@ -179,7 +183,99 @@
    public bool forceMove = false;
    public void MoveToNPC(int npcID, int sid = 0)
    private struct MoveToData
    {
        public int npcID;
        public int sid;
    }
    public void MoveToNPC(int _npcID, int _sid = 0)
    {
        StopCoroutine("CoMoveToNPC");
        var _data = new MoveToData
        {
            npcID = _npcID,
            sid = _sid
        };
        StartCoroutine("CoMoveToNPC", _data);
    }
    private IEnumerator CoMoveToNPC(MoveToData data)
    {
        var _hero = PlayerDatas.Instance.hero;
        if (_hero == null)
        {
            yield break;
        }
        var npcID = data.npcID;
        var sid = data.sid;
        Vector3 _destPostion = Vector3.zero;
        // 判断是否能够得到到达指定点
        // 获取NPC位置数据
        GAStaticDefine.NPCLocation _npcLocation;
        var _findLocation = GAStaticDefine.TryGetMapNPCLocation(npcID, out _npcLocation);
        if (!_findLocation)
        {
#if UNITY_EDITOR
            Debug.LogWarningFormat("需要传送至的npcid有错,无法在mapnpc表中查询到, id: {0}", npcID);
#endif
            // 如果找不到配置, 可能为客户端战斗配置的刷怪逻辑
            // 由于可能有回包慢问题, 这里等待
            yield return WaitingForSecondConst.WaitMS200;
            GActor _npc = GAMgr.Instance.GetCloserNPC(_hero.Pos, npcID);
            if (_npc != null)
            {
                //Debug.LogFormat(" |-- 在视野内");
                _destPostion = _npc.Pos;
            }
        }
        else
        {
            _destPostion = new Vector3(_npcLocation.position.x, 0, _npcLocation.position.y);
        }
        if (_destPostion == Vector3.zero)
        {
            Debug.LogErrorFormat("移动至NPC: {0} 时找不到一个可以到达的点.", npcID);
            yield break;
        }
        if (PathFinder.WalkAble(_hero.Pos, _destPostion))
        {
            _MoveToNPC(npcID, sid);
        }
        else
        {
            // 不可达的情况, 这里寻找是否有可以跳跃的点
            Vector3 _jumpPos = ClientSceneManager.Instance.GetCloseTransPoint(_destPostion);
            if (_jumpPos == Vector3.zero)
            {
                Debug.LogErrorFormat("移动至NPC: {0} 时找不到任何跳跃点", npcID);
                yield break;
            }
            float _dis = MathUtility.DistanceSqrtXZ(_hero.Pos, _jumpPos);
            while (_dis > 0.01f)
            {
                _dis = MathUtility.DistanceSqrtXZ(_hero.Pos, _jumpPos);
                _hero.MoveToPosition(_jumpPos);
                yield return null;
            }
            while (!GA_Hero.s_Flying)
            {
                yield return null;
            }
            while (GA_Hero.s_Flying)
            {
                yield return null;
            }
            _MoveToNPC(npcID, sid);
        }
    }
    private void _MoveToNPC(int npcID, int sid = 0)
    {
        if (npcID != NpcID)
        {
@@ -982,6 +1078,7 @@
    public void Clear()
    {
        StopCoroutine("CoMoveToNPC");
        if (m_SwitchMapFinished)
        {
            NpcID = 0;
Fight/Stage/MapEditor/Game/ClientSceneManager.cs
@@ -13,6 +13,7 @@
    private Dictionary<int, TriggerHandler> m_TriggerHandlerDict = new Dictionary<int, TriggerHandler>();
    private List<int> m_ReadyRemoveTriggerList = new List<int>();
    private Dictionary<int, List<GActorNpcFight>> m_EventActorDict = new Dictionary<int, List<GActorNpcFight>>();
    public bool IsClientFightMode { get; private set; }
    private IEnumerator DelayUnTrigger(int id)
    {
@@ -131,6 +132,7 @@
            int _triggerID = (int)package.DictValue;
            if (_triggerID == 0)
            {
                Debug.LogFormat("退出当前触发事件, 已触发数量: {0}", m_TriggerIDToMissionIDDict.Count);
                foreach (var _removeTriggerID in m_TriggerIDToMissionIDDict.Keys)
                {
                    SnxxzGame.Instance.StartCoroutine(DelayUnTrigger(_removeTriggerID));
@@ -147,10 +149,12 @@
            if (package.DictValue == 0)
            {
                Debug.LogFormat("=           退出了前端模式             =");
                IsClientFightMode = false;
            }
            else
            {
                Debug.LogFormat("=           进入了前端模式             =");
                IsClientFightMode = true;
            }
        }
    }
@@ -246,21 +250,44 @@
        return null;
    }
    public Vector3 GetCloseTransPoint(Vector3 pos)
    {
        // 遍历找到离给定点最近并且可寻路至的传送点 P
        // 找到 P点的 另一端 P1
        // 判断当前传入的点是否可以寻路至 P1
        // 不行的话重新寻找 可以的话返回 P1 的坐标
        float _compareDis;
        float _dis;
        Vector3 _targetPos = Vector3.zero;
        foreach (var _p in m_TransferGroupList)
        foreach (var _t in m_MapData.transfers)
        {
            for (int i = 0; i < _t.transferPoints.Length; ++i)
            {
                if (PathFinder.WalkAble(pos, _t.transferPoints[i].position))
                {
                    if (i == 0)
                    {
                        _targetPos = _t.transferPoints[_t.transferPoints.Length - 1].position;
                    }
                    else
                    {
                        _targetPos = _t.transferPoints[0].position;
                    }
                    break;
                }
            }
            if (_targetPos != Vector3.zero)
            {
                break;
            }
        }
        return Vector3.zero;
        if (_targetPos == Vector3.zero)
        {
            Debug.LogWarningFormat("寻找最近的寻路飞跃点, 没有找到任何结果...");
        }
        return _targetPos;
    }
    private IEnumerator DelayTrigger(uint missionID, int triggerID)
Fight/Stage/MapEditor/Game/EventRefreshNPCHandler.cs
@@ -88,7 +88,7 @@
        {
            var _data = m_Evt.monsters[m_RefreshCount];
            var _npc = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightNorm>(_data.npcID, E_ActorGroup.Enemy);
            _npc.Pos = _data.position;
            _npc.BornPos = _npc.Pos = _data.position;
            _npc.belongEventID = m_Evt.id;
            ClientSceneManager.Instance.NpcBorn(m_Evt.id, _npc);
        }
@@ -101,7 +101,7 @@
            foreach (var _data in m_Evt.monsters)
            {
                var _npc = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightNorm>(_data.npcID, E_ActorGroup.Enemy);
                _npc.Pos = _data.position;
                _npc.BornPos = _npc.Pos = _data.position;
                _npc.belongEventID = m_Evt.id;
                ClientSceneManager.Instance.NpcBorn(m_Evt.id, _npc);
            }
Fight/Stage/MapEditor/Game/TransferGroup.cs
@@ -79,6 +79,7 @@
                        {
                            _hero.RunImmediate();
                        }
                        GA_Hero.s_Flying = true;
                        break;
                    }
                }
@@ -185,6 +186,7 @@
                        _hero.SwitchHeadNameBindNode(false);
                        _hero.StopPathFind();
                        CameraController.Instance.LookAtTarget = _hero.Root;
                        GA_Hero.s_Flying = false;
                    }
                }
                break;
@@ -196,8 +198,6 @@
                    m_Step = 0;
                    m_InCreaseTime = 0;
                    targetPoint = -1;
                    _hero.StopPathFind();
                    _hero.Behaviour.StopHandupAI(true);
                }
                break;
        }