SocialManager.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using UnityEngine.EventSystems;
  4. using System;
  5. using System.Collections;
  6. using System.Diagnostics;
  7. using System.Collections.Generic;
  8. using LitJson;
  9. using Debug = UnityEngine.Debug;
  10. public class SocialManager : Regist
  11. {
  12. #region Config
  13. public static bool OpenRankPanelFlag;
  14. public static int RecordCommentLastIndex;
  15. public static int RecordCommentFirstIndex;
  16. public static bool OpenCommentFlag;
  17. public static Vector3 RecordCommentPosition;
  18. public static bool IsPlayer;
  19. public static bool IsPanelOpen;
  20. public static bool PullCommentDataFlag;
  21. public static bool UpdateCommentDataFlag;
  22. public static int PlayerLastDisplayIndex = -1;
  23. public static int PlayerFirstDisplayIndex;
  24. public static int VisiteeLastDisplayIndex = -1;
  25. public static int VisiteeFirstDisplayIndex;
  26. public static int CurrentPlayerCommentPage;
  27. public static int CurrentVisiteeCommentPage;
  28. public static bool IsFriendFilterOn;
  29. public static Text PraiseText;
  30. public static Button PraiseButton;
  31. public static Toggle CommentFriendFilterToggle;
  32. public static DateTime CommentTime;
  33. public static InputField CommentInputField;
  34. public static ScrollRectPlus CommentScrollRect;
  35. public static float UpdateRankDataTime = 5;
  36. public static float UpdateRankDataTimer = 0;
  37. public static float UpdatePraiseDataTime = 10;
  38. public static float UpdatePraiseDataTimer = 5;
  39. public static float CommentTimeSpan = 30f;
  40. public static List<CommentData> PlayerCommentDatas = new List<CommentData>();
  41. public static List<CommentData> VisiteeCommentDatas = new List<CommentData>();
  42. public static List<CommentItem> CommentItems = new List<CommentItem>();
  43. private static int CommentPanelMaxRevertAmt = 15;
  44. private static int CommentPanelMaxChildAmt = 20;
  45. private static float CommentItemHeight = 120;
  46. #endregion
  47. public void Update()
  48. {
  49. if (!HttpManager.IsRankDataReady)
  50. {
  51. UpdateRankDataTimer += Time.deltaTime;
  52. if (UpdateRankDataTimer >= UpdateRankDataTime)
  53. {
  54. UpdateRankDataTimer = 0;
  55. HttpManager.GetRankData();
  56. }
  57. }
  58. if (VisitManager.InVisit)
  59. {
  60. return;
  61. }
  62. UpdatePraiseDataTimer += Time.deltaTime;
  63. if (UpdatePraiseDataTimer >= UpdatePraiseDataTime)
  64. {
  65. UpdatePraiseDataTimer = 0;
  66. PraiseText.text = HttpManager.PraiseAmt.ToString();
  67. }
  68. }
  69. public override void FirstInit()
  70. {
  71. PraiseText = ResourceManager.Get<Text>(CanvasLabel.C_PraiseText);
  72. PraiseButton = ResourceManager.Get<Button>(CanvasLabel.C_Praise);
  73. CommentInputField = ResourceManager.Get<InputField>(CanvasLabel.Q_InputField);
  74. CommentScrollRect = ResourceManager.Get<ScrollRectPlus>(CanvasLabel.Q_ScrollRect);
  75. CommentFriendFilterToggle = ResourceManager.Get<Toggle>(CanvasLabel.Q_FriendFilterButton);
  76. CommentFriendFilterToggle.onValueChanged.AddListener(OnCommentFriendFilterToggleClick);
  77. CommentScrollRect.onValueChanged.AddListener(OnScroll);
  78. FriendPanel.OnFriendListRefresh += OnFriendListRefresh;
  79. VisitManager.OnEnterVisteeGarden += OnEnterVisiteeGarden;
  80. VisitManager.OnExitVisteeGarden += OnExitVisiteeGarden;
  81. }
  82. public static void Praise()
  83. {
  84. if (VisitManager.InVisit)
  85. {
  86. PraiseText.text = (int.Parse(PraiseText.text) + 1).ToString();
  87. HttpManager.Praise(HttpManager.SerialNumber, VisitManager.VisiteeSerialNumber);
  88. DisablePraise();
  89. }
  90. else
  91. {
  92. throw new Exception();
  93. }
  94. }
  95. public static void EnablePraise()
  96. {
  97. PraiseText.color = Lib.PraiseTextBlue;
  98. PraiseButton.image.color = Color.white;
  99. PraiseButton.interactable = true;
  100. }
  101. public static void DisablePraise()
  102. {
  103. PraiseText.color = Lib.PraiseTextWhite;
  104. PraiseButton.image.color = Lib.Pink;
  105. PraiseButton.interactable = false;
  106. }
  107. public static void Comment()
  108. {
  109. if (string.IsNullOrEmpty(CommentInputField.text))
  110. {
  111. Bubble.Show(Language.GetStr(LanguageLabel.UI__Lb_Send2));
  112. return;
  113. }
  114. if ((DateTime.Now - CommentTime).TotalSeconds > CommentTimeSpan)
  115. {
  116. CommentTime = DateTime.Now;
  117. string content = StringFilter.GetFilteredString(CommentInputField.text);
  118. HttpManager.AddComment(HttpManager.SerialNumber, VisitManager.VisiteeSerialNumber, content, CommentType.Garden);
  119. CommentInputField.text = "";
  120. }
  121. else
  122. {
  123. Bubble.Show(Language.GetStr(LanguageLabel.UI__Q_CommentTip));
  124. }
  125. }
  126. public static void OpenCommentPanel()
  127. {
  128. IsPlayer = !VisitManager.InVisit;
  129. if (IsPlayer)
  130. {
  131. UpdateCommentPage(IsPlayer);
  132. }
  133. else
  134. {
  135. if (string.IsNullOrEmpty(VisitManager.VisiteeSerialNumber))
  136. {
  137. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__C_CannotComment));
  138. return;
  139. }
  140. else
  141. {
  142. UpdateCommentPage(IsPlayer);
  143. }
  144. }
  145. IsPanelOpen = true;
  146. ResourceManager.Get(CanvasLabel.Q_CommentBK).TweenForCG();
  147. if (VisitManager.InVisit)
  148. {
  149. ResourceManager.SetActive(CanvasLabel.Q_InputBK, true);
  150. RectTransform rectTransform = ResourceManager.Get<RectTransform>(CanvasLabel.Q_ScrollRect);
  151. rectTransform.sizeDelta = new Vector2(rectTransform.rect.size.x, 206.1f);
  152. }
  153. else
  154. {
  155. ResourceManager.SetActive(CanvasLabel.Q_InputBK, false);
  156. RectTransform rectTransform = ResourceManager.Get<RectTransform>(CanvasLabel.Q_ScrollRect);
  157. rectTransform.sizeDelta = new Vector2(rectTransform.rect.size.x, 278.3f);
  158. }
  159. }
  160. public static void CloseCommentPanel()
  161. {
  162. ResourceManager.Get(CanvasLabel.Q_CommentBK).TweenBacCG();
  163. IsPanelOpen = false;
  164. }
  165. public static void RecordCommentPanel()
  166. {
  167. if (IsPlayer)
  168. {
  169. OpenCommentFlag = true;
  170. RecordCommentLastIndex = PlayerLastDisplayIndex;
  171. RecordCommentFirstIndex = PlayerFirstDisplayIndex;
  172. RecordCommentPosition = CommentScrollRect.content.transform.position;
  173. }
  174. }
  175. public static void RecoverCommentPanel()
  176. {
  177. if (OpenCommentFlag)
  178. {
  179. OpenCommentFlag = false;
  180. ClearCommentPanel();
  181. PlayerLastDisplayIndex = -1;
  182. PlayerFirstDisplayIndex = 0;
  183. int antiCrush = 0;
  184. while (PlayerFirstDisplayIndex != RecordCommentFirstIndex || PlayerLastDisplayIndex != RecordCommentLastIndex)
  185. {
  186. if (antiCrush > 10000)
  187. {
  188. throw new Exception("Crush");
  189. }
  190. if (CommentScrollRect.content.childCount >= CommentPanelMaxChildAmt)
  191. {
  192. CommentItem commentItem = CommentScrollRect.content.GetChild(0).GetComponent<CommentItem>();
  193. ResourceManager.Save(commentItem);
  194. CommentItems.Remove(commentItem);
  195. PlayerFirstDisplayIndex++;
  196. }
  197. PlayerLastDisplayIndex++;
  198. CommentData commentData = PlayerCommentDatas[PlayerLastDisplayIndex];
  199. CommentItem newCommentItem = ResourceManager.GetCommentItem(commentData.NickName, commentData.SerialNumber, commentData.Content);
  200. CommentItems.Add(newCommentItem);
  201. }
  202. CommentScrollRect.content.transform.position = RecordCommentPosition;
  203. OpenCommentPanel();
  204. }
  205. }
  206. public static void PullCommentPage(bool isPlayer)
  207. {
  208. PullCommentDataFlag = true;
  209. UpdateCommentDataFlag = false;
  210. //Debug.Log("PullPage");
  211. if (isPlayer)
  212. {
  213. HttpManager.GetComment
  214. (
  215. HttpManager.SerialNumber,
  216. (CurrentPlayerCommentPage + 1).ToString(),
  217. CommentType.Garden,
  218. data =>
  219. {
  220. if (!UpdateCommentDataFlag)
  221. {
  222. ReceiveCommentDatas(IsPlayer, data);
  223. NextCommentPage(IsPlayer, true);
  224. }
  225. else
  226. {
  227. PullCommentDataFlag = false;
  228. }
  229. }
  230. );
  231. }
  232. else
  233. {
  234. HttpManager.GetComment
  235. (
  236. HttpManager.SerialNumber,
  237. (CurrentVisiteeCommentPage + 1).ToString(),
  238. CommentType.Garden,
  239. data =>
  240. {
  241. if (!UpdateCommentDataFlag)
  242. {
  243. ReceiveCommentDatas(IsPlayer, data);
  244. NextCommentPage(IsPlayer, true);
  245. }
  246. else
  247. {
  248. PullCommentDataFlag = false;
  249. }
  250. }
  251. );
  252. }
  253. }
  254. public static void UpdateCommentPage(bool isPlayer)
  255. {
  256. UpdateCommentDataFlag = true;
  257. ClearCommentPanel();
  258. ResourceManager.Get(CanvasLabel.Q_Tip).TweenForCG();
  259. LanguageManager.Add(ResourceManager.Get<Text>(CanvasLabel.Q_Tip), Language.GetStr(LanguageLabel.UI__Loading));
  260. if (isPlayer)
  261. {
  262. //Debug.Log("UpdatePlayer");
  263. PlayerFirstDisplayIndex = 0;
  264. PlayerLastDisplayIndex = -1;
  265. CurrentPlayerCommentPage = 0;
  266. PlayerCommentDatas = new List<CommentData>();
  267. HttpManager.GetComment
  268. (
  269. HttpManager.SerialNumber,
  270. "1",
  271. CommentType.Garden,
  272. data =>
  273. {
  274. if (!VisitManager.InVisit)
  275. {
  276. DelayCall.Call(0.5f, () => ResourceManager.Get(CanvasLabel.Q_Tip).TweenBacCG());
  277. LanguageManager.Add(ResourceManager.Get<Text>(CanvasLabel.Q_Tip), Language.GetStr(LanguageLabel.UI__LoadSucceed));
  278. ReceiveCommentDatas(true, data);
  279. NextCommentPage(true, true);
  280. ResourceManager.Get<CanvasGroup>(CanvasLabel.Q_CommentBK).interactable = false;
  281. DelayCall.Call(1, () => ResourceManager.Get<CanvasGroup>(CanvasLabel.Q_CommentBK).interactable = true);
  282. }
  283. }
  284. );
  285. }
  286. else
  287. {
  288. //Debug.Log("UpdateVisitee");
  289. VisiteeFirstDisplayIndex = 0;
  290. VisiteeLastDisplayIndex = -1;
  291. CurrentVisiteeCommentPage = 0;
  292. VisiteeCommentDatas = new List<CommentData>();
  293. HttpManager.GetComment
  294. (
  295. VisitManager.VisiteeSerialNumber,
  296. "1",
  297. CommentType.Garden,
  298. data =>
  299. {
  300. if (VisitManager.InVisit)
  301. {
  302. DelayCall.Call(0.5f, () => ResourceManager.Get(CanvasLabel.Q_Tip).TweenBacCG());
  303. LanguageManager.Add(ResourceManager.Get<Text>(CanvasLabel.Q_Tip), Language.GetStr(LanguageLabel.UI__LoadSucceed));
  304. ReceiveCommentDatas(false, data);
  305. NextCommentPage(false, true);
  306. ResourceManager.Get<CanvasGroup>(CanvasLabel.Q_CommentBK).interactable = false;
  307. DelayCall.Call(1, () => ResourceManager.Get<CanvasGroup>(CanvasLabel.Q_CommentBK).interactable = true);
  308. }
  309. }
  310. );
  311. }
  312. }
  313. public static void ReceiveCommentDatas(bool isPlayer, JsonData jsonData)
  314. {
  315. Auxiliary.Instance.DelayCall
  316. (
  317. () =>
  318. {
  319. PullCommentDataFlag = false;
  320. },
  321. 1
  322. );
  323. if (!jsonData.Inst_Object.ContainsKey("l"))
  324. {
  325. return;
  326. }
  327. if (jsonData["l"].Count == 0)
  328. {
  329. return;
  330. }
  331. if (isPlayer)
  332. {
  333. CurrentPlayerCommentPage++;
  334. foreach (JsonData commentData in jsonData["l"])
  335. {
  336. PlayerCommentDatas.UniqueAdd(new CommentData(commentData));
  337. }
  338. }
  339. else
  340. {
  341. CurrentVisiteeCommentPage++;
  342. foreach (JsonData commentData in jsonData["l"])
  343. {
  344. VisiteeCommentDatas.UniqueAdd(new CommentData(commentData));
  345. }
  346. }
  347. }
  348. public static void NextCommentPage(bool isPlayer, bool isDownload)
  349. {
  350. //Debug.Log("NextPage");
  351. if (isPlayer)
  352. {
  353. int saveAmt = 0;
  354. int updateAmt = Mathf.Min(15, PlayerCommentDatas.Count - PlayerLastDisplayIndex - 1);
  355. for (int i = 0; i < updateAmt; i++)
  356. {
  357. if (CommentScrollRect.content.childCount >= CommentPanelMaxChildAmt)
  358. {
  359. saveAmt++;
  360. CommentItem commentItem = CommentScrollRect.content.GetChild(0).GetComponent<CommentItem>();
  361. ResourceManager.Save(commentItem);
  362. CommentItems.Remove(commentItem);
  363. PlayerFirstDisplayIndex++;
  364. }
  365. PlayerLastDisplayIndex++;
  366. CommentData commentData = PlayerCommentDatas[PlayerLastDisplayIndex];
  367. CommentItem newCommentItem = ResourceManager.GetCommentItem(commentData.NickName, commentData.SerialNumber, commentData.Content);
  368. CommentItems.Add(newCommentItem);
  369. }
  370. int offset = isDownload ? 1 : 0;
  371. float scaleFactor = isDownload ? CommentScrollRect.GetComponent<Image>().canvas.scaleFactor : 1;
  372. if (saveAmt > 0)
  373. {
  374. CommentScrollRect.content.position += new Vector3(0, -(saveAmt - offset)*CommentItemHeight*scaleFactor, 0);
  375. CommentScrollRect.AddContentOffset(new Vector3(0, -(saveAmt - offset)* CommentItemHeight * scaleFactor, 0));
  376. }
  377. }
  378. else
  379. {
  380. int saveAmt = 0;
  381. int updateAmt = Mathf.Min(15, VisiteeCommentDatas.Count - VisiteeLastDisplayIndex - 1);
  382. for (int i = 0; i < updateAmt; i++)
  383. {
  384. if (CommentScrollRect.content.childCount >= CommentPanelMaxChildAmt)
  385. {
  386. saveAmt++;
  387. CommentItem commentItem = CommentScrollRect.content.GetChild(0).GetComponent<CommentItem>();
  388. ResourceManager.Save(commentItem);
  389. CommentItems.Remove(commentItem);
  390. VisiteeFirstDisplayIndex++;
  391. }
  392. VisiteeLastDisplayIndex++;
  393. CommentData commentData = VisiteeCommentDatas[VisiteeLastDisplayIndex];
  394. CommentItem newCommentItem = ResourceManager.GetCommentItem(commentData.NickName, commentData.SerialNumber, commentData.Content);
  395. CommentItems.Add(newCommentItem);
  396. }
  397. int offset = isDownload ? 1 : 0;
  398. float scaleFactor = isDownload ? CommentScrollRect.GetComponent<Image>().canvas.scaleFactor : 1;
  399. if (saveAmt > 0)
  400. {
  401. CommentScrollRect.content.position += new Vector3(0, -(saveAmt - offset)* CommentItemHeight * scaleFactor, 0);
  402. CommentScrollRect.AddContentOffset(new Vector3(0, -(saveAmt - offset)* CommentItemHeight * scaleFactor, 0));
  403. }
  404. }
  405. }
  406. public static void PreviousCommentPage(bool isPlayer)
  407. {
  408. if (CommentScrollRect.content.childCount == 0)
  409. {
  410. return;
  411. }
  412. //Debug.Log("PreviousPage");
  413. if (isPlayer)
  414. {
  415. if (PlayerCommentDatas.Count > CommentPanelMaxChildAmt && PlayerFirstDisplayIndex > 0)
  416. {
  417. int revertAmt = Mathf.Min(CommentPanelMaxRevertAmt, PlayerFirstDisplayIndex);
  418. for (int i = 0; i < revertAmt; i++)
  419. {
  420. CommentItem commentItem = CommentScrollRect.content.GetChild(CommentScrollRect.content.childCount - 1).GetComponent<CommentItem>();
  421. ResourceManager.Save(commentItem);
  422. CommentItems.Remove(commentItem);
  423. CommentData commentData = VisiteeCommentDatas[VisiteeLastDisplayIndex];
  424. commentItem = ResourceManager.GetCommentItem(commentData.NickName, commentData.SerialNumber, commentData.Content);
  425. CommentItems.Add(commentItem);
  426. commentItem.transform.SetAsFirstSibling();
  427. PlayerLastDisplayIndex--;
  428. PlayerFirstDisplayIndex--;
  429. }
  430. if (revertAmt > 0)
  431. {
  432. CommentScrollRect.content.position += new Vector3(0, revertAmt* CommentItemHeight, 0);
  433. CommentScrollRect.AddContentOffset(new Vector3(0, revertAmt* CommentItemHeight, 0));
  434. }
  435. }
  436. }
  437. else
  438. {
  439. if (VisiteeCommentDatas.Count > CommentPanelMaxChildAmt && VisiteeFirstDisplayIndex > 0)
  440. {
  441. int revertAmt = Mathf.Min(CommentPanelMaxRevertAmt, VisiteeFirstDisplayIndex);
  442. for (int i = 0; i < revertAmt; i++)
  443. {
  444. CommentItem commentItem = CommentScrollRect.content.GetChild(CommentScrollRect.content.childCount - 1).GetComponent<CommentItem>();
  445. ResourceManager.Save(commentItem);
  446. CommentItems.Remove(commentItem);
  447. CommentData commentData = VisiteeCommentDatas[VisiteeLastDisplayIndex];
  448. commentItem = ResourceManager.GetCommentItem(commentData.NickName, commentData.SerialNumber, commentData.Content);
  449. CommentItems.Add(commentItem);
  450. commentItem.transform.SetAsFirstSibling();
  451. VisiteeLastDisplayIndex--;
  452. VisiteeFirstDisplayIndex--;
  453. }
  454. if (revertAmt > 0)
  455. {
  456. CommentScrollRect.content.position += new Vector3(0, revertAmt* CommentItemHeight, 0);
  457. CommentScrollRect.AddContentOffset(new Vector3(0, revertAmt* CommentItemHeight, 0));
  458. }
  459. }
  460. }
  461. }
  462. public static void ClearCommentPanel()
  463. {
  464. int childAmt = CommentScrollRect.content.childCount;
  465. for (int i = 0; i < childAmt; i++)
  466. {
  467. CommentItem commentItem = CommentScrollRect.content.GetChild(0).GetComponent<CommentItem>();
  468. ResourceManager.Save(commentItem);
  469. CommentItems.Remove(commentItem);
  470. }
  471. CommentScrollRect.verticalNormalizedPosition = 1;
  472. }
  473. public static void OnScroll(Vector2 position)
  474. {
  475. if (PullCommentDataFlag)
  476. {
  477. return;
  478. }
  479. if (CommentScrollRect.content.childCount == 0)
  480. {
  481. return;
  482. }
  483. if (position.y >= 1)
  484. {
  485. PreviousCommentPage(IsPlayer);
  486. }
  487. if (position.y <= 0)
  488. {
  489. if (IsPlayer)
  490. {
  491. if (PlayerLastDisplayIndex == PlayerCommentDatas.Count - 1)
  492. {
  493. PullCommentPage(true);
  494. }
  495. else if (PlayerLastDisplayIndex < PlayerCommentDatas.Count - 1)
  496. {
  497. NextCommentPage(true, false);
  498. }
  499. }
  500. else
  501. {
  502. if (VisiteeLastDisplayIndex == VisiteeCommentDatas.Count - 1)
  503. {
  504. PullCommentPage(false);
  505. }
  506. else if (VisiteeLastDisplayIndex < VisiteeCommentDatas.Count - 1)
  507. {
  508. NextCommentPage(false, false);
  509. }
  510. }
  511. }
  512. }
  513. public static void OpenRankPanel()
  514. {
  515. AudioManager.PlayClip(AudioLabel.Bubble);
  516. ResourceManager.Get(CanvasLabel.S_RankBK).TweenForCG();
  517. }
  518. public static void CloseRankPanel()
  519. {
  520. AudioManager.PlayClip(AudioLabel.ClickButton);
  521. ResourceManager.Get(CanvasLabel.S_RankBK).TweenBacCG();
  522. }
  523. public static void RecordRankPanel()
  524. {
  525. OpenRankPanelFlag = true;
  526. }
  527. public static void RecoverRankPanel()
  528. {
  529. if (OpenRankPanelFlag)
  530. {
  531. OpenRankPanelFlag = false;
  532. OpenRankPanel();
  533. }
  534. }
  535. public static void InitRankPanel()
  536. {
  537. if (Initializer.Inited && HttpManager.IsRankDataReady)
  538. {
  539. for (int i = 0; i < HttpManager.RankDatas.Count; i++)
  540. {
  541. ResourceManager.GetRanktem((i + 1).ToString(), HttpManager.RankDatas[i][1].ToString(), HttpManager.RankDatas[i][0].ToString());
  542. }
  543. }
  544. }
  545. public static void OnCommentFriendFilterToggleClick(bool value)
  546. {
  547. AudioManager.PlayClip(ResourceLabel.BtnClip);
  548. if (value)
  549. {
  550. EnableCommentFriendFilter();
  551. }
  552. else
  553. {
  554. DisableCommentFriendFilter();
  555. }
  556. }
  557. public static void EnableCommentFriendFilter()
  558. {
  559. IsFriendFilterOn = true;
  560. foreach (var commentItem in CommentItems)
  561. {
  562. if (!commentItem.IsFriend(FriendPanel.FriendAccountDatas))
  563. {
  564. commentItem.SetActive(false);
  565. }
  566. }
  567. }
  568. public static void DisableCommentFriendFilter()
  569. {
  570. IsFriendFilterOn = false;
  571. foreach (var commentItem in CommentItems)
  572. {
  573. commentItem.SetActive(true);
  574. }
  575. }
  576. private static void OnFriendListRefresh(List<AccountData> accountDatas)
  577. {
  578. if (IsFriendFilterOn)
  579. {
  580. EnableCommentFriendFilter();
  581. }
  582. }
  583. public static void OnEnterVisiteeGarden()
  584. {
  585. ResourceManager.SetActive(CanvasLabel.C_NotifyParent, false);
  586. }
  587. public static void OnExitVisiteeGarden()
  588. {
  589. if (ResourceManager.Get(CanvasLabel.C_Notify).gameObject.activeSelf)
  590. {
  591. ResourceManager.SetActive(CanvasLabel.C_NotifyParent, true);
  592. }
  593. }
  594. }