Beispiel #1
0
 public void VerifyDead(CharacterEntity character, bool isPlayer)
 {
     if (character && character.isDead)
     {
         #region 超时强制从锁定列表移除
         if (_deadDic.ContainsKey(character.characterInfo.instanceID))
         {
             float deadTime = _deadDic[character.characterInfo.instanceID];
             if (Time.time - deadTime > FORCE_CLEAR_TIME)
             {
                 VirtualServerControllerUtil.RemoveFromDic(character.characterInfo.instanceID, beLcokedDic);
                 _deadDic.Remove(character.characterInfo.instanceID);
             }
         }
         else
         {
             _deadDic.Add(character.characterInfo.instanceID, Time.time);
         }
         #endregion
         ClearSkiller(character.characterInfo.instanceID, isPlayer);
         if (!VirtualServerControllerUtil.ExistInDic(character.characterInfo.instanceID, beLcokedDic))
         {
             DataMessageHandler.DataMessage_Dead(character.characterInfo.instanceID, isPlayer);
         }
     }
 }
Beispiel #2
0
        private void TickCD(bool isTick)
        {
            float time = Time.time;

            DataMessageHandler.DataMessage_TickCD(isTick);
            if (!isTick)
            {
                DataMessageHandler.DataMessage_LastTickTime(time);
            }
        }
Beispiel #3
0
 public void FightHangup()
 {
     if (_hanguped)
     {
         return;
     }
     _hanguped = true;
     TickCD(false);
     DataMessageHandler.DataMessage_FightHangup();
 }
Beispiel #4
0
        public void PlayEnemySkill(uint id, List <Dictionary <uint, List <KeyValuePair <uint, uint> > > > timelineList, uint skillId)
        {
            SkillData skillData = SkillData.GetSkillDataById(skillId);

            if (skillData.skillType == SkillType.Skill || skillData.skillType == SkillType.Aeon)
            {
                TickCD(false);
            }
            DataMessageHandler.DataMessage_PlayEnemySkill(id, timelineList, skillId);
        }
Beispiel #5
0
        private IEnumerator FinishLevelCoroutine()
        {
            while (true)
            {
                if (skillingDic.Count == 0 && beLcokedDic.Count == 0 && aeonSkillingDic.Count == 0)
                {
                    break;
                }
                yield return(null);
            }

            DataMessageHandler.DataMessage_TickCD(false);
            ClearData();
            ResetSkillOrder();
            #region imitate
#if UNITY_EDITOR
            if (Fight.Controller.FightController.imitate)
            {
                if (++_imitateWave <= Fight.Controller.FightController.instance.enemyWave)
                {
                    //DataMessageHandler.DataMessage_PlayNextFightEffect();
                    //yield return new WaitForSeconds(2f);
                    //if (Fight.Model.FightProxy.instance.hasBoss)
                    //    DataMessageHandler.DataMessage_PlayBossAppearEffect();
                    NextLevel();
                }
                else
                {
                    //yield return new WaitForSeconds(2f);
                    PlayerVictory();
                }
            }
            else
            {
#endif
            #endregion
            if (Fight.Model.FightProxy.instance.HasNextEnemies())
            {
                Fight.Model.FightProxy.instance.Next();
                //yield return new WaitForSeconds(2f);
                if (Fight.Model.FightProxy.instance.hasBoss)
                {
                    DataMessageHandler.DataMessage_PlayBossAppearEffect();
                }
                NextLevel();
            }
            else
            {
                //yield return new WaitForSeconds(2f);
                PlayerVictory();
            }
#if UNITY_EDITOR
        }
#endif
        }
Beispiel #6
0
        public void ResetSkillOrder(CharacterEntity character, uint skillId, bool isPlayer)
        {
            string key = StringUtil.ConcatNumber(character.characterInfo.instanceID, skillId);

            skillWaitingDic.TryDelete(key);
            character.ResetSkillOrder(skillId);
            if (isPlayer)
            {
                DataMessageHandler.DataMessage_ResetSkillOrder(character.characterInfo.instanceID, skillId);
            }
        }
