ManaMiniGame.cs 42 KB

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