242 lines
9.5 KiB
C#
242 lines
9.5 KiB
C#
// using Cal.DataTable;
|
|
// using System;
|
|
// using System.Collections.Generic;
|
|
//
|
|
// namespace ET
|
|
// {
|
|
// public class ManulEquipBattleAwakeSystem : AwakeSystem<ManulEquipBattle, Team>
|
|
// {
|
|
// public override void Awake(ManulEquipBattle self, Team team)
|
|
// {
|
|
// self.Awake(team);
|
|
// }
|
|
// }
|
|
// public class ManulEquipBattleUpdateSystem : UpdateSystem<ManulEquipBattle>
|
|
// {
|
|
// public override void Update(ManulEquipBattle self)
|
|
// {
|
|
// self.Update();
|
|
// }
|
|
// }
|
|
// public class ManulEquipBattleDestroySystem : DestroySystem<ManulEquipBattle>
|
|
// {
|
|
// public override void Destroy(ManulEquipBattle self)
|
|
// {
|
|
// self.team.ChangeState(TeamState.None);
|
|
// self.targetTeam.ChangeState(TeamState.None);
|
|
// self.team = null;
|
|
// foreach (Unit item in self.targetTeam.GetUnits())
|
|
// {
|
|
// item.GetMap().Leave(item);
|
|
//
|
|
// item.Dispose();
|
|
// }
|
|
// self.targetTeam.Dispose();
|
|
// self.targetTeam = null;
|
|
// self.config = null;
|
|
// self.mineKillInfo.Dispose();
|
|
// self.targetKillInfo.Dispose();
|
|
// }
|
|
// }
|
|
// public static class ManulEquipBattleSystem
|
|
// {
|
|
// private const int StartTime = 5 * 1000;
|
|
// //0.50f, 0.46f, 0.41f, 0.35f
|
|
// public readonly static float[] HpDifficultyArr = { 0, 0.50f, 0.96f, 1.37f, 1.72f };
|
|
// // 0.18f, 0.16f, 0.12f, 0.08f
|
|
// public readonly static float[] AtkDefDifficultyArr = { 0, 0.18f, 0.34f, 0.46f, 0.53f };
|
|
// public static void Awake(this ManulEquipBattle self, Team team)
|
|
// {
|
|
// self.team = team;
|
|
// self.mineKillInfo = new MonsterKillInfo(self, team);
|
|
// self.isRunning = false;
|
|
// self.quitBattleAction = OnQuitBattle;
|
|
// }
|
|
// public static void Init(this ManulEquipBattle self, ManulEquipMonsterConfig config)
|
|
// {
|
|
// self.config = config;
|
|
// self.ReadyBeforeBattle();
|
|
// self.startTime = TimeHelper.ClientNow();
|
|
// }
|
|
// public static void Update(this ManulEquipBattle self)
|
|
// {
|
|
// if (!self.isRunning) return;
|
|
// long now = TimeHelper.ClientNow();
|
|
// if (now - self.startTime < StartTime)
|
|
// return;
|
|
// if (now - self.startTime > ConstDefine.ManulEquipBattleTime)
|
|
// {
|
|
// Team anotherTeam = self.GetAnotherTeam(self.team);
|
|
// BattleHelper.OnTargetVictory(self, anotherTeam);
|
|
// return;
|
|
// }
|
|
// CheckCanStartSkill(self, now);
|
|
// }
|
|
//
|
|
// private static void CheckCanStartSkill(ManulEquipBattle self, long now)
|
|
// {
|
|
// foreach (Unit unit in self.team.GetUnits())
|
|
// {
|
|
// if (!unit.IsAlive) continue;
|
|
// if (unit.GetComponent<SkillAI>().CheckCD(now))
|
|
// {
|
|
// BattleHelper.PlayerSkill(unit, now);
|
|
// }
|
|
// }
|
|
// foreach (Unit unit in self.targetTeam.GetUnits())
|
|
// {
|
|
// if (!unit.IsAlive) continue;
|
|
// if (unit.GetComponent<SkillAI>().CheckCD(now))
|
|
// {
|
|
// BattleHelper.MonsterSkill(unit);
|
|
// }
|
|
// }
|
|
//
|
|
// }
|
|
//
|
|
// public static void ReadyBeforeBattle(this ManulEquipBattle self)
|
|
// {
|
|
// try
|
|
// {
|
|
// Team team = self.team;
|
|
// ManulEquipMonsterConfig config = self.config;
|
|
// if (config == null)
|
|
// {
|
|
// BattleMgrCompnent.Instance.RemoveBattle(self);
|
|
// return;
|
|
// }
|
|
// team.ChangeState(TeamState.Fight);
|
|
// LinkedList<Unit> teamList = team.GetUnits();
|
|
// MonsterFactoryHelper.ManulEquipGenerate(self, config);
|
|
//
|
|
// self.targetKillInfo = new MonsterKillInfo(self, self.targetTeam);
|
|
// //!+设置每个人的状态
|
|
// foreach (Unit u in teamList)
|
|
// {
|
|
// u.GetComponent<BattleComponent>().BattleType = BattleType.ManulEquip;
|
|
// }
|
|
// //!+设置目标/技能信息
|
|
// LinkedList<Unit> monsterTeamList = self.targetTeam.GetUnits();
|
|
// Game.EventSystem.Publish(new EventType.BattleStart { teamList = teamList, targetTeamList = monsterTeamList }).Coroutine();
|
|
// foreach (Unit item in monsterTeamList)
|
|
// {
|
|
// CharacterHelper.SyncNumeric(item);
|
|
// CharacterHelper.RecoverUnit(item);
|
|
// }
|
|
// BattleHelper.SetTargets(self, teamList, monsterTeamList);
|
|
// //!+保存主怪Id
|
|
// MainStoryMap.Instance.GetBattleInteractiveInfo(team.LeaderId).LeaderMonsterId = (int)config.Id;
|
|
// //!+创建怪物击破信息
|
|
// self.mineKillInfo.Init(self.targetTeam.MemberCount, OnVictory);
|
|
// self.targetKillInfo.Init(self.team.MemberCount, BattleHelper.OnTargetVictory);
|
|
//
|
|
//
|
|
// Log.Info($"\n{team.GetMemberName()}开始手工副本战斗,[{config.Id / 1000}][{config.Id % 1000 / 100}]*************");
|
|
//
|
|
//
|
|
// self.SendMonsterInfo();
|
|
// self.isRunning = true;
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// BattleMgrCompnent.Instance.RemoveBattle(self);
|
|
// Log.Error(e);
|
|
// }
|
|
// }
|
|
// private static void SendMonsterInfo(this ManulEquipBattle self)
|
|
// {
|
|
// M2C_SendManulEquipMonsterInfo sendInfo = new M2C_SendManulEquipMonsterInfo();
|
|
// foreach (Unit unitMonster in self.targetTeam.GetUnits())
|
|
// {
|
|
// MonsterUnitInfo info = new MonsterUnitInfo
|
|
// {
|
|
// MonsterId = unitMonster.GetComponent<MonsterInfo>().monsterId,
|
|
// Id = unitMonster.Id
|
|
// };
|
|
// sendInfo.UnitIdList.Add(info);
|
|
// }
|
|
// foreach (Unit u in self.team.GetUnits())
|
|
// {
|
|
// MessageHelper.SendActor(u, sendInfo);
|
|
// }
|
|
// }
|
|
// public static void ReSendMonsterInfo(this ManulEquipBattle self, Unit unit)
|
|
// {
|
|
// M2C_ReSendManulEquipMonsterInfo sendInfo = new M2C_ReSendManulEquipMonsterInfo();
|
|
// foreach (Unit unitMonster in self.targetTeam.GetUnits())
|
|
// {
|
|
// MonsterUnitInfo info = new MonsterUnitInfo
|
|
// {
|
|
// MonsterId = unitMonster.GetComponent<MonsterInfo>().monsterId,
|
|
// Id = unitMonster.Id
|
|
// };
|
|
// sendInfo.UnitIdList.Add(info);
|
|
// }
|
|
// MessageHelper.SendActor(unit, sendInfo);
|
|
//
|
|
// }
|
|
// public static void Victory(this ManulEquipBattle self,Unit unit)
|
|
// {
|
|
// Team team = TeamComponent.Instance.Get(unit.TeamLeaderId);
|
|
// OnVictory(self, team);
|
|
// }
|
|
//
|
|
// private static void OnVictory(BattleBase self, Team team)
|
|
// {
|
|
// try
|
|
// {
|
|
// if (self == null)
|
|
// {
|
|
// Log.Error($"battle == null");
|
|
// return;
|
|
// }
|
|
// if (!self.isRunning) return;
|
|
// Execute(self.As<ManulEquipBattle>(), team).Coroutine();
|
|
// static async ETVoid Execute(ManulEquipBattle self, Team team)
|
|
// {
|
|
// self.isRunning = false;
|
|
//
|
|
// LinkedList<Unit> teamList = team.GetUnits();
|
|
// Unit unit = MapUnitComponent.Instance.Get(team.LeaderId);
|
|
//
|
|
// Log.Info($"{team.GetMemberName()}手工副本胜利了!");
|
|
// //!触发通关任务事件
|
|
// await TimerComponent.Instance.WaitAsync(5500);
|
|
// foreach (Unit item in teamList)
|
|
// {
|
|
// MessageHelper.SendActor(item, new M2C_BattleVictory() { BattleType = (int)self.battleType });
|
|
// }
|
|
// ManulEquipMap.instance.SetLayer(unit.GetComponent<PlayerData>(), self.config.Id);
|
|
// await BattleHelper.VictoryOption(self, team);
|
|
//
|
|
// Team anotherTeam = self.GetAnotherTeam(team);
|
|
// BattleHelper.EnermyClearOption(self, anotherTeam);
|
|
// BattleMgrCompnent.Instance.RemoveBattle(self);
|
|
//
|
|
// }
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// Log.Error(e);
|
|
// BattleMgrCompnent.Instance.RemoveBattle(self);
|
|
// }
|
|
// }
|
|
// private static void OnQuitBattle(BattleBase self, Team team,long Id)
|
|
// {
|
|
// try
|
|
// {
|
|
// if (team.AddVote(Id))
|
|
// {
|
|
// Team anotherTeam = self.GetAnotherTeam(team);
|
|
// BattleHelper.OnTargetVictory(self, anotherTeam);
|
|
// }
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// Log.Error(e);
|
|
// BattleMgrCompnent.Instance.RemoveBattle(self);
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|