少年修仙传客户端代码仓库
client_linchunjie
2019-04-12 a49c6f317d8548066715108d5534296bcd4eddf1
3335 缥缈仙域
5个文件已修改
162 ■■■■ 已修改文件
Fight/Stage/Dungeon/ClientDungeonStageUtility.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Dungeon/DungeonModel.cs 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/HazyRegion/ClientHazyDemonKingStage.cs 131 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/HazyRegion/HazyDemonKingModel.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/HazyRegion/HazyGrassModel.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Stage/Dungeon/ClientDungeonStageUtility.cs
@@ -9,6 +9,8 @@
    public static bool isClientDungeon { get; private set; }
    public static ushort clientMapId { get; private set; }
    public static event Action onReceiveCustomDropItme;
    public static void Init()
    {
        DTC0102_tagCDBPlayer.switchAccountEvent += Reset;
@@ -36,6 +38,12 @@
        GameNetSystem.Instance.SendInfo(pak);
    }
    public static void RequestStartClientDungeon()
    {
        var pak = new CA231_tagCMClientStartCustomScene();
        GameNetSystem.Instance.SendInfo(pak);
    }
    public static void RequestExitClientDungeon()
    {
        var pak = new CA233_tagCMClientExitCustomScene();
@@ -44,7 +52,10 @@
    public static void ReceiveCustomItems(HB214_tagMCCuntomFBPrizeInfo package)
    {
        if (onReceiveCustomDropItme != null)
        {
            onReceiveCustomDropItme();
        }
    }
    private static void Reset()
System/Dungeon/DungeonModel.cs
@@ -27,6 +27,7 @@
        public event Action<DungeonCoolDownType> dungeonCoolDownEvent;
        public event Action dungeonBeginCoolDownEndEvent;
        public event Action updateMissionEvent;
        public event Action onDungeonResultEvent;
        public event Action<int> dungeonStageChangeEvent;
        public event Action getDungeonResultEvent;
        public event Action dungeonEnterCoolDownUpdate;
@@ -918,10 +919,8 @@
            if (AdventureStage.Instance.IsInAdventureStage)
            {
                WindowCenter.Instance.Open<DungeonAdventureVictoryWin>();
                return;
            }
            if (m_DungeonResult.isSweep == 1)
            else if (m_DungeonResult.isSweep == 1)
            {
                switch (m_DungeonResult.dataMapID)
                {
@@ -1084,6 +1083,11 @@
                    }
                }
            }
            if (onDungeonResultEvent != null)
            {
                onDungeonResultEvent();
            }
        }
        public int GetDungeonHintId(int _dataMapId, int _lineId)
System/HazyRegion/ClientHazyDemonKingStage.cs
@@ -9,15 +9,49 @@
    static readonly Vector3 playerBornPosition = new Vector3(10, 6.38f, 6.67f);
    static readonly Vector3 bossBornPosition = new Vector3(8.35f, 6.37f, 9.7f);
    static GA_NpcClientFightBoss clientFightBoss = null;
    GA_NpcClientFightBoss clientFightBoss = null;
    static float totalTime = 20f;
    static float timer = 0f;
    static DateTime playerAtkTime = DateTime.Now;
    float totalTime = 20f;
    float timer = 0f;
    DateTime playerAtkTime = DateTime.Now;
    float stepTimer = 0f;
    float existTime = 10f;
    bool pickAllDropItem = false;
    Step m_Step = Step.Fight;
    Step step
    {
        get { return m_Step; }
        set
        {
            if (m_Step != value)
            {
                m_Step = value;
                switch (m_Step)
                {
                    case Step.Fight:
                        stepTimer = 0f;
                        break;
                    case Step.PickItem:
                        stepTimer = 5f;
                        break;
                    case Step.Settle:
                        stepTimer = 0f;
                        break;
                    case Step.Exit:
                        stepTimer = 0f;
                        break;
                }
            }
        }
    }
    HazyDemonKingModel model { get { return ModelCenter.Instance.GetModel<HazyDemonKingModel>(); } }
    HazyRegionModel hazyRegionModel { get { return ModelCenter.Instance.GetModel<HazyRegionModel>(); } }
    DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
    public override void Initialize()
    {
@@ -25,9 +59,13 @@
        timer = 0f;
        playerAtkTime = DateTime.MinValue;
        m_Step = Step.None;
        pickAllDropItem = false;
        DTC0403_tagPlayerLoginLoadOK.mapInitOkEvent += OnReconnected;
        AttackHandler.OnAttackTarget += OnPlayerAttack;
        ClientDungeonStageUtility.onReceiveCustomDropItme += OnReceiveCustomDropItme;
        dungeonModel.onDungeonResultEvent += OnDungeonResultEvent;
    }
    protected override void OnStageLoadFinish()
