| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using System; |
| | | using LitJson; |
| | | using DG.Tweening; |
| | | |
| | | public class BattleField |
| | | { |
| | | public BattleObjMgr battleObjMgr; |
| | | |
| | | public BattleEffectMgr battleEffectMgr; |
| | | |
| | | public BattleTweenMgr battleTweenMgr; |
| | | |
| | | public RecordPlayer recordPlayer; |
| | | |
| | | public IOperationAgent operationAgent; |
| | | |
| | | public int round = 0; |
| | | |
| | | public string guid = string.Empty; |
| | | |
| | | public int MapID = 0; |
| | | |
| | | public int FuncLineID = 0; |
| | | |
| | | public JsonData extendData; |
| | | |
| | | public bool IsActive |
| | | { |
| | |
| | | |
| | | public Action<bool> OnBattlePause; |
| | | |
| | | public virtual void Init(TeamBase _redTeam, TeamBase _blueTeam) |
| | | protected List<TeamBase> redTeamList = null; |
| | | |
| | | protected List<TeamBase> blueTeamList = null; |
| | | |
| | | protected int redTeamIndex = 0; |
| | | |
| | | protected int blueTeamIndex = 0; |
| | | |
| | | public BattleField(string _guid) |
| | | { |
| | | guid = _guid; |
| | | } |
| | | |
| | | public virtual void Init(int _MapID, int _FuncLineID, JsonData _extendData, |
| | | List<TeamBase> _redTeamList, List<TeamBase> _blueTeamList) |
| | | { |
| | | MapID = _MapID; |
| | | redTeamList = _redTeamList; |
| | | blueTeamList = _blueTeamList; |
| | | FuncLineID = _FuncLineID; |
| | | extendData = _extendData; |
| | | |
| | | redTeamIndex = 0; |
| | | blueTeamIndex = 0; |
| | | |
| | | GameObject go = ResManager.Instance.LoadAsset<GameObject>("Battle/Prefabs", "BattleRootNode"); |
| | | GameObject battleRootNodeGO = GameObject.Instantiate(go); |
| | | battleRootNode = battleRootNodeGO.GetComponent<BattleRootNode>(); |
| | | battleRootNodeGO.name = this.GetType().Name; |
| | | |
| | | battleObjMgr = new BattleObjMgr(); |
| | | battleObjMgr.Init(this, _redTeam, _blueTeam); |
| | | battleObjMgr.Init(this, redTeamList[redTeamIndex], blueTeamList[blueTeamIndex]); |
| | | battleEffectMgr = new BattleEffectMgr(); |
| | | battleEffectMgr.Init(this); |
| | | battleTweenMgr = new BattleTweenMgr(); |
| | | battleTweenMgr.Init(this); |
| | | |
| | | // 这里的Init交给各个子类的Init里去实现 |
| | | // battleObjMgr.Init(this, _redTeam, _blueTeam); |
| | | |
| | | recordPlayer = new RecordPlayer(); |
| | | recordPlayer.Init(this); |
| | |
| | | { |
| | | battleObjMgr.ResumeGame(); |
| | | recordPlayer.ResumeGame(); |
| | | battleEffectMgr.ResumeGame(); |
| | | battleTweenMgr.ResumeGame(); |
| | | } |
| | | |
| | | protected virtual void PauseGame() |
| | |
| | | |
| | | battleObjMgr.PauseGame(); |
| | | recordPlayer.PauseGame(); |
| | | battleEffectMgr.PauseGame(); |
| | | battleTweenMgr.PauseGame(); |
| | | } |
| | | |
| | | public virtual void TurnFightState(int TurnNum, int State, |
| | | uint FuncLineID, JsonData extendData) |
| | | { |
| | | round = TurnNum; |
| | | } |
| | | |
| | | public virtual void OnTurnFightObjAction(int turnNum, int ObjID) |
| | | { |
| | | |
| | | } |
| | | |
| | | public virtual void OnTurnFightState(int turnNum, int State, int FuncLineID, JsonData extendData) |
| | | { |
| | | |
| | | } |
| | | |
| | | public void ObjInfoRefresh(H0418_tagObjInfoRefresh _refreshInfo) |
| | | { |
| | | BattleObject battleObj = battleObjMgr.GetBattleObject((int)_refreshInfo.ObjID); |
| | | |
| | | if (null != battleObj) |
| | | { |
| | | battleObj.OnObjInfoRefresh(_refreshInfo); |
| | | } |
| | | } |
| | | |
| | | public void ObjPropertyRefreshView(H0423_tagObjPropertyRefreshView vNetData) |
| | | { |
| | | |
| | | } |
| | | |
| | | public virtual void OnObjDead(int ObjID) |
| | | { |
| | | DeathRecordAction recordAction = new DeathRecordAction(this, battleObjMgr.GetBattleObject(ObjID)); |
| | | recordPlayer.PlayRecord(recordAction); |
| | | } |
| | | |
| | | public virtual void Destroy() |
| | | { |
| | | // 销毁全部内容 |
| | | } |
| | | |
| | | public void FinishBattleInAdvance(uint[] ObjIDArr) |
| | | { |
| | | // 让npc隐藏后 左边播放睡觉动作 |
| | | |
| | | |
| | | } |
| | | |
| | | public virtual void ProcessUseSkillAttack(H0604_tagUseSkillAttack vNetData) |
| | | { |
| | | // H0604_tagUseSkillAttack |
| | | // public uint ObjID; |
| | | // public byte ObjType; |
| | | // public byte BattleType; //物理/魔法 |
| | | // public ushort SkillID; |
| | | // public uint AttackID; //主攻击目标 |
| | | // public byte AttackObjType; //主攻击目标 |
| | | // public ushort HurtCount; //伤害数目 |
| | | // public tagSkillHurtObj[] HurtList; //size = HurtCount |
| | | |
| | | // ObjType类型的ObjID使用BattleType类技能SkillID攻击了AttackObjType类型的AttackID 伤害数字是HurtList |
| | | // SkillAction skillAction = new SkillAction(); |
| | | |
| | | } |
| | | |
| | | public RectTransform GetTeamNode(BattleCamp battleCamp) |
| | | { |
| | | if (battleCamp == BattleCamp.Red) |
| | | { |
| | | return battleRootNode.redTeamNode; |
| | | } |
| | | else |
| | | { |
| | | return battleRootNode.blueTeamNode; |
| | | } |
| | | } |
| | | |
| | | |
| | | public bool IsRoundReachLimit() |
| | | { |
| | | // return round > xxx; |