GardenManager.cs 21 KB

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