Beispiel #7
0
        public void FinishRun(CharacterType type)
        {
            switch (type)
            {
            case CharacterType.Player:
                _isPlayerInPlace = true;
                DataMessageHandler.DataMessage_EndRun(type);
                if (Fight.Model.FightProxy.instance.CurrentTeamIndex > 0)
                {
                    InitEnemy();
                }
                break;

            case CharacterType.Enemy:
                //if (Fight.Model.FightProxy.instance.CurrentTeamIndex == 0)
                //    DataMessageHandler.DataMessage_PlayFightStartEffect();
                _isEnemyInPlace = true;
                break;
            }
            if (canFight)
            {
                switch (Fight.Controller.FightController.instance.fightType)
                {
                case FightType.PVE:
                case FightType.Arena:
                case FightType.DailyPVE:
                case FightType.Expedition:
                case FightType.WorldTree:
                case FightType.WorldBoss:
                case FightType.SkillDisplay:
                case FightType.PVP:
                case FightType.FriendFight:
                case FightType.MineFight:
#if UNITY_EDITOR
                case FightType.Imitate:
#endif
                    if (Fight.Model.FightProxy.instance.CurrentTeamIndex == 0)
                    {
                        DataMessageHandler.DataMessage_PlayFightStartEffect();
                    }
                    break;

                case FightType.FirstFight:
                    break;

                case FightType.ConsortiaFight:
                    //ConsortiaFightController.instance.CLIENT2LOBBY_FIGHT_START_REQ(Fight.Model.FightProxy.instance.fightId);
                    break;
                }
                StartFight();
            }
        }
Beispiel #8
0
        public void ReadyFight()
        {
            #region imitate
#if UNITY_EDITOR
            if (Fight.Controller.FightController.imitate)
            {
                _imitateWave = 1;
            }
#endif
            #endregion
            ClearData();
            VirtualServerController.instance.runnig = true;
            _initPlayer = false;
            _initEnemy  = false;
            victory     = false;
            DataMessageHandler.DataMessage_ReadyScene();
            _orderCount = 0;
        }
Beispiel #9
0
 private void OrderConsortiaSkill()
 {
     if (skillWaitingOrders.Count > 0)
     {
         KeyValuePair <uint, uint> kvp = skillWaitingOrders.Dequeue();
         _orderCount++;
         if (!DataMessageHandler.DataMessage_OrderConsortiaSkill(kvp.Key, kvp.Value))
         {
             OrderSkill(kvp.Key, kvp.Value, false);
         }
         Debugger.LogError("order skill:{0} {1} ", kvp.Key, kvp.Value);
         //if (skillWaitingOrders.Count > 0)
         //{
         //    MechanicsType mt = Skill.SkillUtil.GetSkillMechanicsType(kvp.Value);
         //    if (mt != MechanicsType.None)
         //    {
         //        List<KeyValuePair<uint, uint>> list = new List<KeyValuePair<uint, uint>>();
         //        for (int i = 0, count = skillWaitingOrders.Count; i < count; i++)
         //        {
         //            KeyValuePair<uint, uint> k = skillWaitingOrders[i];
         //            SkillData skillData = SkillData.GetSkillDataById(k.Value);
         //            if (skillData == null) continue;
         //            switch (mt)
         //            {
         //                case MechanicsType.Float:
         //                    if (Logic.Skill.SkillUtil.AttackableFloat(skillData))
         //                        list.Add(k);
         //                    break;
         //                case MechanicsType.Tumble:
         //                    if (Logic.Skill.SkillUtil.AttackableTumble(skillData))
         //                        list.Add(k);
         //                    break;
         //            }
         //        }
         //    }
         //}
     }
 }
Beispiel #10
0
 public void InitOK(CharacterType characterType)
 {
     if (characterType == CharacterType.Player)
     {
         _initPlayer = true;
     }
     else if (characterType == CharacterType.Enemy)
     {
         _initEnemy = true;
     }
     if (FightController.instance.fightType == FightType.SkillDisplay)
     {
         playerReady = _initPlayer;
         enemyReady  = _initEnemy;
         if (canFight)
         {
             StartFight();
         }
     }
     else
     {
         DataMessageHandler.DataMessage_Run(characterType);
     }
 }
