12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904 |
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.Serialization;
- using System;
- using System.Xml;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- using Random = UnityEngine.Random;
- public class Award
- {
- #region 变量
- public static int BonusCoin;
- public static int BonusDiamond;
- public static string Info;
-
- public int Rate;
- public int Coin;
- public int Score;
- public int Diamond;
- public bool FlowerFlag;
- public bool DiamondFlag;
- #region 配置
- public static int FlowerID;
- public static bool FlowerLock;
- public int DiamondMin;
- public int DiamondMax;
- public string CoinFml;
- public string FlowerFml;
- public string DiamondFml;
- public List<float> Odds = new List<float>();
- public List<float> Standard = new List<float>();
- #endregion
- #endregion
- public void GetAward(int score)
- {
- #region 获得奖励
- #region Rate
- Score = (int)Mathf.Clamp(score, 1, Mathf.Infinity);
- if (Score < Standard[1])
- {
- Rate = 0;
- }
- else if (Score < Standard[2])
- {
- Rate = 1;
- }
- else
- {
- Rate = 2;
- }
- #endregion
- #region Reset
- FlowerFlag = false;
- DiamondFlag = false;
- #endregion
- StringBuilder sb = new StringBuilder();
- #region Coin
- Coin = (int)Auxiliary.FmlParse(CoinFml, "s", Score.ToString(), "l", Mathf.Clamp(ManaCenter.Level, 1, 9999).ToString());
- Coin = (int)(Coin * (1 + ManaCenter.SkillPlus) + BonusCoin);
- Coin = (int) Mathf.Clamp(Coin, 1, Mathf.Infinity);
- ManaReso.Get<Text>("Da_CoinLab").text = Coin.ToString();
- ManaReso.Get<Text>("Da_CoinLab").Resize(true, false);
- ManaReso.Get<ContentSizeFitter>("Da_CoinGroup").enabled = true;
- ManaReso.SetActive("Da_CoinLab", true);
- ManaCenter.AddCoin(Coin, StaticsManager.ItemID.获得金币, StaticsManager.ConsumeModule.MiniGame);
- sb.AppendFormat("{0}{1}{2} ", Language.GetStr("UI", "J_Info0"), "<(金币)>", Coin);
- #endregion
- #region Diamond
- float diamondRate = (float)Auxiliary.FmlParse(DiamondFml, "l", Mathf.Clamp(ManaCenter.Level, 1, 1000).ToString());
-
- if (Random.Range(0, 1f) <= diamondRate)
- {
- DiamondFlag = true;
- Diamond = (int)(Mathf.Lerp(DiamondMin, DiamondMax, Random.Range(0, 1f)) + BonusDiamond);
- ManaReso.Get<Text>("Da_DiamondLab").text = Diamond.ToString();
- ManaReso.Get<Text>("Da_DiamondLab").Resize(true, false);
- ManaReso.Get<ContentSizeFitter>("Da_DiamondGroup").enabled = true;
- ManaReso.SetActive("Da_DiamondLab", true);
- ManaCenter.AddDiamond(Diamond, StaticsManager.ItemID.获得钻石, StaticsManager.ConsumeModule.MiniGame);
- ManaReso.SetActive("Da_Diamond", true);
- sb.AppendFormat("{0}{1}{2} ", Language.GetStr("UI", "J_Info0"), "<(钻石)>", Diamond);
- }
- else
- {
- if (BonusDiamond > 0)
- {
- DiamondFlag = true;
- Diamond = BonusDiamond;
- ManaReso.Get<Text>("Da_DiamondLab").text = Diamond.ToString();
- ManaReso.Get<Text>("Da_DiamondLab").Resize(true, false);
- ManaReso.Get<ContentSizeFitter>("Da_DiamondGroup").enabled = true;
- ManaReso.SetActive("Da_DiamondLab", true);
- ManaCenter.AddDiamond(Diamond, StaticsManager.ItemID.获得钻石, StaticsManager.ConsumeModule.MiniGame);
- ManaReso.SetActive("Da_Diamond", true);
- sb.AppendFormat("{0}{1}{2} ", Language.GetStr("UI", "J_Info0"), "<(钻石)>", Diamond);
- }
- else
- {
- Diamond = 0;
- }
- }
- #endregion
- #region Flower
- if (ManaTutorial.TutorialA)
- {
- FlowerFlag = true;
- FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic[1];
- ManaReso.SetActive("Da_FlowerIcon", true);
- ManaReso.Get<Image>("Da_FlowerIcon").sprite = flowerInfo.Icon;
- ManaReso.Get<Image>("Da_FlowerIcon").Resize(true, 0.2f, 0.2f);
- ManaReso.SetText("Da_FlowerLab", flowerInfo.Name);
- sb.AppendFormat("{0}{1}{2}", Language.GetStr("UI", "J_Info0"), "<(花朵)>", flowerInfo.Name);
- }
- else
- {
- if (!FlowerLock)
- {
- FlowerFlag = true;
- if (Random.Range(0, 1f) <= Odds[Rate])
- {
- FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic[FlowerID];
- flowerInfo.Unlock = true;
- ManaReso.SetActive("Da_Flower", true);
- ManaReso.Get<Image>("Da_FlowerIcon").sprite = flowerInfo.Icon;
- ManaReso.Get<Image>("Da_FlowerIcon").Resize(true, 0.2f, 0.2f);
- ManaReso.SetText("Da_FlowerLab", flowerInfo.Name);
- sb.AppendFormat("{0}{1}{2}", Language.GetStr("UI", "J_Info0"), "<(花朵)>", flowerInfo.Name);
- }
- else
- {
- ManaReso.SetActive("Da_Flower", false);
- ManaReso.SetText("Da_FlowerLab", Language.GetStr("UI", "Da_HigherScore"));
- }
- }
- }
- #endregion
- Info = sb.ToString();
- BonusCoin = 0;
- BonusDiamond = 0;
- #endregion
- ManaReso.SetActive("Da_Info", true);
- Auxiliary.Instance.DelayCall
- (
- () =>
- {
- ManaReso.Get<Text>("Da_CoinLab").SetLayoutDirty();
- ManaReso.Get<Text>("Da_DiamondLab").SetLayoutDirty();
- ManaReso.Get<ContentSizeFitter>("Da_CoinGroup").enabled = false;
- ManaReso.Get<ContentSizeFitter>("Da_DiamondGroup").enabled = false;
- InitializeAnim();
- },
- 2
- );
- }
- public void InitializeAnim()
- {
- #region 构造动画
- #region Reset
- ManaReso.Get("Da_Info").TweenForCG();
- ManaReso.SetText("Da_Tit", Language.GetStr("UI", "Da_Tit1"));
- ManaReso.SetText("Da_CoinLab", "0");
- ManaReso.SetText("Da_DiamondLab", "0");
- ManaReso.SetActive("Da_Lab", false);
- ManaReso.SetActive("Da_Quit", false);
- ManaReso.SetActive("Da_Cancel", false);
- ManaReso.SetActive("Da_CoinLab", false);
- ManaReso.SetActive("Da_ScoreTit", false);
- ManaReso.SetActive("Da_ScoreLab", false);
- ManaReso.SetActive("Da_GetAward", false);
- ManaReso.SetActive("Da_DiamondLab", false);
- ManaReso.SetActive("Da_VGroup", true);
- ManaReso.SetActive("Da_HGroup1", false);
- ManaReso.SetActive("Da_FlowerGroup", false);
- ManaReso.SetActive("Da_DiamondGroup", false);
- if (FlowerFlag)
- {
- ManaReso.SetActive("Da_FlowerGroup", true);
- }
- if (DiamondFlag)
- {
- ManaReso.SetActive("Da_DiamondGroup", true);
- }
- Auxiliary.Instance.DelayCall
- (
- () =>
- {
- ManaReso.Get<VerticalLayoutGroup>("Da_VGroup").enabled = false;
- ManaReso.SetActive("Da_CoinGroup", false);
- ManaReso.SetActive("Da_FlowerGroup", false);
- ManaReso.SetActive("Da_DiamondGroup", false);
- },
- 1
- );
- float timeCoin = Mathf.Lerp(0, 1.5f, Mathf.Clamp01(Coin / 15f));
- float timeScore = Mathf.Lerp(0, 1.5f, Mathf.Clamp01(Score / 50f));
- float timeDiamond = Mathf.Lerp(0, 1.5f, Mathf.Clamp01(Diamond / 15f));
- float time = Mathf.Max(timeCoin, timeDiamond);
-
- ManaReso.Get("Da_CoinLab").CreateTweenNumber(0, Coin, time, false, true, Curve.EaseOutQuad);
- ManaReso.Get("Da_ScoreLab").CreateTweenNumber(0, Score, timeScore, false, true, Curve.EaseOutQuad);
- ManaReso.Get("Da_DiamondLab").CreateTweenNumber(0, Diamond, time, false, true, Curve.EaseOutQuad);
- #endregion
- #region 花
- TweenRoot tween;
- if (FlowerFlag)
- {
- tween = ManaReso.Get("Da_CoinLab").GetTweenNumber();
- tween.AddEventOnetime
- (
- EventType.ForwardFinish,
- () =>
- {
- ManaReso.Get("Da_FlowerGroup").TweenReForScale();
- }
- );
- }
- #endregion
- #region 按钮
- if (FlowerFlag)
- {
- tween = ManaReso.Get("Da_FlowerGroup").GetTweenScale();
- tween.AddEventOnetime
- (
- EventType.ForwardFinish,
- () =>
- {
- ManaReso.Get("Da_GetAward").TweenReForCG();
- }
- );
- }
- else
- {
- tween = ManaReso.Get("Da_CoinLab").GetTweenNumber();
- tween.AddEventOnetime
- (
- EventType.ForwardFinish,
- () =>
- {
- ManaReso.Get("Da_GetAward").TweenReForCG();
- }
- );
- }
- if (ManaTutorial.TutorialA)
- {
- tween = ManaReso.Get("Da_GetAward").GetTweenCG();
- tween.AddEventOnetime
- (
- EventType.ForwardFinish,
- () =>
- {
- Tutorial.HightScreen(ManaReso.Get("Da_Arrow0"), ManaReso.Get("Da_Arrow1"), ManaReso.Get("Da_GetAward"));
- }
- );
- }
- ManaReso.AddButtonEventOnetime
- (
- "Da_GetAward",
- () =>
- {
- ManaReso.Get("Da_VGroup").GetComponent<VerticalLayoutGroup>().enabled = true;
- }
- );
- #endregion
- #region 得分
- if (Rate == 0)
- {
- tween = ManaReso.Get("Da_Star1").GetTweenScale();
- }
- else if (Rate == 1)
- {
- tween = ManaReso.Get("Da_Star2").GetTweenScale();
- }
- else if (Rate == 2)
- {
- tween = ManaReso.Get("Da_Star3").GetTweenScale();
- }
- tween.AddEventOnetime
- (
- EventType.ForwardFinish,
- () =>
- {
- ManaReso.Get("Da_ScoreTit").TweenReForFont();
- }
- );
- tween = ManaReso.Get("Da_ScoreTit").GetTweenFont();
- tween.InOrigin = true;
- tween.AddEventOnetime
- (
- EventType.ForwardFinish,
- () =>
- {
- ManaReso.Get("Da_ScoreLab").TweenReForNumber();
- }
- );
- #endregion
- #region 五角星
- tween = ManaReso.Get("Da_Star3").GetTweenScale();
- tween.InOrigin = true;
- tween = ManaReso.Get("Da_Star2").GetTweenScale();
- tween.InOrigin = true;
- tween = ManaReso.Get("Da_Star1").GetTweenScale();
- tween.InOrigin = true;
- tween = ManaReso.Get("Da_Info").GetTweenCG();
- tween.AddEventOnetime
- (
- EventType.ForwardFinish,
- () =>
- {
- ManaReso.Get("Da_Star1").TweenReForScale();
- ManaReso.SetActive("Da_HGroup1", true);
- }
- );
- if (Rate == 0)
- {
- ManaReso.SetActive("Da_Star2", false);
- ManaReso.SetActive("Da_Star3", false);
- }
- else if (Rate == 1)
- {
- ManaReso.SetActive("Da_Star2", true);
- ManaReso.SetActive("Da_Star3", false);
- tween = ManaReso.Get("Da_Star1").GetTweenScale();
- tween.AddEventOnetime
- (
- EventType.ForwardFinish,
- () =>
- {
- ManaReso.Get("Da_Star2").TweenReForScale();
- }
- );
- }
- else if (Rate == 2)
- {
- ManaReso.SetActive("Da_Star2", true);
- ManaReso.SetActive("Da_Star3", true);
- tween = ManaReso.Get("Da_Star1").GetTweenScale();
- tween.AddEventOnetime
- (
- EventType.ForwardFinish,
- () =>
- {
- ManaReso.Get("Da_Star2").TweenReForScale();
- }
- );
- tween = ManaReso.Get("Da_Star2").GetTweenScale();
- tween.AddEventOnetime
- (
- EventType.ForwardFinish,
- () =>
- {
- ManaReso.Get("Da_Star3").TweenReForScale();
- }
- );
- }
- #endregion
- #region 金币钻石
- tween = ManaReso.Get("Da_ScoreLab").GetTweenNumber();
- tween.AddEventOnetime
- (
- EventType.ForwardFinish,
- () =>
- {
- ManaReso.Get("Da_CoinGroup").TweenReForScale();
- if (DiamondFlag)
- {
- ManaReso.Get("Da_DiamondGroup").TweenReForScale();
- }
- }
- );
- tween = ManaReso.Get("Da_CoinGroup").GetTweenScale();
- tween.AddEventOnetime
- (
- EventType.ForwardFinish,
- () =>
- {
- ManaReso.Get("Da_CoinLab").TweenReForNumber();
- }
- );
- if (DiamondFlag)
- {
- tween = ManaReso.Get("Da_DiamondGroup").GetTweenScale();
- tween.AddEventOnetime
- (
- EventType.ForwardFinish,
- () =>
- {
- ManaReso.Get("Da_DiamondLab").TweenReForNumber();
- }
- );
- }
- #endregion
- #endregion
- }
- public Award(XmlAttributeCollection attribute)
- {
- Flower.CoinFml = attribute[8].Value;
- DropGold.CoinFml = attribute[7].Value;
- Star.CD = float.Parse(attribute[9].Value);
- Star.Time = float.Parse(attribute[11].Value);
- string[] strings = attribute[10].Value.Split(',');
- ManaGarden.MinStarTime = float.Parse(strings[0]);
- ManaGarden.MaxStarTime = float.Parse(strings[1]);
- ManaGarden.StarTimer = Mathf.Lerp(ManaGarden.MinStarTime, ManaGarden.MaxStarTime, Random.Range(0f, 1f));
- CoinFml = attribute[1].Value;
- FlowerFml = attribute[4].Value;
- DiamondFml = attribute[3].Value;
-
- strings = attribute[2].Value.Split(',');
- DiamondMin = int.Parse(strings[0]);
- DiamondMax = int.Parse(strings[1]);
- strings = attribute[5].Value.Split(',');
- Odds = new List<float>()
- {
- float.Parse(strings[0]),
- float.Parse(strings[1]),
- float.Parse(strings[2]),
- };
- strings = attribute[6].Value.Split(',');
- Standard = new List<float>()
- {
- float.Parse(strings[0]),
- float.Parse(strings[1]),
- float.Parse(strings[2]),
- };
- }
- }
- public class ManaMiniGame : Regist
- {
- #region 变量
- public static int Score
- {
- get { return Score_; }
- set
- {
- Score_ = value;
- ManaReso.SetText("D_ScoreLab", ScoreLab + Score_);
- }
- }
- public static bool Game
- {
- get { return Game_; }
- set
- {
- Game_ = value;
- if (Game_)
- {
- ManaReso.SetText("D_StatusLab", Language.GetStr("UI", "D_StatusLab1"));
- }
- else
- {
- ManaReso.SetText("D_StatusLab", Language.GetStr("UI", "D_StatusLab0"));
- }
- }
- }
- public static bool Pause
- {
- get { return Pause_; }
- set
- {
- Pause_ = value;
- if (Game)
- {
- if (Pause_)
- {
- ManaReso.SetText("D_StatusLab", Language.GetStr("UI", "D_StatusLab2"));
- }
- else
- {
- ManaReso.SetText("D_StatusLab", Language.GetStr("UI", "D_StatusLab1"));
- }
- }
- else if (Prepare)
- {
- if (Pause_)
- {
- PrepareLab.GetStreamScale().Pause();
- }
- else
- {
- PrepareLab.GetStreamScale().Resume();
- }
- }
- }
- }
- public static bool Panalty
- {
- get { return Panalty_; }
- set
- {
- Panalty_ = value;
- if (Game)
- {
- if (Panalty_)
- {
- ManaReso.SetText("D_StatusLab", Language.GetStr("UI", "D_StatusLab3"));
- }
- else
- {
- ManaReso.SetText("D_StatusLab", Language.GetStr("UI", "D_StatusLab1"));
- }
- }
- }
- }
- public static float GameTimer
- {
- get { return GameTimer_; }
- set
- {
- GameTimer_ = value;
- TimerLab.text = (GameTime-GameTimer_).ToString("0.0");
- TimerBk.fillAmount = GameTimer_/GameTime;
- TimerBk.material.SetFloat("_Fill", TimerBk.fillAmount);
- }
- }
- private static int Score_;
- private static bool Game_;
- private static bool Pause_;
- private static bool Panalty_;
- private static float GameTimer_;
- public static Text TimerLab;
- public static Text PrepareLab;
- public static Image TimerBk;
- public static Award Award;
- public static Transform D_Grid;
- public static Transform D_Timer;
- public static Transform D_Begin;
- public static Transform D_Status1;
- public static Transform D_Status2;
- public static Transform D_Status3;
- public static Transform D_Operate1;
- public static Transform D_Operate2;
- public static Transform D_Operate3;
- public static Transform CorrectBtnC;
- public static List<int> IndexList = new List<int>();
- public static List<int> FlowerIDListC = new List<int>();
- public static List<Drop> DropList = new List<Drop>();
- public static List<Flower> OpList = new List<Flower>();
- public static List<Flower> IdleList = new List<Flower>();
- public static List<Flower> FadeList = new List<Flower>();
- public static Dictionary<int, Flower> FlowerDic = new Dictionary<int, Flower>();
- public static int MiniGameIndex;
- public static string ScoreLab;
- public static bool GameA;
- public static bool GameB;
- public static bool GameC;
- public static bool Prepare;
- public static bool FlowerLock;
- public static bool TutorialLock = true;
- public static bool DropDiamond;
- public static float OpTimer;
- public static float FadeTimer;
- public static float GoldTimer;
- public static float PanaltyTimer;
- public static float PrepareTimer;
- public static float DiamondTimer;
- public static float OpTime = 1.5f;
- public static float FadeTime = 2f;
- public static float GameTime = 45f;
- public static float PanaltyTime = 1f;
- public static float NewOpTime;
- public static float NewFadeTime;
- #endregion
- private void FixedUpdate()
- {
- if (Pause)
- {
- return;
- }
- if (Game)
- {
- GameThreadA();
- GameThreadB();
- GameThreadC();
- }
- if (Prepare)
- {
- PrepareThread();
- }
- }
- private void GameThreadA()
- {
- if (!GameA)
- {
- return;
- }
- GameTimer += Time.fixedDeltaTime;
- if (GameTimer >= GameTime)
- {
- GameOver();
- return;
- }
- if (Panalty)
- {
- PanaltyTimer -= Time.fixedDeltaTime;
- if (PanaltyTimer <= 0)
- {
- Panalty = false;
- }
- }
- if (IdleList.Count > 0)
- {
- OpTimer -= Time.fixedDeltaTime;
- if (OpTimer <= 0)
- {
- NewOpTime -= NewOpTime * 0.03f;
- OpTimer = NewOpTime;
- CreateOperate();
- }
- }
- BonusThread();
- }
- private void GameThreadB()
- {
- if (!GameB)
- {
- return;
- }
- GameTimer += Time.fixedDeltaTime;
- if (GameTimer >= GameTime)
- {
- GameOver();
- return;
- }
- if (Panalty)
- {
- PanaltyTimer -= Time.fixedDeltaTime;
- if (PanaltyTimer <= 0)
- {
- Panalty = false;
- }
- }
-
- if (FadeList.Count < 6)
- {
- FadeTimer -= Time.fixedDeltaTime;
-
- if (FadeTimer <= 0)
- {
- FadeTimer = NewFadeTime;
- Fade();
- }
- }
- BonusThread();
- }
- private void GameThreadC()
- {
- if (!GameC)
- {
- return;
- }
- GameTimer += Time.fixedDeltaTime;
- if (GameTimer >= GameTime)
- {
- GameOver();
- return;
- }
- if (Panalty)
- {
- PanaltyTimer -= Time.fixedDeltaTime;
- if (PanaltyTimer <= 0)
- {
- Panalty = false;
- }
- }
- BonusThread();
- }
- private void BonusThread()
- {
- GoldTimer -= Time.fixedDeltaTime;
- if (GoldTimer < 0)
- {
- GoldTimer = Random.Range(3f, 6f);
- DropList.Add(ManaReso.GetDrop(ObjType.DropGold));
- }
- if (DropDiamond)
- {
- DiamondTimer -= Time.fixedDeltaTime;
- if (DiamondTimer < 0)
- {
- DropDiamond = false;
- DropList.Add(ManaReso.GetDrop(ObjType.DropDiamond));
- }
- }
- }
- private void PrepareThread()
- {
- PrepareTimer -= Time.fixedDeltaTime;
- if (PrepareTimer <= 0)
- {
- Prepare = false;
- GameBegin();
- }
- }
- public override void RegistValueA()
- {
- Award = new Award(ManaData.GetAwardConfig());
- MiniGameIndex = ManaData.GetPlayerInt("MiniGameIndex");
- }
- public override void RegistReference()
- {
- D_Grid = ManaReso.Get("D_Grid");
- D_Begin = ManaReso.Get("D_Begin");
- D_Timer = ManaReso.Get("D_Timer");
- D_Status1 = ManaReso.Get("D_Status1");
- D_Status2 = ManaReso.Get("D_Status2");
- D_Status3 = ManaReso.Get("D_Status3");
- D_Operate1 = ManaReso.Get("D_Operate1");
- D_Operate2 = ManaReso.Get("D_Operate2");
- D_Operate3 = ManaReso.Get("D_Operate3");
- TimerLab = ManaReso.Get<Text>("D_TimerLab");
- PrepareLab = ManaReso.Get<Text>("D_PrepareLab");
- TimerBk = ManaReso.Get<Image>("D_TimerIcon");
- }
- public static void OperateC(int id, int btnIndex)
- {
- if (!Game)
- {
- return;
- }
- if (Panalty)
- {
- return;
- }
- if (FlowerIDListC[0] == id)
- {
- Flower flower = IdleList.Find(tempFlower => { return tempFlower.ID == id; });
- ManaReso.GetHudText("+50", Color.white, 90, flower.ChildDic["ScorePosTra"], ManaReso.Get("D_HudParent"), true);
- Score += 50;
- flower.PlayFlashLight();
- ManaAudio.PlayClip(Clip.BtnClip);
- RoundEndC();
- }
- else
- {
- Panalty = true;
- PanaltyTimer = PanaltyTime;
- ManaReso.Get("D_FlowerIcon" + btnIndex).TweenForGra();
- ManaReso.Get("D_FlowerBtn" + btnIndex).Shake(0.5f, 3, new Vector3(20f, 0, 0), Curve.EaseOutQuad);
- ManaAudio.PlayClip(Clip.ErrorClip);
- }
- }
- public static void OperateB(int index, int slotIndex)
- {
- if (Panalty || !FadeList.Valid())
- {
- return;
- }
- if (IndexList.Count == 0)
- {
- return;
- }
- if (slotIndex == IndexList[0])
- {
- int uiIndex = IndexMap(IndexList[0]);
- ManaReso.Get<Image>("D_FlowerBtn" + uiIndex).material = Lib.GrayMat;
- ManaReso.Get<Button>("D_FlowerBtn" + uiIndex).interactable = false;
- ManaReso.Get<Image>("D_FlowerIcon" + uiIndex).material = Lib.GrayMat;
- ManaReso.SetActive("D_FlowerTick" + uiIndex, true);
- IndexList.RemoveAt(0);
- Flower flower = FlowerDic[slotIndex];
- ManaReso.GetHudText("+30", Color.white, 90, flower.ChildDic["ScorePosTra"], ManaReso.Get("D_HudParent"), true);
- Score += 30;
- flower.PlayFlashLight();
- if (!Award.FlowerLock && Award.FlowerID == flower.ID)
- {
- flower.PlayNewFlowerEffec();
- }
- ManaAudio.PlayClip(Clip.BtnClip);
- TweenRoot tween = flower.FlowerIcon.TweenBacSr();
- if (IndexList.Count == 0)
- {
- tween.AddEventOnetime
- (
- EventType.BackwardFinish,
- () =>
- {
- RoundEndB();
- RoundResetB();
- RoundBeginB();
- }
- );
- }
- }
- else
- {
- Panalty = true;
- PanaltyTimer = PanaltyTime;
-
- ManaReso.Get("D_FlowerIcon" + index).TweenForGra();
- ManaReso.Get("D_FlowerBtn" + index).Shake(0.5f, 3, new Vector3(20f, 0, 0), Curve.EaseOutQuad);
- ManaAudio.PlayClip(Clip.ErrorClip);
- }
- }
- public static void OperateA(OpType opType)
- {
- if (Panalty || !OpList.Valid())
- {
- return;
- }
- if (OpList[0].Operate(opType))
- {
- IdleList.Add(OpList[0]);
- OpList.Remove(OpList[0]);
- if (OpList.Count >= 2)
- {
- OpList[0].SetFirstOp();
- OpList[1].SetSecondOp();
- }
- else if (OpList.Count >= 1)
- {
- OpList[0].SetFirstOp();
- }
- }
- else
- {
- Panalty = true;
- PanaltyTimer = PanaltyTime;
- }
- }
- public static void ResetOprerate()
- {
- ManaReso.Get<Image>("D_FlowerBtn1").material = null;
- ManaReso.Get<Image>("D_FlowerBtn2").material = null;
- ManaReso.Get<Image>("D_FlowerBtn3").material = null;
- ManaReso.Get<Image>("D_FlowerBtn4").material = null;
- ManaReso.Get<Image>("D_FlowerBtn5").material = null;
- ManaReso.Get<Image>("D_FlowerBtn6").material = null;
- ManaReso.Get<Button>("D_FlowerBtn1").interactable = true;
- ManaReso.Get<Button>("D_FlowerBtn2").interactable = true;
- ManaReso.Get<Button>("D_FlowerBtn3").interactable = true;
- ManaReso.Get<Button>("D_FlowerBtn4").interactable = true;
- ManaReso.Get<Button>("D_FlowerBtn5").interactable = true;
- ManaReso.Get<Button>("D_FlowerBtn6").interactable = true;
- ManaReso.Get<Image>("D_FlowerIcon1").material = null;
- ManaReso.Get<Image>("D_FlowerIcon2").material = null;
- ManaReso.Get<Image>("D_FlowerIcon3").material = null;
- ManaReso.Get<Image>("D_FlowerIcon4").material = null;
- ManaReso.Get<Image>("D_FlowerIcon5").material = null;
- ManaReso.Get<Image>("D_FlowerIcon6").material = null;
- ManaReso.SetActive("D_FlowerTick1", false);
- ManaReso.SetActive("D_FlowerTick2", false);
- ManaReso.SetActive("D_FlowerTick3", false);
- ManaReso.SetActive("D_FlowerTick4", false);
- ManaReso.SetActive("D_FlowerTick5", false);
- ManaReso.SetActive("D_FlowerTick6", false);
- }
- public static void CreateOperate()
- {
- ManaAudio.PlayClip(Clip.BubbleClip);
- if (ManaTutorial.TutorialA && TutorialLock)
- {
- Pause = true;
- TutorialLock = false;
- Flower flower = IdleList[4];
- flower.CreateOp(OpList.Count, OpType.Water);
- OpList.Add(flower);
- IdleList.Remove(flower);
- Tutorial.HightScreen(ManaReso.Get("D_WaterArrow0"), ManaReso.Get("D_WaterArrow1"), ManaReso.Get("D_Water1"));
- Tutorial.SetArea(OpList[0].OperateIcon.transform, 0.1f, 0.125f);
- ManaReso.AddButtonEventOnetime
- (
- "D_Water2",
- () =>
- {
- Pause = false;
- Tutorial.HightDisable();
- }
- );
- }
- else
- {
- Flower flower = IdleList[Random.Range(0, IdleList.Count)];
- flower.CreateOp(OpList.Count);
- OpList.Add(flower);
- IdleList.Remove(flower);
- }
- }
- public static void Fade()
- {
- for (int i = 0; i < IndexList.Count; i++)
- {
- Flower flower = FlowerDic[IndexList[i]];
- if (FadeList.UniqueAdd(flower))
- {
- IdleList.Remove(flower);
- flower.PlayFlashLight();
- flower.StopNewFlowerEffec();
- flower.FlowerIcon.TweenForSr();
- if (FadeList.Count == 6)
- {
- RoundBeginB();
- }
- break;
- }
- }
- }
- public static void InitializeMode()
- {
- GameA = false;
- GameB = false;
- GameC = false;
- D_Operate1.SetActive(false);
- D_Operate2.SetActive(false);
- D_Operate3.SetActive(false);
- bool gameAvailibleB = ManaCenter.Level >= 18;
- bool gameAvailibleC = ManaGarden.MyFlower >= 2;
- float thresholdA;
- float thresholdB;
- float thresholdC;
- if (gameAvailibleB && gameAvailibleC)
- {
- thresholdA = 0.33f;
- thresholdB = 0.66f;
- thresholdC = 1f;
- }
- else if (gameAvailibleB)
- {
- thresholdA = 0.5f;
- thresholdB = 1;
- thresholdC = 0;
- }
- else if (gameAvailibleC)
- {
- thresholdA = 0.5f;
- thresholdB = 0;
- thresholdC = 1;
- }
- else
- {
- thresholdA = 1;
- thresholdB = 0;
- thresholdC = 0;
- }
- float posibility = Random.Range(0f, 1f);
- if (posibility <= thresholdA)
- {
- GameA = true;
- }
- else if (posibility <= thresholdB)
- {
- GameB = true;
- }
- else if (posibility <= thresholdC)
- {
- GameC = true;
- }
- if (ManaTutorial.TutorialB)
- {
- GameA = false;
- GameB = true;
- GameC = false;
- }
- if (ManaTutorial.TutorialE)
- {
- GameA = false;
- GameB = false;
- GameC = true;
- }
- }
- public static void InitializeAward()
- {
- float flowerRate = (float)Auxiliary.FmlParse(Award.FlowerFml, "l", ManaCenter.Level.ToString(), "f", ManaGarden.MyFlower.ToString());
- if (Random.Range(0, 1f) <= flowerRate)
- {
- if (ManaGarden.MyFlower < ManaGarden.TotalFlower)
- {
- foreach (var kv in ManaGarden.FlowerInfoDic)
- {
- if (kv.Value.Unlock == false)
- {
- Award.FlowerID = kv.Value.ID_;
- Award.FlowerLock = false;
- break;
- }
- }
- }
- else
- {
- Award.FlowerLock = true;
- }
- }
- else
- {
- Award.FlowerLock = true;
- }
- }
- public static void GameEnd()
- {
- PrepareLab.GetStreamScale().InOrigin = true;
- if (Game)
- {
- ManaCenter.MiniLock = false;
- ManaCenter.MiniTimer = Mathf.Lerp(180, 300, Random.Range(0, 1f));
- }
- ManaReso.Get("C_MiniGame").TweenForCG();
- if (ManaCenter.MiniTimer > 0)
- {
- ManaReso.Get("C_MiniGame").TweenForRect();
- }
- Score = 0;
- Pause = false;
- Game = false;
- Panalty = false;
- Prepare = false;
- GameTimer = GameTime;
- for (int i = 0; i < OpList.Count; i++)
- {
- OpList[i].GameOver();
- }
- for (int i = 0; i < IdleList.Count; i++)
- {
- IdleList[i].GameOver();
- }
- for (int i = 0; i < DropList.Count; i++)
- {
- DropList[i].Retrieve();
- DropList.RemoveAt(i--);
- }
- }
- public static void GameOver()
- {
- ManaAudio.PlayClip(Clip.MiniEndClip);
- Award.GetAward(Score);
- ManaCenter.MiniGameAmt++;
- FlowerLock = false;
- GameEnd();
- }
- public static void GameEnter()
- {
- if (ManaTutorial.TutorialA)
- {
- Award.FlowerID = 1;
- Award.FlowerLock = true;
- InitializeMode();
- }
- else
- {
- if (!FlowerLock)
- {
- InitializeMode();
- InitializeAward();
- FlowerLock = true;
- }
- }
- if (ManaTutorial.TutorialB)
- {
- InitializeMode();
- }
- if (GameA)
- {
- GameEnterA();
- }
- if (GameB)
- {
- GameEnterB();
- }
- if (GameC)
- {
- GameEnterC();
- }
- ScoreLab = Language.GetStr("UI", "D_ScoreLab");
- TimerBk.fillAmount = 0;
- TimerLab.text = GameTime.ToString("0");
- ManaReso.Get("C_MiniGame").TweenBacCG();
- }
- public static void GameEnterA()
- {
- D_Operate1.SetActive(true);
- D_Timer.SetParent(D_Status1);
- D_Grid.SetParent(D_Status1);
- D_Begin.SetParent(D_Operate1);
- PrepareLab.SetParent(ManaReso.Get("D_PrepareLayout1"));
- ManaReso.SetActive("D_Rip1", false);
- ManaReso.SetActive("D_Water1", false);
- ManaReso.SetActive("D_Fertilize1", false);
- ManaReso.SetActive("D_Begin", true);
- ManaReso.SetActive("D_DescA", true);
- if (Award.FlowerLock)
- {
- for (int i = 1; i < 10; i++)
- {
- while (true)
- {
- FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic.Random();
- if (flowerInfo.Unlock)
- {
- IdleList.Add(ManaReso.GetFlower(flowerInfo, ManaReso.Get("SlotMini" + i)));
- break;
- }
- }
- }
- }
- else
- {
- List<int> idList = new List<int>();
- idList = new List<int>() {1, 2, 3, 4, 5, 6, 7, 8, 9};
- int special = idList.Random(1, true, true)[0];
- Flower flower = ManaReso.GetFlower(ManaGarden.FlowerInfoDic[Award.FlowerID], ManaReso.Get("SlotMini" + special));
- flower.PlayNewFlowerEffec();
- IdleList.Add(flower);
- for (int i = 0; i < idList.Count; i++)
- {
- while (true)
- {
- FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic.Random();
- if (flowerInfo.Unlock)
- {
- flower = ManaReso.GetFlower(flowerInfo, ManaReso.Get("SlotMini" + idList[i]));
- IdleList.Add(flower);
- break;
- }
- }
- }
- }
- }
- public static void GameEnterB()
- {
- D_Operate2.SetActive(true);
- D_Timer.SetParent(D_Status2);
- D_Grid.SetParent(D_Status2);
- D_Begin.SetParent(D_Operate2);
- PrepareLab.SetParent(ManaReso.Get("D_PrepareLayout2"));
- ResetOprerate();
- ManaReso.Get("D_Mask").TweenBacGra();
- ManaReso.SetActive("D_FlowerBtn1", false);
- ManaReso.SetActive("D_FlowerBtn2", false);
- ManaReso.SetActive("D_FlowerBtn3", false);
- ManaReso.SetActive("D_FlowerBtn4", false);
- ManaReso.SetActive("D_FlowerBtn5", false);
- ManaReso.SetActive("D_FlowerBtn6", false);
- ManaReso.SetActive("D_Begin", true);
- ManaReso.SetActive("D_DescB", true);
- List<int> idList = new List<int>() {1, 2, 4, 5, 7, 8};
- FlowerDic = new Dictionary<int, Flower>();
- Flower flower;
- if (Award.FlowerLock)
- {
- for (int i = 0; i < idList.Count; i++)
- {
- while (true)
- {
- FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic.Random();
- if (flowerInfo.Unlock)
- {
- flower = ManaReso.GetFlower(flowerInfo, ManaReso.Get("SlotMini" + idList[i]));
- IdleList.Add(flower);
- FlowerDic.Add(idList[i], flower);
- break;
- }
- }
- }
- }
- else
- {
- int special = idList.Random(1, true, true)[0];
- flower = ManaReso.GetFlower(ManaGarden.FlowerInfoDic[Award.FlowerID], ManaReso.Get("SlotMini" + special));
- flower.PlayNewFlowerEffec();
- IdleList.Add(flower);
- FlowerDic.Add(special, flower);
- for (int i = 0; i < idList.Count; i++)
- {
- while (true)
- {
- FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic.Random();
- if (flowerInfo.Unlock)
- {
- flower = ManaReso.GetFlower(flowerInfo, ManaReso.Get("SlotMini" + idList[i]));
- IdleList.Add(flower);
- FlowerDic.Add(idList[i], flower);
- break;
- }
- }
- }
- }
- for (int i = 0; i < IdleList.Count; i++)
- {
- IdleList[i].FlowerIcon.CreateTweenSr(1, 0, 0.25f, true, false, Curve.EaseOutQuad, false, true);
- }
- }
- public static void GameEnterC()
- {
- D_Operate3.SetActive(true);
- ManaReso.SetActive("D_Begin", true);
- ManaReso.SetActive("D_DescB", true);
- ManaReso.SetActive("D_FlowerBtn7", false);
- ManaReso.SetActive("D_FlowerBtn8", false);
- ManaReso.SetActive("D_FlowerBtn9", false);
- D_Begin.SetParent(D_Operate3);
- D_Timer.SetParent(D_Status3);
- D_Grid.SetParent(D_Status3);
- PrepareLab.SetParent(ManaReso.Get("D_PrepareLayout3"));
- RoundResetC(true);
- }
- public static void GameBegin()
- {
- Game = true;
- MiniGameIndex++;
- Score = 0;
- OpTimer = OpTime;
- FadeTimer = FadeTime;
- GoldTimer = Random.Range(3f, 6f);
- GameTimer = 0;
- NewOpTime = OpTime;
- NewFadeTime = FadeTime;
- DiamondTimer = Random.Range(0f, GameTime - 5);
- StaticsManager.GetInstance().UseItem(StaticsManager.ItemID.开始小游戏, StaticsManager.ItemType.小游戏, "1", StaticsManager.ConsumeModule.None);
- if (GameA)
- {
- for (int i = 0; i < IdleList.Count; i++)
- {
- IdleList[i].GameBegin();
- }
- }
- if (GameB)
- {
- RoundResetB();
- }
- if (GameC)
- {
- RoundBeginC(true);
- }
- if (Random.Range(5, 9) <= MiniGameIndex)
- {
- MiniGameIndex = 0;
- DropDiamond = true;
- }
- else
- {
- if (Random.Range(0, 1f) <= 0.01f)
- {
- DropDiamond = true;
- }
- else
- {
- DropDiamond = false;
- }
- }
- }
- public static void GamePrepare()
- {
- Prepare = true;
- PrepareTimer = 3;
- ManaReso.Get("D_Begin").SetActive(false);
- ManaReso.Get("D_DescA").SetActive(false);
- ManaReso.Get("D_DescB").SetActive(false);
- ManaReso.Get("D_DescC").SetActive(false);
- if (GameA)
- {
- ManaReso.Get("D_Rip1").SetActive(true);
- ManaReso.Get("D_Water1").SetActive(true);
- ManaReso.Get("D_Fertilize1").SetActive(true);
- }
- if (GameB)
- {
- ManaReso.Get("D_Mask").TweenForGra();
- ManaReso.SetActive("D_FlowerBtn1", true);
- ManaReso.SetActive("D_FlowerBtn2", true);
- ManaReso.SetActive("D_FlowerBtn3", true);
- ManaReso.SetActive("D_FlowerBtn4", true);
- ManaReso.SetActive("D_FlowerBtn5", true);
- ManaReso.SetActive("D_FlowerBtn6", true);
- ManaReso.SetSprite("D_FlowerIcon1", FlowerDic[1].FlowerInfo.Icon).Resize(true, 0.85f, 0.85f);
- ManaReso.SetSprite("D_FlowerIcon2", FlowerDic[2].FlowerInfo.Icon).Resize(true, 0.85f, 0.85f);
- ManaReso.SetSprite("D_FlowerIcon3", FlowerDic[4].FlowerInfo.Icon).Resize(true, 0.85f, 0.85f);
- ManaReso.SetSprite("D_FlowerIcon4", FlowerDic[5].FlowerInfo.Icon).Resize(true, 0.85f, 0.85f);
- ManaReso.SetSprite("D_FlowerIcon5", FlowerDic[7].FlowerInfo.Icon).Resize(true, 0.85f, 0.85f);
- ManaReso.SetSprite("D_FlowerIcon6", FlowerDic[8].FlowerInfo.Icon).Resize(true, 0.85f, 0.85f);
- }
- PrepareLab.StreamForScale();
- }
- public static void RoundEndB()
- {
- ManaReso.Get("D_Mask").TweenForGra();
- }
- public static void RoundResetB()
- {
- for (int i = 0; i < FadeList.Count; i++)
- {
- IdleList.Add(FadeList[i]);
- }
- NewFadeTime -= NewFadeTime * 0.3f;
- FadeTimer = NewFadeTime;
- FadeList = new List<Flower>();
- IndexList = new List<int>();
- List<int> randomList = new List<int>() { 1, 2, 4, 5, 7, 8 };
- for (int i = 0; i < randomList.Count; i++)
- {
- IndexList.Add(randomList.Random(1, true, true)[0]);
- i--;
- }
- ResetOprerate();
- }
- public static void RoundBeginB()
- {
- ManaReso.Get("D_Mask").TweenBacGra();
- if (ManaTutorial.TutorialB)
- {
- ManaTutorial.EnterB1();
- }
- }
- public static void RoundEndC()
- {
- if (IdleList[0].ID == Award.FlowerID)
- {
- IdleList[0].StopNewFlowerEffec();
- }
- for (int i = 0; i < IdleList.Count; i++)
- {
- IdleList[i].FlowerIcon.TweenForSr();
- }
- ManaReso.Get("D_FlowerBtn7").TweenBacCG();
- ManaReso.Get("D_FlowerBtn8").TweenBacCG();
- ManaReso.Get("D_FlowerBtn9").TweenBacCG();
- Auxiliary.Instance.DelayCall
- (
- () =>
- {
- if (Game)
- {
- RoundResetC();
- RoundBeginC();
- }
- },
- 1.5f
- );
- }
- public static void RoundResetC(bool firstRound = false)
- {
- ExtList.ForEach(IdleList, flower => { flower.Retrieve(); });
- IdleList = new List<Flower>();
- FlowerIDListC = new List<int>();
- List<int> slotList = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
- FlowerInfo flowerInfo;
- if (firstRound && !Award.FlowerLock)
- {
- flowerInfo = ManaGarden.FlowerInfoDic[Award.FlowerID];
- }
- else
- {
- flowerInfo = ManaGarden.FlowerInfoDic.Random(false, flowerIndo => { return flowerIndo.Unlock; });
- }
- FlowerIDListC.Add(flowerInfo.ID_);
- IdleList.Add(ManaReso.GetFlower(flowerInfo, ManaReso.Get("SlotMini" + slotList.Random(1, true, true)[0])));
- while (slotList.Count > 0)
- {
- flowerInfo = ManaGarden.FlowerInfoDic.Random(false, info => { return info.Unlock && info.ID_ != FlowerIDListC[0]; });
- if (slotList.Count == 1)
- {
- if (!FlowerIDListC.Contains(flowerInfo.ID_))
- {
- continue;
- }
- }
- else
- {
- FlowerIDListC.UniqueAdd(flowerInfo.ID_);
- }
- int amt = Mathf.Min(Random.Range(2, 9), slotList.Count);
- for (int i = 0; i < amt; i++)
- {
- IdleList.Add(ManaReso.GetFlower(flowerInfo, ManaReso.Get("SlotMini" + slotList.Random(1, true, true)[0])));
- }
- }
- for (int i = 0; i < IdleList.Count; i++)
- {
- IdleList[i].FlowerIcon.CreateTweenSr(1, 0, 0.25f, true, false, Curve.EaseOutQuad, false, true);
- IdleList[i].FlowerIcon.GetTweenSr().InDestination = true;
- }
- List<int> idList = new List<int>()
- {
- FlowerIDListC[0],
- };
- if (FlowerIDListC.Count == 2)
- {
- idList.Add(FlowerIDListC[1]);
- idList.Add(FlowerIDListC[1]);
- }
- else if (FlowerIDListC.Count > 2)
- {
- idList.AddRange(FlowerIDListC.Random(2, true, false, id => { return id != idList[0]; }));
- }
- else
- {
- throw new Exception();
- }
- idList = idList.Disturb();
- ManaReso.SetSprite("D_FlowerIcon7", ManaGarden.FlowerInfoDic[idList[0]].Icon).Resize(true, 0.85f, 0.85f);
- ManaReso.SetSprite("D_FlowerIcon8", ManaGarden.FlowerInfoDic[idList[1]].Icon).Resize(true, 0.85f, 0.85f);
- ManaReso.SetSprite("D_FlowerIcon9", ManaGarden.FlowerInfoDic[idList[2]].Icon).Resize(true, 0.85f, 0.85f);
- for (int i = 0; i < idList.Count; i++)
- {
- int id = idList[i];
- int index = i;
- if (firstRound && ManaTutorial.TutorialE && id == FlowerIDListC[0])
- {
- CorrectBtnC = ManaReso.Get("D_FlowerBtn" + (7 + i));
- ManaReso.SetButtonEvent("D_FlowerBtn" + (7 + i), () => { OperateC(id, (7 + index)); ManaTutorial.EndE(); });
- }
- else
- {
- ManaReso.SetButtonEvent("D_FlowerBtn" + (7 + i), () => { OperateC(id, (7 + index)); });
- }
- }
- }
- public static void RoundBeginC(bool firstRound = false)
- {
- if (firstRound && !Award.FlowerLock)
- {
- IdleList[0].PlayNewFlowerEffec();
- }
- ManaReso.Get("D_FlowerBtn7").TweenReForCG();
- ManaReso.Get("D_FlowerBtn8").TweenReForCG();
- ManaReso.Get("D_FlowerBtn9").TweenReForCG();
- for (int i = 0; i < IdleList.Count; i++)
- {
- IdleList[i].FlowerIcon.TweenBacSr();
- }
- if (firstRound && ManaTutorial.TutorialE)
- {
- ManaTutorial.EnterE2(CorrectBtnC.GetChild(1), CorrectBtnC);
- }
- }
- public static int IndexMap(int slotIndex)
- {
- if (slotIndex == 1)
- {
- return 1;
- }
- else if (slotIndex == 2)
- {
- return 2;
- }
- else if (slotIndex == 4)
- {
- return 3;
- }
- else if (slotIndex == 5)
- {
- return 4;
- }
- else if (slotIndex == 7)
- {
- return 5;
- }
- else if (slotIndex == 8)
- {
- return 6;
- }
- else
- {
- throw new Exception();
- }
- }
- public void OnApplicationPause(bool pause)
- {
- if (!pause)
- {
- if (!ManaTutorial.TutorialA)
- {
- if (Game || Prepare)
- {
- ManaReso.Get<Button>("D_Quit").onClick.Invoke();
- }
- }
- }
- }
- }
|