FightingManagerUI.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. using System;
  2. using UnityEngine;
  3. using System.Collections;
  4. using UnityEngine.UI;
  5. namespace YLBattle
  6. {
  7. /// <summary>
  8. ///
  9. /// </summary>
  10. partial class FightingManager : MonoSingleton<FightingManager>
  11. {
  12. #region UI-BattleResult
  13. /// <summary>
  14. /// 战斗胜利特效界面
  15. /// </summary>
  16. private void LateShowSuccessAniWindow()
  17. {
  18. this.ClearBattleData();
  19. if (this.mLevelMode == 3)
  20. {
  21. this.ClearBattleBundle();
  22. //Application.LoadLevel("TestForRuiBin");
  23. return;
  24. }
  25. PanelHelper.Instance.ShowPanel("BUI_SuccessAniWindow", (GameObject panel) =>
  26. {
  27. if (panel != null)
  28. {
  29. panel.GetComponent<BUI_SuccessAniWindow>();
  30. }
  31. }, null, -1, null, "/CameraManager/UICamera");
  32. }
  33. /// <summary>
  34. /// 延迟显示战斗胜利界面
  35. /// </summary>
  36. [Obsolete("旧代码清理, gwang 2020.4.20")]
  37. private void LateShowBattleSuccessWindow()
  38. {
  39. this.ClearBattleData();
  40. //PanelHelper.Instance.ShowPanel("UI_BattleWinWindow", (GameObject obj) =>
  41. // {
  42. // //需要传关卡id,难度,星数和队伍列表
  43. // obj.GetComponent<UI_BattleWinWindow>().Init(this.mCarbonId, this.mGateId, this.mLevelDif, this.mStar, this.mHeros, this.mBuyBuffGold,
  44. // () =>
  45. // {
  46. // this.ClearBattleBundle();
  47. // });////最后这个0,是购买buffer费的金币数.请按实际值填入.
  48. //}, null, -1, null, "/CameraManager/UICamera");
  49. }
  50. /// <summary>
  51. /// 战斗失败特效界面
  52. /// </summary>
  53. private void LateShowFailAniWindow()
  54. {
  55. this.ClearBattleData();
  56. if (this.mLevelMode == 3)
  57. {
  58. this.ClearBattleBundle();
  59. //Application.LoadLevel("TestForRuiBin");
  60. return;
  61. }
  62. PanelHelper.Instance.ShowPanel("BUI_FailAniWindow", (GameObject panel) =>
  63. {
  64. if (panel != null)
  65. {
  66. panel.GetComponent<BUI_FailAniWindow>();
  67. }
  68. }, null, -1, null, "/CameraManager/UICamera");
  69. }
  70. /// <summary>
  71. /// 延迟显示战斗失败窗口
  72. /// </summary>
  73. [Obsolete("旧代码, gwang 2020.4.20")]
  74. private void LateShowBattleFailWindow()
  75. {
  76. this.ClearBattleData();
  77. //// 开启战斗失败窗口
  78. //PanelHelper.Instance.ShowPanel("UI_BattleFailWindow", (GameObject panel) =>
  79. // {
  80. // //传两个参数,关卡id,和关卡难度
  81. // panel.GetComponent<UI_BattleFailWindow>().Init(this.mGateId, this.mLevelDif, this.mBuyBuffGold, () =>
  82. // {
  83. // this.ClearBattleBundle();
  84. // });////最后这个0,是购买buffer费的金币数.请按实际值填入.
  85. //}, null, -1, null, "/CameraManager/UICamera");
  86. }
  87. /// <summary>
  88. /// 延迟显示战斗胜利界面
  89. /// </summary>
  90. [Obsolete("旧代码,gwang 2020.4.20")]
  91. private void LateShowBattleForeverSuccessWindow()
  92. {
  93. this.ClearBattleData();
  94. //PanelHelper.Instance.ShowPanel("UI_BattleForeverWinWindow", (GameObject obj) =>
  95. // {
  96. // this.ClearBattleBundle();
  97. // //需要传关卡id,难度,星数和队伍列表
  98. // obj.GetComponent<UI_BattleForeverWinWindow>().InitPanel(this.mGateId, this.mLevelDif, this.mHeros, this.mBuyBuffGold, this.mLevelState, this.mBattleForever_leaveState);////最后这个0,是购买buffer费的金币数.请按实际值填入.
  99. //}, null, -1, null, "/CameraManager/UICamera");
  100. }
  101. /// <summary>
  102. /// 延迟显示战斗失败窗口
  103. /// </summary>
  104. [Obsolete("旧代码, gwang 2020年4月20日")]
  105. private void LateShowBattleForeverFailWindow()
  106. {
  107. this.ClearBattleData();
  108. //// 开启战斗失败窗口
  109. //PanelHelper.Instance.ShowPanel("UI_BattleForeverFailWindow", (GameObject panel) =>
  110. //{
  111. // this.ClearBattleBundle();
  112. // //传两个参数,关卡id,和关卡难度
  113. // panel.GetComponent<UI_BattleForeverFailWindow>().InitPanel(this.mGateId, this.mLevelDif, this.mHeros, this.mBuyBuffGold, this.mLevelState);////最后这个0,是购买buffer费的金币数.请按实际值填入.
  114. //}, null, -1, null, "/CameraManager/UICamera");
  115. }
  116. /// <summary>
  117. /// 延迟显示战斗胜利界面
  118. /// </summary>
  119. [Obsolete("2020.5.7 --gwang",true)]
  120. private void LateShowBattlePVPSuccessWindow()
  121. {
  122. //this.ClearBattleData();
  123. ////传入值
  124. ////this.mPvpPlayerUID
  125. ////this.mPvpType
  126. //PanelHelper.Instance.ShowPanel("UI_Pvp_BattleWinWindow", (GameObject obj) =>
  127. // {
  128. // this.ClearBattleBundle();
  129. // //需要传关卡id,难度,星数和队伍列表
  130. // obj.GetComponent<UI_Pvp_BattleWinWindow>().InitPanel(this.mPvpPlayerUID, this.mPvpType);////最后这个0,是购买buffer费的金币数.请按实际值填入.
  131. //}, null, -1, null, "/CameraManager/UICamera");
  132. }
  133. ///// <summary>
  134. ///// 延迟显示战斗失败窗口
  135. ///// </summary>
  136. //private void LateShowBattlePVPFailWindow()
  137. //{
  138. // this.ClearBattleData();
  139. // //传入值
  140. // //this.mPvpPlayerUID
  141. // //this.mPvpType
  142. // // 开启战斗失败窗口
  143. // PanelHelper.Instance.ShowPanel("UI_Pvp_BattleFailWindow", (GameObject panel) =>
  144. // {
  145. // this.ClearBattleBundle();
  146. // //传两个参数,关卡id,和关卡难度
  147. // panel.GetComponent<UI_Pvp_BattleFailWindow>().InitPanel(this.mPvpPlayerUID, this.mPvpType);
  148. // }, null, -1, null, "/CameraManager/UICamera");
  149. //}
  150. #endregion
  151. #region Window
  152. /// <summary>
  153. /// 战斗暴击警示
  154. /// </summary>
  155. /// <param name="who">who</param>
  156. public void BattleBossWarning(string who)
  157. {
  158. //赋值并显示窗体
  159. //BUI_BossTipWindow.Instance.SetData(mFighterTIDs[who], () =>
  160. //{
  161. // mBFM.ConfirmBattleWarningComplete();
  162. // mBFM.OnManualCriticalFromUnity(who);
  163. //});
  164. }
  165. /// <summary>
  166. /// 战斗必杀警示
  167. /// </summary>
  168. /// <param name="who">who</param>
  169. public void BattleCriticalWarning()
  170. {
  171. ///暴击提示窗体是由shader和animator组成的,如果是直接打开关系,则特效无法释放出来
  172. ///所以这里需要从已加载的资源中克隆出一份儿新的~以激活特效
  173. PanelHelper.Instance.ShowPanel("BUI_CriticalTipWindow", (GameObject panel) =>
  174. {
  175. BUI_CriticalTipWindow tipScript = null;
  176. if (panel != null)
  177. {
  178. tipScript = panel.GetComponent<BUI_CriticalTipWindow>();
  179. //赋值并显示窗体
  180. tipScript.SetData(() =>
  181. {
  182. mBFM.ConfirmBattleCriticalTipComplete();
  183. });
  184. }
  185. }, null, -1, null, "/CameraManager/TipCamera");
  186. }
  187. /// <summary>
  188. /// 技能警示
  189. /// </summary>
  190. /// <param name="who">who</param>
  191. public void BattleSkillTip(string who, string skillid)
  192. {
  193. Fighter fighter = null;
  194. if (mFighterList.ContainsKey(who))
  195. {
  196. fighter = mFighterList[who];
  197. }
  198. PanelHelper.Instance.ShowPanel("BUI_SkillTipWindow", (GameObject panel) =>
  199. {
  200. BUI_SkillTipWindow tipScript = null;
  201. if (panel != null)
  202. {
  203. tipScript = panel.GetComponent<BUI_SkillTipWindow>();
  204. //赋值并显示窗体
  205. tipScript.SetData(fighter, skillid, () =>
  206. {
  207. mBFM.ConfirmBattleSkillComplete();
  208. mBFM.OnCastBullet(fighter.mID, skillid, "", true);
  209. });
  210. }
  211. }, null, -1, null, "/CameraManager/TipCamera");
  212. }
  213. #endregion
  214. #region UI-INFO
  215. /// <summary>
  216. /// 伤害提示
  217. /// </summary>
  218. /// <param name="who"></param>
  219. /// <param name="type"></param>
  220. /// <param name="showStyle">显示位置 0=角色位置 1=屏幕中间</param>
  221. internal void BattleDamageInfo(string who, EBattleTips type, string val, float tipdelay = 0, int showStyle = 0)
  222. {
  223. if (mFighterList.ContainsKey(who))
  224. {
  225. BUI_DamageManager.Instance.AddDamageTips(mFighterList[who].mTeam, who, type, val, tipdelay, showStyle);
  226. }
  227. else
  228. {
  229. if (type == EBattleTips.EDAMAGE_TIPS_NONE)
  230. {
  231. BUI_DamageManager.Instance.AddDamageTips(EBattleTeam.NONE, who, EBattleTips.EDAMAGE_TIPS, "资源加载错误");
  232. }
  233. }
  234. }
  235. /// <summary>
  236. /// 刷新teamHp,teamPower
  237. /// </summary>
  238. public void OnRefreshWindowData()
  239. {
  240. BUI_ButtomUIWindow.Instance.SetHpValue(this.mBFM.GetTeamHp(EBattleTeam.BLUETEAM));
  241. BUI_TopUIWindow.Instance.SetHpValue(this.mBFM.GetTeamHp(EBattleTeam.REDTEAM));
  242. }
  243. /// <summary>
  244. ///
  245. /// </summary>
  246. /// <param name="isShow"></param>
  247. public void OnSetBossDescriptionWindow(string _bossID, bool isShow)
  248. {
  249. if (!isShow)
  250. {
  251. BUI_BossDescriptionWindow.Instance.Hide();
  252. return;
  253. }
  254. PanelHelper.Instance.ShowPanel("BUI_BossDescriptionWindow", (GameObject panel) =>
  255. {
  256. if (panel != null)
  257. {
  258. panel.GetComponent<BUI_BossDescriptionWindow>().SetData(this.mFighterList[_bossID].mTID, this.mFighterList[_bossID].mLevel, () =>
  259. {
  260. this.mBFM.ConfirmBossDescriptionClickTrigger();
  261. this.OnOverMapBossEffect();
  262. });
  263. }
  264. }, null, -1, null, "/CameraManager/UICamera");
  265. }
  266. /// <summary>
  267. /// 显示敌方技能提示
  268. /// </summary>
  269. /// <param name="who"></param>
  270. /// <param name="_strSkill"></param>
  271. public void OnShowEnemySkillTip(string who, string _strSkill)
  272. {
  273. Fighter fighter = null;
  274. if (mFighterList.ContainsKey(who))
  275. {
  276. fighter = mFighterList[who];
  277. }
  278. BUI_BossSkillTip.Instance.SetData(fighter, _strSkill, () =>
  279. {
  280. this.mBFM.ConfirmBattleBossSkillComplete(who, _strSkill);
  281. });
  282. }
  283. /// <summary>
  284. /// 打开地图配合boss出场效果
  285. /// </summary>
  286. public void OnStartMapBossEffect()
  287. {
  288. FightingMap.Instance.StartMapBossEffect();
  289. }
  290. /// <summary>
  291. /// 结束地图配合boss出场效果
  292. /// </summary>
  293. public void OnOverMapBossEffect()
  294. {
  295. FightingMap.Instance.OverMapBossEffect();
  296. }
  297. /// <summary>
  298. /// 开始战斗
  299. /// </summary>
  300. /// <param name="bolSecSpeed">是否2倍速度</param>
  301. public void OnOprStateSetting(bool bolSecSpeed)
  302. {
  303. BUI_TopBtnWindow.Instance.SetData(bolSecSpeed, this.mGateId, this.mLevelDif);
  304. }
  305. /// <summary>
  306. /// Prewar-> 播放开战动画
  307. /// </summary>
  308. public void OnPlayBattleStartAnimation()
  309. {
  310. SkillControl.Instance.createUIScreenEffect("UI_SKILL_kaishizhandou", "UI_SKILL_kaishizhandou");
  311. AudioManager.Instance.PlayUISoundEffect(AudioManager.BattleSepcial_StartFightSound);
  312. }
  313. /// <summary>
  314. /// Prewar-> 播放开战动画
  315. /// </summary>
  316. public void OnPlayLevelEffect()
  317. {
  318. BUI_TopUIWindow.Instance.SetLevelData(this.mLevelName, this.mLevelState + 1, this.mLevelTotal, this.mLevelMode);
  319. }
  320. /// <summary>
  321. /// 替换指定占位的角色
  322. /// </summary>
  323. /// <param name="_seat">位置索引</param>
  324. /// <param name="_serveriid">serverIID</param>
  325. public void OnUpdateSlotData(int _seat, string _serveriid)
  326. {
  327. BUI_FighterUIWindow.Instance.UpdateSlotData(_seat, _serveriid);
  328. }
  329. /// <summary>
  330. /// 设置场景UI操作状态
  331. /// </summary>
  332. /// <param name="_bolSkillUI">是否可点击释放技能</param>
  333. /// <param name="_bolTopBtn">是否可点击双倍速按钮</param>
  334. public void OnSetBattleUIOperate(bool _bolSkillUI, bool _bolTopBtn)
  335. {
  336. //Debug.LogError("Opr " + _bolSkillUI + "............................");
  337. BUI_FighterUIWindow.Instance.SetLockedState(_bolSkillUI);
  338. BUI_TopBtnWindow.Instance.SetLockedState(_bolTopBtn);
  339. }
  340. /// <summary>
  341. ///
  342. /// </summary>
  343. /// <param name="iid"></param>
  344. public void OnBossArrival(string iid)
  345. {
  346. //BUI_TopUIWindow.Instance.SetBoss(iid);
  347. }
  348. /// <summary>
  349. /// 隐藏战斗UI
  350. /// (战斗开始,boss开始出场)
  351. /// </summary>
  352. public void OnHideBattleUI()
  353. {
  354. BUI_TopUIWindow.Instance.SetShow(false);
  355. BUI_TopBtnWindow.Instance.SetShow(false);
  356. BUI_ButtomUIWindow.Instance.SetShow(false);
  357. BUI_FighterUIWindow.Instance.SetShow(false);
  358. }
  359. /// <summary>
  360. /// 显示战斗UI
  361. /// ( boss结束出场 )
  362. /// </summary>
  363. public void OnShowBattleUI()
  364. {
  365. BUI_TopUIWindow.Instance.SetShow(true);
  366. BUI_TopBtnWindow.Instance.SetShow(true);
  367. BUI_ButtomUIWindow.Instance.SetShow(true);
  368. BUI_FighterUIWindow.Instance.SetShow(true);
  369. }
  370. /// <summary>
  371. /// 好友支援提示
  372. /// </summary>
  373. public void OnFriendSupportTip(string friendtid)
  374. {
  375. //PanelHelper.Instance.ShowPanel("BUI_FriendSupportWindow", "/CameraManager/TipCamera", (GameObject panel) =>
  376. //{
  377. // if (panel != null)
  378. // {
  379. // panel.GetComponent<BUI_FriendSupportWindow>().Open(friendtid);
  380. // }
  381. //});
  382. }
  383. #endregion
  384. }
  385. }