少年修仙传客户端代码仓库
client_Hale
2019-04-20 60fe3614f713b37e5bbea27e371f249e49d044d7
382 采集相关逻辑修改
1个文件已修改
98 ■■■■ 已修改文件
Fight/GameActor/GA_NpcClientCollect.cs 98 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/GameActor/GA_NpcClientCollect.cs
@@ -25,9 +25,54 @@
    private void HandleCallback(E_NpcType type, int npcID, uint sid)
    {
        if (sid == ServerInstID)
        var _hero = PlayerDatas.Instance.hero;
        if (_hero != null)
        {
            OnClick();
            if (_hero.SelectTarget == null)
            {
                if (sid == ServerInstID)
                {
                    OnClick();
                }
            }
            else
            {
                var _collect = _hero.SelectTarget as GA_NpcClientCollect;
                if (_collect != null)
                {
                    float _chkDistSqrt = MathUtility.DistanceSqrtXZ(_hero.Pos, _collect.Pos);
                    // 这里判断是否要走向此对象
                    if (_chkDistSqrt < 4)
                    {
                        if (OnArrive != null)
                        {
                            OnArrive(_collect.ServerInstID, _collect.NpcConfig.NPCID);
                        }
                        var _model = ModelCenter.Instance.GetModel<HazyGrassModel>();
                        if (_model.CanCollectClientNpc(_collect.NpcConfig.NPCID))
                        {
                            StartCollect();
                        }
                        else
                        {
                            _model.DisplayCollectErrorTip();
                        }
                    }
                    else
                    {
                        _hero.MoveToPosition(_collect.Pos, 1.5f);
                    }
                }
                else
                {
                    if (sid == ServerInstID)
                    {
                        OnClick();
                    }
                }
            }
        }
    }
@@ -101,13 +146,13 @@
        float _chkDistSqrt = MathUtility.DistanceSqrtXZ(_hero.Pos, Pos);
        // 这里判断是否要走向此对象
        if (_chkDistSqrt > 2f)
        {
            _hero.MoveToPosition(Pos, 1f);
        }
        if (_chkDistSqrt < 4)
        {
            if (OnArrive != null)
            {
                OnArrive(ServerInstID, NpcConfig.NPCID);
            }
            var _model = ModelCenter.Instance.GetModel<HazyGrassModel>();
            if (_model.CanCollectClientNpc(NpcConfig.NPCID))
            {
@@ -117,6 +162,10 @@
            {
                _model.DisplayCollectErrorTip();
            }
        }
        else
        {
            _hero.MoveToPosition(Pos, 1.5f);
        }
    }
@@ -140,6 +189,11 @@
        PrepareHandler.Instance.isPreparing = true;
        WindowCenter.Instance.Open<NormalCollectWin>();
        m_StartCollect = true;
        var _hero = PlayerDatas.Instance.hero;
        if (_hero != null && !_hero.ActorInfo.serverDie)
        {
            _hero.Collect();
        }
    }
    public void StopCollect()
@@ -147,6 +201,14 @@
        PrepareHandler.Instance.isPreparing = false;
        WindowCenter.Instance.Close<NormalCollectWin>();
        m_StartCollect = false;
        var _hero = PlayerDatas.Instance.hero;
        if (_hero != null && _hero.ActorInfo.serverDie)
        {
            if (_hero.IsCollect())
            {
                _hero.IdleImmediate();
            }
        }
    }
    protected override void OnUpdate()
@@ -244,14 +306,7 @@
            }
            else
            {
                if (m_ArrivedList.Contains(ServerInstID))
                {
                    if (OnLeave != null)
                    {
                        OnLeave(ServerInstID, NpcConfig.NPCID);
                    }
                    m_ArrivedList.Remove(ServerInstID);
                }
                Leave();
            }
        }
    }
@@ -262,13 +317,22 @@
        {
            OnArrive(ServerInstID, NpcConfig.NPCID);
        }
        if (!m_ArrivedList.Contains(ServerInstID))
        {
            m_ArrivedList.Add(ServerInstID);
        }
    }
    public void Leave()
    {
        if (OnLeave != null)
        if (m_ArrivedList.Contains(ServerInstID))
        {
            OnLeave(ServerInstID, NpcConfig.NPCID);
            if (OnLeave != null)
            {
                OnLeave(ServerInstID, NpcConfig.NPCID);
            }
            m_ArrivedList.Remove(ServerInstID);
        }
    }
}