Beispiel #11
0
        private void StartFight()
        {
            _interlude = false;
            _hangup    = false;
            List <HeroEntity>  heroList  = PlayerController.instance.heros;
            List <EnemyEntity> enemyList = EnemyController.instance.enemies;

            switch (Fight.Controller.FightController.instance.fightType)
            {
            case FightType.PVE:
            case FightType.Arena:
            case FightType.DailyPVE:
            case FightType.Expedition:
            case FightType.WorldTree:
            case FightType.WorldBoss:
            case FightType.PVP:
            case FightType.FriendFight:
            case FightType.MineFight:
#if UNITY_EDITOR
            case FightType.Imitate:
#endif
                SortHitSkill(heroList, enemyList);
                _enemyAutoOrder = true;
                DataMessageHandler.DataMessage_TickCD(true);
                break;

            case FightType.ConsortiaFight:
#if UNITY_EDITOR
                orderSkills.Clear();
                finishSkills.Clear();
#endif
                _enemyAutoOrder = false;
                DataMessageHandler.DataMessage_TickCD(true);
                //StopCoroutine("PVPResultCoroutine");
                OrderConsortiaSkill();
                break;

            case FightType.FirstFight:
            case FightType.SkillDisplay:
                _enemyAutoOrder = false;
                break;
            }
            DataMessageHandler.DataMessage_StartFight();
            HeroEntity hero = null;
            for (int i = 0, count = heroList.Count; i < count; i++)
            {
                hero = heroList[i];
                if (Fight.Model.FightProxy.instance.CurrentTeamIndex == 0)
                {
                    if (Fight.Controller.FightController.instance.fightType == FightType.FirstFight)
                    {
                        FirstFightCharacterData ffcd = MockFightController.instance.GetCharacterDataById((int)hero.characterInfo.instanceID);
                        hero.skill1CD = ffcd.cd1;
                        hero.skill2CD = ffcd.cd2;
                    }
                    else
                    {
                        hero.skill1CD = 0;
                        hero.skill2CD = 0;
                    }
                }
                hero.SetOrderable();
                //Debugger.Log("hero {0},hp {1} ", hero.characterInfo.instanceID, hero.HP);
            }

            EnemyEntity enemy = null;
            for (int i = 0, count = enemyList.Count; i < count; i++)
            {
                enemy          = enemyList[i];
                enemy.skill1CD = 0;
                enemy.skill2CD = 0;
                switch (Fight.Controller.FightController.instance.fightType)
                {
                case FightType.PVE:
                case FightType.DailyPVE:
                case FightType.WorldTree:
                    try
                    {
                        if (Fight.Model.FightProxy.instance.CurrentTeamIndex > 0)
                        {
                            Logic.Team.Model.TeamData teamData = Logic.Fight.Model.FightProxy.instance.GetCurrentTeamData();
                            if (enemy.characterInfo.skillId1 > 0)
                            {
                                enemy.skill1CD = teamData.cdReduceRate * enemy.characterInfo.skillInfo1.skillData.CD;
                            }
                            else
                            {
                                enemy.skill1CD = 0;
                            }
                            if (enemy.characterInfo.skillId2 > 0)
                            {
                                enemy.skill2CD = teamData.cdReduceRate * enemy.characterInfo.skillInfo2.skillData.CD;
                            }
                            else
                            {
                                enemy.skill2CD = 0;
                            }
                        }
                        else
                        {
                            enemy.skill1CD = 0;
                            enemy.skill2CD = 0;
                        }
                    }
                    catch (System.Exception e)
                    {
                        Debugger.Log("set cd fail:" + e.StackTrace);
                        enemy.skill1CD = 0;
                        enemy.skill2CD = 0;
                    }
                    break;

                case FightType.FirstFight:
                    FirstFightCharacterData ffcd = MockFightController.instance.GetCharacterDataById((int)enemy.characterInfo.instanceID);
                    enemy.skill1CD = ffcd.cd1;
                    enemy.skill2CD = ffcd.cd2;
                    break;
                }
                //if (Fight.Controller.FightController.instance.fightType == FightType.FirstFight)
                //{
                //    FirstFightCharacterData ffcd = MockFightController.instance.GetCharacterDataById((int)enemy.characterInfo.instanceID);
                //    enemy.skill1CD = ffcd.cd1;
                //    enemy.skill2CD = ffcd.cd2;
                //}
                //else
                //{
                //    enemy.skill1CD = 0;
                //    enemy.skill2CD = 0;
                //}
                enemy.SetOrderable();
                //Debugger.Log("enemy {0},hp {1} ", enemy.characterInfo.instanceID, enemy.HP);
            }
        }
Beispiel #12
0
 private void InitEnemy()
 {
     _isEnemyInPlace = false;
     DataMessageHandler.DataMessage_InitEnemys();
 }
