using UnityEngine; using System.Collections; using System.Collections.Generic; using UnityGameFramework.Runtime; using GameFramework.Event; namespace X2Battle { /// /// 战斗管理 /// public partial class X2BattleManager : Singleton { /// /// 战斗上下文环境信息 /// protected YLBattle.BattleParam mBattleParam = null; /// /// (技能)子弹管理器 /// public BulletManager mBulletModel = new BulletManager(); public YLBattle.BuffManager mBuffModel = new YLBattle.BuffManager(); //public RoleManager mRoleManager; /// /// 返回上下文环境信息 /// /// 上下文环境信息 public YLBattle.BattleParam Env() { return this.mBattleParam; } /// /// 开始一场战斗 /// /// 战斗参数 public void BattleStart(YLBattle.BattleParam param) { ///战场模块数据间的交互 this.mBattleParam = param; this.mBattleParam.mBulletManagerOpr = mBulletModel; ///交互模块的初始化 this.mBulletModel.Initialize(this.mBattleParam); ///buff模块的初始化 this.mBuffModel.Initialize(this.mBattleParam); this.mBattleParam.TimeCenter().Start(); //this.mRoleManager = RoleManager.Instance; } /// /// 帧调度 /// /// 调度结果 public void Update() { //TimeControl.Instance.GameNormal /// 计时器调度 //this.mBattleParam.TimeCenter().Update(); /// 时间 //long now = this.Env().TimeCenter().Now(); //RoleManager.Instance.OnUpdateRoles(); /// buff调度 this.mBuffModel.OnUpdateBuffs(0); /// 技能调度 this.mBulletModel.OnUpdateBullet(0); } static public void EquipWeapOrYanling(object sender, GameEventArgs e) { User_AddItemEvent itemEvent = e as User_AddItemEvent; ItemVo vo = itemEvent.Item; int heroId = int.Parse(UserProxy.Instance.player.heroTeamConfig.CurTeam.CurTeamLeaderUID); int heroTypeId =int.Parse( UserProxy.Instance.player.collectHero.GetHeroGameInfoByHeroUId(heroId.ToString()).typeId); int heroLevel = UserProxy.Instance.player.collectHero.GetHeroGameInfoByHeroUId(heroId.ToString()).level; if (vo.nMo.subType == (int)EItemSubType.YanLing) { if (ItemProxy.Instance.TestWearYanlingToHeroCanImproveFightPower(int.Parse(vo.uid), heroId) && vo.nMo.GetYanlingExt().require_herolvl <= heroLevel && vo.nMo.GetYanlingExt().CanbeUsedForHero(heroTypeId))////按刘海的需求,这里让王刚找到方法.检测该言灵是否可以让该英雄用 { if(GameDateManager.Instance.lastBattleType == BattleDefine.EBattleSceneType.EBattleType_Safe) { return; } PanelHelper.Instance.ShowPanel("UI_ChangeEquipWindow", (GameObject panel) => { if (panel) { UI_ChangeEquipWindow equipWind = panel.GetComponent(); equipWind.InitData(vo as UserYanlingVo); } }); } } else if (vo.nMo.subType == (int)EItemSubType.Weapon) { if (ItemProxy.Instance.TestWearEquipToHeroCanImproveFightPower(int.Parse(vo.uid), heroId) && vo.nMo.GetWeaponExt().require_herolvl <= heroLevel && vo.nMo.GetWeaponExt().CanbeEquipedOnHero(heroTypeId))////按刘海的需求,这里让王刚加了一个方法.检测该武器是否可以让该英雄用 { if (GameDateManager.Instance.lastBattleType == BattleDefine.EBattleSceneType.EBattleType_Safe) { return; } PanelHelper.Instance.ShowPanel("UI_ChangeEquipWindow", (GameObject panel) => { if (panel) { UI_ChangeEquipWindow equipWind = panel.GetComponent(); equipWind.InitData(vo as UserEquipmentVo); } }); } } } } }