GardenManager.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using UnityEngine.Events;
  4. using UnityEngine.EventSystems;
  5. using System;
  6. using System.Xml;
  7. using System.Linq;
  8. using System.Collections;
  9. using System.Collections.Generic;
  10. using Random = UnityEngine.Random;
  11. public class GardenLabel
  12. {
  13. public static string GardenBK2 = "GardenBK2";
  14. public static string GardenBK3 = "GardenBK3";
  15. public static string GardenBK4 = "GardenBK4";
  16. public static string BK2RightPos = "BK2RightPos";
  17. public static string BK2LeftPos = "BK2LeftPos";
  18. public static string BK3RightPos = "BK3RightPos";
  19. public static string BK3LeftPos = "BK3LeftPos";
  20. public static string BK4RightPos = "BK4RightPos";
  21. public static string BK4LeftPos = "BK4LeftPos";
  22. public static string MinigameLeftPos = "MinigameLeftPos";
  23. public static string GardenCloud1 = "GardenCloud1";
  24. public static string GardenCloud2 = "GardenCloud2";
  25. public static string GardenCloud3 = "GardenCloud3";
  26. public static string BirdPivot = "BirdPivot";
  27. public static string GardenLeftTree = "GardenLeftTree";
  28. public static string GardenRightTree = "GardenRightTree";
  29. public static string GardenRainbow = "GardenRainbow";
  30. public static string Minigame = "Minigame";
  31. public static string SlotPage = "SlotPage";
  32. public static string GardenPivot = "GardenPivot";
  33. public static string GardenPlayerPos = "GardenPlayerPos";
  34. public static string Minigame_DropAward_LeftBorder = "Minigame_DropAward_LeftBorder";
  35. public static string FindMinigame_DropAward_RightBorder = "FindMinigame_DropAward_RightBorder";
  36. public static string MemoryMinigame_DropAward_RightBorder = "MemoryMinigame_DropAward_RightBorder";
  37. public static string MinigameSlot1 = "MinigameSlot1";
  38. public static string MinigameSlot2 = "MinigameSlot2";
  39. public static string MinigameSlot3 = "MinigameSlot3";
  40. public static string MinigameSlot4 = "MinigameSlot4";
  41. public static string MinigameSlot5 = "MinigameSlot5";
  42. public static string MinigameSlot6 = "MinigameSlot6";
  43. public static string MinigameSlot7 = "MinigameSlot7";
  44. public static string MinigameSlot8 = "MinigameSlot8";
  45. public static string MinigameSlot9 = "MinigameSlot9";
  46. }
  47. public enum ElfType
  48. {
  49. Bee_Red,
  50. Bee_Blue,
  51. Bee_White,
  52. Bee_Purple,
  53. Bee_Yellow,
  54. Beetle_Red,
  55. Beetle_Blue,
  56. Beetle_White,
  57. Beetle_Purple,
  58. Beetle_Yellow,
  59. Butterfly_Red,
  60. Butterfly_Blue,
  61. Butterfly_White,
  62. Butterfly_Purple,
  63. Butterfly_Yellow,
  64. Dragonfly_Red,
  65. Dragonfly_Blue,
  66. Dragonfly_White,
  67. Dragonfly_Purple,
  68. Dragonfly_Yellow,
  69. }
  70. public class GardenManager : Regist
  71. {
  72. #region Config
  73. public static int TotalSlot
  74. {
  75. get { return totalSlot; }
  76. set
  77. {
  78. totalSlot = value;
  79. ResourceManager.SetText(CanvasLabel.G_CollectLab2, string.Format("{0}/{1}", totalSlot, TotalSlotPage * TotalSlotInOnePage));
  80. }
  81. }
  82. public static int totalSlot;
  83. public static int TotalSlotPage
  84. {
  85. get { return SlotPageList.Count; }
  86. }
  87. public static int TotalUnlockFlower
  88. {
  89. get { return totalUnlockFlower; }
  90. set
  91. {
  92. totalUnlockFlower = value;
  93. AchieveManager.UpdateStatus(AchieveType.UnlockFlowerAmt, totalUnlockFlower);
  94. ResourceManager.SetText(CanvasLabel.F_FlowerLab, string.Format("{0}", TotalUnlockFlower));
  95. ResourceManager.SetText(CanvasLabel.G_CollectLab1, string.Format("{0}/{1}", TotalUnlockFlower, TotalFlower));
  96. if (totalUnlockFlower >= TutorialManager.MinFlowerForFindSoloGame && Manager.GardenLevel >= TutorialManager.FindSoloMinigameTutorialLevel)
  97. {
  98. if (TutorialManager.findSoloMinigameTutorial)
  99. {
  100. TutorialManager.PlayFindSoloGame();
  101. }
  102. }
  103. if (totalUnlockFlower >= TutorialManager.MinFlowerForFindMissingGame && Manager.GardenLevel >= TutorialManager.FindMissingMinigameTutorialLevel)
  104. {
  105. if (TutorialManager.findMissingMinigameTutorial)
  106. {
  107. TutorialManager.PlayFindMissingGame();
  108. }
  109. }
  110. }
  111. }
  112. private static int totalUnlockFlower;
  113. public static int TotalUnlockSpecialFlower
  114. {
  115. get { return totalUnlockSpecialFlower; }
  116. set
  117. {
  118. totalUnlockSpecialFlower = value;
  119. TotalUnlockFlower = totalUnlockSpecialFlower + totalUnlockNormalFlower;
  120. }
  121. }
  122. private static int totalUnlockSpecialFlower;
  123. public static int TotalUnlockNormalFlower
  124. {
  125. get { return totalUnlockNormalFlower; }
  126. set
  127. {
  128. totalUnlockNormalFlower = value;
  129. TotalUnlockFlower = totalUnlockSpecialFlower + totalUnlockNormalFlower;
  130. }
  131. }
  132. private static int totalUnlockNormalFlower;
  133. public static int TotalFlower;
  134. public static int TotalSpecialFlower
  135. {
  136. get { return totalSpecialFlower; }
  137. set
  138. {
  139. totalSpecialFlower = value;
  140. TotalFlower = totalSpecialFlower + totalNormalFlower;
  141. }
  142. }
  143. private static int totalSpecialFlower;
  144. public static int TotalNormalFlower
  145. {
  146. get { return totalNormalFlower; }
  147. set
  148. {
  149. totalNormalFlower = value;
  150. TotalFlower = totalSpecialFlower + totalNormalFlower;
  151. }
  152. }
  153. private static int totalNormalFlower;
  154. public static int FirstUnlockFlowerID
  155. {
  156. get
  157. {
  158. foreach (var kv in FlowerInfoDictionary)
  159. {
  160. if (!kv.Value.Unlock)
  161. {
  162. return kv.Key;
  163. }
  164. }
  165. return -1;
  166. }
  167. }
  168. public static List<int> UnlockedFlowerIDList
  169. {
  170. get
  171. {
  172. List<int> unlockedFlowerIDList = new List<int>();
  173. foreach (var kv in FlowerInfoDictionary)
  174. {
  175. if (kv.Value.Unlock)
  176. {
  177. unlockedFlowerIDList.Add(kv.Key);
  178. }
  179. }
  180. return unlockedFlowerIDList;
  181. }
  182. }
  183. public static int DefaultUnlockSlot = 1;
  184. public static bool InMinigameFlag = true;
  185. public static float MinCreateElfTime = 5;
  186. public static float MaxCreateElfTime = 30;
  187. public static float CreateElfTimer;
  188. public static float MinCreateStarTime;
  189. public static float MaxCreateStarTime;
  190. public static float CreateStarTimer;
  191. public static float MinCreateAwardTime = 5;
  192. public static float MaxCreateAwardTime = 15;
  193. public static float CreateAwardTimer;
  194. public static Text BuyFlowerButtonText;
  195. public static Text RetrieveFlowerButtonText;
  196. public static Button BuyFlowerButton;
  197. public static Button RetrieveFlowerButton;
  198. public static FlowerInfo SelectFlowerInfo;
  199. public static TweenMatFloat FlowerCardMaterialTween;
  200. public static GardenManager Instance;
  201. public static List<Slot> SlotList = new List<Slot>();
  202. public static List<Slot> PlantSlotList = new List<Slot>();
  203. public static List<Star> StarList = new List<Star>();
  204. public static List<ElfType> ElfList = new List<ElfType>();
  205. public static List<Transform> SlotPageList = new List<Transform>();
  206. public static Dictionary<int, FlowerInfo> FlowerInfoDictionary = new Dictionary<int, FlowerInfo>();
  207. public static int DefaultSlotPage = 2;
  208. public static int CriticalSlotIndex = 7;
  209. public static int TotalSlotInOnePage = 9;
  210. public static int LeftTopSlotIndex = 0;
  211. public static int RightTopSlotIndex = 3;
  212. public static int RightDownSlotIndex = 8;
  213. public static int LeftDownSlotIndex = 4;
  214. #endregion
  215. public void Update()
  216. {
  217. if (TutorialManager.NewplayerTutorial || Player.InDressRoom || SFSManager.GardenSmartFox.PlazaRoomController.JoinedPlazaRoom)
  218. {
  219. return;
  220. }
  221. CreateElfThread();
  222. CreateStarThread();
  223. CreateAwardThread();
  224. }
  225. public void CreateElfThread()
  226. {
  227. if (!InMinigameFlag)
  228. {
  229. return;
  230. }
  231. CreateElfTimer -= Time.deltaTime;
  232. if (CreateElfTimer < 0)
  233. {
  234. CreateElfTimer = Random.Range(MinCreateElfTime, MaxCreateElfTime);
  235. if (ElfList.Count > 0 && PlantSlotList.Count > 0)
  236. {
  237. PlantSlotList.Random()[0].PlantFlower.GetElf(ElfList.Random()[0]);
  238. }
  239. }
  240. }
  241. public void CreateStarThread()
  242. {
  243. if (InMinigameFlag && !Manager.MinigameFlag && !VisitManager.InVisit)
  244. {
  245. CreateStarTimer -= Time.deltaTime;
  246. if (CreateStarTimer < 0)
  247. {
  248. CreateStarTimer = Mathf.Lerp(MinCreateStarTime, MaxCreateStarTime, Random.Range(0f, 1f));
  249. StarList.Add(ResourceManager.GetStar());
  250. }
  251. }
  252. }
  253. public void CreateAwardThread()
  254. {
  255. if (InMinigameFlag)
  256. {
  257. CreateAwardTimer -= Time.deltaTime;
  258. if (CreateAwardTimer <= 0)
  259. {
  260. CreateAwardTimer = Random.Range(MinCreateAwardTime, MaxCreateAwardTime);
  261. List<Flower> spareList = new List<Flower>();
  262. for (int i = 0; i < PlantSlotList.Count; i++)
  263. {
  264. if (PlantSlotList[i].PlantFlower.HaveAward == false)
  265. {
  266. spareList.Add(PlantSlotList[i].PlantFlower);
  267. }
  268. }
  269. if (spareList.Count > 0)
  270. {
  271. spareList.Random()[0].HaveAward = true;
  272. }
  273. }
  274. }
  275. }
  276. public override void InstantiatePrefabs()
  277. {
  278. ResourceManager.Get(ResourceLabel.Garden, Folder.Scene, true, transform, true, ObjType.Garden).AddScript<Garden>();
  279. for (int i = 0; i < DefaultSlotPage; i++)
  280. {
  281. CreatePage();
  282. }
  283. #region 生成FlowerItem
  284. List<XmlAttributeCollection> attributeList = ConfigManager.GetFlowerConfig();
  285. for (int i = 0; i < attributeList.Count; i++)
  286. {
  287. FlowerInfo flowerInfo = new FlowerInfo(attributeList[i]);
  288. if (flowerInfo.IsSpecial)
  289. {
  290. TotalSpecialFlower++;
  291. }
  292. else
  293. {
  294. TotalNormalFlower++;
  295. }
  296. FlowerInfoDictionary.Add(flowerInfo.ID, flowerInfo);
  297. }
  298. #endregion
  299. }
  300. public override void FirstInit()
  301. {
  302. Instance = this;
  303. CreateElfTimer = Random.Range(MinCreateElfTime, MaxCreateElfTime);
  304. CreateAwardTimer = Random.Range(MinCreateAwardTime, MaxCreateAwardTime);
  305. UnlockSlot();
  306. for (int i = 0; i < ConfigManager.GetIntFormConfig(PlayerConfigLabel.ExtraSlot); i++)
  307. {
  308. UnlockSlot();
  309. }
  310. #region 读花朵存档
  311. List<int> flowerIDList = ConfigManager.GetFlowerList();
  312. for (int i = 0; i < flowerIDList.Count; i++)
  313. {
  314. FlowerInfoDictionary[flowerIDList[i]].Unlock = true;
  315. }
  316. List<int> flowerAmountList = ConfigManager.GetIntList(' ', PlayerConfigLabel.FlowerAmtList, null);
  317. for (int i = 0; i < flowerAmountList.Count; i++)
  318. {
  319. FlowerInfoDictionary[flowerIDList[i]].Amount = flowerAmountList[i];
  320. }
  321. List<KV<int, int>> plantList = ConfigManager.GetPlantList();
  322. for (int i = 0; i < plantList.Count; i++)
  323. {
  324. PlantFlower(plantList[i].Key, plantList[i].Value);
  325. }
  326. #endregion
  327. }
  328. public override void RegistReference()
  329. {
  330. RetrieveFlowerButton = ResourceManager.Get<Button>(CanvasLabel.H_Btn);
  331. RetrieveFlowerButtonText = ResourceManager.Get<Text>(CanvasLabel.H_BtnLab);
  332. BuyFlowerButton = ResourceManager.Get<Button>(CanvasLabel.H_Btn1);
  333. BuyFlowerButtonText = ResourceManager.Get<Text>(CanvasLabel.H_BtnLab1);
  334. }
  335. private static float PageXOffset = 18.9f;
  336. public static void CreatePage()
  337. {
  338. Transform tra = ResourceManager.Get(ResourceLabel.Page, Folder.Scene, false, ResourceManager.Get(GardenLabel.SlotPage), false, ObjType.SlotPage);
  339. float offset = TotalSlotPage * PageXOffset;
  340. tra.SetLX(offset);
  341. Vector3 pos = ResourceManager.Get(GardenLabel.SlotPage).position;
  342. pos.x = -offset;
  343. Garden.PagePos.Add(pos);
  344. for (int i = 0; i < TotalSlotInOnePage; i++)
  345. {
  346. Slot slot = tra.GetChild(i).GetComponent<Slot>();
  347. if (slot == null)
  348. {
  349. slot = tra.GetChild(i).AddScript<Slot>();
  350. }
  351. slot.Index = SlotList.Count;
  352. SlotList.Add(slot);
  353. }
  354. SlotPageList.Add(tra);
  355. }
  356. public static void UnlockSlot()
  357. {
  358. for (int i = 0; i < SlotList.Count; i++)
  359. {
  360. if (SlotList[i].Lock == false)
  361. {
  362. TotalSlot++;
  363. SlotList[i].Lock = true;
  364. SlotList[i].Available = true;
  365. if (TotalSlot% TotalSlotInOnePage == CriticalSlotIndex)
  366. {
  367. if (TotalSlot/ TotalSlotInOnePage + DefaultSlotPage >= TotalSlotPage)
  368. {
  369. CreatePage();
  370. }
  371. }
  372. return;
  373. }
  374. }
  375. }
  376. public static void ShowPlantCard(FlowerInfo flowerInfo, Slot seleSlot = null)
  377. {
  378. ShowFlowerCard(flowerInfo, null, seleSlot);
  379. RetrieveFlowerButton.SetActive(false);
  380. BuyFlowerButton.SetActive(true);
  381. }
  382. public static void PlantFlower(int id, int index)
  383. {
  384. Slot slot = SlotList[index];
  385. FlowerInfo flowerInfo = FlowerInfoDictionary[id];
  386. slot.Plant(flowerInfo, false);
  387. }
  388. public static void PlantFlower(FlowerInfo flowerInfo)
  389. {
  390. Slot slot = null;
  391. for (int i = 0; i < SlotList.Count; i++)
  392. {
  393. if (SlotList[i].Available)
  394. {
  395. slot = SlotList[i];
  396. break;
  397. }
  398. }
  399. if (slot == null)
  400. {
  401. Bubble.Show(null, Language.GetStr(LanguageLabel.Common__NoValidSlot));
  402. }
  403. else
  404. {
  405. slot.Plant(flowerInfo, true);
  406. UpdatePlantCardStatus(flowerInfo);
  407. UpdateRetrieveCardStatus(flowerInfo, RetrieveFlowerButton);
  408. AudioManager.PlayClip(AudioLabel.PlantFlower);
  409. }
  410. }
  411. private static void UpdatePlantCardStatus(FlowerInfo flowerInfo)
  412. {
  413. if (flowerInfo.RemainAmount == 0)
  414. {
  415. ResourceManager.Get<Button>(CanvasLabel.H_Icon2).interactable = false;
  416. ResourceManager.SetActive(CanvasLabel.H_AmtLab, false);
  417. ResourceManager.SetActive(CanvasLabel.H_Rotate, false);
  418. ResourceManager.SetText(CanvasLabel.H_Desc, Language.GetStr(LanguageLabel.UI__H_AllPlanted));
  419. }
  420. else
  421. {
  422. ResourceManager.Get<Button>(CanvasLabel.H_Icon2).interactable = true;
  423. ResourceManager.SetActive(CanvasLabel.H_AmtLab, true);
  424. ResourceManager.SetText(CanvasLabel.H_AmtLab, FlowerInfo.AmountTextPrefix + flowerInfo.RemainAmount);
  425. ResourceManager.SetActive(CanvasLabel.H_Rotate, true);
  426. ResourceManager.SetText(CanvasLabel.H_Desc, Language.GetStr(LanguageLabel.UI__H_PlantTip));
  427. }
  428. }
  429. private static void SetBuyFlowerButton(FlowerInfo flowerInfo, Button button, Text buttonLab)
  430. {
  431. if (flowerInfo.UnlockCur == Current.Free)
  432. {
  433. buttonLab.text = Language.GetStr(LanguageLabel.UI__H_BtnLab2);
  434. button.image.material = Lib.GrayMat;
  435. button.onClick.RemoveAllListeners();
  436. button.onClick.AddListener
  437. (
  438. () =>
  439. {
  440. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__H_BtnLab3));
  441. }
  442. );
  443. }
  444. else
  445. {
  446. buttonLab.text = Auxiliary.ImageParse(flowerInfo.UnlockCur) + flowerInfo.UnlockCost;
  447. button.image.material = null;
  448. button.onClick.RemoveAllListeners();
  449. button.onClick.AddListener
  450. (
  451. () =>
  452. {
  453. Manager.Pay
  454. (
  455. "",
  456. flowerInfo.UnlockCost,
  457. flowerInfo.UnlockCur,
  458. () =>
  459. {
  460. flowerInfo.Add();
  461. UpdatePlantCardStatus(flowerInfo);
  462. //HttpManager.UploadConfig();
  463. PlayFlowerCardMaterialTween();
  464. AudioManager.PlayClip(AudioLabel.GetCurrent);
  465. ResourceManager.Get(CanvasLabel.H_Icon1).FindChild($"{CanvasLabel.H_UIFlashLight}/{CanvasLabel.H_UIParticleSystem}").GetComponent<UIPartical>().Begin();
  466. },
  467. StaticsManager.ItemID.解锁花朵,
  468. StaticsManager.ConsumeModule.Shop,
  469. true,
  470. false,
  471. () =>
  472. {
  473. ResourceManager.Get(CanvasLabel.H_FlowerCard).TweenBacCG();
  474. TweenCG tweenCg = ResourceManager.Get(CanvasLabel.G_Flower).TweenBacCG();
  475. tweenCg.AddEventOnetime
  476. (
  477. EventType.BackwardFinish,
  478. () =>
  479. {
  480. ResourceManager.Get(CanvasLabel.F_Manage0).TweenForVec();
  481. }
  482. );
  483. }
  484. );
  485. }
  486. );
  487. }
  488. }
  489. private static void PlayFlowerCardMaterialTween()
  490. {
  491. if (ResourceManager.Get<Image>(CanvasLabel.H_Icon2).material != Lib.GrayMat)
  492. {
  493. return;
  494. }
  495. Material material = new Material(ResourceManager.Get<Image>(CanvasLabel.H_Icon2).material);
  496. MaterialUnit materialUnit = new MaterialUnit
  497. (
  498. material,
  499. ResourceManager.Get(CanvasLabel.H_Icon2),
  500. new List<string>()
  501. {
  502. MaterialLabel.GrayMatGrayLerp,
  503. }
  504. );
  505. FlowerCardMaterialTween = materialUnit.CreateTweenMatFloat(1, 0, 1, true, true, Curve.EaseOutQuad, false);
  506. FlowerCardMaterialTween.OnForwardStart = () =>
  507. {
  508. materialUnit.Transform.GetComponent<Image>().material = materialUnit.Material;
  509. };
  510. FlowerCardMaterialTween.OnForwardFinish = () =>
  511. {
  512. ResourceManager.Get<Image>(CanvasLabel.H_Icon2).material = null;
  513. };
  514. materialUnit.TweenForMatFloat();
  515. }
  516. public static void ShowRetrieveCard(FlowerInfo flowerInfo, Slot seleSlot = null)
  517. {
  518. ShowFlowerCard(flowerInfo, null, seleSlot);
  519. RetrieveFlowerButton.SetActive(true);
  520. BuyFlowerButton.SetActive(true);
  521. }
  522. public static void RetriveFlower(Slot seleSlot = null)
  523. {
  524. if (seleSlot != null && seleSlot.PlantFlower == null)
  525. seleSlot = null;
  526. if (seleSlot == null)
  527. {
  528. foreach (var slot in PlantSlotList)
  529. {
  530. if (slot.PlantFlower.FlowerInfo == SelectFlowerInfo)
  531. {
  532. seleSlot = slot;
  533. break;
  534. }
  535. }
  536. }
  537. seleSlot.Retrieve();
  538. UpdatePlantCardStatus(seleSlot.PlantFlowerInfo);
  539. UpdateRetrieveCardStatus(seleSlot.PlantFlowerInfo, RetrieveFlowerButton);
  540. }
  541. public static void RetriveAllFlower()
  542. {
  543. for (int i = 0; i < PlantSlotList.Count; i++)
  544. {
  545. PlantSlotList[i--].Retrieve();
  546. }
  547. }
  548. private static void UpdateRetrieveCardStatus(FlowerInfo flowerInfo, Button button)
  549. {
  550. if (flowerInfo.PlantAmt == 0)
  551. button.SetActive(false);
  552. else
  553. button.SetActive(true);
  554. }
  555. private static void SetRetrieveFlowerButton(Button button, Text buttonLab, Slot seleSlot = null)
  556. {
  557. RetrieveFlowerButton = button;
  558. buttonLab.text = Language.GetStr(LanguageLabel.UI__H_BtnLab1);
  559. button.image.material = null;
  560. button.onClick.RemoveAllListeners();
  561. button.onClick.AddListener
  562. (
  563. () =>
  564. {
  565. AudioManager.PlayClip(AudioLabel.ClickButton);
  566. RetriveFlower(seleSlot);
  567. }
  568. );
  569. }
  570. public static void ShowUnlockCard(FlowerInfo flowerInfo, Slot seleSlot = null)
  571. {
  572. ShowFlowerCard(flowerInfo, Lib.GrayMat, seleSlot);
  573. RetrieveFlowerButton.SetActive(false);
  574. BuyFlowerButton.SetActive(true);
  575. }
  576. private static void ShowFlowerCard(FlowerInfo flowerInfo, Material material, Slot seleSlot)
  577. {
  578. SetRetrieveFlowerButton(RetrieveFlowerButton, RetrieveFlowerButtonText, seleSlot);
  579. SetBuyFlowerButton(flowerInfo, BuyFlowerButton, BuyFlowerButtonText);
  580. SelectFlowerInfo = flowerInfo;
  581. ResourceManager.Get(CanvasLabel.H_FlowerCard).TweenForCG();
  582. ResourceManager.SetText(CanvasLabel.H_Lab, flowerInfo.Name);
  583. UpdatePlantCardStatus(flowerInfo);
  584. Image image = ResourceManager.Get<Image>(CanvasLabel.H_Icon2);
  585. image.material = material;
  586. image.sprite = flowerInfo.Icon;
  587. image.Resize(true, DeltaSize.FlowerCardSpriteX, DeltaSize.FlowerCardSpriteY);
  588. }
  589. public static void RetrieveAllElf()
  590. {
  591. for (int i = 0; i < PlantSlotList.Count; i++)
  592. {
  593. PlantSlotList[i].PlantFlower.RetrieveElf();
  594. }
  595. }
  596. public static void RetrieveAllStar()
  597. {
  598. for (int i = 0; i < StarList.Count; i++)
  599. {
  600. ResourceManager.Save(StarList[i]);
  601. }
  602. }
  603. }