@@ -36,6 +74,8 @@
        InitializePlayer();
        InitializeBoss();
        step = Step.Fight;
    }
    void InitializePlayer()
@@ -82,6 +122,16 @@
        }
    }
    private void OnReceiveCustomDropItme()
    {
        step = Step.PickItem;
    }
    private void OnDungeonResultEvent()
    {
        step = Step.Settle;
    }
    protected override void OnUpdate()
    {
        base.OnUpdate();
@@ -97,6 +147,40 @@
                }
            }
        }
        switch (step)
        {
            case Step.Fight:
                if (clientFightBoss == null)
                {
                    stepTimer += Time.deltaTime;
                    if (stepTimer > 5f)
                    {
                        stepTimer = 0f;
                        RequestDropItem();
                    }
                }
                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)
                {
                    step = Step.Exit;
                    model.RequestExitClientDungeon();
                }
                break;
        }
    }
    void OnBossDie()
@@ -108,6 +192,22 @@
            clientFightBoss.Die();
            clientFightBoss = null;
        }
        RequestDropItem();
    }
    void RequestDropItem()
    {
        var incidentId = hazyRegionModel.processingIncidentId;
        var config = HazyRegionConfig.Get(incidentId);
        ClientDungeonStageUtility.RequestClientDropItem(config.dungeonId, config.lineId);
    }
    void RequestSettle()
    {
        var incidentId = hazyRegionModel.processingIncidentId;
        var config = HazyRegionConfig.Get(incidentId);
        ClientDungeonStageUtility.RequestSettleClientDungeon(config.dungeonId, config.lineId);
    }
    private void OnReconnected()
@@ -129,7 +229,9 @@
        }
        DTC0403_tagPlayerLoginLoadOK.mapInitOkEvent -= OnReconnected;
        AttackHandler.OnAttackTarget -= OnPlayerAttack;
        AttackHandler.OnAttackTarget -= OnPlayerAttack;
        ClientDungeonStageUtility.onReceiveCustomDropItme -= OnReceiveCustomDropItme;
        dungeonModel.onDungeonResultEvent -= OnDungeonResultEvent;
    }
#if UNITY_EDITOR
@@ -144,19 +246,10 @@
    public enum Step
    {
        Start,
        None,
        Fight,
        End,
    }
    public abstract class ClientStage
    {
        public abstract bool isCompleted { get; protected set; }
        protected HazyRegionModel model { get { return ModelCenter.Instance.GetModel<HazyRegionModel>(); } }
        public abstract void OnUpdate();
        public abstract void OnStart();
        public abstract void OnEnd();
        PickItem,
        Settle,
        Exit
    }
}
System/HazyRegion/HazyDemonKingModel.cs
@@ -200,8 +200,7 @@
        {
            MapTransferUtility.Instance.Clear();
            ClientDungeonStageUtility.SetClientDungeon(true, Client_MapID);
            var sendInfo = new CA231_tagCMClientStartCustomScene();
            GameNetSystem.Instance.SendInfo(sendInfo);
            ClientDungeonStageUtility.RequestStartClientDungeon();
            CrossServerLogin.Instance.SetWaitForLoginCrossServerState(false);
            StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand()
            {
@@ -223,6 +222,7 @@
        public void RequestExitClientDungeon()
        {
            ClientDungeonStageUtility.SetClientDungeon(false, 0);
            ClientDungeonStageUtility.RequestExitClientDungeon();
            PlayerDatas.Instance.extersion.pkState = 0;
            ModelCenter.Instance.GetModel<DungeonModel>().ResetBufData();
System/HazyRegion/HazyGrassModel.cs
@@ -27,8 +27,7 @@
        {
            MapTransferUtility.Instance.Clear();
            ClientDungeonStageUtility.SetClientDungeon(true, Client_MapID);
            var sendInfo = new CA231_tagCMClientStartCustomScene();
            GameNetSystem.Instance.SendInfo(sendInfo);
            ClientDungeonStageUtility.RequestStartClientDungeon();
            CrossServerLogin.Instance.SetWaitForLoginCrossServerState(false);
            StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand()
            {
@@ -50,6 +49,7 @@
        public void RequestExitClientDungeon()
        {
            ClientDungeonStageUtility.SetClientDungeon(false, 0);
            ClientDungeonStageUtility.RequestExitClientDungeon();
            PlayerDatas.Instance.extersion.pkState = 0;
            ModelCenter.Instance.GetModel<DungeonModel>().ResetBufData();