123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902 |
- 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.Coin += Coin;
- 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.Diamond += Diamond;
- 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.Diamond += Diamond;
- 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);
- 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();
- }
- }
- }
- }
- }
|