少年修仙传客户端代码仓库
client_linchunjie
2019-05-22 2935539e4b300315dcfdd9caee7818be321099a4
3335 缥缈仙域优化
6个文件已修改
172 ■■■■■ 已修改文件
Fight/Stage/Dungeon/ClientDungeonStageUtility.cs 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Stage/Dungeon/ClientHazyPreciousDungeonStage.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/HazyRegion/ClientHazyDemonKingStage.cs 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/HazyRegion/ClientHazyGrassStage.cs 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/HazyRegion/HazyGrassModel.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/HazyRegion/HazyRegionModel.cs 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Stage/Dungeon/ClientDungeonStageUtility.cs
@@ -159,8 +159,11 @@
        switch (clientMapId)
        {
            case HazyDemonKingModel.CLIENTDATAMAP:
                if (StageLoad.Instance.currentStage is ClientHazyDemonKingStage)
                {
                    if (!(StageLoad.Instance.currentStage is ClientHazyDemonKingStage))
                    {
                        return;
                    }
                    var stage = StageLoad.Instance.currentStage as ClientHazyDemonKingStage;
                    if (stage.step > ClientHazyDemonKingStage.Step.Fight)
                    {
@@ -168,6 +171,33 @@
                    }
                }
                break;
            case HazyGrassModel.FAIRY_CLIENTDATAMAP:
            case HazyGrassModel.REIKI_CLIENTDATAMAP:
                {
                    if (!(StageLoad.Instance.currentStage is ClientHazyGrassStage))
                    {
                        return;
                    }
                    var stage = StageLoad.Instance.currentStage as ClientHazyGrassStage;
                    if (stage.hasCompleted)
                    {
                        return;
                    }
                }
                break;
            case HazyRegionModel.PRECIOUS_CLIENTDATAMAP:
                {
                    if (!(StageLoad.Instance.currentStage is ClientHazyPreciousDungeonStage))
                    {
                        return;
                    }
                    var stage = StageLoad.Instance.currentStage as ClientHazyPreciousDungeonStage;
                    if (stage.step > ClientHazyPreciousDungeonStage.Step.Collect)
                    {
                        return;
                    }
                }
                break;
        }
        var key = StringUtility.Contact(OFFLINEMAPRECORD, "_", PlayerDatas.Instance.baseData.PlayerID);
Fight/Stage/Dungeon/ClientHazyPreciousDungeonStage.cs
@@ -36,7 +36,7 @@
        GA_NpcClientCollect clientPrecious;
        Step m_Step = Step.None;
        Step step
        public Step step
        {
            get { return m_Step; }
            set
@@ -242,6 +242,8 @@
            m_ExitClock = Clock.AlarmAfter(seconds, OnExitDungeon);
            ClientDungeonStageUtility.ClearClientDataMapSymbol();
            UpdateMissionData();
        }
@@ -341,7 +343,7 @@
            }
        }
        enum Step
        public enum Step
        {
            None,
            Prepare,
System/HazyRegion/ClientHazyDemonKingStage.cs
@@ -11,15 +11,9 @@
    static GA_NpcClientFightBoss clientFightBoss = null;
    Clock pickItemClock = null;
    float stepTimer = 0f;
    float existTime = 10f;
    bool pickAllDropItem = false;
    int itemCount = 0;
    Step m_Step = Step.Fight;
    public Step step
@@ -34,9 +28,6 @@
                {
                    case Step.Fight:
                        stepTimer = 0f;
                        break;
                    case Step.PickItem:
                        stepTimer = 5f;
                        break;
                    case Step.Settle:
                        stepTimer = 0f;
@@ -58,12 +49,8 @@
        base.Initialize();
        m_Step = Step.None;
        pickAllDropItem = false;
        itemCount = 0;
        ClientDungeonStageUtility.onReceiveCustomDropItme += OnReceiveCustomDropItme;
        dungeonModel.onDungeonResultEvent += OnDungeonResultEvent;
        ClientDropItemUtility.OnItemPickup += OnItemPickup;
        PersonalEnemy.OnNpcAppear += OnNpcAppear;
    }
@@ -103,52 +90,10 @@
        PersonalEnemy.Create((uint)config.npcId, E_ActorGroup.Enemy, bossBornPosition);
    }
    private void OnReceiveCustomDropItme(HB214_tagMCCuntomFBPrizeInfo package)
    {
        step = Step.PickItem;
        ClientDungeonStageUtility.ClearClientDataMapSymbol();
        if (package.PrizeItemCount <= 0)
        {
            pickAllDropItem = true;
        }
        else
        {
            itemCount = package.PrizeItemCount;
            int[] items = new int[itemCount];
            for (int i = 0; i < itemCount; i++)
            {
                items[i] = (int)package.PrizeItemIDList[i];
            }
            ClientDropItemUtility.Instance.Drop(bossBornPosition, items);
            dungeonModel.UpdateCoolDown(DungeonCoolDownType.PickUpTime, 30 * 1000);
            if (pickItemClock != null)
            {
                Clock.Stop(pickItemClock);
                pickItemClock = null;
            }
            pickItemClock = Clock.AlarmAfter(30, OnPickUpItemLimit);
        }
    }
    void OnPickUpItemLimit()
    {
        pickAllDropItem = true;
    }
    private void OnItemPickup(int itemId)
    {
        itemCount--;
        if (itemCount == 0)
        {
            pickAllDropItem = true;
        }
    }
    private void OnDungeonResultEvent()
    {
        step = Step.Settle;
        ClientDungeonStageUtility.ClearClientDataMapSymbol();
        dungeonModel.UpdateCoolDown(DungeonCoolDownType.LeaveMap, 10 * 1000);
    }
