UIStartFightRoomComponentSystem.cs 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using UnityEngine;
  6. using UnityEngine.PlayerLoop;
  7. using UnityEngine.UI;
  8. using static System.Net.Mime.MediaTypeNames;
  9. using static UnityEditor.Progress;
  10. namespace ET.Client
  11. {
  12. #region 定时器 刷新
  13. [Invoke(TimerInvokeType.fightTimeShow)]
  14. public class UIStartFightRoomComponentChecker : ATimer<UIStartFightRoomComponent>
  15. {
  16. protected override void Run(UIStartFightRoomComponent self)
  17. {
  18. try
  19. {
  20. self.Check();
  21. }
  22. catch (Exception e)
  23. {
  24. Log.Error($"idle check error: {self.Id}\n{e}");
  25. }
  26. }
  27. }
  28. [Invoke(TimerInvokeType.startFightTimeCount)]
  29. public class UIStartFightTimeCountChecker : ATimer<UIStartFightRoomComponent>
  30. {
  31. protected override void Run(UIStartFightRoomComponent self)
  32. {
  33. try
  34. {
  35. self.UpdateTimeCount();
  36. }
  37. catch (Exception e)
  38. {
  39. Log.Error($"idle check error: {self.Id}\n{e}");
  40. }
  41. }
  42. }
  43. #endregion
  44. [FriendOf(typeof(UIStartFightRoomComponent))]
  45. public static class UIStartFightRoomComponentSystem
  46. {
  47. public static void Check(this UIStartFightRoomComponent self)
  48. {
  49. self.timeTxt.text = string.Format("{0}:{1}", DateTime.Now.Hour, DateTime.Now.Minute);
  50. }
  51. public static void UpdateTimeCount(this UIStartFightRoomComponent self)
  52. {
  53. if (self.startTimeCount > 0)
  54. {
  55. self.timeCountObj.SetActive(true);
  56. self.timeCountTxt.text = self.startTimeCount.ToString();
  57. }
  58. else
  59. {
  60. self.timeCountObj.SetActive(false);
  61. if (self.startTimer > 0)
  62. TimerComponent.Instance?.Remove(ref self.startTimer);
  63. }
  64. self.startTimeCount = self.startTimeCount - 1;
  65. }
  66. [ObjectSystem]
  67. public class UIStartFightRoomComponentAwakeSystem : AwakeSystem<UIStartFightRoomComponent>
  68. {
  69. protected override void Awake(UIStartFightRoomComponent self, params object[] param)
  70. {
  71. ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
  72. //头像部分
  73. self.houseIcon = rc.Get<GameObject>("houseIcon");
  74. self.houseIdTxt = rc.Get<GameObject>("houseIdTxt");
  75. self.gameNumTxt = rc.Get<GameObject>("gameNumTxt");
  76. self.curResidueTxt = rc.Get<GameObject>("curResidueTxt");
  77. //右上系统信息部分
  78. self.wifiImage = rc.Get<GameObject>("wifiImage");
  79. self.powerImage = rc.Get<GameObject>("powerImage");
  80. var timeTxt = rc.Get<GameObject>("timeTxt");
  81. self.timeTxt = timeTxt.GetComponent<UnityEngine.UI.Text>();
  82. self.menuBtn = rc.Get<GameObject>("menuBtn");
  83. self.menuBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnMenuBtn(); });
  84. self.faceBtn = rc.Get<GameObject>("faceBtn");
  85. self.faceBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnFaceBtn(); });
  86. self.videoBtn = rc.Get<GameObject>("videoBtn");
  87. self.videoBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnVideoBtn(); });
  88. //菜单
  89. self.menuPanel = rc.Get<GameObject>("menuPanel");
  90. self.menuPanel.SetActive(false);
  91. self.maskBtn = rc.Get<GameObject>("maskBtn");
  92. self.maskBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnMenuPanelClose(); });
  93. self.menuBackBtn = rc.Get<GameObject>("menuBackBtn");
  94. self.menuBackBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnMenuPanelBack(); });
  95. self.menuQuitBtn = rc.Get<GameObject>("menuQuitBtn");
  96. self.menuQuitBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnMenuPanelQuit(); });
  97. self.menuSettingBtn = rc.Get<GameObject>("menuSettingBtn");
  98. self.menuSettingBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnMenuPanelSetting(); });
  99. //表情面板
  100. self.facePanel = rc.Get<GameObject>("facePanel");
  101. self.facePanel.SetActive(false);
  102. self.fastToggleBtn = rc.Get<GameObject>("fastToggleBtn");
  103. self.fastToggleBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnFaceFastToggleBtn(0); });
  104. self.faceToggleBtn = rc.Get<GameObject>("faceToggleBtn");
  105. self.faceToggleBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnFaceFastToggleBtn(1); });
  106. self.faceAndVideoObj = rc.Get<GameObject>("faceAndVideoObj");
  107. self.faceAndVideoObj.SetActive(false);
  108. self.facePanelCloseBtn = rc.Get<GameObject>("facePanelCloseBtn");
  109. self.facePanelCloseBtn.GetComponent<Button>().onClick.AddListener(() => { self.facePanel.SetActive(false); });
  110. //表情列表以及快捷语列表
  111. self.listFastGridBg = rc.Get<GameObject>("listFastGridBg");
  112. self.listFastGridBg.SetActive(false);
  113. self.listFastContent = rc.Get<GameObject>("listFastContent");
  114. self.gridFastItem = rc.Get<GameObject>("gridFastItem");
  115. self.listFaceGridBg = rc.Get<GameObject>("listFaceGridBg");
  116. self.listFaceGridBg.SetActive(false);
  117. self.listFaceContent = rc.Get<GameObject>("listFaceContent");
  118. self.gridFaceItem = rc.Get<GameObject>("gridFaceItem");
  119. self.timeCountObj = rc.Get<GameObject>("timeCountObj");
  120. self.timeCountTxt = rc.Get<GameObject>("timeCountTxt").GetComponent<UnityEngine.UI.Text>();
  121. //玩
  122. self.readyBtn = rc.Get<GameObject>("readyBtn");
  123. self.readyBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnReadyAndInviteBtn(0); });
  124. self.inviteBtn = rc.Get<GameObject>("inviteBtn");
  125. self.inviteBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnReadyAndInviteBtn(1); });
  126. self.fightCardItem = rc.Get<GameObject>("fightCardItem");
  127. self.fightCardItem.SetActive(false);
  128. GameUtil.Instance.SetCardCloneItem(self.fightCardItem,0);
  129. self.fightCardItem1 = rc.Get<GameObject>("fightCardItem1");
  130. self.fightCardItem1.SetActive(false);
  131. GameUtil.Instance.SetCardCloneItem(self.fightCardItem1, 1);
  132. for (int i = 1;i <= 4;i++)
  133. {
  134. UIStartFightRoomPlayerCom uIStartFightRoomPlayerCom = new UIStartFightRoomPlayerCom();
  135. var playerObj = rc.Get<GameObject>("player" + i);
  136. var playerIconObj = rc.Get<GameObject>("playerIcon" + i);
  137. var readyImage = rc.Get<GameObject>("readyImage" + i);
  138. var playerIconImage = playerIconObj.GetComponent<UnityEngine.UI.Image>();
  139. uIStartFightRoomPlayerCom.playerObj = playerObj;
  140. uIStartFightRoomPlayerCom.readyImage = readyImage;
  141. uIStartFightRoomPlayerCom.playerIcon = playerIconImage;
  142. var fightCardContentNode = rc.Get<GameObject>("fightCardContent" + i);
  143. uIStartFightRoomPlayerCom.fightCardNode = fightCardContentNode;
  144. var disCardContentNode = rc.Get<GameObject>("disCardContent" + i);
  145. uIStartFightRoomPlayerCom.disCardsNode = disCardContentNode;
  146. self.uIStartFightRoomPlayerComs.Add(uIStartFightRoomPlayerCom);
  147. playerObj.SetActive(false);
  148. var playChatObj = rc.Get<GameObject>("playChatObj" + i);
  149. self.playChatObjList.Add(playChatObj);
  150. }
  151. //操作
  152. self.operatorObj = rc.Get<GameObject>("operatorObj");
  153. self.operatorObj.SetActive(false);
  154. int operatorIndex = 1;
  155. for (int i = 1;i <= 5;i++)
  156. {
  157. var operatorObjBtn = rc.Get<GameObject>("operatorBtn" + i);
  158. var btn = operatorObjBtn.GetComponent<Button>();
  159. operatorIndex = i;
  160. btn.onClick.AddListener(()=>
  161. {
  162. self.OnOperatorBtn(operatorIndex);
  163. });
  164. self.operatorObj_btn.Add(operatorObjBtn);
  165. }
  166. self.Init();
  167. }
  168. }
  169. private static async void Init(this UIStartFightRoomComponent self)
  170. {
  171. self.RepeatedTimer = TimerComponent.Instance.NewRepeatedTimer(ConstValue.fightTimeRefreshTime / 2 + 100, TimerInvokeType.fightTimeShow, self);
  172. var startFightRoomInfo = self.ClientScene().GetComponent<StartFightRoomComponment>().GetStartFightRoomInfo();
  173. CommonBridge.Instance.dispathPush += DispathPush;
  174. self.readyBtn.SetActive(true);
  175. self.inviteBtn.SetActive(true);
  176. self.houseIdTxt.GetComponent<UnityEngine.UI.Text>().text = startFightRoomInfo.roomInfo.RoomId.ToString();
  177. self.gameNumTxt.GetComponent<UnityEngine.UI.Text>().text = startFightRoomInfo.roomInfo.OwnerId.ToString();
  178. self.curResidueTxt.GetComponent<UnityEngine.UI.Text>().text = "0";
  179. await SoundManager.Instance.PlaySound("common_playing", true);
  180. }
  181. private static void DispathPush(Scene scene, object type)
  182. {
  183. switch (type)
  184. {
  185. case EventType.JoinRoomPush:
  186. {
  187. var ui = scene.GetComponent<UIComponent>().Get(UIType.UIStartFightRoom);
  188. var startFightRoomComponentUI = ui.GetComponent<UIStartFightRoomComponent>();
  189. var startFightRoomInfo = scene.GetComponent<StartFightRoomComponment>().GetStartFightRoomInfo();
  190. //处理其他玩家信息
  191. for (int i = 1; i < startFightRoomComponentUI.uIStartFightRoomPlayerComs.Count; i++)
  192. {
  193. startFightRoomComponentUI.uIStartFightRoomPlayerComs[i].playerObj.SetActive(false);
  194. }
  195. if (startFightRoomInfo.roomInfo.OtherInfo != null && startFightRoomInfo.roomInfo.OtherInfo.Count > 0)
  196. {
  197. for (int i = 0; i < startFightRoomInfo.roomInfo.OtherInfo.Count; i++)
  198. {
  199. var otherPlayInfo = startFightRoomInfo.roomInfo.OtherInfo[i];
  200. if (i >= startFightRoomComponentUI.uIStartFightRoomPlayerComs.Count - 1)
  201. {
  202. startFightRoomComponentUI.uIStartFightRoomPlayerComs[i + 1].playerObj.SetActive(false);
  203. }
  204. else
  205. {
  206. startFightRoomComponentUI.uIStartFightRoomPlayerComs[i + 1].playerObj.SetActive(true);
  207. startFightRoomComponentUI.uIStartFightRoomPlayerComs[i + 1].readyImage.SetActive(false);
  208. }
  209. }
  210. }
  211. break;
  212. }
  213. case EventType.KickPush:
  214. {
  215. break;
  216. }
  217. case EventType.ReadyPush:
  218. {
  219. var ui = scene.GetComponent<UIComponent>().Get(UIType.UIStartFightRoom);
  220. var startFightRoomComponent = ui.GetComponent<UIStartFightRoomComponent>();
  221. var startFightRoomInfo = scene.GetComponent<StartFightRoomComponment>().GetStartFightRoomInfo();
  222. //先处理自己的信息
  223. if (startFightRoomInfo.roomInfo.MyInfo != null)
  224. {
  225. startFightRoomComponent.readyBtn.SetActive(startFightRoomInfo.roomInfo.MyInfo.state == 0);
  226. startFightRoomComponent.inviteBtn.SetActive(startFightRoomInfo.roomInfo.MyInfo.state == 0);
  227. startFightRoomComponent.uIStartFightRoomPlayerComs[0].playerObj.SetActive(true);
  228. startFightRoomComponent.faceAndVideoObj.SetActive(true);
  229. startFightRoomComponent.uIStartFightRoomPlayerComs[0].readyImage.SetActive(startFightRoomInfo.roomInfo.MyInfo.state == 1);
  230. }
  231. //处理其他玩家信息
  232. for (int i = 1;i < startFightRoomComponent.uIStartFightRoomPlayerComs.Count;i++)
  233. {
  234. startFightRoomComponent.uIStartFightRoomPlayerComs[i].playerObj.SetActive(false);
  235. }
  236. if (startFightRoomInfo.roomInfo.OtherInfo != null && startFightRoomInfo.roomInfo.OtherInfo.Count > 0)
  237. {
  238. for (int i = 0; i < startFightRoomInfo.roomInfo.OtherInfo.Count; i++)
  239. {
  240. var otherPlayInfo = startFightRoomInfo.roomInfo.OtherInfo[i];
  241. if (i >= startFightRoomComponent.uIStartFightRoomPlayerComs.Count - 1)
  242. {
  243. startFightRoomComponent.uIStartFightRoomPlayerComs[i + 1].playerObj.SetActive(false);
  244. }
  245. else
  246. {
  247. startFightRoomComponent.uIStartFightRoomPlayerComs[i + 1].playerObj.SetActive(true);
  248. startFightRoomComponent.uIStartFightRoomPlayerComs[i + 1].readyImage.SetActive(otherPlayInfo.state == 1);
  249. }
  250. }
  251. }
  252. break;
  253. }
  254. case EventType.ReadyStartPush:
  255. {
  256. //开始 倒计时
  257. var startFightRoomInfo = scene.GetComponent<StartFightRoomComponment>().GetStartFightRoomInfo();
  258. Log.Error("@@@@@ 倒计时: " + startFightRoomInfo.readyStartTimeCount);
  259. var ui = scene.GetComponent<UIComponent>().Get(UIType.UIStartFightRoom);
  260. var startFightRoomComponentUI = ui.GetComponent<UIStartFightRoomComponent>();
  261. startFightRoomComponentUI.startTimeCount = startFightRoomInfo.readyStartTimeCount;
  262. startFightRoomComponentUI.startTimer = TimerComponent.Instance.NewRepeatedTimer(ConstValue.fightTimeRefreshTime / 2 + 100, TimerInvokeType.startFightTimeCount, startFightRoomComponentUI);
  263. break;
  264. }
  265. case EventType.GameStartPush:
  266. case EventType.GameDrawCardPush:
  267. case EventType.GameOperationPush:
  268. {
  269. //正式开始 发牌
  270. var ui = scene.GetComponent<UIComponent>().Get(UIType.UIStartFightRoom);
  271. var startFightRoomComponentUI = ui.GetComponent<UIStartFightRoomComponent>();
  272. var startFightRoomInfo = scene.GetComponent<StartFightRoomComponment>().GetStartFightRoomInfo();
  273. var myCardInfo = startFightRoomInfo.roomInfo.MyInfo;
  274. var otherCardInfo = startFightRoomInfo.roomInfo.OtherInfo;
  275. #region 其他玩家牌处理
  276. //处理其他玩家信息
  277. for (int i = 1; i < startFightRoomComponentUI.uIStartFightRoomPlayerComs.Count; i++)
  278. {
  279. startFightRoomComponentUI.uIStartFightRoomPlayerComs[i].playerObj.SetActive(false);
  280. }
  281. if (otherCardInfo != null && otherCardInfo.Count > 0)
  282. {
  283. RefreshPlayCardList(0, otherCardInfo, startFightRoomInfo.roomInfo, startFightRoomComponentUI);
  284. }
  285. #endregion
  286. #region 自己牌处理
  287. //处理牌型
  288. //自己牌
  289. if (myCardInfo != null)
  290. {
  291. RefreshPlayCardList(1, new List<PlayerInfo>() { myCardInfo }, startFightRoomInfo.roomInfo, startFightRoomComponentUI);
  292. }
  293. #endregion
  294. break;
  295. }
  296. case EventType.GameDisCardPush:
  297. {
  298. //其他玩家出推送,处理自己的操作
  299. var startFightRoomInfo = scene.GetComponent<StartFightRoomComponment>().GetStartFightRoomInfo();
  300. var myCardInfo = startFightRoomInfo.roomInfo.MyInfo;
  301. if (myCardInfo != null && myCardInfo.cardInfo != null && myCardInfo.cardInfo.Acts.Count > 0)
  302. {
  303. var ui = scene.GetComponent<UIComponent>().Get(UIType.UIStartFightRoom);
  304. var startFightRoomComponentUI = ui.GetComponent<UIStartFightRoomComponent>();
  305. startFightRoomComponentUI.operatorObj.SetActive(true);
  306. //处理操作按钮
  307. for (int i = 0;i < startFightRoomComponentUI.operatorObj_btn.Count;i++)
  308. {
  309. startFightRoomComponentUI.operatorObj_btn[i].SetActive(false);
  310. }
  311. for (int i = 0; i < myCardInfo.cardInfo.Acts.Count; i++)
  312. {
  313. if (myCardInfo.cardInfo.Acts[i] == 1)
  314. {
  315. startFightRoomComponentUI.operatorObj_btn[i].SetActive(true);
  316. }
  317. }
  318. //重置所有牌的状态
  319. var parentNode = startFightRoomComponentUI.uIStartFightRoomPlayerComs[0].fightCardNode;
  320. for (int i = 0;i < parentNode.transform.childCount;i++)
  321. {
  322. StartFightCardItem startFightCardItem = parentNode.transform.GetChild(i).gameObject.GetComponent<StartFightCardItem>();
  323. startFightCardItem.GetDown();
  324. }
  325. GameObjectPool.Instance.ClearRealySelCardList();
  326. //抬起
  327. for (int i = 0; i < myCardInfo.cardInfo.ActInfo.Count; i++)
  328. {
  329. //根据服务器信息 弹起响应的牌
  330. DisCardPushWithOperator(parentNode.transform, myCardInfo.cardInfo.ActInfo[i]);
  331. }
  332. //记录当前出的牌
  333. startFightRoomComponentUI.curCardVal = startFightRoomInfo.roomInfo.CurDisCard;
  334. Log.Error("当前出的牌: " + startFightRoomComponentUI.curCardVal);
  335. }
  336. break;
  337. }
  338. }
  339. }
  340. #region 右上系统部分
  341. public static void OnMenuBtn(this UIStartFightRoomComponent self)
  342. {
  343. self.menuPanel.SetActive(!self.menuPanel.activeInHierarchy);
  344. }
  345. public static async void OnFaceBtn(this UIStartFightRoomComponent self)
  346. {
  347. await SoundManager.Instance.PlaySound("clickbtnsound");
  348. self.facePanel.SetActive(true);
  349. self.LoadChatData(0);
  350. }
  351. public static void OnVideoBtn(this UIStartFightRoomComponent self)
  352. {
  353. }
  354. #endregion
  355. #region 菜单
  356. public static void OnMenuPanelClose(this UIStartFightRoomComponent self)
  357. {
  358. self.menuPanel.SetActive(false);
  359. }
  360. public static async void OnMenuPanelBack(this UIStartFightRoomComponent self)
  361. {
  362. Action<object> myAction = (param) =>
  363. {
  364. int result = (int)param;
  365. if (result == 1)
  366. {
  367. self.ReturnMainUI().Coroutine();
  368. }
  369. };
  370. Dictionary<string,object> dic = new Dictionary<string, object>()
  371. {
  372. { "callback",myAction},
  373. { "title","提示"},
  374. { "content","返回大厅,你的房间仍会保留。"},
  375. { "yesTxt","确定"},
  376. { "cancelTxt","取消"},
  377. };
  378. await SoundManager.Instance.PlaySound("clickbtnsound");
  379. await UIHelper.Create(self.ClientScene(), UIType.UIAlert, UILayer.High, dic);
  380. }
  381. public static void OnMenuPanelQuit(this UIStartFightRoomComponent self)
  382. {
  383. }
  384. public static void OnMenuPanelSetting(this UIStartFightRoomComponent self)
  385. {
  386. }
  387. #endregion
  388. #region 表情
  389. public static async void OnFaceFastToggleBtn(this UIStartFightRoomComponent self,int index)
  390. {
  391. await SoundManager.Instance.PlaySound("clickbtnsound");
  392. self.LoadChatData(index);
  393. }
  394. static async void LoadChatData(this UIStartFightRoomComponent self, int index)
  395. {
  396. self.listFaceGridBg.SetActive(false);
  397. self.listFastGridBg.SetActive(false);
  398. string[] abName = new string[] { "com_bg1", "com_bg2" };
  399. await ResourcesComponentHelper.Instance.LoadSprite(self.ClientScene(), "commonatlas");
  400. Sprite sprite = ResourcesComponentHelper.Instance.GetSprite("commonatlas", abName[0]);
  401. Sprite sprite1 = ResourcesComponentHelper.Instance.GetSprite("commonatlas", abName[1]);
  402. self.fastToggleBtn.GetComponent<UnityEngine.UI.Image>().sprite = index == 0 ? sprite: sprite1;
  403. self.faceToggleBtn.GetComponent<UnityEngine.UI.Image>().sprite = index == 1 ? sprite : sprite1;
  404. self.CleanChatItem(index);
  405. if (index == 0)
  406. {
  407. self.listFastGridBg.SetActive(true);
  408. var startFightRoomInfo = self.ClientScene().GetComponent<StartFightRoomComponment>().GetStartFightRoomInfo();
  409. int sexType = startFightRoomInfo.roomInfo.MyInfo.sex;
  410. var fightConfig = FightChatConfigCategory.Instance.GetAll();
  411. var achievedDic = fightConfig.Where(kvp => kvp.Value.Type == sexType);
  412. foreach (var item in achievedDic)
  413. {
  414. if (GameObjectPool.Instance.chatFastItemPools.Count > 0)
  415. {
  416. GameObject uiFastItem = GameObjectPool.Instance.chatFastItemPools[0];
  417. GameObjectPool.Instance.chatFastItemPools.RemoveAt(0);
  418. uiFastItem.SetActive(true);
  419. uiFastItem.transform.SetParent(self.listFastContent.transform, false);
  420. var txt = uiFastItem.GetComponentInChildren<UnityEngine.UI.Text>();
  421. txt.text = item.Value.Content;
  422. var btn = txt.gameObject.GetComponent<Button>();
  423. btn.onClick.RemoveAllListeners();
  424. btn.onClick.AddListener(async () =>
  425. {
  426. Log.Error("btn click1: " + item.Value.Content + " vedio: " + item.Value.VedioPath);
  427. await SoundManager.Instance.PlaySound(item.Value.VedioPath);
  428. self.facePanel.SetActive(false);
  429. self.playChatObjList[0].SetActive(true);
  430. var playChatTxt = self.playChatObjList[0].GetComponentInChildren<UnityEngine.UI.Text>();
  431. playChatTxt.text = item.Value.Content;
  432. await TimerComponent.Instance.WaitAsync(3000);
  433. self.playChatObjList[0].SetActive(false);
  434. });
  435. }
  436. else
  437. {
  438. var uiFastItem = GameUtil.Instance.InitializeObj(self.gridFastItem);
  439. uiFastItem.gameObject.SetActive(true);
  440. uiFastItem.transform.SetParent(self.listFastContent.transform, false);
  441. var txt = uiFastItem.GetComponentInChildren<UnityEngine.UI.Text>();
  442. txt.text = item.Value.Content;
  443. var btn = txt.gameObject.GetComponent<Button>();
  444. btn.onClick.RemoveAllListeners();
  445. btn.onClick.AddListener(async () =>
  446. {
  447. Log.Error("btn click1: " + item.Value.Content + " vedio: " + item.Value.VedioPath);
  448. await SoundManager.Instance.PlaySound(item.Value.VedioPath);
  449. self.facePanel.SetActive(false);
  450. self.playChatObjList[0].SetActive(true);
  451. var playChatTxt = self.playChatObjList[0].GetComponentInChildren<UnityEngine.UI.Text>();
  452. playChatTxt.text = item.Value.Content;
  453. await TimerComponent.Instance.WaitAsync(3000);
  454. self.playChatObjList[0].SetActive(false);
  455. });
  456. }
  457. }
  458. }
  459. else
  460. {
  461. }
  462. }
  463. static void CleanChatItem(this UIStartFightRoomComponent self,int index)
  464. {
  465. Transform node = null;
  466. List<GameObject> list = null;
  467. if (index == 0)
  468. {
  469. node = self.listFastContent.transform;
  470. list = GameObjectPool.Instance.chatFastItemPools;
  471. }
  472. else
  473. {
  474. node = self.listFaceContent.transform;
  475. list = GameObjectPool.Instance.chatFaceItemPools;
  476. }
  477. for (int i = 0; i < node.childCount; i++)
  478. {
  479. var child = node.GetChild(i);
  480. list.Add(child.gameObject);
  481. child.gameObject.SetActive(false);
  482. }
  483. }
  484. #endregion
  485. #region 邀请以及准备
  486. public static void OnReadyAndInviteBtn(this UIStartFightRoomComponent self, int index)
  487. {
  488. if (index == 0)
  489. {
  490. self.ReadyRes().Coroutine();
  491. }
  492. else
  493. {
  494. //邀请
  495. }
  496. }
  497. #endregion
  498. public static void SetBattery()
  499. {
  500. //var level = SystemInfo.batteryLevel == -1 ? 1 : SystemInfo.batteryLevel;
  501. //batteryLevelImg.fillAmount = level;
  502. //batteryTxt.text = (level * 100).ToString() + "%";
  503. //var isCharging = SystemInfo.batteryStatus == BatteryStatus.Charging;
  504. //charging.gameObject.SetActive(isCharging);
  505. }
  506. static async ETTask ReturnMainUI(this UIStartFightRoomComponent self)
  507. {
  508. var scene = self.ClientScene();
  509. await UIHelper.Remove(scene, UIType.UIStartFightRoom);
  510. var startFightRoomInfo = scene.GetComponent<StartFightRoomComponment>().GetStartFightRoomInfo();
  511. Dictionary<string, object> dic = new Dictionary<string, object>()
  512. {
  513. { "result",1},
  514. { "roomId",startFightRoomInfo.roomInfo.RoomId.ToString()}
  515. };
  516. await UIHelper.Create(scene, UIType.UIMain, UILayer.Mid, dic);
  517. }
  518. static async ETTask ReadyRes(this UIStartFightRoomComponent self)
  519. {
  520. //try
  521. {
  522. var scene = self.ClientScene();
  523. var session = scene.GetComponent<SessionComponent>().Session;
  524. if (session != null)
  525. {
  526. G2C_Ready g2Ready = (G2C_Ready)await session.Call(
  527. new C2G_Ready() { });
  528. if (g2Ready.Error != ErrorCode.ERR_Success)
  529. {
  530. Log.Error($"g2Ready错误...errCode={g2Ready.Error}" + " mess: " + g2Ready.Message);
  531. return;
  532. }
  533. }
  534. }
  535. //catch (Exception e)
  536. //{
  537. // Log.Error($"准备出错...{e.Message}");
  538. //}
  539. }
  540. public static async void OnCloseAsync(this UIStartFightRoomComponent self)
  541. {
  542. await UIHelper.Remove(self.ClientScene(),UIType.UIStartFightRoom);
  543. }
  544. public static async void OnOperatorBtn(this UIStartFightRoomComponent self, int operatorIndex)
  545. {
  546. var startFightRoomInfo = GameUtil.Instance.GetSceneComponent().GetComponent<StartFightRoomComponment>().GetStartFightRoomInfo();
  547. int sexType = startFightRoomInfo.roomInfo.MyInfo.sex;
  548. switch (operatorIndex)
  549. {
  550. case 1:
  551. {
  552. //吃
  553. var list = GameObjectPool.Instance.GetRealySelCardList();
  554. if (list == null || list.Count <= 0 || list.Count > 3)
  555. {
  556. await CommonUtil.Instance.OpenCommonServerMsgPanel("出牌不符合条件,请重新调整 " + string.Join(", ", list));
  557. return;
  558. }
  559. var isSequence = GameUtil.Instance.CheckIsSequence(list);
  560. if (!isSequence)
  561. {
  562. await CommonUtil.Instance.OpenCommonServerMsgPanel("出牌不符合条件,请重新调整 " + string.Join(", ", list));
  563. return;
  564. }
  565. int cardVal = list[0];
  566. Log.Error("当前吃牌请求发送的值: " + cardVal);
  567. Dictionary<string, object> dic = new Dictionary<string, object>()
  568. {
  569. { "OpType",operatorIndex},
  570. { "Card",cardVal}
  571. };
  572. await RequestServerUtil.Instance.OpenRequestServer(OuterMessage.C2G_Operation,dic,async (messageObj, errorCode) =>
  573. {
  574. if (errorCode != ErrorCode.ERR_Success)
  575. {
  576. await CommonUtil.Instance.OpenCommonServerMsgPanel($"操作失败,errCode={errorCode},operatorType={operatorIndex}");
  577. return;
  578. }
  579. string soundStrType = sexType == 0 ? GameSetting.Instance.disCardBoySoundName : GameSetting.Instance.disCardGirlSoundName;
  580. await SoundManager.Instance.PlaySound(string.Concat(soundStrType, "chi"));
  581. });
  582. break;
  583. }
  584. //case 2:
  585. // {
  586. // //碰
  587. // var list = GameObjectPool.Instance.GetRealySelCardList();
  588. // if (list == null || list.Count <= 0 || list.Count > 3)
  589. // {
  590. // await CommonUtil.Instance.OpenCommonServerMsgPanel("出牌不符合条件,请重新调整 " + string.Join(", ", list));
  591. // return;
  592. // }
  593. // var isSequence = GameUtil.Instance.CheckIsSame(list,0);
  594. // if (!isSequence)
  595. // {
  596. // await CommonUtil.Instance.OpenCommonServerMsgPanel("出牌不符合条件,请重新调整 " + string.Join(", ", list));
  597. // return;
  598. // }
  599. // int cardVal = list[0];
  600. // Log.Error("当前碰牌请求发送的值: " + cardVal);
  601. // Dictionary<string, object> dic = new Dictionary<string, object>()
  602. // {
  603. // { "OpType",operatorIndex},
  604. // { "Card",0}
  605. // };
  606. // await RequestServerUtil.Instance.OpenRequestServer(OuterMessage.C2G_Operation, dic, async (messageObj, errorCode) =>
  607. // {
  608. // if (errorCode != ErrorCode.ERR_Success)
  609. // {
  610. // await CommonUtil.Instance.OpenCommonServerMsgPanel($"操作失败,errCode={errorCode},operatorType={operatorIndex}");
  611. // return;
  612. // }
  613. // });
  614. // break;
  615. // }
  616. case 2:
  617. case 3:
  618. case 5:
  619. {
  620. //胡 peng guo
  621. Dictionary<string, object> dic = new Dictionary<string, object>()
  622. {
  623. { "OpType",operatorIndex},
  624. { "Card",0}
  625. };
  626. await RequestServerUtil.Instance.OpenRequestServer(OuterMessage.C2G_Operation, dic, async (messageObj, errorCode) =>
  627. {
  628. if (errorCode != ErrorCode.ERR_Success)
  629. {
  630. await CommonUtil.Instance.OpenCommonServerMsgPanel($"操作失败,errCode={errorCode},operatorType={operatorIndex}");
  631. return;
  632. }
  633. if (operatorIndex == 2 || operatorIndex == 3)
  634. {
  635. string soundStrType = sexType == 0 ? GameSetting.Instance.disCardBoySoundName : GameSetting.Instance.disCardGirlSoundName;
  636. string destSoundStr = operatorIndex == 2? "peng": "hu";
  637. await SoundManager.Instance.PlaySound(string.Concat(soundStrType, destSoundStr));
  638. }
  639. });
  640. break;
  641. }
  642. case 4:
  643. {
  644. //杠
  645. var list = GameObjectPool.Instance.GetRealySelCardList();
  646. if (list == null || list.Count <= 0 || list.Count > 4)
  647. {
  648. await CommonUtil.Instance.OpenCommonServerMsgPanel("出牌不符合条件,请重新调整 " + string.Join(", ", list));
  649. return;
  650. }
  651. var isSequence = GameUtil.Instance.CheckIsSame(list, 1);
  652. if (!isSequence)
  653. {
  654. await CommonUtil.Instance.OpenCommonServerMsgPanel("出牌不符合条件,请重新调整 " + string.Join(", ", list));
  655. return;
  656. }
  657. int cardVal = list[0];
  658. Log.Error("当前杠牌请求发送的值: " + cardVal);
  659. Dictionary<string, object> dic = new Dictionary<string, object>()
  660. {
  661. { "OpType",operatorIndex},
  662. { "Card",cardVal}
  663. };
  664. await RequestServerUtil.Instance.OpenRequestServer(OuterMessage.C2G_Operation, dic, async (messageObj, errorCode) =>
  665. {
  666. if (errorCode != ErrorCode.ERR_Success)
  667. {
  668. await CommonUtil.Instance.OpenCommonServerMsgPanel($"操作失败,errCode={errorCode},operatorType={operatorIndex}");
  669. return;
  670. }
  671. string soundStrType = sexType == 0 ? GameSetting.Instance.disCardBoySoundName : GameSetting.Instance.disCardGirlSoundName;
  672. await SoundManager.Instance.PlaySound(string.Concat(soundStrType, "gang"));
  673. });
  674. break;
  675. }
  676. }
  677. }
  678. public static async void RefreshPlayCardList(int index, List<PlayerInfo> playerInfos,RoomInfo roomInfo, UIStartFightRoomComponent startFightRoomComponentUI)
  679. {
  680. if (index == 0)
  681. {
  682. for (int i = 0; i < playerInfos.Count; i++)
  683. {
  684. var otherPlayInfo = playerInfos[i];
  685. if (i >= startFightRoomComponentUI.uIStartFightRoomPlayerComs.Count - 1)
  686. {
  687. startFightRoomComponentUI.uIStartFightRoomPlayerComs[i + 1].playerObj.SetActive(false);
  688. }
  689. else
  690. {
  691. startFightRoomComponentUI.uIStartFightRoomPlayerComs[i + 1].playerObj.SetActive(true);
  692. startFightRoomComponentUI.uIStartFightRoomPlayerComs[i + 1].readyImage.SetActive(false);
  693. var fightCardParentNode = startFightRoomComponentUI.uIStartFightRoomPlayerComs[i + 1].fightCardNode;
  694. var disCardParentNode = startFightRoomComponentUI.uIStartFightRoomPlayerComs[i + 1].disCardsNode;
  695. CleanCardItemList(fightCardParentNode.transform,0);
  696. for (int p = 0; p < otherPlayInfo.cardInfo.RemainCardsNum; p++)
  697. {
  698. if (GameObjectPool.Instance.fightCardItemPools.Count > 0)
  699. {
  700. GameObject uifightItem = GameObjectPool.Instance.fightCardItemPools[0];
  701. GameObjectPool.Instance.fightCardItemPools.RemoveAt(0);
  702. uifightItem.gameObject.SetActive(true);
  703. uifightItem.transform.SetParent(fightCardParentNode.transform, false);
  704. var sprite = await GameObjectPool.Instance.AcquireSprite(GameSetting.Instance.otherPlayCardSpiteName);
  705. UnityEngine.UI.Image icon = uifightItem.GetComponentInChildren<UnityEngine.UI.Image>();
  706. icon.sprite = sprite;
  707. var btn = icon.gameObject.GetComponent<Button>();
  708. btn.onClick.RemoveAllListeners();
  709. btn.onClick.AddListener(() =>
  710. {
  711. Log.Error("card Click...");
  712. });
  713. }
  714. else
  715. {
  716. int cloneItemIndex = i % 2 == 0? 1 : 0;
  717. var uifightItem = GameUtil.Instance.InitializeObj(GameUtil.Instance.GetCardCloneItem(cloneItemIndex));
  718. uifightItem.SetActive(true);
  719. uifightItem.transform.SetParent(fightCardParentNode.transform, false);
  720. var sprite = await GameObjectPool.Instance.AcquireSprite(GameSetting.Instance.otherPlayCardSpiteName);
  721. UnityEngine.UI.Image icon = uifightItem.GetComponentInChildren<UnityEngine.UI.Image>();
  722. icon.sprite = sprite;
  723. }
  724. }
  725. //已经出过的牌列表
  726. CleanCardItemList(disCardParentNode.transform, 1);
  727. if (otherPlayInfo.cardInfo.DisCards != null)
  728. {
  729. for (int l = 0; l < otherPlayInfo.cardInfo.DisCards.Count; l++)
  730. {
  731. int value = otherPlayInfo.cardInfo.DisCards[l];
  732. if (GameObjectPool.Instance.disCardItemPools.Count > 0)
  733. {
  734. GameObject uiDisItem = GameObjectPool.Instance.disCardItemPools[0];
  735. GameObjectPool.Instance.disCardItemPools.RemoveAt(0);
  736. uiDisItem.gameObject.SetActive(true);
  737. uiDisItem.transform.SetParent(disCardParentNode.transform, false);
  738. var sprite = await GameObjectPool.Instance.AcquireSprite(string.Concat(GameSetting.Instance.selfPlayCardSpiteName, value));
  739. UnityEngine.UI.Image icon = uiDisItem.GetComponentInChildren<UnityEngine.UI.Image>();
  740. icon.sprite = sprite;
  741. }
  742. else
  743. {
  744. int cloneItemIndex = i % 2 == 0 ? 1 : 0;
  745. var uiDisItem = GameUtil.Instance.InitializeObj(GameUtil.Instance.GetCardCloneItem(cloneItemIndex));
  746. uiDisItem.SetActive(true);
  747. uiDisItem.transform.SetParent(disCardParentNode.transform, false);
  748. var sprite = await GameObjectPool.Instance.AcquireSprite(string.Concat(GameSetting.Instance.selfPlayCardSpiteName, value));
  749. UnityEngine.UI.Image icon = uiDisItem.GetComponentInChildren<UnityEngine.UI.Image>();
  750. icon.sprite = sprite;
  751. }
  752. }
  753. }
  754. }
  755. }
  756. }
  757. else
  758. {
  759. var myCardInfo = playerInfos[0];
  760. if (myCardInfo.cardInfo.RemainCards == null)
  761. {
  762. Log.Error("自己牌队列为NULL");
  763. return;
  764. }
  765. var parentNode = startFightRoomComponentUI.uIStartFightRoomPlayerComs[0].fightCardNode;
  766. var disCardParentNode = startFightRoomComponentUI.uIStartFightRoomPlayerComs[0].disCardsNode;
  767. startFightRoomComponentUI.uIStartFightRoomPlayerComs[0].readyImage.SetActive(false);
  768. Log.Error("card数量: " + myCardInfo.cardInfo.RemainCards.Count);
  769. CleanCardItemList(parentNode.transform,0);
  770. for (int i = 0; i < myCardInfo.cardInfo.RemainCards.Count;i++)
  771. {
  772. var value = myCardInfo.cardInfo.RemainCards[i];
  773. if (GameObjectPool.Instance.fightCardItemPools.Count > 0)
  774. {
  775. GameObject uifightItem = GameObjectPool.Instance.fightCardItemPools[0];
  776. StartFightCardItem startFightCardItem = uifightItem.GetComponent<StartFightCardItem>();
  777. if(startFightCardItem == null)
  778. startFightCardItem = uifightItem.AddComponent<StartFightCardItem>();
  779. GameObjectPool.Instance.fightCardItemPools.RemoveAt(0);
  780. uifightItem.gameObject.SetActive(true);
  781. uifightItem.transform.SetParent(parentNode.transform, false);
  782. startFightCardItem.Init(uifightItem.GetComponentInChildren<UnityEngine.UI.Image>(), value,(val)=>
  783. {
  784. if (myCardInfo.state != roomInfo.OpPos || myCardInfo.id != roomInfo.OpId)
  785. {
  786. Log.Error("不是自己回合");
  787. return;
  788. }
  789. DisCardRequest(val).Coroutine();
  790. });
  791. }
  792. else
  793. {
  794. var uifightItem = GameUtil.Instance.InitializeObj(GameUtil.Instance.GetCardCloneItem(0));
  795. StartFightCardItem startFightCardItem = uifightItem.GetComponent<StartFightCardItem>();
  796. if (startFightCardItem == null)
  797. startFightCardItem = uifightItem.AddComponent<StartFightCardItem>();
  798. uifightItem.gameObject.SetActive(true);
  799. uifightItem.transform.SetParent(parentNode.transform, false);
  800. startFightCardItem.Init(uifightItem.GetComponentInChildren<UnityEngine.UI.Image>(), value, (val) =>
  801. {
  802. if (myCardInfo.state != roomInfo.OpPos || myCardInfo.id != roomInfo.OpId)
  803. {
  804. Log.Error("不是自己回合");
  805. return;
  806. }
  807. DisCardRequest(val).Coroutine();
  808. });
  809. }
  810. }
  811. //已经出过的牌列表
  812. CleanCardItemList(disCardParentNode.transform, 1);
  813. if (myCardInfo.cardInfo.DisCards != null)
  814. {
  815. for (int l = 0; l < myCardInfo.cardInfo.DisCards.Count; l++)
  816. {
  817. int value = myCardInfo.cardInfo.DisCards[l];
  818. if (GameObjectPool.Instance.disCardItemPools.Count > 0)
  819. {
  820. GameObject uiDisItem = GameObjectPool.Instance.disCardItemPools[0];
  821. GameObjectPool.Instance.disCardItemPools.RemoveAt(0);
  822. uiDisItem.gameObject.SetActive(true);
  823. uiDisItem.transform.SetParent(disCardParentNode.transform, false);
  824. var sprite = await GameObjectPool.Instance.AcquireSprite(string.Concat(GameSetting.Instance.selfPlayCardSpiteName, value));
  825. UnityEngine.UI.Image icon = uiDisItem.GetComponentInChildren<UnityEngine.UI.Image>();
  826. icon.sprite = sprite;
  827. }
  828. else
  829. {
  830. var uiDisItem = GameUtil.Instance.InitializeObj(GameUtil.Instance.GetCardCloneItem(0));
  831. uiDisItem.SetActive(true);
  832. uiDisItem.transform.SetParent(disCardParentNode.transform, false);
  833. var sprite = await GameObjectPool.Instance.AcquireSprite(string.Concat(GameSetting.Instance.selfPlayCardSpiteName, value));
  834. UnityEngine.UI.Image icon = uiDisItem.GetComponentInChildren<UnityEngine.UI.Image>();
  835. icon.sprite = sprite;
  836. }
  837. }
  838. }
  839. }
  840. }
  841. #region 请求相关
  842. //操作,chi p hu
  843. public static async ETTask OperationCardRequest(int operationType,int firstCard)
  844. {
  845. try
  846. {
  847. var scene = GameUtil.Instance.GetSceneComponent();
  848. var session = scene.GetComponent<SessionComponent>().Session;
  849. if (session != null)
  850. {
  851. G2C_Operation g2Operation = (G2C_Operation)await session.Call(
  852. new C2G_Operation() { OpType = operationType , Card = firstCard });
  853. if (g2Operation.Error != ErrorCode.ERR_Success)
  854. {
  855. Log.Error($"操作 {operationType} 出错...errCode={g2Operation.Error}");
  856. return;
  857. }
  858. //之后走推送
  859. }
  860. }
  861. catch (Exception e)
  862. {
  863. Log.Error($"操作 {operationType} 出错...{e.Message}");
  864. }
  865. }
  866. //出
  867. public static async ETTask DisCardRequest(int disCard)
  868. {
  869. try
  870. {
  871. var scene = GameUtil.Instance.GetSceneComponent();
  872. var session = scene.GetComponent<SessionComponent>().Session;
  873. if (session != null)
  874. {
  875. G2C_DisCard g2DisCard = (G2C_DisCard)await session.Call(
  876. new C2G_DisCard() { Card = disCard });
  877. if (g2DisCard.Error != ErrorCode.ERR_Success)
  878. {
  879. await CommonUtil.Instance.OpenCommonServerMsgPanel($"出牌{disCard} 出错...errCode={g2DisCard.Error}");
  880. return;
  881. }
  882. var startFightRoomInfo = GameUtil.Instance.GetSceneComponent().GetComponent<StartFightRoomComponment>().GetStartFightRoomInfo();
  883. int sexType = startFightRoomInfo.roomInfo.MyInfo.sex;
  884. string soundStrType = sexType == 0 ? GameSetting.Instance.disCardBoySoundName : GameSetting.Instance.disCardGirlSoundName;
  885. await SoundManager.Instance.PlaySound(string.Concat(soundStrType, disCard));
  886. //之后走推送
  887. }
  888. }
  889. catch (Exception e)
  890. {
  891. Log.Error($"操作 {disCard} 出错...{e.Message}");
  892. }
  893. }
  894. #endregion
  895. public static void CleanCardItemList(Transform node,int index)
  896. {
  897. List<GameObject> tempList = index == 0? GameObjectPool.Instance.fightCardItemPools: GameObjectPool.Instance.disCardItemPools;
  898. for (int i = 0;i < node.childCount;i++)
  899. {
  900. var child = node.GetChild(i);
  901. tempList.Add(child.gameObject);
  902. child.gameObject.SetActive(false);
  903. }
  904. }
  905. public static void DisCardPushWithOperator(Transform node, ActInfo actInfo)
  906. {
  907. ActInfoType actInfoType = (ActInfoType)actInfo.Type;
  908. switch (actInfoType)
  909. {
  910. case ActInfoType.LightPole:
  911. case ActInfoType.BackPole:
  912. case ActInfoType.DarkPole:
  913. {
  914. var cardVal = actInfo.Card;
  915. int loopIndex = 1;
  916. for (int i = 0; i < node.childCount; i++)
  917. {
  918. if (loopIndex > 3)
  919. {
  920. break;
  921. }
  922. var child = node.GetChild(i);
  923. StartFightCardItem startFightCardItem = child.gameObject.GetComponent<StartFightCardItem>();
  924. if (startFightCardItem.val == cardVal)
  925. {
  926. startFightCardItem.StandUp();
  927. }
  928. loopIndex++;
  929. }
  930. //将出的牌添加到操作列表里面去
  931. GameObjectPool.Instance.OperatoRarealySelCardList(0, cardVal);
  932. break;
  933. }
  934. case ActInfoType.Peng:
  935. {
  936. var cardVal = actInfo.Card;
  937. int loopIndex = 1;
  938. for (int i = 0; i < node.childCount; i++)
  939. {
  940. if (loopIndex >= 3)
  941. {
  942. break;
  943. }
  944. var child = node.GetChild(i);
  945. StartFightCardItem startFightCardItem = child.gameObject.GetComponent<StartFightCardItem>();
  946. if (startFightCardItem.val == cardVal)
  947. {
  948. startFightCardItem.StandUp();
  949. }
  950. loopIndex++;
  951. }
  952. GameObjectPool.Instance.OperatoRarealySelCardList(0, cardVal);
  953. break;
  954. }
  955. case ActInfoType.Chi:
  956. {
  957. var cardVal = actInfo.Card;
  958. int loopIndex = 1;
  959. for (int i = 0; i < node.childCount; i++)
  960. {
  961. if (loopIndex >= 3)
  962. {
  963. break;
  964. }
  965. var child = node.GetChild(i);
  966. StartFightCardItem startFightCardItem = child.gameObject.GetComponent<StartFightCardItem>();
  967. if (startFightCardItem.val == cardVal + 1)
  968. {
  969. startFightCardItem.StandUp();
  970. }
  971. cardVal = startFightCardItem.val;
  972. loopIndex++;
  973. }
  974. GameObjectPool.Instance.OperatoRarealySelCardList(0, cardVal);
  975. break;
  976. }
  977. }
  978. }
  979. [ObjectSystem]
  980. public class UIStartFightRoomComponentDestroySystem : DestroySystem<UIStartFightRoomComponent>
  981. {
  982. protected override void Destroy(UIStartFightRoomComponent self)
  983. {
  984. TimerComponent.Instance?.Remove(ref self.RepeatedTimer);
  985. CommonBridge.Instance.Clear();
  986. }
  987. }
  988. }
  989. }