1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084 |
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine.UI;
- using System;
- namespace YLBattle
- {
- /// <summary>
- /// 战斗管理者
- /// </summary>
- public partial class FightingManager : MonoSingleton<FightingManager>
- {
- #region 战斗结果
- /// <summary>
- /// 参展己方ID
- /// </summary>
- private List<string> mHeros = new List<string>();
- /// <summary>
- /// 星级
- /// </summary>
- private int mStar = 0;
- /// <summary>
- ///
- /// </summary>
- private int mBattleForever_leaveState = 0;
- #endregion
- #region 关卡变量(pve)
- /// <summary>
- /// 战斗关卡
- /// </summary>
- private int mGateId = 0;
- /// <summary>
- /// 波次总数
- /// </summary>
- private int mLevelTotal = 0;
- /// <summary>
- /// 当前波次
- /// </summary>
- private int mLevelState = 0;
- /// <summary>
- /// 当前关卡难度
- /// </summary>
- private int mLevelDif = 0;
- /// <summary>
- /// 购买buff需要的金钱
- /// </summary>
- private int mBuyBuffGold = 0;
- /// <summary>
- /// 关卡名称
- /// </summary>
- private string mLevelName = string.Empty;
- /// <summary>
- /// 关卡模式 [0=普通关卡 1=无穷尽 2=pvp 3=test 4=guide]
- /// </summary>
- private int mLevelMode = 0;
- /// <summary>
- /// 副本ID
- /// </summary>
- private int mCarbonId = 0;
- #endregion
- #region 关卡变量(pvp)
- /// <summary>
- ///
- /// </summary>
- private string mPvpPlayerUID = string.Empty;
- /// <summary>
- ///
- /// </summary>
- private string mPvpType = string.Empty;
- #endregion
- #region 变量
- /// <summary>
- /// 战斗者列表
- /// </summary>
- private Dictionary<string, Fighter> mFighterList = new Dictionary<string, Fighter>();
- /// <summary>
- /// 战斗者ID对应的TID
- /// </summary>
- private Dictionary<string, string> mFighterTIDs = new Dictionary<string, string>();
- /// <summary>
- /// 战斗者ID对应的IID
- /// </summary>
- private Dictionary<string, string> mFighterIIDs = new Dictionary<string, string>();
- /// <summary>
- /// 援军IID
- /// </summary>
- private Dictionary<int, string> mFriendIIDs = new Dictionary<int, string>();
- /// <summary>
- /// UFF 资源对象表
- /// </summary>
- private Dictionary<string, GameObject> mBuffEffTemplate = new Dictionary<string, GameObject>();
- /// <summary>
- /// 战斗外部数据接口
- /// </summary>
- private IBattleGlobalOper mBFM = null;
- /// <summary>
- /// 是否更新
- /// </summary>
- private bool mUpdate = false;
- /// <summary>
- /// 是否暂停
- /// </summary>
- private bool mGetFocus = false;
- /// <summary>
- /// 是否开启连击模式
- /// </summary>
- private bool mOpenAombos = false;
- /// <summary>
- /// 上次连击操作点击时间
- /// </summary>
- private float mLastClick = 0f;
- #endregion
- #region 属性(对外)
- /// <summary>
- /// 是否暂停
- /// </summary>
- private bool isPause = false;
- /// <summary>
- /// 战斗结束
- /// </summary>
- private bool isGameOver = false;
- #endregion
- /// <summary>
- /// 实例
- /// </summary>
- static FightingManager mInstance;
- /// <summary>
- /// 获取单键
- /// </summary>
- /// <returns>单键实例</returns>
- public static FightingManager Instance
- {
- get
- {
- if (mInstance == null)
- {
- GameObject obj = GameObject.Find("FightingManager");
- if (obj != null)
- {
- mInstance = obj.AddComponent<FightingManager>();
- obj.AddComponent<InApplication>();
- }
- }
- return mInstance;
- }
- }
- /// <summary>
- /// 设置暂停
- /// </summary>
- /// <param name="_pause"></param>
- public void SetGameOver(bool _over)
- {
- this.isGameOver = _over;
- }
- /// <summary>
- /// 设置暂停
- /// </summary>
- /// <param name="_pause"></param>
- public void SetPause(bool _pause)
- {
- this.isPause = _pause;
- if (this.isPause)
- {
- this.FightingPause();
- }
- else
- {
- this.FightingContinue();
- }
- }
- /// <summary>
- /// 战斗暂停
- /// </summary>
- public void FightingPause()
- {
- //TimeScale.Instance().Pause();
- //if (this.mBFM != null)
- //{
- // this.mBFM.Pause();
- //}
- }
- /// <summary>
- /// 战斗继续
- /// </summary>
- public void FightingContinue()
- {
- //if (this.isPause && this.isGameOver == false)
- //{
- // return;
- //}
-
- //TimeScale.Instance().PauseOver();
- //if (this.mBFM != null)
- //{
- // this.mBFM.Continue();
- //}
- }
- /// <summary>
- /// 更新
- /// </summary>
- void Update()
- {
- #region 总开关
- if (!mUpdate)
- {
- return;
- }
- GameBattleManager.Instance().Update();
- #endregion
- if (InApplication.Instance.Focus != this.mGetFocus)
- {
- this.mGetFocus = InApplication.Instance.Focus;
- if (this.mGetFocus)
- {
- this.FightingContinue();
- }
- else
- {
- this.FightingPause();
- }
- }
- #region //是否打开连击模式
- if (this.mOpenAombos == false)
- {
- return;
- }
- //如果左键按下
- if (Input.GetMouseButtonDown(0))
- {
- //从主这相机到鼠标点发射一条射线
- Ray ray = CameraManager.Instance.SenceCamara.ScreenPointToRay(Input.mousePosition);
- //接受射线返回的碰撞信息
- RaycastHit hitInfo;
- //如果射线碰撞到东西
- if (Physics.Raycast(ray, out hitInfo))
- {
- // if (hitInfo.collider.gameObject.tag == "BattleMonster")
- if (hitInfo.collider.gameObject.CompareTag("BattleMonster"))
- {
- Fighter fighter = hitInfo.collider.gameObject.GetComponent<Fighter>();
- if (fighter != null && fighter.IsDead == false)
- {
- fighter.SetLianjiEffect(true);
- this.mLastClick = Time.realtimeSinceStartup;
- SkillControl.Instance.createPosEffect(fighter.mID, "UI_SKILL_dianji", fighter.mBodyCenterPos, 2, 1.0f);
- this.mBFM.ConfirmUIClickCritical(hitInfo.collider.gameObject.GetComponent<Fighter>().mID);
- }
- }
- }
- }
- bool _showEffect = Time.realtimeSinceStartup - this.mLastClick > BattleConst.BattleLianjiSpanTime;
- //fighter的特效更新
- foreach (Fighter f in this.mFighterList.Values)
- {
- if (f.IsDead == false && f.mTeam == EBattleTeam.REDTEAM)
- {
- f.SetLianjiEffect(_showEffect);
- }
- }
- #endregion
- }
- #region 战场动态
- /// <summary>
- /// 获取战斗操作接口
- /// </summary>
- /// <returns> IBattlingOpr 对象</returns>
- public IBattleGlobalOper FiledBattlingHandler()
- {
- return this.mBFM;
- }
- /// <summary>
- /// BattleManager=>设置本次战斗信息(波次初始化)
- /// </summary>
- /// <param name="bfm"> 对象管理器</param>
- /// <param name="scene">地图</param>
- internal void SetLevelInfo(IBattleGlobalOper op, string scene, string bg, int mode)
- {
- this.mLevelMode = mode;
- this.isGameOver = false;
- this.ClearAllFighter();
- ///清空技能数据和实例
- LogHelper.Log("清空技能数据和实例");
- if (SkillControl.Instance)
- {
- SkillControl.Instance.ClearAllSkill();
- }
- mBFM = op;
- SkillControl.Instance.SetOp(mBFM);
- if (this.mLevelState == 0)
- {
- FightingMap.Instance.SetMapMode(mode);
- ///初始化状态需要去加载地图
- FightingMap.Instance.GetState().ChangeState(EMapState.Loading, new List<string>() { bg, scene });
- }
- }
- /// <summary>
- /// 设置更新状态
- /// </summary>
- /// <param name="b">状态</param>
- public void SetUpdateState(bool _bolState)
- {
- mUpdate = _bolState;
- }
- /// <summary>
- /// 设置是否开启必杀状态
- /// </summary>
- /// <param name="_bol"></param>
- internal void SetCriticalState(bool _bol)
- {
- this.mOpenAombos = _bol;
- this.mLastClick = 0f;
- if (this.mOpenAombos == false)
- {
- foreach (Fighter f in this.mFighterList.Values)
- {
- if (f.IsDead == false && f.mTeam == EBattleTeam.REDTEAM)
- {
- f.SetLianjiEffect(false);
- }
- }
- }
- }
- /// <summary>
- /// Arrival.Enter=>设置关卡信息
- /// </summary>
- /// <param name="status"></param>
- internal void SetFightingLevelInfo(int _gateID, int _status, int total, int dif,
- string _gateName, int _buybuffgold, int _levelmode)
- {
- LogHelper.Log("........准备开始........:::波次::" + _status);
- this.mGateId = _gateID;
- this.mLevelState = _status;
- this.mLevelTotal = total;
- this.mLevelDif = dif;
- this.mLevelName = _gateName;
- this.mBuyBuffGold = _buybuffgold;
- this.mLevelMode = _levelmode;
- if (_status == 0)
- {
- //PlayerGuideManager.Instance.OnOutTrigger(EGuideEventType.EnterSence, new Dictionary<string, string>() { { "senceName", "Battle" } });
- UI_LoadingWindow.Instance().Hide();
- }
- }
- /// <summary>
- /// Arrival.Enter=>设置关卡信息
- /// </summary>
- /// <param name="status"></param>
- internal void SetPVPLevelInfo(int levelID, string pvpPlayerID, string pvpType)
- {
- LogHelper.Log("........准备开始........");
- this.mGateId = levelID;
- this.mPvpPlayerUID = pvpPlayerID;
- this.mPvpType = pvpType;
- this.mLevelMode = 2;
- UI_LoadingWindow.Instance().Hide();
- }
- /// <summary>
- /// Arrival=>战斗开始
- /// </summary>
- /// <param name="status">进度</param>
- internal void FightingStart(int _status)
- {
- LogHelper.Log("战斗开始,刷新界面数据......");
- this.OnShowBattleUI();
- BUI_TopUIWindow.Instance.SetData(this.mLevelState + 1, this.mLevelTotal, this.mLevelMode);
- BUI_BattleControl.Instance.SetBattleMode(this.mLevelMode);
- BUI_ButtomUIWindow.Instance.SetData(this.mLevelMode);
- BUI_FighterUIWindow.Instance.SetSlotData(this.mLevelMode);
- BUI_FighterUIWindow.Instance.SetLockedState(false);
- BUI_ButtomUIWindow.Instance.SetActive();
- BUI_BattleInfoBar.Instance.SetAcive();
- }
- /// <summary>
- /// 战斗计时刷新
- /// </summary>
- /// <param name="leftMil">剩余毫秒数</param>
- internal void BattleTime(long leftMil)
- {
- BUI_ButtomUIWindow.Instance.SetBattleTime((int)leftMil);
- }
- /// <summary>
- /// Leave=>下一场战斗
- /// </summary>
- internal void BattleLeave()
- {
- LogHelper.Log("------战场离开------");
- BUI_FighterUIWindow.Instance.SetLockedState(true);
- }
- /// <summary>
- /// 清除战斗资源
- /// </summary>
- public void ClearBattleBundle()
- {
- LogHelper.Log("------清除战斗资源------");
- ///战斗结果窗体
- BUI_MainWindow.Instance.UnloadAllBUIBundle();
- ///清理bundle,放在此,主要是为了避免战斗中有些技能或者其他效果未播放完毕,就被清理~~~(特效播放有延迟)
- ResourceHelper.Instance.UnloadAssetBundle("DragonBone_Mon");
- ResourceHelper.Instance.UnloadAssetBundle("DragonBone_Role");
- ResourceHelper.Instance.UnloadAssetBundle("UI_carbon_605021_siwang"); //死亡
- ResourceHelper.Instance.UnloadAssetBundle("SKILL_604001_Arrival"); //出场动画
- ResourceHelper.Instance.UnloadAssetBundle("UI_SKILL_kaishizhandou"); //开战动画
- ResourceHelper.Instance.UnloadAssetBundle("UI_SKILL_LianjiFiger");
- ResourceHelper.Instance.UnloadAssetBundle("UI_SKILL_dianji");
- //ResourceHelper.Instance.UnloadAssetBundle(IconPrefixConst.Battle_BossIcon);
- ResourceHelper.Instance.UnloadAssetBundle(IconPrefixConst.LianJi0_Icon);
- ResourceHelper.Instance.UnloadAssetBundle(IconPrefixConst.LianJi1_Icon);
- ResourceHelper.Instance.UnloadAssetBundle(IconPrefixConst.SkillNameIcon);
- ResourceHelper.Instance.UnloadAssetBundle(IconPrefixConst.Battle_BossIcon);
- this.ClearBuffBundle();
- FightingMap.Instance.UnloadMapBundle();
- foreach (string sID in this.mLoadedMonsterDragons)
- {
- FightingResManager.Instance.UnloadDragonBone(sID);
- }
- FightingResManager.Instance.Clear();
- this.mLoadedMonsterDragons.Clear();
- /// 清除延迟调用的函数
- //CancelInvoke("LateShowSuccessAniWindow");
- //CancelInvoke("LateShowFailAniWindow");
- CancelInvoke("LateShowBattleSuccessWindow");
- CancelInvoke("LateShowBattleFailWindow");
- //CancelInvoke("LateShowBattleForeverSuccessWindow");
- //CancelInvoke("LateShowBattleForeverFailWindow");
- CancelInvoke("LateShowBattlePVPSuccessWindow");
- CancelInvoke("LateShowBattlePVPFailWindow");
- }
- /// <summary>
- /// 清理战场(龙骨,UI隐藏,角色数据,地图归位
- /// </summary>
- public void ClearBattleData()
- {
- BUI_BattleInfoBar.Instance.Clear();
- this.ClearAllFighter();
- if (SkillControl.Instance)
- {
- SkillControl.Instance.ClearAllSkill();
- SkillControl.Instance.UnLoadAllBundle();
- }
- this.SetUpdateState(false);
- }
- #endregion
- #region 战斗结果
- /// <summary>
- /// 战斗失败
- /// </summary>
- /// <param name="levelid">本次战斗关卡id</param>
- /// <param name="record">伤害统计</param>
- public void BattleFailed(int levelid)
- {
- this.mGateId = levelid;
- this.isGameOver = true;
- AudioManager.Instance.PlayUISoundEffect(AudioManager.BattleSepcial_LoseSound);
- if (this.mLevelMode == 4) //引导
- {
- Invoke("LateShowGuideBattleWindow", 1.5f);
- }
- if (this.mLevelMode == 0)
- {
- //Invoke("LateShowFailAniWindow", 1.0f);
- Invoke("LateShowBattleFailWindow", 1.0f);
- }
- if (this.mLevelMode == 1)
- {
- if (this.mLevelState == 0)
- {
- Invoke("LateShowBattleForeverFailWindow", 1.0f);
- }
- else
- {
- Invoke("LateShowBattleForeverSuccessWindow", 1.0f);
- }
- }
- if (this.mLevelMode == 2)
- {
- Invoke("LateShowBattlePVPFailWindow", 1.0f);
- }
- if (this.mLevelMode == 3)
- {
- Invoke("LateShowFailAniWindow", 1.0f);
- }
- }
- /// <summary>
- /// 战斗胜利
- /// </summary>
- /// <param name="result">战斗结果信息</param>
- public void BattleVictory(IBattleResult result)
- {
- return;
- this.isGameOver = true;
- if (this.mLevelMode == 4)
- {
- Invoke("LateShowGuideBattleWindow", 1.5f);
- }
- mHeros = new List<string>();
- for (int i = 0; i < result.BlueTeamFighter().Count; ++i)
- {
- mHeros.Add(result.BlueTeamFighter()[i].IID());
- }
- this.mStar = result.Star();
- this.mLevelDif = result.Diflv();
- this.mGateId = result.LevelID();
- this.mCarbonId = result.CarbonID();
- this.mBattleForever_leaveState = result.BattleForever_leaveState();
- AudioManager.Instance.PlayUISoundEffect(AudioManager.BattleSepcial_WinSound);
- if (this.mLevelMode == 0)
- {
- //Invoke("LateShowSuccessAniWindow", 1.0f);
- // Invoke("LateShowBattleSuccessWindow", 1.0f);
- }
- if (this.mLevelMode == 1)
- {
- Invoke("LateShowBattleForeverSuccessWindow", 1.0f);
- }
- if (this.mLevelMode == 2)
- {
- Invoke("LateShowBattlePVPSuccessWindow", 1.0f);
- }
- //if (this.mLevelMode == 3)
- //{
- // Invoke("LateShowSuccessAniWindow", 1.0f);
- //}
- }
- /// <summary>
- /// 战斗超时
- /// </summary>
- /// <param name="levelid">本次战斗关卡id</param>
- /// <param name="record">伤害统计</param>
- public void BattleTimeOut(int levelid)
- {
- this.isGameOver = true;
- this.mGateId = levelid;
- //Invoke("LateShowFailAniWindow", 1.0f);
- Invoke("LateShowBattleFailWindow", 2.5f);
- }
- #endregion
- #region Map
- /// <summary>
- /// 技能触发的地图被攻击动作(Bomb阶段)
- /// </summary>
- /// <param name="lv"></param>
- public void SetMapDraging(int shakeType)
- {
- FightingMap.Instance.GetState().ChangeState(EMapState.Drag, shakeType);
- }
- /// <summary>
- /// 技能触发的地图被攻击动作(Bomb阶段)
- /// </summary>
- /// <param name="lv"></param>
- public void SetMapShaking(int shakeType)
- {
- FightingMap.Instance.SetShaking(shakeType);
- }
- /// <summary>
- /// 地图行为
- /// </summary>
- /// <param name="who"></param>
- public void SetMapMove(string who)
- {
- if (FightingMap.Instance.Locked)
- {
- return;
- }
- if (mFighterList.ContainsKey(who))
- {
- if (mFighterList[who].mTeam == EBattleTeam.REDTEAM)
- {
- #region old 角色在地图转动时的隐藏效果
- //int hideSeat = -1;
- //if (mFighterList[who].mSeat == 1)
- //{
- // hideSeat = 2;
- //}
- //if (mFighterList[who].mSeat == 2)
- //{
- // hideSeat = 1;
- //}
- //foreach (Fighter f in mFighterList.Values)
- //{
- // if (f.mTeam != EBattleTeam.REDTEAM || f.IsDead == true)
- // {
- // continue;
- // }
- // if (f.mSeat != hideSeat)
- // {
- // BUI_BattleInfoBar.Instance.SetFade(false, f.mID);
- // f.SetLight();
- // }
- // else
- // {
- // BUI_BattleInfoBar.Instance.SetFade(true, f.mID);
- // f.SetDark();
- // }
- //}
- #endregion
- FightingMap.Instance.GetState().ChangeState(EMapState.Move, mFighterList[who].mSeat);
- }
- }
- else
- {
- FightingMap.Instance.GetState().ChangeState(EMapState.Move, 0);
- //foreach (Fighter f in mFighterList.Values)
- //{
- // if (f.mTeam != EBattleTeam.REDTEAM || f.IsDead == true)
- // {
- // continue;
- // }
- // BUI_BattleInfoBar.Instance.SetFade(false, f.mID);
- // f.SetLight();
- //}
- }
- }
- /// <summary>
- /// 锁定地图状态
- /// </summary>
- /// <param name="_bol"></param>
- internal void SetMapLock(bool _bol)
- {
- FightingMap.Instance.SetLock(_bol);
- }
- /// <summary>
- /// Arrival.Enter=>设置地图平板的状态
- /// </summary>
- /// <param name="status"></param>
- internal void SetMapPlatState(int _status, string _aniName)
- {
- FightingMap.Instance.GetState().ChangeState((EMapState)_status, _aniName);
- }
- /// <summary>
- /// Arrival.IsComplete=>转盘是否处于指定状态
- /// </summary>
- /// <returns></returns>
- internal bool CheckMapState(EMapState state)
- {
- return FightingMap.Instance.GetState().GetCurrentState().Type() == state;
- }
- #endregion
- #region Fighter操作
- /// <summary>
- /// 进入攻击状态
- /// </summary>
- /// <param name="_strWhoId">攻击者</param>
- /// <param name="_strSkill">技能ID</param>
- /// <param name="_atkactiontype">攻击动作</param>
- public void FighterAttack(string _who, string _strSkill, int _atkactiontype)
- {
- if (mFighterList.ContainsKey(_who))
- {
- mFighterList[_who].SetAttack(_strSkill, _atkactiontype);
- }
- }
- /// <summary>
- /// 目标受伤
- /// </summary>
- /// <param name="who"></param>
- public void BattleFighterBeHit(string who, int _atkactiontype = 0)
- {
- if (mFighterList.ContainsKey(who))
- {
- AudioManager.Instance.PlayHeroSound(this.mFighterList[who].mTID, this.mFighterList[who].mBeattackSound, ESoundType.HERO_SOUND_BEATTACK);
- if (mFighterList[who].mTeam == EBattleTeam.BLUETEAM)
- {
- BUI_FighterUIWindow.Instance.GetFighterSlot(who).SetHit();
- }
- else
- {
- mFighterList[who].SetHit();
- /**
- * 增加地图配合动画(向后拉)
- */
- FightingMap.Instance.GetState().ChangeState(EMapState.BeHit, null);
- }
- }
- }
- /// <summary>
- /// 目标被选择
- /// </summary>
- /// <param name="who"></param>
- public void BattleFighterBeSelect(string who, bool isSelect = false)
- {
- if (mFighterList.ContainsKey(who))
- {
- Fighter fighter = mFighterList[who];
- if (fighter.mTeam == EBattleTeam.BLUETEAM)
- {
- if (isSelect)
- {
- BUI_FighterUIWindow.Instance.GetFighterSlot(who).SetBeSelect();
- }
- else
- {
- BUI_FighterUIWindow.Instance.GetFighterSlot(who).SetBeForget();
- }
- }
- else
- {
- if (isSelect)
- {
- SkillControl.Instance.createPosEffect(mFighterList[who].mID, "UI_SKILL_beijitishi", Vector3.zero, 1, 1.20f);
- //fighter.SetBeSelect();
- }
- else
- {
- fighter.SetBeForget();
- }
- }
- }
- }
- /// <summary>
- /// 目标死亡
- /// </summary>
- /// <param name="who"></param>
- public void BattleFighterBeDead(string who)
- {
- if (mFighterList.ContainsKey(who))
- {
- mFighterList[who].SetDead();
- BUI_BattleInfoBar.Instance.SetDead(who);
- ///己方,通知管理是否有队友支援
- if (mFighterList[who].mTeam == EBattleTeam.BLUETEAM)
- {
- this.mBFM.SetFriendHelp(mFighterList[who].mSeat);
- }
- ///敌方,播放死亡动画
- if (mFighterList[who].mTeam == EBattleTeam.REDTEAM)
- {
- SkillControl.Instance.createPosEffect(mFighterList[who].mID, "UI_carbon_605021_siwang", Vector3.zero, 1, 1.0f);
- }
- }
- else
- {
- LogHelper.LogError("someOne is not exist...." + who);
- }
- // ------------------------ 新手引导 ----------------------------------------
- //GuideStepAdapter adp = PlayerGuideServer.Instance.GetCurtNoviceNodeType(EGuideEventType.FighterDead);
- //if (adp != null && adp.TriggerEventType == EGuideEventType.FighterDead)
- //{
- // adp.mNoviceEvent(gameObject, mFighterList[who].mTID);
- //}
- // ------------------------ 新手引导 ----------------------------------------
- }
- /// <summary>
- /// 目标等待
- /// </summary>
- /// <param name="who"></param>
- public void BattleFighterDisapper(string who)
- {
- if (mFighterList.ContainsKey(who))
- {
- if (mFighterList[who].mTeam == EBattleTeam.REDTEAM)
- {
- mFighterList[who].SetDisapper();
- }
- }
- }
- public void BattleFighterLight(string who)
- {
- if (mFighterList.ContainsKey(who))
- {
- BUI_BattleInfoBar.Instance.SetFade(false, mFighterList[who].mID);
- mFighterList[who].SetLight();
- }
- }
- public void BattleFigherDark(string who)
- {
- if (mFighterList.ContainsKey(who))
- {
- BUI_BattleInfoBar.Instance.SetFade(true, mFighterList[who].mID);
- mFighterList[who].SetDark();
- }
- }
- /// <summary>
- /// 目标隐藏
- /// </summary>
- /// <param name="who"></param>
- public void BattleFighterHidden(string who)
- {
- if (mFighterList.ContainsKey(who))
- {
- mFighterList[who].SetHidden();
- }
- }
- /// <summary>
- /// 目标显示及出场
- /// </summary>
- /// <param name="who"></param>
- public void BattleFighterArrival(string who, bool boleffect)
- {
- if (mFighterList.ContainsKey(who))
- {
- mFighterList[who].SetArrival();
- }
- if (boleffect)
- {
- SkillControl.Instance.createPosEffect(mFighterList[who].mID, "SKILL_604001_Arrival", Vector3.zero, 0, 2.6f);
- }
- }
- /// <summary>
- /// 进入静止状态
- /// </summary>
- /// <param name="_strId">who</param>
- /// <param name="_force">是否强制执行静止状态</param>
- public void BattleFighterIdle(string who, bool _force)
- {
- if (mFighterList.ContainsKey(who))
- {
- mFighterList[who].SetIdle(_force);
- }
- }
- /// <summary>
- /// 进入特定动画状态
- /// </summary>
- /// <param name="_strId">who</param>
- /// <param name="_strAniName">动画名字</param>
- /// <param name="ac">回调</param>
- public void BattleSpecialAni(string who, string _strAniName = "", Action ac = null)
- {
- if (mFighterList.ContainsKey(who))
- {
- if (_strAniName.Length <= 0)
- {
- //Debug.LogError("re false");
- mFighterList[who].SetActiveBodyTexture(false);
- }
- else
- {
- mFighterList[who].SetActiveBodyTexture(true, "Attack", () =>
- {
- if (ac != null)
- {
- ac.Invoke();
- }
- });
- }
- }
- }
- #endregion
- #region Buff
- /// <summary>
- /// 添加一个BUFF 缓存
- /// </summary>
- /// <param name="name"></param>
- public void AddOneBuffCache(string name)
- {
- ResourceHelper.Instance.LoadAssetBundle(name, ab =>
- {
- if (ab != null && !mBuffEffTemplate.ContainsKey(name))
- {
- //LogHelper.LogError("###加载buff资源" + name);
- GameObject buffEff = ab.LoadAsset<GameObject>(name);
- mBuffEffTemplate.Add(name, buffEff);
- }
- });
- }
- /// <summary>
- /// 增加icon
- /// </summary>
- /// <param name="who"></param>
- public void AddNewBuffRes(string who, int iid, string res)
- {
- if (!mFighterList.ContainsKey(who))
- {
- return;
- }
- SkillControl.Instance.createPosEffect(who, res, Vector3.zero, 0);
- }
- /// <summary>
- /// 增加icon
- /// </summary>
- /// <param name="who"></param>
- public void AddNewBuffIcon(string who, int iid, string tid, string icon)
- {
- if (mFighterList.ContainsKey(who))
- {
- GameObject buffObj = null;
- if (!this.mBuffEffTemplate.ContainsKey(icon))
- {
- return;
- }
- else
- {
- buffObj = this.mBuffEffTemplate[icon];
- }
- if (mFighterList[who].mTeam == EBattleTeam.REDTEAM)
- {
- BUI_BattleUIMovedInfoBar A = BUI_BattleInfoBar.Instance.GetFighterBar(who);
- if (A != null)
- {
- A.AddBuff(tid, iid, buffObj);
- }
- else
- {
- //Debug.LogError("血条Null id=" + who);
- }
- }
- else
- {
- BUI_FighterUIWindow.Instance.GetFighterSlot(who).AddBuff(tid, iid, buffObj);
- }
- }
- }
- /// <summary>
- /// 删除icon
- /// </summary>
- /// <param name="who"></param>
- /// <param name="iid"></param>
- public void RemoveBuffIcon(string who, int iid)
- {
- if (mFighterList.ContainsKey(who))
- {
- if (mFighterList[who].mTeam == EBattleTeam.REDTEAM)
- {
- BUI_BattleUIMovedInfoBar bar = BUI_BattleInfoBar.Instance.GetFighterBar(who);
- if (bar != null)
- {
- bar.DelBuff(iid);
- }
- }
- else
- {
- BUI_FighterUIWindow.Instance.GetFighterSlot(who).DelBuff(iid);
- }
- }
- }
- /// <summary>
- /// 清除所有buff的bundle
- /// </summary>
- public void ClearBuffBundle()
- {
- foreach (KeyValuePair<string, GameObject> keyvalue in this.mBuffEffTemplate)
- {
- ResourceHelper.Instance.UnloadAssetBundle(keyvalue.Key);
- }
- this.mBuffEffTemplate.Clear();
- }
- #endregion
- }
- }
|