少年修仙传客户端代码仓库
client_Hale
2019-07-08 62680862d169ed21957f3c79815b7f9274085a0d
Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
2个文件已修改
76 ■■■■ 已修改文件
System/HazyRegion/ClientHazyGrassStage.cs 72 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/HazyRegion/HazyGrassModel.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/HazyRegion/ClientHazyGrassStage.cs
@@ -24,6 +24,8 @@
    static Dictionary<uint, int> s_Sid2NpcIndexs = new Dictionary<uint, int>();
    static Dictionary<int, int> s_NpcCounts = new Dictionary<int, int>();
    static GA_NpcClientCollect autoNpc = null;
    HazyRegionIncidentType incidentType;
    HazyGrassModel model { get { return ModelCenter.Instance.GetModel<HazyGrassModel>(); } }
@@ -123,25 +125,22 @@
            s_CollectNpcs.Remove(_sid);
        }
        if (ClientDungeonStageUtility.clientMapId == HazyGrassModel.REIKI_CLIENTDATAMAP)
        var dungeon = ClientDungeonStageUtility.dungeonInfo;
        var hintId = dungeonModel.GetDungeonHintId(dungeon.mapId, dungeon.lineId);
        var dungeonHintConfig = DungeonHintConfig.Get(hintId);
        if (dungeonHintConfig != null)
        {
            var dungeon = ClientDungeonStageUtility.dungeonInfo;
            var hintId = dungeonModel.GetDungeonHintId(dungeon.mapId, dungeon.lineId);
            var dungeonHintConfig = DungeonHintConfig.Get(hintId);
            if (dungeonHintConfig != null)
            var collectCount = 0;
            for (int i = 0; i < dungeonHintConfig.NPC1ID.Length; i++)
            {
                var collectCount = 0;
                for (int i = 0; i < dungeonHintConfig.NPC1ID.Length; i++)
                collectCount += dungeonModel.GetDugneonNpcCollectCount(dungeonHintConfig.NPC1ID[i]);
            }
            if (dungeonHintConfig.targetValue1.Length > 0
                && dungeonHintConfig.targetValue1[0] > 0)
            {
                if (collectCount < dungeonHintConfig.targetValue1[0] - 1)
                {
                    collectCount += dungeonModel.GetDugneonNpcCollectCount(dungeonHintConfig.NPC1ID[i]);
                }
                if (dungeonHintConfig.targetValue1.Length > 0
                    && dungeonHintConfig.targetValue1[0] > 0)
                {
                    if (collectCount < dungeonHintConfig.targetValue1[0] - 1)
                    {
                        TryGotoCloserNpc();
                    }
                    TryGotoCloserNpc();
                }
            }
        }
@@ -172,18 +171,53 @@
        }
        var minDis = float.MaxValue;
        var targetPosition = PlayerBornPosition1;
        autoNpc = null;
        foreach (var npc in s_CollectNpcs.Values)
        {
            var dis = MathUtility.CalDistance(hero.Pos, npc.Pos);
            if (minDis > dis)
            {
                minDis = dis;
                targetPosition = npc.Pos;
                autoNpc = npc;
            }
        }
        hero.MoveToPosition(targetPosition, 0.3f);
        if (autoNpc != null)
        {
            hero.OnPathFindStop -= OnHeroFindStop;
            hero.OnPathFindStop += OnHeroFindStop;
            MapTransferUtility.Instance.MoveToNPC(autoNpc.NpcConfig.NPCID, (int)autoNpc.ServerInstID);
        }
    }
    private void OnHeroFindStop()
    {
        var hero = PlayerDatas.Instance.hero;
        if (hero == null)
        {
            return;
        }
        hero.OnPathFindStop -= OnHeroFindStop;
        if (ClientDungeonStageUtility.clientMapId == HazyGrassModel.REIKI_CLIENTDATAMAP)
        {
            if (PlayerDatas.Instance.baseData.LV >= model.autoCollectLevel)
            {
                if (autoNpc != null)
                {
                    float _chkDistSqrt = MathUtility.DistanceSqrtXZ(hero.Pos, autoNpc.Pos);
                    float _chkDist = GeneralDefine.CloseNpcDist + autoNpc.NpcConfig.ModelRadius + 0.3f;
                    if (_chkDistSqrt <= Mathf.Pow(_chkDist, 2))
                    {
                        hero.SelectTarget = autoNpc;
                        ClientCollectUtility.HandleCallback(E_NpcType.Collect, autoNpc.NpcConfig.NPCID, autoNpc.ServerInstID);
                    }
                }
            }
        }
    }
    void InitializeNpc()
System/HazyRegion/HazyGrassModel.cs
@@ -16,6 +16,7 @@
        public const int FAIRY_CLIENTDATAMAP = 3250;
        public bool IsInDungeon { get; private set; }
        public int autoCollectLevel { get; private set; }
        public event Action onMapNpcCountRefresh;
@@ -46,6 +47,9 @@
        {
            var funcConfig = FuncConfigConfig.Get("HazyGrassNpcMapItem");
            m_NpcMapItems = ConfigParse.GetDic<int, int>(funcConfig.Numerical1);
            var level = 0;
            int.TryParse(funcConfig.Numerical2, out level);
            autoCollectLevel = level;
        }
        private void OnStageLoadFinish()