ManaMiniGame.cs 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using UnityEngine.Serialization;
  4. using System;
  5. using System.Xml;
  6. using System.Text;
  7. using System.Collections;
  8. using System.Collections.Generic;
  9. using Random = UnityEngine.Random;
  10. public class Award
  11. {
  12. #region 变量
  13. public static int BonusCoin;
  14. public static int BonusDiamond;
  15. public static string Info;
  16. public int Rate;
  17. public int Coin;
  18. public int Score;
  19. public int Diamond;
  20. public bool FlowerFlag;
  21. public bool DiamondFlag;
  22. #region 配置
  23. public static int FlowerID;
  24. public static bool FlowerLock;
  25. public int DiamondMin;
  26. public int DiamondMax;
  27. public string CoinFml;
  28. public string FlowerFml;
  29. public string DiamondFml;
  30. public List<float> Odds = new List<float>();
  31. public List<float> Standard = new List<float>();
  32. #endregion
  33. #endregion
  34. public void GetAward(int score)
  35. {
  36. #region 获得奖励
  37. #region Rate
  38. Score = (int)Mathf.Clamp(score, 1, Mathf.Infinity);
  39. if (Score < Standard[1])
  40. {
  41. Rate = 0;
  42. }
  43. else if (Score < Standard[2])
  44. {
  45. Rate = 1;
  46. }
  47. else
  48. {
  49. Rate = 2;
  50. }
  51. #endregion
  52. #region Reset
  53. FlowerFlag = false;
  54. DiamondFlag = false;
  55. #endregion
  56. StringBuilder sb = new StringBuilder();
  57. #region Coin
  58. Coin = (int)Auxiliary.FmlParse(CoinFml, "s", Score.ToString(), "l", Mathf.Clamp(ManaCenter.Level, 1, 9999).ToString());
  59. Coin = (int)(Coin * (1 + ManaCenter.SkillPlus) + BonusCoin);
  60. Coin = (int) Mathf.Clamp(Coin, 1, Mathf.Infinity);
  61. ManaReso.Get<Text>("Da_CoinLab").text = Coin.ToString();
  62. ManaReso.Get<Text>("Da_CoinLab").Resize(true, false);
  63. ManaReso.Get<ContentSizeFitter>("Da_CoinGroup").enabled = true;
  64. ManaReso.SetActive("Da_CoinLab", true);
  65. ManaCenter.Coin += Coin;
  66. sb.AppendFormat("{0}{1}{2} ", Language.GetStr("UI", "J_Info0"), "<(金币)>", Coin);
  67. #endregion
  68. #region Diamond
  69. float diamondRate = (float)Auxiliary.FmlParse(DiamondFml, "l", Mathf.Clamp(ManaCenter.Level, 1, 1000).ToString());
  70. if (Random.Range(0, 1f) <= diamondRate)
  71. {
  72. DiamondFlag = true;
  73. Diamond = (int)(Mathf.Lerp(DiamondMin, DiamondMax, Random.Range(0, 1f)) + BonusDiamond);
  74. ManaReso.Get<Text>("Da_DiamondLab").text = Diamond.ToString();
  75. ManaReso.Get<Text>("Da_DiamondLab").Resize(true, false);
  76. ManaReso.Get<ContentSizeFitter>("Da_DiamondGroup").enabled = true;
  77. ManaReso.SetActive("Da_DiamondLab", true);
  78. ManaCenter.Diamond += Diamond;
  79. ManaReso.SetActive("Da_Diamond", true);
  80. sb.AppendFormat("{0}{1}{2} ", Language.GetStr("UI", "J_Info0"), "<(钻石)>", Diamond);
  81. }
  82. else
  83. {
  84. if (BonusDiamond > 0)
  85. {
  86. DiamondFlag = true;
  87. Diamond = BonusDiamond;
  88. ManaReso.Get<Text>("Da_DiamondLab").text = Diamond.ToString();
  89. ManaReso.Get<Text>("Da_DiamondLab").Resize(true, false);
  90. ManaReso.Get<ContentSizeFitter>("Da_DiamondGroup").enabled = true;
  91. ManaReso.SetActive("Da_DiamondLab", true);
  92. ManaCenter.Diamond += Diamond;
  93. ManaReso.SetActive("Da_Diamond", true);
  94. sb.AppendFormat("{0}{1}{2} ", Language.GetStr("UI", "J_Info0"), "<(钻石)>", Diamond);
  95. }
  96. }
  97. #endregion
  98. #region Flower
  99. if (ManaTutorial.TutorialA)
  100. {
  101. FlowerFlag = true;
  102. FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic[1];
  103. ManaReso.SetActive("Da_FlowerIcon", true);
  104. ManaReso.Get<Image>("Da_FlowerIcon").sprite = flowerInfo.Icon;
  105. ManaReso.Get<Image>("Da_FlowerIcon").Resize(true, 0.25f, 0.25f);
  106. ManaReso.SetText("Da_FlowerLab", flowerInfo.Name);
  107. sb.AppendFormat("{0}{1}{2}", Language.GetStr("UI", "J_Info0"), "<(花朵)>", flowerInfo.Name);
  108. }
  109. else
  110. {
  111. if (!FlowerLock)
  112. {
  113. FlowerFlag = true;
  114. if (Random.Range(0, 1f) <= Odds[Rate])
  115. {
  116. FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic[FlowerID];
  117. flowerInfo.Unlock = true;
  118. ManaReso.SetActive("Da_Flower", true);
  119. ManaReso.Get<Image>("Da_FlowerIcon").sprite = flowerInfo.Icon;
  120. ManaReso.Get<Image>("Da_FlowerIcon").Resize(true, 0.25f, 0.25f);
  121. ManaReso.SetText("Da_FlowerLab", flowerInfo.Name);
  122. sb.AppendFormat("{0}{1}{2}", Language.GetStr("UI", "J_Info0"), "<(花朵)>", flowerInfo.Name);
  123. }
  124. else
  125. {
  126. ManaReso.SetActive("Da_Flower", false);
  127. ManaReso.SetText("Da_FlowerLab", Language.GetStr("UI", "Da_HigherScore"));
  128. }
  129. }
  130. }
  131. #endregion
  132. Info = sb.ToString();
  133. BonusCoin = 0;
  134. BonusDiamond = 0;
  135. #endregion
  136. ManaReso.SetActive("Da_Info", true);
  137. Auxiliary.Instance.DelayCall
  138. (
  139. () =>
  140. {
  141. ManaReso.Get<Text>("Da_CoinLab").SetLayoutDirty();
  142. ManaReso.Get<Text>("Da_DiamondLab").SetLayoutDirty();
  143. ManaReso.Get<ContentSizeFitter>("Da_CoinGroup").enabled = false;
  144. ManaReso.Get<ContentSizeFitter>("Da_DiamondGroup").enabled = false;
  145. InitializeAnim();
  146. },
  147. 2
  148. );
  149. }
  150. public void InitializeAnim()
  151. {
  152. #region 构造动画
  153. #region Reset
  154. ManaReso.Get("Da_Info").TweenForCG();
  155. ManaReso.SetText("Da_Tit", Language.GetStr("UI", "Da_Tit1"));
  156. ManaReso.SetText("Da_CoinLab", "0");
  157. ManaReso.SetText("Da_DiamondLab", "0");
  158. ManaReso.SetActive("Da_Lab", false);
  159. ManaReso.SetActive("Da_Quit", false);
  160. ManaReso.SetActive("Da_Cancel", false);
  161. ManaReso.SetActive("Da_CoinLab", false);
  162. ManaReso.SetActive("Da_ScoreTit", false);
  163. ManaReso.SetActive("Da_ScoreLab", false);
  164. ManaReso.SetActive("Da_GetAward", false);
  165. ManaReso.SetActive("Da_DiamondLab", false);
  166. ManaReso.SetActive("Da_VGroup", true);
  167. ManaReso.SetActive("Da_HGroup1", false);
  168. ManaReso.SetActive("Da_FlowerGroup", false);
  169. ManaReso.SetActive("Da_DiamondGroup", false);
  170. if (FlowerFlag)
  171. {
  172. ManaReso.SetActive("Da_FlowerGroup", true);
  173. }
  174. if (DiamondFlag)
  175. {
  176. ManaReso.SetActive("Da_DiamondGroup", true);
  177. }
  178. Auxiliary.Instance.DelayCall
  179. (
  180. () =>
  181. {
  182. ManaReso.Get<VerticalLayoutGroup>("Da_VGroup").enabled = false;
  183. ManaReso.SetActive("Da_CoinGroup", false);
  184. ManaReso.SetActive("Da_FlowerGroup", false);
  185. ManaReso.SetActive("Da_DiamondGroup", false);
  186. },
  187. 1
  188. );
  189. float timeCoin = Mathf.Lerp(0, 1.5f, Mathf.Clamp01(Coin / 15f));
  190. float timeScore = Mathf.Lerp(0, 1.5f, Mathf.Clamp01(Score / 50f));
  191. float timeDiamond = Mathf.Lerp(0, 1.5f, Mathf.Clamp01(Diamond / 15f));
  192. float time = Mathf.Max(timeCoin, timeDiamond);
  193. ManaReso.Get("Da_CoinLab").CreateTweenNumber(0, Coin, time, false, true, Curve.EaseOutQuad);
  194. ManaReso.Get("Da_ScoreLab").CreateTweenNumber(0, Score, timeScore, false, true, Curve.EaseOutQuad);
  195. ManaReso.Get("Da_DiamondLab").CreateTweenNumber(0, Diamond, time, false, true, Curve.EaseOutQuad);
  196. #endregion
  197. #region 花
  198. TweenRoot tween;
  199. if (FlowerFlag)
  200. {
  201. tween = ManaReso.Get("Da_CoinLab").GetTweenNumber();
  202. tween.AddEventOnetime
  203. (
  204. EventType.ForwardFinish,
  205. () =>
  206. {
  207. ManaReso.Get("Da_FlowerGroup").TweenReForScale();
  208. }
  209. );
  210. }
  211. #endregion
  212. #region 按钮
  213. if (FlowerFlag)
  214. {
  215. tween = ManaReso.Get("Da_FlowerGroup").GetTweenScale();
  216. tween.AddEventOnetime
  217. (
  218. EventType.ForwardFinish,
  219. () =>
  220. {
  221. ManaReso.Get("Da_GetAward").TweenReForCG();
  222. }
  223. );
  224. }
  225. else
  226. {
  227. tween = ManaReso.Get("Da_CoinLab").GetTweenNumber();
  228. tween.AddEventOnetime
  229. (
  230. EventType.ForwardFinish,
  231. () =>
  232. {
  233. ManaReso.Get("Da_GetAward").TweenReForCG();
  234. }
  235. );
  236. }
  237. if (ManaTutorial.TutorialA)
  238. {
  239. tween = ManaReso.Get("Da_GetAward").GetTweenCG();
  240. tween.AddEventOnetime
  241. (
  242. EventType.ForwardFinish,
  243. () =>
  244. {
  245. Tutorial.HightScreen(ManaReso.Get("Da_Arrow0"), ManaReso.Get("Da_Arrow1"), ManaReso.Get("Da_GetAward"));
  246. }
  247. );
  248. }
  249. ManaReso.AddButtonEventOnetime
  250. (
  251. "Da_GetAward",
  252. () =>
  253. {
  254. ManaReso.Get("Da_VGroup").GetComponent<VerticalLayoutGroup>().enabled = true;
  255. }
  256. );
  257. #endregion
  258. #region 得分
  259. if (Rate == 0)
  260. {
  261. tween = ManaReso.Get("Da_Star1").GetTweenScale();
  262. }
  263. else if (Rate == 1)
  264. {
  265. tween = ManaReso.Get("Da_Star2").GetTweenScale();
  266. }
  267. else if (Rate == 2)
  268. {
  269. tween = ManaReso.Get("Da_Star3").GetTweenScale();
  270. }
  271. tween.AddEventOnetime
  272. (
  273. EventType.ForwardFinish,
  274. () =>
  275. {
  276. ManaReso.Get("Da_ScoreTit").TweenReForFont();
  277. }
  278. );
  279. tween = ManaReso.Get("Da_ScoreTit").GetTweenFont();
  280. tween.InOrigin = true;
  281. tween.AddEventOnetime
  282. (
  283. EventType.ForwardFinish,
  284. () =>
  285. {
  286. ManaReso.Get("Da_ScoreLab").TweenReForNumber();
  287. }
  288. );
  289. #endregion
  290. #region 五角星
  291. tween = ManaReso.Get("Da_Star3").GetTweenScale();
  292. tween.InOrigin = true;
  293. tween = ManaReso.Get("Da_Star2").GetTweenScale();
  294. tween.InOrigin = true;
  295. tween = ManaReso.Get("Da_Star1").GetTweenScale();
  296. tween.InOrigin = true;
  297. tween = ManaReso.Get("Da_Info").GetTweenCG();
  298. tween.AddEventOnetime
  299. (
  300. EventType.ForwardFinish,
  301. () =>
  302. {
  303. ManaReso.Get("Da_Star1").TweenReForScale();
  304. ManaReso.SetActive("Da_HGroup1", true);
  305. }
  306. );
  307. if (Rate == 0)
  308. {
  309. ManaReso.SetActive("Da_Star2", false);
  310. ManaReso.SetActive("Da_Star3", false);
  311. }
  312. else if (Rate == 1)
  313. {
  314. ManaReso.SetActive("Da_Star2", true);
  315. ManaReso.SetActive("Da_Star3", false);
  316. tween = ManaReso.Get("Da_Star1").GetTweenScale();
  317. tween.AddEventOnetime
  318. (
  319. EventType.ForwardFinish,
  320. () =>
  321. {
  322. ManaReso.Get("Da_Star2").TweenReForScale();
  323. }
  324. );
  325. }
  326. else if (Rate == 2)
  327. {
  328. ManaReso.SetActive("Da_Star2", true);
  329. ManaReso.SetActive("Da_Star3", true);
  330. tween = ManaReso.Get("Da_Star1").GetTweenScale();
  331. tween.AddEventOnetime
  332. (
  333. EventType.ForwardFinish,
  334. () =>
  335. {
  336. ManaReso.Get("Da_Star2").TweenReForScale();
  337. }
  338. );
  339. tween = ManaReso.Get("Da_Star2").GetTweenScale();
  340. tween.AddEventOnetime
  341. (
  342. EventType.ForwardFinish,
  343. () =>
  344. {
  345. ManaReso.Get("Da_Star3").TweenReForScale();
  346. }
  347. );
  348. }
  349. #endregion
  350. #region 金币钻石
  351. tween = ManaReso.Get("Da_ScoreLab").GetTweenNumber();
  352. tween.AddEventOnetime
  353. (
  354. EventType.ForwardFinish,
  355. () =>
  356. {
  357. ManaReso.Get("Da_CoinGroup").TweenReForScale();
  358. if (DiamondFlag)
  359. {
  360. ManaReso.Get("Da_DiamondGroup").TweenReForScale();
  361. }
  362. }
  363. );
  364. tween = ManaReso.Get("Da_CoinGroup").GetTweenScale();
  365. tween.AddEventOnetime
  366. (
  367. EventType.ForwardFinish,
  368. () =>
  369. {
  370. ManaReso.Get("Da_CoinLab").TweenReForNumber();
  371. }
  372. );
  373. if (DiamondFlag)
  374. {
  375. tween = ManaReso.Get("Da_DiamondGroup").GetTweenScale();
  376. tween.AddEventOnetime
  377. (
  378. EventType.ForwardFinish,
  379. () =>
  380. {
  381. ManaReso.Get("Da_DiamondLab").TweenReForNumber();
  382. }
  383. );
  384. }
  385. #endregion
  386. #endregion
  387. }
  388. public Award(XmlAttributeCollection attribute)
  389. {
  390. Flower.CoinFml = attribute[8].Value;
  391. DropGold.CoinFml = attribute[7].Value;
  392. Star.CD = float.Parse(attribute[9].Value);
  393. Star.Time = float.Parse(attribute[11].Value);
  394. string[] strings = attribute[10].Value.Split(',');
  395. ManaGarden.MinStarTime = float.Parse(strings[0]);
  396. ManaGarden.MaxStarTime = float.Parse(strings[1]);
  397. ManaGarden.StarTimer = Mathf.Lerp(ManaGarden.MinStarTime, ManaGarden.MaxStarTime, Random.Range(0f, 1f));
  398. CoinFml = attribute[1].Value;
  399. FlowerFml = attribute[4].Value;
  400. DiamondFml = attribute[3].Value;
  401. strings = attribute[2].Value.Split(',');
  402. DiamondMin = int.Parse(strings[0]);
  403. DiamondMax = int.Parse(strings[1]);
  404. strings = attribute[5].Value.Split(',');
  405. Odds = new List<float>()
  406. {
  407. float.Parse(strings[0]),
  408. float.Parse(strings[1]),
  409. float.Parse(strings[2]),
  410. };
  411. strings = attribute[6].Value.Split(',');
  412. Standard = new List<float>()
  413. {
  414. float.Parse(strings[0]),
  415. float.Parse(strings[1]),
  416. float.Parse(strings[2]),
  417. };
  418. }
  419. }
  420. public class ManaMiniGame : Regist
  421. {
  422. #region 变量
  423. public static int Score
  424. {
  425. get { return Score_; }
  426. set
  427. {
  428. Score_ = value;
  429. ManaReso.SetText("D_ScoreLab", ScoreLab + Score_);
  430. }
  431. }
  432. public static bool Game
  433. {
  434. get { return Game_; }
  435. set
  436. {
  437. Game_ = value;
  438. if (Game_)
  439. {
  440. ManaReso.SetText("D_StatusLab", Language.GetStr("UI", "D_StatusLab1"));
  441. }
  442. else
  443. {
  444. ManaReso.SetText("D_StatusLab", Language.GetStr("UI", "D_StatusLab0"));
  445. }
  446. }
  447. }
  448. public static bool Pause
  449. {
  450. get { return Pause_; }
  451. set
  452. {
  453. Pause_ = value;
  454. if (Game)
  455. {
  456. if (Pause_)
  457. {
  458. ManaReso.SetText("D_StatusLab", Language.GetStr("UI", "D_StatusLab2"));
  459. }
  460. else
  461. {
  462. ManaReso.SetText("D_StatusLab", Language.GetStr("UI", "D_StatusLab1"));
  463. }
  464. }
  465. else if (Prepare)
  466. {
  467. if (Pause_)
  468. {
  469. PrepareLab.GetStreamScale().Pause();
  470. }
  471. else
  472. {
  473. PrepareLab.GetStreamScale().Resume();
  474. }
  475. }
  476. }
  477. }
  478. public static bool Panalty
  479. {
  480. get { return Panalty_; }
  481. set
  482. {
  483. Panalty_ = value;
  484. if (Game)
  485. {
  486. if (Panalty_)
  487. {
  488. ManaReso.SetText("D_StatusLab", Language.GetStr("UI", "D_StatusLab3"));
  489. }
  490. else
  491. {
  492. ManaReso.SetText("D_StatusLab", Language.GetStr("UI", "D_StatusLab1"));
  493. }
  494. }
  495. }
  496. }
  497. public static float GameTimer
  498. {
  499. get { return GameTimer_; }
  500. set
  501. {
  502. GameTimer_ = value;
  503. TimerLab.text = (GameTime-GameTimer_).ToString("0.0");
  504. TimerBk.fillAmount = GameTimer_/GameTime;
  505. TimerBk.material.SetFloat("_Fill", TimerBk.fillAmount);
  506. }
  507. }
  508. private static int Score_;
  509. private static bool Game_;
  510. private static bool Pause_;
  511. private static bool Panalty_;
  512. private static float GameTimer_;
  513. public static Text TimerLab;
  514. public static Text PrepareLab;
  515. public static Image TimerBk;
  516. public static Award Award;
  517. public static Transform D_Grid;
  518. public static Transform D_Timer;
  519. public static Transform D_Begin;
  520. public static Transform D_Status1;
  521. public static Transform D_Status2;
  522. public static Transform D_Status3;
  523. public static Transform D_Operate1;
  524. public static Transform D_Operate2;
  525. public static Transform D_Operate3;
  526. public static List<int> IndexList = new List<int>();
  527. public static List<Drop> DropList = new List<Drop>();
  528. public static List<Flower> OpList = new List<Flower>();
  529. public static List<Flower> IdleList = new List<Flower>();
  530. public static List<Flower> FadeList = new List<Flower>();
  531. public static List<Flower> FlowerListC = new List<Flower>();
  532. public static Dictionary<int, Flower> FlowerDic = new Dictionary<int, Flower>();
  533. public static int FlowerID;
  534. public static int MiniGameIndex;
  535. public static string ScoreLab;
  536. public static bool GameA;
  537. public static bool GameB;
  538. public static bool GameC;
  539. public static bool Prepare;
  540. public static bool FlowerLock;
  541. public static bool TutorialLock = true;
  542. public static bool DropDiamond;
  543. public static float OpTimer;
  544. public static float FadeTimer;
  545. public static float GoldTimer;
  546. public static float PanaltyTimer;
  547. public static float PrepareTimer;
  548. public static float DiamondTimer;
  549. public static float OpTime = 1.5f;
  550. public static float FadeTime = 2f;
  551. public static float GameTime = 45f;
  552. public static float PanaltyTime = 1f;
  553. public static float NewOpTime;
  554. public static float NewFadeTime;
  555. #endregion
  556. private void FixedUpdate()
  557. {
  558. if (Pause)
  559. {
  560. return;
  561. }
  562. if (Game)
  563. {
  564. GameThreadA();
  565. GameThreadB();
  566. }
  567. if (Prepare)
  568. {
  569. PrepareThread();
  570. }
  571. }
  572. private void GameThreadA()
  573. {
  574. if (GameB)
  575. {
  576. return;
  577. }
  578. GameTimer += Time.fixedDeltaTime;
  579. if (GameTimer >= GameTime)
  580. {
  581. GameOver();
  582. return;
  583. }
  584. if (Panalty)
  585. {
  586. PanaltyTimer -= Time.fixedDeltaTime;
  587. if (PanaltyTimer <= 0)
  588. {
  589. Panalty = false;
  590. }
  591. }
  592. if (IdleList.Count > 0)
  593. {
  594. OpTimer -= Time.fixedDeltaTime;
  595. if (OpTimer <= 0)
  596. {
  597. NewOpTime -= NewOpTime * 0.03f;
  598. OpTimer = NewOpTime;
  599. CreateOperate();
  600. }
  601. }
  602. BonusThread();
  603. }
  604. private void GameThreadB()
  605. {
  606. if (GameA)
  607. {
  608. return;
  609. }
  610. GameTimer += Time.fixedDeltaTime;
  611. if (GameTimer >= GameTime)
  612. {
  613. GameOver();
  614. return;
  615. }
  616. if (Panalty)
  617. {
  618. PanaltyTimer -= Time.fixedDeltaTime;
  619. if (PanaltyTimer <= 0)
  620. {
  621. Panalty = false;
  622. }
  623. }
  624. if (FadeList.Count < 6)
  625. {
  626. FadeTimer -= Time.fixedDeltaTime;
  627. if (FadeTimer <= 0)
  628. {
  629. FadeTimer = NewFadeTime;
  630. Fade();
  631. }
  632. }
  633. BonusThread();
  634. }
  635. private void BonusThread()
  636. {
  637. GoldTimer -= Time.fixedDeltaTime;
  638. if (GoldTimer < 0)
  639. {
  640. GoldTimer = Random.Range(3f, 6f);
  641. DropList.Add(ManaReso.GetDrop(ObjType.DropGold));
  642. }
  643. if (DropDiamond)
  644. {
  645. DiamondTimer -= Time.fixedDeltaTime;
  646. if (DiamondTimer < 0)
  647. {
  648. DropDiamond = false;
  649. DropList.Add(ManaReso.GetDrop(ObjType.DropDiamond));
  650. }
  651. }
  652. }
  653. private void PrepareThread()
  654. {
  655. PrepareTimer -= Time.fixedDeltaTime;
  656. if (PrepareTimer <= 0)
  657. {
  658. Prepare = false;
  659. GameBegin();
  660. }
  661. }
  662. public override void RegistValueA()
  663. {
  664. Award = new Award(ManaData.GetAwardConfig());
  665. MiniGameIndex = ManaData.GetPlayerInt("MiniGameIndex");
  666. }
  667. public override void RegistReference()
  668. {
  669. D_Grid = ManaReso.Get("D_Grid");
  670. D_Begin = ManaReso.Get("D_Begin");
  671. D_Timer = ManaReso.Get("D_Timer");
  672. D_Status1 = ManaReso.Get("D_Status1");
  673. D_Status2 = ManaReso.Get("D_Status2");
  674. D_Status3 = ManaReso.Get("D_Status3");
  675. D_Operate1 = ManaReso.Get("D_Operate1");
  676. D_Operate2 = ManaReso.Get("D_Operate2");
  677. D_Operate3 = ManaReso.Get("D_Operate3");
  678. TimerLab = ManaReso.Get<Text>("D_TimerLab");
  679. PrepareLab = ManaReso.Get<Text>("D_PrepareLab");
  680. TimerBk = ManaReso.Get<Image>("D_TimerIcon");
  681. }
  682. public static void Operate(int index, int slotIndex)
  683. {
  684. if (Panalty || !FadeList.Valid())
  685. {
  686. return;
  687. }
  688. if (IndexList.Count == 0)
  689. {
  690. return;
  691. }
  692. if (slotIndex == IndexList[0])
  693. {
  694. int uiIndex = IndexMap(IndexList[0]);
  695. ManaReso.Get<Image>("D_FlowerBtn" + uiIndex).material = Lib.GrayMat;
  696. ManaReso.Get<Button>("D_FlowerBtn" + uiIndex).interactable = false;
  697. ManaReso.Get<Image>("D_FlowerIcon" + uiIndex).material = Lib.GrayMat;
  698. ManaReso.SetActive("D_FlowerTick" + uiIndex, true);
  699. IndexList.RemoveAt(0);
  700. Flower flower = FlowerDic[slotIndex];
  701. ManaReso.GetHudText("+30", Color.white, 90, flower.ChildDic["ScorePosTra"], ManaReso.Get("D_HudParent"), true);
  702. Score += 30;
  703. flower.PlayParticle();
  704. TweenRoot tween = flower.FlowerIcon.TweenBacSr();
  705. ManaAudio.PlayClip(Clip.BtnClip);
  706. if (IndexList.Count == 0)
  707. {
  708. tween.AddEventOnetime
  709. (
  710. EventType.BackwardFinish,
  711. () =>
  712. {
  713. RoundEndB();
  714. RoundResetB();
  715. RoundBeginB();
  716. }
  717. );
  718. }
  719. }
  720. else
  721. {
  722. Panalty = true;
  723. PanaltyTimer = PanaltyTime;
  724. ManaReso.Get("D_FlowerIcon" + index).TweenForGra();
  725. ManaReso.Get("D_FlowerBtn" + index).Shake(0.5f, 3, new Vector3(20f, 0, 0), Curve.EaseOutQuad);
  726. ManaAudio.PlayClip(Clip.ErrorClip);
  727. }
  728. }
  729. public static void Operate(OpType opType)
  730. {
  731. if (Panalty || !OpList.Valid())
  732. {
  733. return;
  734. }
  735. if (OpList[0].Operate(opType))
  736. {
  737. IdleList.Add(OpList[0]);
  738. OpList.Remove(OpList[0]);
  739. if (OpList.Count >= 2)
  740. {
  741. OpList[0].SetFirstOp();
  742. OpList[1].SetSecondOp();
  743. }
  744. else if (OpList.Count >= 1)
  745. {
  746. OpList[0].SetFirstOp();
  747. }
  748. }
  749. else
  750. {
  751. Panalty = true;
  752. PanaltyTimer = PanaltyTime;
  753. }
  754. }
  755. public static void ResetOprerate()
  756. {
  757. ManaReso.Get<Image>("D_FlowerBtn1").material = null;
  758. ManaReso.Get<Image>("D_FlowerBtn2").material = null;
  759. ManaReso.Get<Image>("D_FlowerBtn3").material = null;
  760. ManaReso.Get<Image>("D_FlowerBtn4").material = null;
  761. ManaReso.Get<Image>("D_FlowerBtn5").material = null;
  762. ManaReso.Get<Image>("D_FlowerBtn6").material = null;
  763. ManaReso.Get<Button>("D_FlowerBtn1").interactable = true;
  764. ManaReso.Get<Button>("D_FlowerBtn2").interactable = true;
  765. ManaReso.Get<Button>("D_FlowerBtn3").interactable = true;
  766. ManaReso.Get<Button>("D_FlowerBtn4").interactable = true;
  767. ManaReso.Get<Button>("D_FlowerBtn5").interactable = true;
  768. ManaReso.Get<Button>("D_FlowerBtn6").interactable = true;
  769. ManaReso.Get<Image>("D_FlowerIcon1").material = null;
  770. ManaReso.Get<Image>("D_FlowerIcon2").material = null;
  771. ManaReso.Get<Image>("D_FlowerIcon3").material = null;
  772. ManaReso.Get<Image>("D_FlowerIcon4").material = null;
  773. ManaReso.Get<Image>("D_FlowerIcon5").material = null;
  774. ManaReso.Get<Image>("D_FlowerIcon6").material = null;
  775. ManaReso.SetActive("D_FlowerTick1", false);
  776. ManaReso.SetActive("D_FlowerTick2", false);
  777. ManaReso.SetActive("D_FlowerTick3", false);
  778. ManaReso.SetActive("D_FlowerTick4", false);
  779. ManaReso.SetActive("D_FlowerTick5", false);
  780. ManaReso.SetActive("D_FlowerTick6", false);
  781. }
  782. public static void CreateOperate()
  783. {
  784. ManaAudio.PlayClip(Clip.BubbleClip);
  785. if (ManaTutorial.TutorialA && TutorialLock)
  786. {
  787. Pause = true;
  788. TutorialLock = false;
  789. Flower flower = IdleList[4];
  790. flower.CreateOp(OpList.Count, OpType.Water);
  791. OpList.Add(flower);
  792. IdleList.Remove(flower);
  793. Tutorial.HightScreen(ManaReso.Get("D_WaterArrow0"), ManaReso.Get("D_WaterArrow1"), ManaReso.Get("D_Water1"));
  794. Tutorial.SetArea(OpList[0].OperateIcon.transform, 0.1f, 0.125f);
  795. ManaReso.AddButtonEventOnetime
  796. (
  797. "D_Water2",
  798. () =>
  799. {
  800. Pause = false;
  801. Tutorial.HightDisable();
  802. }
  803. );
  804. }
  805. else
  806. {
  807. Flower flower = IdleList[Random.Range(0, IdleList.Count)];
  808. flower.CreateOp(OpList.Count);
  809. OpList.Add(flower);
  810. IdleList.Remove(flower);
  811. }
  812. }
  813. public static void Fade()
  814. {
  815. for (int i = 0; i < IndexList.Count; i++)
  816. {
  817. Flower flower = FlowerDic[IndexList[i]];
  818. if (FadeList.UniqueAdd(flower))
  819. {
  820. IdleList.Remove(flower);
  821. flower.PlayParticle();
  822. flower.FlowerIcon.TweenForSr();
  823. if (FadeList.Count == 6)
  824. {
  825. RoundBeginB();
  826. }
  827. break;
  828. }
  829. }
  830. }
  831. public static void InitializeMode()
  832. {
  833. GameA = false;
  834. GameB = false;
  835. GameC = false;
  836. D_Operate1.SetActive(false);
  837. D_Operate2.SetActive(false);
  838. D_Operate3.SetActive(false);
  839. bool gameAvailibleB = ManaCenter.Level >= 18;
  840. bool gameAvailibleC = ManaGarden.MyFlower >= 2;
  841. float thresholdA;
  842. float thresholdB;
  843. float thresholdC;
  844. if (gameAvailibleB && gameAvailibleC)
  845. {
  846. thresholdA = 0.33f;
  847. thresholdB = 0.66f;
  848. thresholdC = 1f;
  849. }
  850. else if (gameAvailibleB)
  851. {
  852. thresholdA = 0.5f;
  853. thresholdB = 1;
  854. thresholdC = 0;
  855. }
  856. else if (gameAvailibleC)
  857. {
  858. thresholdA = 0.5f;
  859. thresholdB = 0;
  860. thresholdC = 1;
  861. }
  862. else
  863. {
  864. thresholdA = 1;
  865. thresholdB = 0;
  866. thresholdC = 0;
  867. }
  868. float posibility = Random.Range(0f, 1f);
  869. if (posibility <= thresholdA)
  870. {
  871. GameA = true;
  872. }
  873. else if (posibility <= thresholdB)
  874. {
  875. GameB = true;
  876. }
  877. else if (posibility <= thresholdC)
  878. {
  879. GameC = true;
  880. }
  881. if (ManaTutorial.TutorialB)
  882. {
  883. GameA = false;
  884. GameB = true;
  885. GameC = false;
  886. }
  887. if (ManaTutorial.TutorialE)
  888. {
  889. GameA = false;
  890. GameB = false;
  891. GameC = true;
  892. }
  893. }
  894. public static void InitializeAward()
  895. {
  896. float flowerRate = (float)Auxiliary.FmlParse(Award.FlowerFml, "l", ManaCenter.Level.ToString(), "f", ManaGarden.MyFlower.ToString());
  897. if (Random.Range(0, 1f) <= flowerRate)
  898. {
  899. if (ManaGarden.MyFlower < ManaGarden.TotalFlower)
  900. {
  901. foreach (var kv in ManaGarden.FlowerInfoDic)
  902. {
  903. if (kv.Value.Unlock == false)
  904. {
  905. Award.FlowerID = kv.Value.ID_;
  906. Award.FlowerLock = false;
  907. break;
  908. }
  909. }
  910. }
  911. else
  912. {
  913. Award.FlowerLock = true;
  914. }
  915. }
  916. else
  917. {
  918. Award.FlowerLock = true;
  919. }
  920. }
  921. public static void GameEnd()
  922. {
  923. PrepareLab.GetStreamScale().InOrigin = true;
  924. if (Game)
  925. {
  926. ManaCenter.MiniLock = false;
  927. ManaCenter.MiniTimer = Mathf.Lerp(180, 300, Random.Range(0, 1f));
  928. }
  929. ManaReso.Get("C_MiniGame").TweenForCG();
  930. if (ManaCenter.MiniTimer > 0)
  931. {
  932. ManaReso.Get("C_MiniGame").TweenForRect();
  933. }
  934. Score = 0;
  935. Pause = false;
  936. Game = false;
  937. Panalty = false;
  938. Prepare = false;
  939. GameTimer = GameTime;
  940. for (int i = 0; i < OpList.Count; i++)
  941. {
  942. OpList[i].GameOver();
  943. }
  944. for (int i = 0; i < IdleList.Count; i++)
  945. {
  946. IdleList[i].GameOver();
  947. }
  948. for (int i = 0; i < DropList.Count; i++)
  949. {
  950. DropList[i].Retrieve();
  951. DropList.RemoveAt(i--);
  952. }
  953. }
  954. public static void GameOver()
  955. {
  956. ManaAudio.PlayClip(Clip.MiniEndClip);
  957. Award.GetAward(Score);
  958. ManaCenter.MiniGameAmt++;
  959. FlowerLock = false;
  960. GameEnd();
  961. }
  962. public static void GameEnter()
  963. {
  964. if (ManaTutorial.TutorialA)
  965. {
  966. Award.FlowerID = 1;
  967. Award.FlowerLock = true;
  968. InitializeMode();
  969. }
  970. else
  971. {
  972. if (!FlowerLock)
  973. {
  974. InitializeMode();
  975. InitializeAward();
  976. FlowerLock = true;
  977. }
  978. }
  979. if (ManaTutorial.TutorialB)
  980. {
  981. InitializeMode();
  982. }
  983. if (GameA)
  984. {
  985. GameEnterA();
  986. }
  987. if (GameB)
  988. {
  989. GameEnterB();
  990. }
  991. if (GameC)
  992. {
  993. GameEnterC();
  994. }
  995. ScoreLab = Language.GetStr("UI", "D_ScoreLab");
  996. TimerBk.fillAmount = 0;
  997. TimerLab.text = GameTime.ToString("0");
  998. ManaReso.Get("C_MiniGame").TweenBacCG();
  999. }
  1000. public static void GameEnterA()
  1001. {
  1002. D_Operate1.SetActive(true);
  1003. D_Timer.SetParent(D_Status1);
  1004. D_Grid.SetParent(D_Status1);
  1005. D_Begin.SetParent(D_Operate1);
  1006. PrepareLab.SetParent(ManaReso.Get("D_PrepareLayout1"));
  1007. ManaReso.SetActive("D_Rip1", false);
  1008. ManaReso.SetActive("D_Water1", false);
  1009. ManaReso.SetActive("D_Fertilize1", false);
  1010. ManaReso.SetActive("D_Begin", true);
  1011. ManaReso.SetActive("D_DescA", true);
  1012. if (Award.FlowerLock)
  1013. {
  1014. for (int i = 1; i < 10; i++)
  1015. {
  1016. while (true)
  1017. {
  1018. FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic.Random();
  1019. if (flowerInfo.Unlock)
  1020. {
  1021. IdleList.Add(ManaReso.GetFlower(flowerInfo, ManaReso.Get("SlotMini" + i)));
  1022. break;
  1023. }
  1024. }
  1025. }
  1026. }
  1027. else
  1028. {
  1029. List<int> idList = new List<int>();
  1030. idList = new List<int>() {1, 2, 3, 4, 5, 6, 7, 8, 9};
  1031. int special = idList.Random(true);
  1032. Flower flower = ManaReso.GetFlower(ManaGarden.FlowerInfoDic[Award.FlowerID], ManaReso.Get("SlotMini" + special));
  1033. IdleList.Add(flower);
  1034. for (int i = 0; i < idList.Count; i++)
  1035. {
  1036. while (true)
  1037. {
  1038. FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic.Random();
  1039. if (flowerInfo.Unlock)
  1040. {
  1041. flower = ManaReso.GetFlower(flowerInfo, ManaReso.Get("SlotMini" + idList[i]));
  1042. IdleList.Add(flower);
  1043. break;
  1044. }
  1045. }
  1046. }
  1047. }
  1048. }
  1049. public static void GameEnterB()
  1050. {
  1051. D_Operate2.SetActive(true);
  1052. D_Timer.SetParent(D_Status2);
  1053. D_Grid.SetParent(D_Status2);
  1054. D_Begin.SetParent(D_Operate2);
  1055. PrepareLab.SetParent(ManaReso.Get("D_PrepareLayout2"));
  1056. ResetOprerate();
  1057. ManaReso.Get("D_Mask").TweenBacGra();
  1058. ManaReso.SetActive("D_FlowerBtn1", false);
  1059. ManaReso.SetActive("D_FlowerBtn2", false);
  1060. ManaReso.SetActive("D_FlowerBtn3", false);
  1061. ManaReso.SetActive("D_FlowerBtn4", false);
  1062. ManaReso.SetActive("D_FlowerBtn5", false);
  1063. ManaReso.SetActive("D_FlowerBtn6", false);
  1064. ManaReso.SetActive("D_Begin", true);
  1065. ManaReso.SetActive("D_DescB", true);
  1066. List<int> idList = new List<int>() {1, 2, 4, 5, 7, 8};
  1067. FlowerDic = new Dictionary<int, Flower>();
  1068. Flower flower;
  1069. if (Award.FlowerLock)
  1070. {
  1071. for (int i = 0; i < idList.Count; i++)
  1072. {
  1073. while (true)
  1074. {
  1075. FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic.Random();
  1076. if (flowerInfo.Unlock)
  1077. {
  1078. flower = ManaReso.GetFlower(flowerInfo, ManaReso.Get("SlotMini" + idList[i]));
  1079. IdleList.Add(flower);
  1080. FlowerDic.Add(idList[i], flower);
  1081. break;
  1082. }
  1083. }
  1084. }
  1085. }
  1086. else
  1087. {
  1088. int special = idList.Random(true);
  1089. flower = ManaReso.GetFlower(ManaGarden.FlowerInfoDic[Award.FlowerID], ManaReso.Get("SlotMini" + special));
  1090. IdleList.Add(flower);
  1091. FlowerDic.Add(special, flower);
  1092. for (int i = 0; i < idList.Count; i++)
  1093. {
  1094. while (true)
  1095. {
  1096. FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic.Random();
  1097. if (flowerInfo.Unlock)
  1098. {
  1099. flower = ManaReso.GetFlower(flowerInfo, ManaReso.Get("SlotMini" + idList[i]));
  1100. IdleList.Add(flower);
  1101. FlowerDic.Add(idList[i], flower);
  1102. break;
  1103. }
  1104. }
  1105. }
  1106. }
  1107. for (int i = 0; i < IdleList.Count; i++)
  1108. {
  1109. IdleList[i].FlowerIcon.CreateTweenSr(1, 0, 0.25f, true, false, Curve.EaseOutQuad, false, true);
  1110. }
  1111. }
  1112. public static void GameEnterC()
  1113. {
  1114. D_Operate3.SetActive(true);
  1115. ManaReso.SetActive("D_Begin", true);
  1116. ManaReso.SetActive("D_DescB", true);
  1117. D_Begin.SetParent(D_Operate3);
  1118. D_Timer.SetParent(D_Status3);
  1119. D_Grid.SetParent(D_Status3);
  1120. PrepareLab.SetParent(ManaReso.Get("D_PrepareLayout3"));
  1121. FlowerListC = new List<Flower>();
  1122. List<int> slotList = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  1123. FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic.Random(false, flowerIndo => { return flowerIndo.Unlock; });
  1124. FlowerID = flowerInfo.ID_;
  1125. FlowerListC.Add(ManaReso.GetFlower(flowerInfo, ManaReso.Get("SlotMini" + slotList.Random(true))));
  1126. while (slotList.Count > 0)
  1127. {
  1128. flowerInfo = ManaGarden.FlowerInfoDic.Random(false, flowerIndo => { return flowerIndo.Unlock; });
  1129. for (int i = 0; i < Mathf.Min(Random.Range(2, 9), slotList.Count); i++)
  1130. {
  1131. FlowerListC.Add(ManaReso.GetFlower(flowerInfo, ManaReso.Get("SlotMini" + slotList.Random(true))));
  1132. }
  1133. }
  1134. for (int i = 0; i < FlowerListC.Count; i++)
  1135. {
  1136. FlowerListC[i].FlowerIcon.CreateTweenSr(1, 0, 0.25f, true, false, Curve.EaseOutQuad, false, true);
  1137. FlowerListC[i].FlowerIcon.GetTweenSr().InDestination = true;
  1138. }
  1139. }
  1140. public static void GameBegin()
  1141. {
  1142. Game = true;
  1143. MiniGameIndex++;
  1144. Score = 0;
  1145. OpTimer = OpTime;
  1146. FadeTimer = FadeTime;
  1147. GoldTimer = Random.Range(3f, 6f);
  1148. GameTimer = 0;
  1149. NewOpTime = OpTime;
  1150. NewFadeTime = FadeTime;
  1151. DiamondTimer = Random.Range(0f, GameTime - 5);
  1152. if (GameA)
  1153. {
  1154. for (int i = 0; i < IdleList.Count; i++)
  1155. {
  1156. IdleList[i].GameBegin();
  1157. }
  1158. }
  1159. if (GameB)
  1160. {
  1161. RoundResetB();
  1162. }
  1163. if (GameC)
  1164. {
  1165. RoundBeginC();
  1166. }
  1167. if (Random.Range(5, 9) <= MiniGameIndex)
  1168. {
  1169. MiniGameIndex = 0;
  1170. DropDiamond = true;
  1171. }
  1172. else
  1173. {
  1174. if (Random.Range(0, 1f) <= 0.01f)
  1175. {
  1176. DropDiamond = true;
  1177. }
  1178. else
  1179. {
  1180. DropDiamond = false;
  1181. }
  1182. }
  1183. }
  1184. public static void GamePrepare()
  1185. {
  1186. Prepare = true;
  1187. PrepareTimer = 3;
  1188. ManaReso.Get("D_Begin").SetActive(false);
  1189. ManaReso.Get("D_DescA").SetActive(false);
  1190. ManaReso.Get("D_DescB").SetActive(false);
  1191. ManaReso.Get("D_DescC").SetActive(false);
  1192. if (GameA)
  1193. {
  1194. ManaReso.Get("D_Rip1").SetActive(true);
  1195. ManaReso.Get("D_Water1").SetActive(true);
  1196. ManaReso.Get("D_Fertilize1").SetActive(true);
  1197. }
  1198. if (GameB)
  1199. {
  1200. ManaReso.Get("D_Mask").TweenForGra();
  1201. ManaReso.SetActive("D_FlowerBtn1", true);
  1202. ManaReso.SetActive("D_FlowerBtn2", true);
  1203. ManaReso.SetActive("D_FlowerBtn3", true);
  1204. ManaReso.SetActive("D_FlowerBtn4", true);
  1205. ManaReso.SetActive("D_FlowerBtn5", true);
  1206. ManaReso.SetActive("D_FlowerBtn6", true);
  1207. ManaReso.SetSprite("D_FlowerIcon1", FlowerDic[1].FlowerInfo.Icon).Resize(true, 1f, 1f);
  1208. ManaReso.SetSprite("D_FlowerIcon2", FlowerDic[2].FlowerInfo.Icon).Resize(true, 1f, 1f);
  1209. ManaReso.SetSprite("D_FlowerIcon3", FlowerDic[4].FlowerInfo.Icon).Resize(true, 1f, 1f);
  1210. ManaReso.SetSprite("D_FlowerIcon4", FlowerDic[5].FlowerInfo.Icon).Resize(true, 1f, 1f);
  1211. ManaReso.SetSprite("D_FlowerIcon5", FlowerDic[7].FlowerInfo.Icon).Resize(true, 1f, 1f);
  1212. ManaReso.SetSprite("D_FlowerIcon6", FlowerDic[8].FlowerInfo.Icon).Resize(true, 1f, 1f);
  1213. }
  1214. PrepareLab.StreamForScale();
  1215. }
  1216. public static void RoundEndB()
  1217. {
  1218. ManaReso.Get("D_Mask").TweenForGra();
  1219. }
  1220. public static void RoundResetB()
  1221. {
  1222. for (int i = 0; i < FadeList.Count; i++)
  1223. {
  1224. IdleList.Add(FadeList[i]);
  1225. }
  1226. NewFadeTime -= NewFadeTime * 0.3f;
  1227. FadeTimer = NewFadeTime;
  1228. FadeList = new List<Flower>();
  1229. IndexList = new List<int>();
  1230. List<int> randomList = new List<int>() { 1, 2, 4, 5, 7, 8 };
  1231. for (int i = 0; i < randomList.Count; i++)
  1232. {
  1233. IndexList.Add(randomList.Random(true));
  1234. i--;
  1235. }
  1236. ResetOprerate();
  1237. }
  1238. public static void RoundBeginB()
  1239. {
  1240. ManaReso.Get("D_Mask").TweenBacGra();
  1241. if (ManaTutorial.TutorialB)
  1242. {
  1243. ManaTutorial.EnterB1();
  1244. }
  1245. }
  1246. public static void RoundEndC()
  1247. {
  1248. }
  1249. public static void RoundResetC()
  1250. {
  1251. }
  1252. public static void RoundBeginC()
  1253. {
  1254. ManaReso.Get("D_FlowerBtn7").TweenReForCG();
  1255. ManaReso.Get("D_FlowerBtn8").TweenReForCG();
  1256. ManaReso.Get("D_FlowerBtn9").TweenReForCG();
  1257. for (int i = 0; i < FlowerListC.Count; i++)
  1258. {
  1259. FlowerListC[i].FlowerIcon.TweenBacSr();
  1260. }
  1261. }
  1262. public static int IndexMap(int slotIndex)
  1263. {
  1264. if (slotIndex == 1)
  1265. {
  1266. return 1;
  1267. }
  1268. else if (slotIndex == 2)
  1269. {
  1270. return 2;
  1271. }
  1272. else if (slotIndex == 4)
  1273. {
  1274. return 3;
  1275. }
  1276. else if (slotIndex == 5)
  1277. {
  1278. return 4;
  1279. }
  1280. else if (slotIndex == 7)
  1281. {
  1282. return 5;
  1283. }
  1284. else if (slotIndex == 8)
  1285. {
  1286. return 6;
  1287. }
  1288. else
  1289. {
  1290. throw new Exception();
  1291. }
  1292. }
  1293. public void OnApplicationPause(bool pause)
  1294. {
  1295. if (!pause)
  1296. {
  1297. if (!ManaTutorial.TutorialA)
  1298. {
  1299. if (Game || Prepare)
  1300. {
  1301. ManaReso.Get<Button>("D_Quit").onClick.Invoke();
  1302. }
  1303. }
  1304. }
  1305. }
  1306. }
  1307. #region DebugList
  1308. //结束界面的图标能否重复显示
  1309. #endregion