@@ -182,17 +127,6 @@
                    }
                }
                break;
            case Step.PickItem:
                if (pickAllDropItem)
                {
                    stepTimer += Time.deltaTime;
                    if (stepTimer >= 5f)
                    {
                        RequestSettle();
                        stepTimer = 0f;
                    }
                }
                break;
            case Step.Settle:
                stepTimer += Time.deltaTime;
                if (stepTimer >= existTime)
@@ -212,31 +146,16 @@
        }
    }
    void RequestSettle()
    {
        var incidentId = hazyRegionModel.processingIncidentId;
        var config = HazyRegionConfig.Get(incidentId);
        ClientDungeonStageUtility.RequestSettleClientDungeon(config.dungeonId, config.lineId);
    }
    public override void UnInitialize()
    {
        base.UnInitialize();
        if (pickItemClock != null)
        {
            Clock.Stop(pickItemClock);
            pickItemClock = null;
        }
        if (clientFightBoss != null)
        {
            clientFightBoss = null;
        }
        ClientDungeonStageUtility.onReceiveCustomDropItme -= OnReceiveCustomDropItme;
        dungeonModel.onDungeonResultEvent -= OnDungeonResultEvent;
        ClientDropItemUtility.OnItemPickup -= OnItemPickup;
        PersonalEnemy.OnNpcAppear -= OnNpcAppear;
    }
@@ -254,7 +173,6 @@
    {
        None,
        Fight,
        PickItem,
        Settle,
        Exit
    }
System/HazyRegion/ClientHazyGrassStage.cs
@@ -12,6 +12,9 @@
    static readonly int s_EnemyNpcId = 40208005;
    bool hasInitializedNpc = false;
    public bool hasCompleted { get; private set; }
    static Dictionary<uint, GA_NpcClientCollect> s_CollectNpcs = new Dictionary<uint, GA_NpcClientCollect>();
    static Dictionary<uint, int> s_Sid2NpcIds = new Dictionary<uint, int>();
    static Dictionary<uint, int> s_Sid2NpcIndexs = new Dictionary<uint, int>();
@@ -21,6 +24,7 @@
    HazyGrassModel model { get { return ModelCenter.Instance.GetModel<HazyGrassModel>(); } }
    HazyRegionModel hazyRegionModel { get { return ModelCenter.Instance.GetModel<HazyRegionModel>(); } }
    DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
    public override void Initialize()
    {
@@ -35,7 +39,11 @@
        UnloadAllNpc();
        hasInitializedNpc = false;
        hasCompleted = false;
        ClientCollectUtility.OnCollectFinished += OnCollectFinished;
        dungeonModel.onDungeonResultEvent += OnDungeonResultEvent;
    }
    protected override void OnStageLoadFinish()
@@ -44,6 +52,8 @@
        InitialPlayer();
        InitializeNpc();
        model.onMapNpcCountRefresh += OnMapNpcCountRefresh;
    }
    public override void UnInitialize()
@@ -53,6 +63,21 @@
        UnloadAllNpc();
        ClientCollectUtility.OnCollectFinished -= OnCollectFinished;
        dungeonModel.onDungeonResultEvent -= OnDungeonResultEvent;
        model.onMapNpcCountRefresh -= OnMapNpcCountRefresh;
    }
    private void OnMapNpcCountRefresh()
    {
        if (!hasInitializedNpc)
        {
            InitializeNpc();
        }
    }
    private void OnDungeonResultEvent()
    {
        hasCompleted = true;
    }
    private void OnCollectFinished(uint _sid)
@@ -114,6 +139,13 @@
                var npcId = npcInfos[i];
                var count = model.GetMapNpcCount(npcId);
                if (count == 0)
                {
                    continue;
                }
                hasInitializedNpc = true;
                for (int j = 0; j < count; j++)
                {
                    var index = -1;
@@ -146,12 +178,18 @@
            }
        }
        if (ClientDungeonStageUtility.clientMapId == HazyGrassModel.FAIRY_CLIENTDATAMAP)
        if (hasInitializedNpc)
        {
            PersonalEnemy.Create((uint)s_EnemyNpcId, E_ActorGroup.Enemy, PlayerBornPosition2);
            if (ClientDungeonStageUtility.clientMapId == HazyGrassModel.FAIRY_CLIENTDATAMAP)
            {
                PersonalEnemy.Create((uint)s_EnemyNpcId, E_ActorGroup.Enemy, PlayerBornPosition2);
            }
        }
        SaveNpcData();
        if (hasInitializedNpc)
        {
            SaveNpcData();
        }
    }
    void InitializeNpc(int npcId, int index)
System/HazyRegion/HazyGrassModel.cs
@@ -208,7 +208,7 @@
            {
                return m_MapNpcCount[npcId];
            }
            return 5;
            return 0;
        }
        public string GetLocalSaveKey(int mapId)
System/HazyRegion/HazyRegionModel.cs
@@ -531,9 +531,7 @@
        void SendGotoIncidentDungeon(HazyRegionConfig config)
        {
            if (config.dungeonId == HazyGrassModel.FairyGrassMapId ||
                config.dungeonId == HazyGrassModel.ReikiGrassMapId ||
                config.dungeonId == HazyDemonKingModel.DEMONKINGMAPID2)
            if (config.dungeonType == 2)
            {
                var pak = new CC105_tagCMEnterCrossServer();
                pak.DataMapID = (uint)config.dungeonId;