|  | @@ -4,6 +4,7 @@ using CombatLibrary.CombatLibrary.CombatCore;
 | 
	
		
			
				|  |  |  using Common.Utility.CombatEvent;
 | 
	
		
			
				|  |  |  using Common.Utility.CombatTimer;
 | 
	
		
			
				|  |  |  using Core.Audio;
 | 
	
		
			
				|  |  | +using Core.Utility;
 | 
	
		
			
				|  |  |  using Excel2Json;
 | 
	
		
			
				|  |  |  using Fort23.Core;
 | 
	
		
			
				|  |  |  using Fort23.Mono;
 | 
	
	
		
			
				|  | @@ -21,114 +22,134 @@ namespace GameLogic.Combat.CombatType
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  |      public class LevelBattleCombatType : CombatTypeBasic
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  | -       
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        // protected override void ProHeroDie(CombatHeroEntity combatHeroEntity, HarmReturnInfo harmReturnInfo)
 | 
	
		
			
				|  |  | -        // {
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        // }
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        // private void PlayBgm()
 | 
	
		
			
				|  |  | -        // {
 | 
	
		
			
				|  |  | -        //     AudioManager.Instance.PlayBGM("combatBattle.wav");
 | 
	
		
			
				|  |  | -        // }
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        // private void ResurrectionFinish()
 | 
	
		
			
				|  |  | -        // {
 | 
	
		
			
				|  |  | -        //   
 | 
	
		
			
				|  |  | -        // }
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        // protected override async CTask ProStartGame()
 | 
	
		
			
				|  |  | -        // {
 | 
	
		
			
				|  |  | -        //     CTaskAwaitBuffer cTaskAwaitBuffer = new CTaskAwaitBuffer();
 | 
	
		
			
				|  |  | -        //     // TestCombat(cTaskAwaitBuffer);
 | 
	
		
			
				|  |  | -        //     InitPlayerHero(cTaskAwaitBuffer);
 | 
	
		
			
				|  |  | -        //     InitTestCombatBoChi();
 | 
	
		
			
				|  |  | -        //     CreateEnemy(cTaskAwaitBuffer);
 | 
	
		
			
				|  |  | -        //     await cTaskAwaitBuffer.WaitAll();
 | 
	
		
			
				|  |  | -        //     CombatController.currActiveCombat.CombatHeroController.SetFollowTarget();
 | 
	
		
			
				|  |  | -        // }
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        // public void StartBossCombat()
 | 
	
		
			
				|  |  | -        // {
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        // }
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        // public void StartBossBattle()
 | 
	
		
			
				|  |  | -        // {
 | 
	
		
			
				|  |  | -        //     CombatController.currActiveCombat.isStopAi = false;
 | 
	
		
			
				|  |  | -        // }
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        // protected void InitTestCombatBoChi()
 | 
	
		
			
				|  |  | -        // {
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        // }
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        // private void CreateEnemy(CTaskAwaitBuffer cTaskAwaitBuffer)
 | 
	
		
			
				|  |  | -        // {
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        // }
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        // private void CreateEnemy(CTaskAwaitBuffer cTaskAwaitBuffer, int monsterId, int level, int star, int index,
 | 
	
		
			
				|  |  | -        //     Vector3 pos,
 | 
	
		
			
				|  |  | -        //     System.Action<CombatHeroEntity> callBack = null)
 | 
	
		
			
				|  |  | -        // {
 | 
	
		
			
				|  |  | -        //     CombatHeroEntity heroEntity = CObjectPool.Instance.Fetch<CombatHeroEntity>();
 | 
	
		
			
				|  |  | -        //     heroEntity.IsEnemy = true;
 | 
	
		
			
				|  |  | -        //     CombatHeroInfo combatHeroInfo = new CombatHeroInfo();
 | 
	
		
			
				|  |  | -        //     combatHeroInfo.InitMonster(monsterId, level, star);
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        //     cTaskAwaitBuffer.AddTask(heroEntity.Init(new CombatAIBasic(), combatHeroInfo, pos,
 | 
	
		
			
				|  |  | -        //         delegate(CombatHeroEntity entity)
 | 
	
		
			
				|  |  | -        //         {
 | 
	
		
			
				|  |  | -        //             combatController.CombatHeroController.AddHero(entity);
 | 
	
		
			
				|  |  | -        //             callBack?.Invoke(entity);
 | 
	
		
			
				|  |  | -        //         }));
 | 
	
		
			
				|  |  | -        // }
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        // protected override void ProUpdate(float t)
 | 
	
		
			
				|  |  | -        // {
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        // }
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        // private void InitPlayerHero(CTaskAwaitBuffer cTaskAwaitBuffer)
 | 
	
		
			
				|  |  | -        // {
 | 
	
		
			
				|  |  | -        //     // int i = 0;
 | 
	
		
			
				|  |  | -        //     // foreach (KeyValuePair<int, HeroInfo> keyValuePair in PlayerManager.Instance.heroController.heroDicInLead)
 | 
	
		
			
				|  |  | -        //     // {
 | 
	
		
			
				|  |  | -        //     //     int index = i;
 | 
	
		
			
				|  |  | -        //     //     CombatHeroEntity heroEntity = CObjectPool.Instance.Fetch<CombatHeroEntity>();
 | 
	
		
			
				|  |  | -        //     //     heroEntity.IsEnemy = false;
 | 
	
		
			
				|  |  | -        //     //     heroEntity.number = i;
 | 
	
		
			
				|  |  | -        //     //     Vector3 pos = _combatScenesConfig.heroPoint[index].position;
 | 
	
		
			
				|  |  | -        //     //     cTaskAwaitBuffer.AddTask(heroEntity.Init(new CombatAIBasic(), keyValuePair.Value, pos,
 | 
	
		
			
				|  |  | -        //     //         delegate(CombatHeroEntity entity) { combatController.CombatHeroController.AddHero(entity); }));
 | 
	
		
			
				|  |  | -        //     //
 | 
	
		
			
				|  |  | -        //     //     i++;
 | 
	
		
			
				|  |  | -        //     // }
 | 
	
		
			
				|  |  | -        //     //
 | 
	
		
			
				|  |  | -        //     // Vector3 p = _combatScenesConfig.heroPoint[0].position;
 | 
	
		
			
				|  |  | -        //     // combatController.CombatCameraControllder.root.position = new Vector3(p.x,
 | 
	
		
			
				|  |  | -        //     //     combatController.CombatCameraControllder.root.position.y, p.z + 13);
 | 
	
		
			
				|  |  | -        // }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -       
 | 
	
		
			
				|  |  | +        private float _currTime;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        private int _currBoChi;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        protected Vector3[] enemyHeroPosOff =
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            new Vector3(0, 0, 0),
 | 
	
		
			
				|  |  | +            new Vector3(2, 0, -2),
 | 
	
		
			
				|  |  | +            new Vector3(-2, 0, -2)
 | 
	
		
			
				|  |  | +        };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        protected override void ProInit()
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        protected override void ProHeroDie(CombatHeroEntity combatHeroEntity, HarmReturnInfo harmReturnInfo)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            CombatHeroEntity[] allHero = combatController.CombatHeroController.GetHero(true);
 | 
	
		
			
				|  |  | +            if (allHero==null||allHero.Length <= 0)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                //胜利
 | 
	
		
			
				|  |  | +                CombatController.currActiveCombat.GameOver(true);
 | 
	
		
			
				|  |  | +                return;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            allHero = combatController.CombatHeroController.GetHero(false);
 | 
	
		
			
				|  |  | +            if (allHero==null||allHero.Length <= 0)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                //失败
 | 
	
		
			
				|  |  | +                CombatController.currActiveCombat.GameOver(false);
 | 
	
		
			
				|  |  | +                return;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        protected override async CTask ProStartGame()
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            CTaskAwaitBuffer cTaskAwaitBuffer = new CTaskAwaitBuffer();
 | 
	
		
			
				|  |  | +            TestCombat(cTaskAwaitBuffer);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            await cTaskAwaitBuffer.WaitAll();
 | 
	
		
			
				|  |  | +            CombatController.currActiveCombat.CombatHeroController.SetFollowTarget();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        public async CTask LoadCombat(int levelBattleId, System.Action<bool> caombatFinish)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            LevelbattleConfig levelbattleConfig = ConfigComponent.Instance.Get<LevelbattleConfig>(levelBattleId);
 | 
	
		
			
				|  |  | +            CTaskAwaitBuffer cTaskAwaitBuffer = new CTaskAwaitBuffer();
 | 
	
		
			
				|  |  | +            for (int i = 0; i < levelbattleConfig.Group.Length; i++)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                int group = levelbattleConfig.Group[i];
 | 
	
		
			
				|  |  | +                GroupConfig groupConfig = ConfigComponent.Instance.Get<GroupConfig>(group);
 | 
	
		
			
				|  |  | +                int[] monster = groupConfig.GroupMonster;
 | 
	
		
			
				|  |  | +                int level = groupConfig.GroupMonsterLevel;
 | 
	
		
			
				|  |  | +                if (level < 0)
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    level = PlayerManager.Instance.myHero.level.Value;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                for (int j = 0; j < monster.Length; j++)
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    HeroInfo heroInfo = new HeroInfo();
 | 
	
		
			
				|  |  | +                    heroInfo.InitMonster(monster[j],level);
 | 
	
		
			
				|  |  | +                    CreateEnemy(cTaskAwaitBuffer, heroInfo, j);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            await cTaskAwaitBuffer.WaitAll();
 | 
	
		
			
				|  |  | +            cTaskAwaitBuffer.Dispose();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        public void CreateEnemy(CTaskAwaitBuffer cTaskAwaitBuffer, HeroInfo heroInfo, int index)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            // return;
 | 
	
		
			
				|  |  | +            _currBoChi += 1;
 | 
	
		
			
				|  |  | +            float d = CombatController.currActiveCombat.CombatSenceController.currTime + 0.4f;
 | 
	
		
			
				|  |  | +            Vector3 startPos =
 | 
	
		
			
				|  |  | +                CombatController.currActiveCombat.CombatSenceController.GetTarget(d) + new Vector3(0, 1, 0);
 | 
	
		
			
				|  |  | +            Vector3 startPos2 =
 | 
	
		
			
				|  |  | +                CombatController.currActiveCombat.CombatSenceController.GetTarget(d + 0.01f) + new Vector3(0, 1, 0);
 | 
	
		
			
				|  |  | +            Vector3 dir = startPos2 - startPos;
 | 
	
		
			
				|  |  | +            Quaternion quaternion = Quaternion.LookRotation(dir);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            CombatHeroEntity heroEntity = new CombatHeroEntity();
 | 
	
		
			
				|  |  | +            heroEntity.IsEnemy = true;
 | 
	
		
			
				|  |  | +            Vector3 pos = startPos + quaternion * enemyHeroPosOff[index];
 | 
	
		
			
				|  |  | +            cTaskAwaitBuffer.AddTask(heroEntity.Init(new CombatHeroAi(), heroInfo, pos,
 | 
	
		
			
				|  |  | +                delegate(CombatHeroEntity entity) { combatController.CombatHeroController.AddHero(entity); }));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        protected override void ProUpdate(float t)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            if (!isActiveCombat)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                return;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        private void TestCombat(CTaskAwaitBuffer cTaskAwaitBuffer)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            Vector3 heroPoint = CombatController.currActiveCombat.CombatSenceController.GetTarget(0);
 | 
	
		
			
				|  |  | +            CombatController.currActiveCombat.MagicWeaponCombatSence.SetMagicWeaponCombatSence(heroPoint,
 | 
	
		
			
				|  |  | +                Vector3.forward);
 | 
	
		
			
				|  |  | +            TestCombatHeroConfig testCombatHeroConfig = GameObject.FindObjectOfType<TestCombatHeroConfig>();
 | 
	
		
			
				|  |  | +            if (testCombatHeroConfig != null)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                TestCombatHeroConfig.TestHeroInfoConfig testHeroInfoConfig = testCombatHeroConfig.myHeroInfo[0];
 | 
	
		
			
				|  |  | +                PlayerManager.Instance.AddTestHeroInfo(testHeroInfoConfig.heroID, testHeroInfoConfig.level,
 | 
	
		
			
				|  |  | +                    testHeroInfoConfig.skill, testHeroInfoConfig.magicWeaponId);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                CombatHeroEntity heroEntity = new CombatHeroEntity();
 | 
	
		
			
				|  |  | +                CombatController.currActiveCombat.CombatHeroController.playerHeroEntity = heroEntity;
 | 
	
		
			
				|  |  | +                heroEntity.IsEnemy = false;
 | 
	
		
			
				|  |  | +                heroEntity.number = 0;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                Vector3 pos = heroPoint;
 | 
	
		
			
				|  |  | +                cTaskAwaitBuffer.AddTask(heroEntity.Init(new CombatHeroAi(), PlayerManager.Instance.myHero, pos,
 | 
	
		
			
				|  |  | +                    delegate(CombatHeroEntity entity)
 | 
	
		
			
				|  |  | +                    {
 | 
	
		
			
				|  |  | +                        entity.CurrCombatHeroInfo.hp = (EncryptionLong)(20000);
 | 
	
		
			
				|  |  | +                        entity.MaxCombatHeroInfo.hp = (EncryptionLong)(20000);
 | 
	
		
			
				|  |  | +                        combatController.CombatHeroController.AddHero(entity);
 | 
	
		
			
				|  |  | +                    }, isPlayer: true));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 |