using UnityEngine; using System.Collections; using System.Collections.Generic; using System; namespace YLBattle { /// /// /// public class ShowAdapter : IShowAdapter { #region(战斗) /// /// 初始化 /// /// 数据交互接口 /// 背景图名称 public void Initialize(IBattleGlobalOper op, string scene, string bg, int mode) { FightingManager.Instance.SetLevelInfo(op, scene, bg, mode); } /// /// 战斗准备开始 /// /// 当前波次 /// 总波次 /// 关卡难度 /// 关卡名称 public void SetFightingLevelInfo(int _gateID, int _status, int total, int dif, string _gateName, int _buybuffgold, int _levelmode) { FightingManager.Instance.SetFightingLevelInfo(_gateID, _status, total, dif, _gateName, _buybuffgold, _levelmode); } /// /// 设置PVP信息 /// /// /// public void SetPVPLevelInfo(int _gateID, string pvpPlayerID, string pvpType) { FightingManager.Instance.SetPVPLevelInfo(_gateID, pvpPlayerID, pvpType); } /// /// 锁定地图状态 /// /// public void SetMapLock(bool _bol) { FightingManager.Instance.SetMapLock(_bol); } /// /// 设置地图平板的状态 /// /// 当前波次进度值 public void SetMapPlatState(int _status, string _aniName = "") { FightingManager.Instance.SetMapPlatState(_status, _aniName); } /// /// 转盘是否处于准备状态 /// /// public bool CheckMapPlatState(EMapState state) { return FightingManager.Instance.CheckMapState(state); } /// /// 战斗开始 /// /// 当前关卡进度值,到哪个场景了 public void BattleStart(int status) { FightingManager.Instance.FightingStart(status); } /// /// 战斗计时刷新 /// /// 剩余毫秒数 public void BattleTime(long _leftMil) { FightingManager.Instance.BattleTime(_leftMil); } /// /// 设置是否开启必杀状态 /// /// public void SetCriticalState(bool _bol) { FightingManager.Instance.SetCriticalState(_bol); } /// /// 暂停本场战斗 /// public void BattlePause() { } /// /// 暂停后,继续本场战斗 /// public void BattleContinue() { } /// /// 战斗完成,显示确认离场,开始下一个场景 /// public void BattleLeave() { FightingManager.Instance.BattleLeave(); } /// /// BOSS警示 /// /// public void BattleBossWarning(string who) { FightingManager.Instance.BattleBossWarning(who); } /// /// 必杀警示 /// /// public void BattleCriticalWarning() { FightingManager.Instance.BattleCriticalWarning(); } /// /// 技能警示 /// /// public void BattleSkillWarning(string who, string skillid) { FightingManager.Instance.BattleSkillTip(who, skillid); } /// /// 战斗失败 /// /// 本次战斗关卡id /// 伤害统计 public void BattleFailed(int levelid) { FightingManager.Instance.BattleFailed(levelid); LogHelper.Log("------战斗结束:失败-----"); } /// /// 战斗胜利 /// /// 战斗结果信息 public void BattleVictory(IBattleResult result) { FightingManager.Instance.BattleVictory(result); LogHelper.Log("-----战斗结束:胜利-----"); } /// /// 战斗超时 /// /// 本次战斗关卡id /// 伤害统计 public void BattleTimeOut(int levelid) { FightingManager.Instance.BattleTimeOut(levelid); LogHelper.Log("-----战斗结束:超时-----"); } #endregion #region BattleState /// /// 创建角色 /// /// 编号 /// 预置物体资源名 /// 所属队列 /// 关卡模式 /// 数据 /// 友情支援 public void CreatLogicFighter(string _Id, EBattleTeam _eTeam, int levelmode, IFighterAdapter adapter = null, bool isFriend = false) { string _sounds = adapter.NormalSound() + "," + adapter.SkillSound() + "," + adapter.BeattackSound(); FightingManager.Instance.AddOneFighter(_Id, adapter.IID(), adapter.TID(), adapter.DragonboneName(), _eTeam, adapter.Seat, _sounds, levelmode, isFriend, adapter.PlayerUID()); /** * 下面预加载技能资源 */ if (adapter != null) { NewSkillAndBuff(adapter.Skills()); } } /// /// 预加载技能和buff数据 /// /// 技能id public void NewSkillAndBuff(string[] skills) { /// 预加载 英雄技能 foreach (string skillid in skills) { if (skillid == null) { continue; } var skill = GameConfigData.Ins.GetskillMo(int.Parse(skillid)); if (skill != null) { SkillControl.Instance.LoadBundle(skill.redres); SkillControl.Instance.LoadBundle(skill.blueres); skill.GetBuffList().ForEach(b => { if (!string.IsNullOrWhiteSpace(b.icon)) { FightingManager.Instance.AddOneBuffCache(b.icon); } }); } else { //LogHelper.Log("################技能数据 ID=" + skillid + " 不存在"); } } } /// /// 检测,是否已经创建完毕实体对象 /// /// 实例ID public bool CheckHasFighterCreated(string _strId) { if (FightingManager.Instance.GetFighter(_strId) != null) { return true; } return false; } /// /// 进入特定动画状态 /// /// /// /// /// public void EnterSpecialAni(string _strId, string _strAniName = "", Action ac = null) { FightingManager.Instance.BattleSpecialAni(_strId, _strAniName, ac); } /// /// 进入静止状态 /// /// who /// 是否强制执行静止状态 public void EnterIdleState(string _strId, bool _force) { FightingManager.Instance.BattleFighterIdle(_strId, _force); } /// /// 进入死亡状态 /// /// public void EnterDeadState(string _strId) { FightingManager.Instance.BattleFighterBeDead(_strId); } /// /// 进入受伤状态 /// /// public void EnterHitState(string _strId) { FightingManager.Instance.BattleFighterBeHit(_strId); } /// /// 进入转位状态 /// /// public void EnterMapMoveState(string _strId) { FightingManager.Instance.SetMapMove(_strId); } public void SetMapLight() { FightingMap.Instance.SetMapLight(); } public void SetMapDark() { FightingMap.Instance.SetMapDark(); } /// /// 技能攻击时触发的地图拖拽动作 /// /// 等级 public void EnterMapDragState(int dragType) { FightingManager.Instance.SetMapDraging(dragType); } /// /// 技能攻击时触发的地图震动动作 /// /// 等级 public void EnterMapShakeState(int shakeType) { FightingManager.Instance.SetMapShaking(shakeType); } /// /// 进入尸体消失状态 /// /// public void EnterDisapperState(string _strId) { FightingManager.Instance.BattleFighterDisapper(_strId); } /// /// 进入隐藏状态 /// /// public void EnterHiddenState(string _strId) { FightingManager.Instance.BattleFighterHidden(_strId); } /// /// 进入出场状态 /// /// public void EnterArrivalState(string _strId, bool _boleffect) { FightingManager.Instance.BattleFighterArrival(_strId, _boleffect); } /// /// 进入高亮状态 /// /// public void EnterLightState(string _strId) { FightingManager.Instance.BattleFighterLight(_strId); } /// /// 进入黑暗状态 /// /// public void EnterDarkState(string _strId) { FightingManager.Instance.BattleFigherDark(_strId); } /// /// 进入被选中状态 /// /// public void EnterBeSelectState(string _strId) { FightingManager.Instance.BattleFighterBeSelect(_strId, true); } /// /// 进入(被选中恢复)正常状态 /// /// public void EnterBeGiveUpState(string _strId) { FightingManager.Instance.BattleFighterBeSelect(_strId); } /// /// 进入攻击状态 /// /// 攻击者 /// 技能ID /// 是否为必杀 public void EnterAttackState(string _strWhoId, string _strSkill, int _atkactiontype) { FightingManager.Instance.FighterAttack(_strWhoId, _strSkill, _atkactiontype); } #endregion #region 战斗伤害 UI /// /// 显示敌方技能提示 /// /// /// public void OnShowEnemySkillTip(string who, string _strSkill) { FightingManager.Instance.OnShowEnemySkillTip(who, _strSkill); } /// /// 打开地图配合boss出场效果 /// public void OnStartMapBossEffect() { FightingManager.Instance.OnStartMapBossEffect(); } /// /// 结束地图配合boss出场效果 /// public void OnOverMapBossEffect() { FightingManager.Instance.OnOverMapBossEffect(); } /// /// 关闭boss介绍窗体 /// public void OnSetBossDescriptionWindow(string _bossid, bool isshow) { FightingManager.Instance.OnSetBossDescriptionWindow(_bossid, isshow); } /// /// 战斗伤害信息显示 /// /// 目标编号 /// 伤害类型 /// 伤害数值 /// 显示位置 0=角色位置 1=屏幕中间 public void BattleTipShowing(string who, EBattleTips type, string val, float tipdelay = 0, int showStyle = 0) { FightingManager.Instance.BattleDamageInfo(who, type, val, tipdelay, showStyle); } /// /// 刷新teamHp,teamPower /// public void OnRefreshWindowData() { FightingManager.Instance.OnRefreshWindowData(); } /// /// 开始战斗 /// /// 是否2倍速度 public void OnOprStateSetting(bool bolSecSpeed) { FightingManager.Instance.OnOprStateSetting(bolSecSpeed); } /// /// 播放开战动画 /// public void OnPlayBattleStartAnimation() { FightingManager.Instance.OnPlayBattleStartAnimation(); } /// /// 显示波次数据 /// public void OnPlayLevelEffect() { FightingManager.Instance.OnPlayLevelEffect(); } /// /// 设置场景UI操作状态 /// /// 是否可点击释放技能 /// 是否可点击双倍速按钮 public void OnSetBattleUIOperate(bool _bolSkillUI, bool _bolTopBtn) { FightingManager.Instance.OnSetBattleUIOperate(_bolSkillUI, _bolTopBtn); } /// /// boss开始出场 /// public void OnBossArrival(string iid) { FightingManager.Instance.OnBossArrival(iid); FightingManager.Instance.OnHideBattleUI(); } /// /// boss结束出场 /// public void OnBossLeave() { FightingManager.Instance.OnShowBattleUI(); } /// /// 好友支援提示 /// public void OnFriendSupportTip(string friendtid) { FightingManager.Instance.OnFriendSupportTip(friendtid); } #endregion #region 技能 /// /// 子弹发射 /// /// 子弹唯一标示符 /// 子弹位置目标类型 /// 子弹目标参数(目标ID) public void BulletLaunch(string id, EBulletTargeType type, object param) { SkillControl.Instance.BulletLaunch(id, type, param); } /// /// 检测指定子弹是否创建完成 /// /// 子弹编号 /// true创建成功, false创建失败 public bool BulletLoadComplete(string id) { return SkillControl.Instance.BulletLoadComplete(id); } /// /// 子弹创建 /// /// BulletLoadParam public void BulletLoad(BulletLoadParam param) { SkillControl.Instance.BulletLoad(param); } #endregion #region buff /// /// 播放指定的buff效果 /// /// 目标战斗对象编号 /// buff唯一id /// bufftid /// 效果名称 public void BuffShowIcon(string who, int iid, string tid, string icon) { FightingManager.Instance.AddNewBuffIcon(who, iid, tid, icon); } /// /// 播放指定的buff阶段效果 /// /// /// /// /// public void BuffShowRes(string who, int iid, string res) { FightingManager.Instance.AddNewBuffRes(who, iid, res); } /// /// 谁的buff消失 /// /// 目标对象编号 /// buff唯一编号 public void BuffClear(string who, int iid) { FightingManager.Instance.RemoveBuffIcon(who, iid); } #endregion } }