Beispiel #13
0
 private void InitPlayer()
 {
     _isPlayerInPlace = false;
     DataMessageHandler.DataMessage_InitPlayers();
 }
Beispiel #14
0
 private void RunWithoutMove()
 {
     DataMessageHandler.DataMessage_RunWithoutMove();
 }
Beispiel #15
0
 public void FinishedMechanicsed(uint characterId, bool isPlayer)
 {
     DataMessageHandler.DataMessage_FinishedMechanicsed(characterId, isPlayer);
 }
Beispiel #16
0
        public void FinishSkill(uint skillId, uint characterId, bool isPlayer)
        {
            //Debugger.LogError("finish skillID:" + skillId.ToString());
#if UNITY_EDITOR
            finishSkills.Add(skillId);
#endif
            if (aeonSkillingDic.ContainsKey(skillId))//超级技能
            {
                aeonSkillingDic.Remove(skillId);
                TickCD(true);
            }
            string key = StringUtil.ConcatNumber(characterId, skillId);
            beLcokedDic.TryDelete(key);
            skillWaitFinishDic.TryDelete(key);
            skillingDic.TryDelete(key);


            CharacterEntity character = null;
            //检测自己是否死亡
            if (isPlayer)
            {
                character = PlayerController.instance[characterId];
            }
            else
            {
                character = EnemyController.instance[characterId];
            }
            if (character && character.isDead)
            {
                VerifyDead(character, isPlayer);
            }

            bool needTick = true;
            if (aeonSkillingDic.Count > 0)
            {
                needTick = false;
            }
            else
            {
                string[] keys = skillingDic.GetKeyArray();
                for (int i = 0, count = keys.Length; i < count; i++)
                {
                    KeyValuePair <uint, uint> kvp = keys[i].SplitToKeyValuePair <uint, uint>();
                    SkillData skillData           = SkillData.GetSkillDataById(kvp.Value);
                    if (skillData.skillType == SkillType.Skill)
                    {
                        needTick &= false;
                    }
                }
            }
            if (needTick && !_hanguped)
            {
                TickCD(true);
            }
            switch (FightController.instance.fightType)
            {
            case FightType.PVE:
            case FightType.Arena:
            case FightType.DailyPVE:
            case FightType.Expedition:
            case FightType.WorldTree:
            case FightType.WorldBoss:
            case FightType.FirstFight:
            case FightType.SkillDisplay:
            case FightType.PVP:
            case FightType.FriendFight:
            case FightType.MineFight:
                break;

            case FightType.ConsortiaFight:
                List <int> deadHeroList = Fight.Model.FightProxy.instance.GetConsortiaDeadHeroList((int)characterId, (int)skillId);
                if (deadHeroList != null && deadHeroList.Count > 0)
                {
                    for (int i = 0, count = deadHeroList.Count; i < count; i++)
                    {
                        CharacterEntity c = CharacterUtil.FindTarget((uint)deadHeroList[i]);
                        if (c != null && !c.isDead)
                        {
                            DataMessageHandler.DataMessage_Dead(c.characterInfo.instanceID, c.isPlayer);
                        }
                    }
                }
                OrderConsortiaSkill();
                Fight.Model.FightProxy.instance.RemoveConsortiaFightData((int)characterId, (int)skillId);
                break;
            }
            //VirtualServerController.instance.PlaySkillCalc();
        }
Beispiel #17
0
 public void ForceFinishSkill(uint characterId, uint skillId, bool isPlayer)
 {
     DataMessageHandler.DataMessage_ForceFinishedSkill(characterId, skillId, isPlayer);
 }
Beispiel #18
0
 public void PlayerFail(FightOverType fightOverType = FightOverType.Normal)
 {
     VirtualServerController.instance.runnig = false;
     DataMessageHandler.DataMessage_FightResult(false, fightOverType);
 }
Beispiel #19
0
 private void ResetSkillOrder()
 {
     DataMessageHandler.DataMessage_ResetSkillOrder();
 }
Beispiel #20
0
 public void PlayBootSkill(uint characterId, uint skillId, bool isPlayer)
 {
     DataMessageHandler.DataMessage_PlayBootSkill(characterId, skillId, isPlayer);
 }
Beispiel #21
0
 public void OrderComboSkill(uint id, uint skillId, bool isPlayer)
 {
     DataMessageHandler.OrderComboSkill(id, skillId, isPlayer);
 }