123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- using UnityGameFramework.Runtime;
- using GameFramework.Event;
- namespace X2Battle
- {
- /// <summary>
- /// 战斗管理
- /// </summary>
- public partial class X2BattleManager : Singleton<X2BattleManager>
- {
- /// <summary>
- /// 战斗上下文环境信息
- /// </summary>
- protected YLBattle.BattleParam mBattleParam = null;
- /// <summary>
- /// (技能)子弹管理器
- /// </summary>
- public BulletManager mBulletModel = new BulletManager();
- public YLBattle.BuffManager mBuffModel = new YLBattle.BuffManager();
- //public RoleManager mRoleManager;
- /// <summary>
- /// 返回上下文环境信息
- /// </summary>
- /// <returns>上下文环境信息</returns>
- public YLBattle.BattleParam Env()
- {
- return this.mBattleParam;
- }
- /// <summary>
- /// 开始一场战斗
- /// </summary>
- /// <param name="param">战斗参数</param>
- 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;
- }
- /// <summary>
- /// 帧调度
- /// </summary>
- /// <returns>调度结果</returns>
- 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<UI_ChangeEquipWindow>();
- 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<UI_ChangeEquipWindow>();
- equipWind.InitData(vo as UserEquipmentVo);
- }
- });
- }
- }
- }
- }
- }
|