少年修仙传客户端代码仓库
client_linchunjie
2019-04-12 0e5da8e5d9b1e470b51cac634f4dedb36d53d3cc
3335 缥缈仙域
3个文件已修改
142 ■■■■■ 已修改文件
Fight/Actor/Skill/AttackHandler.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/HazyRegion/ClientHazyDemonKingStage.cs 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/HazyRegion/HazyDemonKingModel.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Actor/Skill/AttackHandler.cs
@@ -181,6 +181,7 @@
            {
                // 处理封魔坛英雄伤害
                FakeDemonJarDungeonStage _dungeon = StageLoad.Instance.currentStage as FakeDemonJarDungeonStage;
                ClientHazyDemonKingStage _clientHazyDemonStage = StageLoad.Instance.currentStage as ClientHazyDemonKingStage;
                if (_dungeon != null)
                {
                    if (attacker.ServerInstID == PlayerDatas.Instance.PlayerId)
@@ -188,6 +189,10 @@
                        _dungeon.AddHeroHurt(hurtValue);
                    }
                }
                else if (_clientHazyDemonStage != null)
                {
                }
                else
                {
                    target.ActorInfo.ReduceHp((uint)hurtValue);
System/HazyRegion/ClientHazyDemonKingStage.cs
@@ -9,44 +9,104 @@
    static readonly Vector3 playerBornPosition = new Vector3(10, 6.38f, 6.67f);
    static readonly Vector3 bossBornPosition = new Vector3(8.35f, 6.37f, 9.7f);
    Step step = Step.Start;
    ClientStage currentStage = null;
    static GA_NpcClientFightBoss clientFightBoss = null;
    static float totalTime = 20f;
    static float timer = 0f;
    static DateTime playerAtkTime = DateTime.Now;
    HazyDemonKingModel model { get { return ModelCenter.Instance.GetModel<HazyDemonKingModel>(); } }
    HazyRegionModel hazyRegionModel { get { return ModelCenter.Instance.GetModel<HazyRegionModel>(); } }
    public override void Initialize()
    {
        base.Initialize();
        currentStage = null;
        timer = 0f;
        playerAtkTime = DateTime.MinValue;
        DTC0403_tagPlayerLoginLoadOK.mapInitOkEvent += OnReconnected;
        DTC0403_tagPlayerLoginLoadOK.mapInitOkEvent += OnReconnected;
        AttackHandler.OnAttackTarget += OnPlayerAttack;
    }
    protected override void OnStageLoadFinish()
    {
        base.OnStageLoadFinish();
        step = Step.Start;
        currentStage = new StartStage();
        currentStage.OnStart();
        InitializePlayer();
        InitializeBoss();
    }
    void InitializePlayer()
    {
        var hero = PlayerDatas.Instance.hero;
        hero.Pos = playerBornPosition;
        CameraController.Instance.Apply();
    }
    void InitializeBoss()
    {
        if (clientFightBoss != null)
        {
            clientFightBoss.ActorInfo.serverDie = true;
            GAMgr.Instance.ServerDie(clientFightBoss.ServerInstID);
            clientFightBoss.Die();
            clientFightBoss = null;
        }
        var config = HazyRegionConfig.Get(hazyRegionModel.processingIncidentId);
        var npcId = NPCConfig.Get(config.npcId);
        clientFightBoss = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightBoss>((uint)config.npcId, E_ActorGroup.Enemy);
        clientFightBoss.Pos = bossBornPosition;
        clientFightBoss.LockTargetSID = PlayerDatas.Instance.PlayerId;
    }
    private void OnPlayerAttack(uint _attackerId, uint _victimId, byte _type, uint _damage)
    {
        if (clientFightBoss == null)
        {
            return;
        }
        if (_victimId == clientFightBoss.ServerInstID)
        {
            var progress = Mathf.Clamp01(1 - timer / totalTime);
            var hp = (ulong)(clientFightBoss.ActorInfo.RealMaxHp * progress);
            TargetBriefInfo.OnRefreshBossLifeBar(_victimId, clientFightBoss.NpcConfig.NPCID,
                hp, clientFightBoss.ActorInfo.RealMaxHp);
            playerAtkTime = DateTime.Now;
        }
    }
    protected override void OnUpdate()
    {
        base.OnUpdate();
        if (currentStage != null)
        if (timer < totalTime)
        {
            currentStage.OnUpdate();
            if (currentStage.isCompleted)
            if ((DateTime.Now - playerAtkTime).TotalSeconds < 1f)
            {
                currentStage.OnEnd();
                currentStage = null;
                timer += Time.deltaTime;
                if (timer >= totalTime)
                {
                    OnBossDie();
                }
            }
        }
    }
    void OnBossDie()
    {
        if (clientFightBoss != null)
        {
            clientFightBoss.ActorInfo.serverDie = true;
            GAMgr.Instance.ServerDie(clientFightBoss.ServerInstID);
            clientFightBoss.Die();
            clientFightBoss = null;
        }
    }
@@ -60,8 +120,6 @@
    {
        base.UnInitialize();
        currentStage = null;
        if (clientFightBoss != null)
        {
            clientFightBoss.ActorInfo.serverDie = true;
@@ -70,7 +128,8 @@
            clientFightBoss = null;
        }
        DTC0403_tagPlayerLoginLoadOK.mapInitOkEvent -= OnReconnected;
        DTC0403_tagPlayerLoginLoadOK.mapInitOkEvent -= OnReconnected;
        AttackHandler.OnAttackTarget -= OnPlayerAttack;
    }
#if UNITY_EDITOR
@@ -99,45 +158,5 @@
        public abstract void OnUpdate();
        public abstract void OnStart();
        public abstract void OnEnd();
    }
    public class StartStage : ClientStage
    {
        public override bool isCompleted
        {
            get; protected set;
        }
        public override void OnStart()
        {
            var hero = PlayerDatas.Instance.hero;
            hero.Pos = playerBornPosition;
            CameraController.Instance.Apply();
            var config = HazyRegionConfig.Get(model.processingIncidentId);
            var npcId = NPCConfig.Get(config.npcId);
            if (clientFightBoss != null)
            {
                clientFightBoss.ActorInfo.serverDie = true;
                GAMgr.Instance.ServerDie(clientFightBoss.ServerInstID);
                clientFightBoss.Die();
                clientFightBoss = null;
            }
            clientFightBoss = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightBoss>((uint)config.npcId, E_ActorGroup.Enemy);
            clientFightBoss.Pos = bossBornPosition;
            clientFightBoss.LockTargetSID = PlayerDatas.Instance.PlayerId;
            isCompleted = true;
        }
        public override void OnUpdate()
        {
        }
        public override void OnEnd()
        {
        }
    }
}
System/HazyRegion/HazyDemonKingModel.cs
@@ -126,10 +126,10 @@
                    var hero = PlayerDatas.Instance.hero;
                    m_PlayerInfos.Add(playerId, new HazyDemonKingPlayerInfo()
                    {
                        job = hero.ActorInfo.Job,
                        job = PlayerDatas.Instance.baseData.Job,
                        hp = hero.ActorInfo.RealHp,
                        maxHp = hero.ActorInfo.RealMaxHp,
                        playerName = UIHelper.ServerStringTrim(hero.ActorInfo.PlayerName),
                        playerName = PlayerDatas.Instance.baseData.PlayerName,
                    });
                }
            }