Manager.cs 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548
  1. using LitJson;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. using UnityEngine.Events;
  5. using UnityEngine.Analytics;
  6. using UnityEngine.EventSystems;
  7. using System;
  8. using System.Xml;
  9. using System.Collections;
  10. using System.Collections.Generic;
  11. public class Manager : Regist
  12. {
  13. #region Config
  14. #region 成就
  15. public static double PlayADsAmt
  16. {
  17. get { return playADsAmt; }
  18. set
  19. {
  20. playADsAmt = value;
  21. AchieveManager.UpdateStatus(AchieveType.PlayADsAmt, playADsAmt);
  22. }
  23. }
  24. private static double playADsAmt;
  25. public static double UseSkillAmt
  26. {
  27. get { return useSkillAmt; }
  28. set
  29. {
  30. useSkillAmt = value;
  31. AchieveManager.UpdateStatus(AchieveType.UseSkillAmt, useSkillAmt);
  32. }
  33. }
  34. private static double useSkillAmt;
  35. public static double SignAmt
  36. {
  37. get { return signAmt; }
  38. set
  39. {
  40. signAmt = value;
  41. AchieveManager.UpdateStatus(AchieveType.SignAmt, signAmt);
  42. }
  43. }
  44. private static double signAmt;
  45. public static double CloseAmt
  46. {
  47. get { return closeAmt; }
  48. set
  49. {
  50. closeAmt = value;
  51. AchieveManager.UpdateStatus(AchieveType.CloseAmt, closeAmt);
  52. }
  53. }
  54. private static double closeAmt;
  55. public static double ShareAmt
  56. {
  57. get { return shareAmt; }
  58. set
  59. {
  60. shareAmt = value;
  61. AchieveManager.UpdateStatus(AchieveType.ShareAmt, shareAmt);
  62. }
  63. }
  64. private static double shareAmt;
  65. public static double PlayMinigameAmt
  66. {
  67. get { return playMinigameAmt; }
  68. set
  69. {
  70. playMinigameAmt = value;
  71. AchieveManager.UpdateStatus(AchieveType.PlayMinigameAmt, playMinigameAmt);
  72. }
  73. }
  74. private static double playMinigameAmt;
  75. public static double AllElfLevel
  76. {
  77. get { return allElfLevel; }
  78. set
  79. {
  80. allElfLevel = value;
  81. AchieveManager.UpdateStatus(AchieveType.AllElfLevel, allElfLevel);
  82. }
  83. }
  84. private static double allElfLevel;
  85. public static double TotalCoin
  86. {
  87. get { return totalCoin; }
  88. set
  89. {
  90. totalCoin = value;
  91. AchieveManager.UpdateStatus(AchieveType.TotalCoin, totalCoin);
  92. }
  93. }
  94. private static double totalCoin;
  95. public static double TotalFlowerAwardCoin
  96. {
  97. get { return totalFlowerAwardCoin; }
  98. set
  99. {
  100. totalFlowerAwardCoin = value;
  101. AchieveManager.UpdateStatus(AchieveType.TotalFlowerAwardCoin, totalFlowerAwardCoin);
  102. }
  103. }
  104. private static double totalFlowerAwardCoin;
  105. public static double TotalVisitPerson
  106. {
  107. get { return totalVisitPerson; }
  108. set
  109. {
  110. totalVisitPerson = value;
  111. AchieveManager.UpdateStatus(AchieveType.TotalVisitPerson, totalVisitPerson);
  112. }
  113. }
  114. private static double totalVisitPerson;
  115. public static double TotalSpendDiamond
  116. {
  117. get { return totalSpendDiamond; }
  118. set
  119. {
  120. totalSpendDiamond = value;
  121. AchieveManager.UpdateStatus(AchieveType.TotalSpendDiamond, totalSpendDiamond);
  122. }
  123. }
  124. private static double totalSpendDiamond;
  125. public static double CreateRoomAmt
  126. {
  127. get { return createRoomAmt; }
  128. set
  129. {
  130. createRoomAmt = value;
  131. AchieveManager.UpdateStatus(AchieveType.CreateRoomAmt, createRoomAmt);
  132. }
  133. }
  134. private static double createRoomAmt;
  135. public static double CreateChestAmt
  136. {
  137. get { return createChestAmt; }
  138. set
  139. {
  140. createChestAmt = value;
  141. AchieveManager.UpdateStatus(AchieveType.CreateChestAmt, createChestAmt);
  142. }
  143. }
  144. private static double createChestAmt;
  145. public static double CreateLuckyChestAmt
  146. {
  147. get { return createLuckyChestAmt; }
  148. set
  149. {
  150. createLuckyChestAmt = value;
  151. AchieveManager.UpdateStatus(AchieveType.CreateLuckyChestAmt, createLuckyChestAmt);
  152. }
  153. }
  154. private static double createLuckyChestAmt;
  155. public static double CreateGuessColorChestAmt
  156. {
  157. get { return createGuessColorChestAmt; }
  158. set
  159. {
  160. createGuessColorChestAmt = value;
  161. AchieveManager.UpdateStatus(AchieveType.CreateGuessColorChestAmt, createGuessColorChestAmt);
  162. }
  163. }
  164. private static double createGuessColorChestAmt;
  165. public static double CreateGuessNumberChestAmt
  166. {
  167. get { return createGuessNumberChestAmt; }
  168. set
  169. {
  170. createGuessNumberChestAmt = value;
  171. AchieveManager.UpdateStatus(AchieveType.CreateGuessNumberChestAmt, createGuessNumberChestAmt);
  172. }
  173. }
  174. private static double createGuessNumberChestAmt;
  175. public static double GetChestAwardAmt
  176. {
  177. get { return getChestAwardAmt; }
  178. set
  179. {
  180. getChestAwardAmt = value;
  181. AchieveManager.UpdateStatus(AchieveType.GetChestAwardAmt, getChestAwardAmt);
  182. }
  183. }
  184. private static double getChestAwardAmt;
  185. #endregion
  186. public static Action<int> OnLevelChange;
  187. public static Action<double> OnCoinChange;
  188. public static Action<double> OnDiamondChange;
  189. public static int GardenLevel
  190. {
  191. get { return gardenLevel; }
  192. set
  193. {
  194. gardenLevel = value;
  195. if (!Inited)
  196. {
  197. return;
  198. }
  199. LanguageManager.Add(ResourceManager.Get<Text>(CanvasLabel.C_LevelText), new MulLanStr(LanguageLabel.UI__C_Level), gardenLevel.ToString());
  200. VisitManager.UpdateVisitCost();
  201. AchieveManager.UpdateStatus(AchieveType.GardenLevel, gardenLevel);
  202. for (int i = 0; i < SkillList.Count; i++)
  203. {
  204. SkillList[i].UpdateStatus();
  205. }
  206. foreach (var kv in PlayerManager.CloseItemDictionary)
  207. {
  208. kv.Value.OnLevelChange();
  209. }
  210. if (OnLevelChange != null)
  211. {
  212. OnLevelChange.Invoke(gardenLevel);
  213. }
  214. if (gardenLevel >= TutorialManager.MemoryMinigameTutorialLevel)
  215. {
  216. if (TutorialManager.memoryMinigameTutorial)
  217. {
  218. TutorialManager.MemoryMinigameTutorial = true;
  219. }
  220. }
  221. if (GardenLevel < TutorialManager.DressroomTutorialLevel)
  222. {
  223. ResourceManager.Get<Image>(CanvasLabel.C_DressRoom).material = Lib.GrayMat;
  224. }
  225. else
  226. {
  227. ResourceManager.Get<Image>(CanvasLabel.C_DressRoom).material = null;
  228. }
  229. if (GardenManager.TotalUnlockFlower >= TutorialManager.MinFlowerForFindSoloGame && gardenLevel >= TutorialManager.FindSoloMinigameTutorialLevel)
  230. {
  231. if (TutorialManager.findSoloMinigameTutorial)
  232. {
  233. TutorialManager.PlayFindSoloGame();
  234. }
  235. }
  236. if (GardenManager.TotalUnlockFlower >= TutorialManager.MinFlowerForFindMissingGame && gardenLevel >= TutorialManager.FindMissingMinigameTutorialLevel)
  237. {
  238. if (TutorialManager.findMissingMinigameTutorial)
  239. {
  240. TutorialManager.PlayFindMissingGame();
  241. }
  242. }
  243. if (gardenLevel >= TutorialManager.CommentTutorialLevel)
  244. {
  245. ResourceManager.Get(CanvasLabel.C_CommentParent).TweenForCG();
  246. }
  247. if (gardenLevel >= TutorialManager.VisitTutorialLevel)
  248. {
  249. if (TutorialManager.visitTutorial)
  250. {
  251. TutorialManager.ClickVisitBtn();
  252. return;
  253. }
  254. else
  255. {
  256. ResourceManager.SetActive(CanvasLabel.C_Visit, true);
  257. }
  258. }
  259. if (gardenLevel >= TutorialManager.DressroomTutorialLevel)
  260. {
  261. if (TutorialManager.dressroomTutorial)
  262. {
  263. TutorialManager.ClickDressroomButton();
  264. return;
  265. }
  266. }
  267. if (gardenLevel >= TutorialManager.PlazaRoomTutorialLevel)
  268. {
  269. if (TutorialManager.plazaRoomTutorial)
  270. {
  271. TutorialManager.ClickPlazaRoomBtn();
  272. return;
  273. }
  274. else
  275. {
  276. ResourceManager.SetActive(CanvasLabel.C_EnterPlazaRoom, true);
  277. ResourceManager.SetActive(CanvasLabel.C_EnterPlazaRoom0, true);
  278. }
  279. }
  280. if (gardenLevel >= TutorialManager.FashionShowTutorialLevel)
  281. {
  282. if (TutorialManager.fashionShowTutorial)
  283. {
  284. TutorialManager.BeginFashionShowTutorial();
  285. return;
  286. }
  287. }
  288. if (gardenLevel >= TutorialManager.ChangeMouseTutorialLevel)
  289. {
  290. if (TutorialManager.changeMouseTutorial)
  291. {
  292. TutorialManager.BeginChangeMouseTutorial();
  293. return;
  294. }
  295. }
  296. }
  297. }
  298. private static int gardenLevel;
  299. public static float Person
  300. {
  301. get { return person; }
  302. set
  303. {
  304. person = value;
  305. ResourceManager.SetText(CanvasLabel.F_PersonLab, Auxiliary.ShrinkBigNumberStr(CurrentPerson*60));
  306. }
  307. }
  308. private static float person;
  309. public static List<string> ExtraPersonSourceSpritesName = new List<string>();
  310. public static float CoinPerson
  311. {
  312. get { return coinPerson; }
  313. set
  314. {
  315. coinPerson = value;
  316. ResourceManager.SetText(CanvasLabel.F_CoinPersonLab, Auxiliary.ShrinkBigNumberStr(CurrentCoinPerson));
  317. }
  318. }
  319. private static float coinPerson;
  320. public static List<string> ExtraCoinPersonSourceSpritesName = new List<string>();
  321. public static float SkillPerson
  322. {
  323. get { return skillPerson; }
  324. set
  325. {
  326. skillPerson = value;
  327. //TweenOutline tween = ResourceManager.Get(CanvasLabel.F_PersonLab).GetTweenOutline();
  328. //if (skillPerson.Equal(0))
  329. //{
  330. // tween.Pause();
  331. // tween.Target.enabled = false;
  332. //}
  333. //else
  334. //{
  335. // if (tween.InPause)
  336. // {
  337. // tween.Resume();
  338. // tween.Target.enabled = true;
  339. // }
  340. // else
  341. // {
  342. // tween.StartForward();
  343. // }
  344. //}
  345. Person = Person;
  346. }
  347. }
  348. public static float skillPerson;
  349. public static float TempSkillPerson
  350. {
  351. get { return tempSkillPerson; }
  352. set
  353. {
  354. tempSkillPerson = value;
  355. TweenOutline tween = ResourceManager.Get(CanvasLabel.F_PersonLab).GetTweenOutline();
  356. if (tempSkillPerson.Equal(0) && tempSkillPersonBuff.Equal(0))
  357. {
  358. tween.Pause();
  359. tween.Target.enabled = false;
  360. }
  361. else
  362. {
  363. if (tween.InPause)
  364. {
  365. tween.Resume();
  366. tween.Target.enabled = true;
  367. }
  368. else
  369. {
  370. tween.StartForward();
  371. }
  372. }
  373. Person = Person;
  374. }
  375. }
  376. public static float tempSkillPerson;
  377. public static float SkillPersonBuff
  378. {
  379. get { return skillPersonBuff; }
  380. set
  381. {
  382. skillPersonBuff = value;
  383. Person = Person;
  384. }
  385. }
  386. public static float skillPersonBuff;
  387. public static float TempSkillPersonBuff
  388. {
  389. get { return tempSkillPersonBuff; }
  390. set
  391. {
  392. tempSkillPersonBuff = value;
  393. TweenOutline tween = ResourceManager.Get(CanvasLabel.F_PersonLab).GetTweenOutline();
  394. if (tempSkillPerson.Equal(0) && tempSkillPersonBuff.Equal(0))
  395. {
  396. tween.Pause();
  397. tween.Target.enabled = false;
  398. }
  399. else
  400. {
  401. if (tween.InPause)
  402. {
  403. tween.Resume();
  404. tween.Target.enabled = true;
  405. }
  406. else
  407. {
  408. tween.StartForward();
  409. }
  410. }
  411. Person = Person;
  412. }
  413. }
  414. public static float tempSkillPersonBuff;
  415. public static float SkillCoinPerson
  416. {
  417. get { return skillCoinPerson; }
  418. set
  419. {
  420. skillCoinPerson = value;
  421. CoinPerson = CoinPerson;
  422. }
  423. }
  424. public static float skillCoinPerson;
  425. public static float TempSkillCoinPerson
  426. {
  427. get { return tempSkillCoinPerson; }
  428. set
  429. {
  430. tempSkillCoinPerson = value;
  431. TweenOutline tween = ResourceManager.Get(CanvasLabel.F_CoinPersonLab).GetTweenOutline();
  432. if (tempSkillCoinPerson.Equal(0) && tempSkillCoinPersonBuff.Equal(0))
  433. {
  434. tween.Pause();
  435. tween.Target.enabled = false;
  436. }
  437. else
  438. {
  439. if (tween.InPause)
  440. {
  441. tween.Resume();
  442. tween.Target.enabled = true;
  443. }
  444. else
  445. {
  446. tween.StartForward();
  447. }
  448. }
  449. CoinPerson = CoinPerson;
  450. }
  451. }
  452. public static float tempSkillCoinPerson;
  453. public static float SkillCoinPersonBuff
  454. {
  455. get { return skillCoinPersonBuff; }
  456. set
  457. {
  458. skillCoinPersonBuff = value;
  459. CoinPerson = CoinPerson;
  460. }
  461. }
  462. public static float skillCoinPersonBuff;
  463. public static float TempSkillCoinPersonBuff
  464. {
  465. get { return tempSkillCoinPersonBuff; }
  466. set
  467. {
  468. tempSkillCoinPersonBuff = value;
  469. TweenOutline tween = ResourceManager.Get(CanvasLabel.F_CoinPersonLab).GetTweenOutline();
  470. if (tempSkillCoinPersonBuff.Equal(0) && tempSkillCoinPerson.Equal(0))
  471. {
  472. tween.Pause();
  473. tween.Target.enabled = false;
  474. }
  475. else
  476. {
  477. if (tween.InPause)
  478. {
  479. tween.Resume();
  480. tween.Target.enabled = true;
  481. }
  482. else
  483. {
  484. tween.StartForward();
  485. }
  486. }
  487. CoinPerson = CoinPerson;
  488. }
  489. }
  490. public static float tempSkillCoinPersonBuff;
  491. public static float IncomeBuff
  492. {
  493. get { return SkillCoinPersonBuff + FlowerPlus; }
  494. }
  495. public static float FlowerPlus
  496. {
  497. get { return flowerPlus; }
  498. set
  499. {
  500. flowerPlus = value;
  501. }
  502. }
  503. public static float flowerPlus;
  504. public static float CurrentPerson
  505. {
  506. get
  507. {
  508. //Debug.Log(Person * (1 + SkillPersonBuff + TempSkillPersonBuff) + SkillPerson + TempSkillPerson);
  509. return Person*(1 + SkillPersonBuff + TempSkillPersonBuff) + SkillPerson + TempSkillPerson;
  510. }
  511. }
  512. public static float CurrentCoinPerson
  513. {
  514. get
  515. {
  516. //Debug.Log(CoinPerson * (1 + SkillCoinPersonBuff + TempSkillCoinPersonBuff) + SkillCoinPerson + TempSkillCoinPerson);
  517. return CoinPerson*(1 + SkillCoinPersonBuff + TempSkillCoinPersonBuff) + SkillCoinPerson + TempSkillCoinPerson;
  518. }
  519. }
  520. public static double Coin
  521. {
  522. get { return coin; }
  523. set
  524. {
  525. coin = value;
  526. ResourceManager.SetText(CanvasLabel.F_CoinLab, Auxiliary.ShrinkBigNumberStr(coin));
  527. ResourceManager.SetText(CanvasLabel.C_CoinLab, Auxiliary.ShrinkBigNumberStr(coin));
  528. ResourceManager.SetText(CanvasLabel.P_CoinLab, Auxiliary.ShrinkBigNumberStr(coin));
  529. AchieveManager.UpdateStatus(AchieveType.CurrentCoin, coin);
  530. OnCoinChange.SafeInvoke(coin);
  531. }
  532. }
  533. public static double coin;
  534. public static double Diamond
  535. {
  536. get { return diamond; }
  537. set
  538. {
  539. diamond = value;
  540. ResourceManager.SetText(CanvasLabel.F_DiamondLab, Auxiliary.ShrinkBigNumberStr(diamond));
  541. ResourceManager.SetText(CanvasLabel.P_DiamondLab, Auxiliary.ShrinkBigNumberStr(diamond));
  542. OnDiamondChange.SafeInvoke(diamond);
  543. }
  544. }
  545. public static double diamond;
  546. public static bool MinigameFlag;
  547. public static bool UploadConfigFlag;
  548. public static bool LoginFlag;
  549. public static bool ReactiveFlag;
  550. public static bool DownloadConfigFlag;
  551. public static bool SceneSwitchFlag;
  552. public static bool Inited;
  553. public static bool IsFirstFrame = true;
  554. public static bool InBackground;
  555. public static float IncomeDisplayTime = 60f;
  556. public static float IncomeCircleTime = 10;
  557. public static float IncomeCircleTimer;
  558. public static float CircleIncome
  559. {
  560. get
  561. {
  562. return CurrentPerson * IncomeCircleTime * CurrentCoinPerson * (1 + FlowerPlus);
  563. }
  564. }
  565. public static float GameBeginTime;
  566. public static bool AlreadyGetOfflineIncome;
  567. public static bool OfflineFlag;
  568. public static float OfflineTime;
  569. public static string OfflineIncomeFml;
  570. public static double OfflineMaxCoin;
  571. public static double OfflineMaxTime;
  572. public static double OfflineMinTime = 120;
  573. public static float InputDetectTime = 45;
  574. public static float InputDetectTimer;
  575. public static float LoginTime = 10f;
  576. public static float LoginTimer;
  577. public static float MinigameCDTimer;
  578. public static float UploadConfigTime = 60f;
  579. public static float UploadConfigTimer;
  580. public static Manager Instance;
  581. public static DateTime LastQuitTime;
  582. public static List<Skill> UsingSkillList = new List<Skill>();
  583. public static List<Skill> CoolSkillList = new List<Skill>();
  584. public static List<Skill> OfflineCoolSkillList = new List<Skill>();
  585. public static List<List<Skill>> OfflineUsingSkillList = new List<List<Skill>>();
  586. public static List<SkillRoot> SkillList = new List<SkillRoot>();
  587. public static Dictionary<string, SkillRoot> SkillDictionary = new Dictionary<string, SkillRoot>();
  588. #endregion
  589. private void Update()
  590. {
  591. LoginThread();
  592. if (TutorialManager.NewplayerTutorial)
  593. {
  594. return;
  595. }
  596. InputDetectThread();
  597. ProcessSkillThread();
  598. MinigameCDThread();
  599. UploadConfigThread();
  600. IncomeCircleThread();
  601. }
  602. private void InputDetectThread()
  603. {
  604. //if (VisitManager.InVisit)
  605. //{
  606. // return;
  607. //}
  608. if (Auxiliary.AnyKeyUp)
  609. {
  610. InputDetectTimer = 0;
  611. ResourceManager.Get(CanvasLabel.C_Group).TweenForCG();
  612. }
  613. else
  614. {
  615. InputDetectTimer += Time.deltaTime;
  616. if (InputDetectTimer >= InputDetectTime)
  617. {
  618. InputDetectTimer = 0;
  619. ResourceManager.Get(CanvasLabel.C_Group).TweenBacCG();
  620. }
  621. }
  622. }
  623. private void ProcessSkillThread()
  624. {
  625. for (int i = 0; i < UsingSkillList.Count; i++)
  626. {
  627. if (UsingSkillList[i].DoUpdate())
  628. {
  629. UsingSkillList.RemoveAt(i--);
  630. }
  631. }
  632. for (int i = 0; i < CoolSkillList.Count; i++)
  633. {
  634. if (CoolSkillList[i].DoCD())
  635. {
  636. CoolSkillList.RemoveAt(i--);
  637. }
  638. }
  639. }
  640. private void MinigameCDThread()
  641. {
  642. if (!MinigameFlag)
  643. {
  644. MinigameCDTimer -= Time.deltaTime;
  645. ResourceManager.SetText(CanvasLabel.C_MiniGameLab, Mathf.CeilToInt(MinigameCDTimer).ToString());
  646. if (MinigameCDTimer < 0)
  647. {
  648. MinigameFlag = true;
  649. ResourceManager.Get(CanvasLabel.C_MiniGame).TweenBacRect();
  650. CDMinigamePanelManager.EnableCDButton();
  651. ResourceManager.SetText(CanvasLabel.C_MiniGameLab, "");
  652. StaticsManager.GetInstance().RewardItem(StaticsManager.ItemID.获得小游戏, StaticsManager.ItemType.小游戏, "1", StaticsManager.ConsumeModule.None);
  653. }
  654. }
  655. }
  656. private void UploadConfigThread()
  657. {
  658. if (DownloadConfigFlag)
  659. {
  660. return;
  661. }
  662. UploadConfigTimer += Time.deltaTime;
  663. if (UploadConfigTimer >= UploadConfigTime)
  664. {
  665. UploadConfigTimer = 0;
  666. if (!PlayerPrefManager.GetBool(PlayerPrefManager.INTERACT_CONFIG, false))
  667. {
  668. HttpManager.GetSelfConfig();
  669. }
  670. else
  671. {
  672. HttpManager.UploadConfig();
  673. }
  674. }
  675. }
  676. private void LoginThread()
  677. {
  678. LoginTimer += Time.deltaTime;
  679. if (LoginTimer >= LoginTime)
  680. {
  681. LoginTimer = 0;
  682. HttpManager.Login();
  683. StaticsManager.GetInstance().Online();
  684. }
  685. }
  686. private void IncomeCircleThread()
  687. {
  688. IncomeCircleTimer -= Time.deltaTime;
  689. if (IncomeCircleTimer < 0)
  690. {
  691. IncomeCircleTimer = IncomeCircleTime;
  692. TotalVisitPerson += CurrentPerson * IncomeCircleTime;
  693. float circleIncome = CircleIncome;
  694. AddCoin(circleIncome, StaticsManager.ItemID.获得金币, StaticsManager.ConsumeModule.Income);
  695. ResourceManager.Get(CanvasLabel.C_IncomeLab).TweenReForGra();
  696. ResourceManager.Get(CanvasLabel.C_IncomeLab).TweenReForVec();
  697. ResourceManager.SetText(CanvasLabel.C_IncomeLab, "+" + Auxiliary.ShrinkBigNumberStr(circleIncome, 0));
  698. }
  699. }
  700. public static void AddCoin(double amt, StaticsManager.ItemID itemId, StaticsManager.ConsumeModule consumeModule)
  701. {
  702. Coin += amt;
  703. if (amt > 0)
  704. {
  705. TotalCoin += amt;
  706. StaticsManager.GetInstance().RewardItem(itemId, StaticsManager.ItemType.金币, amt.ToString("0"), consumeModule);
  707. }
  708. }
  709. public static void AddDiamond(double amt, StaticsManager.ItemID itemId, StaticsManager.ConsumeModule consumeModule)
  710. {
  711. Diamond += amt;
  712. if (amt > 0)
  713. {
  714. StaticsManager.GetInstance().RewardItem(itemId, StaticsManager.ItemType.钻石, amt.ToString("0"), consumeModule);
  715. }
  716. }
  717. public override void Reactive()
  718. {
  719. foreach (var kv in SkillDictionary)
  720. {
  721. kv.Value.Reactive();
  722. }
  723. InitAllSkill(false);
  724. GetOfflineIncome();
  725. SignManager.ShowPanels();
  726. }
  727. public override void InstantiatePrefabs()
  728. {
  729. #region 生成技能条
  730. #region 读技能配置
  731. List<XmlAttributeCollection> attributeList = ConfigManager.GetSkillConfig();
  732. for (int i = 0; i < attributeList.Count; i++)
  733. {
  734. SkillRoot skillRoot;
  735. #region MyRegion
  736. if (attributeList[i].Count == 18)
  737. {
  738. skillRoot = new Pack(attributeList[i]);
  739. }
  740. else if (attributeList[i].Count == 24)
  741. {
  742. skillRoot = new Ability(attributeList[i]);
  743. }
  744. else if (attributeList[i].Count == 34)
  745. {
  746. if (string.IsNullOrEmpty(attributeList[i][4].Value))
  747. {
  748. skillRoot = new Skill(attributeList[i]);
  749. }
  750. else
  751. {
  752. skillRoot = new BigSkill(attributeList[i]);
  753. }
  754. }
  755. else
  756. {
  757. throw new Exception(attributeList[i].Count.ToString());
  758. }
  759. #endregion
  760. SkillDictionary.Add(skillRoot.FullID, skillRoot);
  761. SkillList.Add(skillRoot);
  762. }
  763. SkillList.Sort(SkillRoot.Sort);
  764. #endregion
  765. for (int i = 0; i < SkillList.Count; i++)
  766. {
  767. if (SkillList[i].SkillTab != SkillTab.Null)
  768. {
  769. ResourceManager.GetSkillItem(SkillList[i]);
  770. }
  771. }
  772. #endregion
  773. }
  774. public override void FirstInit()
  775. {
  776. ResourceManager.Get<Graphic>(CanvasLabel.F_Elf).material = Lib.GrayMat;
  777. ResourceManager.Get<Graphic>(CanvasLabel.F_Store).material = Lib.GrayMat;
  778. ResourceManager.Get<Graphic>(CanvasLabel.F_Magic).material = Lib.GrayMat;
  779. ResourceManager.Get<Graphic>(CanvasLabel.F_ElfLab).material = Lib.GrayMat;
  780. ResourceManager.Get<Graphic>(CanvasLabel.F_StoreLab).material = Lib.GrayMat;
  781. ResourceManager.Get<Graphic>(CanvasLabel.F_MagicLab).material = Lib.GrayMat;
  782. ResourceManager.Get<Button>(CanvasLabel.F_Elf).interactable = false;
  783. ResourceManager.Get<Button>(CanvasLabel.F_Store).interactable = false;
  784. ResourceManager.Get<Button>(CanvasLabel.F_Magic).interactable = false;
  785. List<XmlAttributeCollection> attributeList = ConfigManager.GetSkillList();
  786. for (int i = 0; i < attributeList.Count; i++)
  787. {
  788. SkillRoot skillRoot = SkillDictionary[attributeList[i][0].Value];
  789. if (!(skillRoot is Skill))
  790. {
  791. skillRoot.RegistReference();
  792. skillRoot.Init(true, OfflineTime, OfflineUsingSkillList, attributeList[i]);
  793. }
  794. }
  795. }
  796. public override void SecondInit()
  797. {
  798. Instance = this;
  799. Coin = ConfigManager.GetDoubleFormConfig(PlayerConfigLabel.Coin);
  800. Diamond = ConfigManager.GetDoubleFormConfig(PlayerConfigLabel.Diamond);
  801. MinigameCDTimer = ConfigManager.GetFloatFormConfig(PlayerConfigLabel.MiniTimer);
  802. IncomeCircleTimer = ConfigManager.GetFloatFormConfig(PlayerConfigLabel.CircleTimer);
  803. if (MinigameCDTimer > 0)
  804. {
  805. ResourceManager.Get(CanvasLabel.C_MiniGame).TweenForRect();
  806. if (ConfigManager.GetBoolFormConfig(PlayerConfigLabel.MinigameCoolFlag))
  807. {
  808. CDMinigamePanelManager.DisableCDButton();
  809. }
  810. }
  811. else
  812. {
  813. MinigameFlag = true;
  814. }
  815. HttpManager.ID = ConfigManager.GetStringFormConfig(PlayerConfigLabel.ID);
  816. HttpManager.SerialNumber = ConfigManager.GetStringFormConfig(PlayerConfigLabel.SerialNumber);
  817. List<string> offlineList = ConfigManager.GetOfflineConfig();
  818. OfflineMaxCoin = Auxiliary.StringToLong(offlineList[1], 999999999999999999);
  819. OfflineMaxTime = Auxiliary.StringToLong(offlineList[2], 999999999999999999);
  820. OfflineIncomeFml = offlineList[0];
  821. List<double> dataList = ConfigManager.GetAchieveValues();
  822. PlayADsAmt = dataList[0];
  823. AllElfLevel = dataList[4];
  824. UseSkillAmt = dataList[1];
  825. SignAmt = dataList[2];
  826. ShareAmt = dataList[3];
  827. TotalFlowerAwardCoin = dataList[6];
  828. TotalVisitPerson = dataList[7];
  829. TotalSpendDiamond = dataList[8];
  830. PlayMinigameAmt = dataList[5];
  831. CreateRoomAmt = dataList[9];
  832. CreateChestAmt = dataList[10];
  833. CreateLuckyChestAmt = dataList[11];
  834. CreateGuessColorChestAmt = dataList[12];
  835. CreateGuessNumberChestAmt = dataList[13];
  836. GetChestAwardAmt = dataList[14];
  837. }
  838. public static void InitAllSkill(bool firstRegist)
  839. {
  840. OfflineFlag = false;
  841. float realOfflineTime = 0;
  842. ResourceManager.SetActive(CanvasLabel.Ba_Lab2, false);
  843. if (HttpManager.IsConnect && ConfigManager.GetBoolFormConfig(PlayerConfigLabel.QuitFlag))
  844. {
  845. AlreadyGetOfflineIncome = true;
  846. LastQuitTime = DateTime.Parse(ConfigManager.GetStringFormConfig(PlayerConfigLabel.QuitTime));
  847. OfflineTime = (float)HttpManager.CurrentDateTime.Subtract(LastQuitTime).TotalSeconds;
  848. MinigameCDTimer -= OfflineTime;
  849. if (OfflineTime <= OfflineMinTime)
  850. {
  851. realOfflineTime = OfflineTime;
  852. OfflineTime = 0;
  853. }
  854. else
  855. {
  856. OfflineFlag = true;
  857. }
  858. if (OfflineTime > OfflineMaxTime)
  859. {
  860. OfflineTime = (long)OfflineMaxTime;
  861. ResourceManager.SetText(CanvasLabel.Ba_Lab2, Language.GetStr(LanguageLabel.UI__Ba_Lab2));
  862. ResourceManager.SetActive(CanvasLabel.Ba_Lab2, true);
  863. }
  864. }
  865. else
  866. {
  867. if (ConfigManager.GetBoolFormConfig(PlayerConfigLabel.QuitFlag))
  868. {
  869. AlreadyGetOfflineIncome = false;
  870. LastQuitTime = DateTime.Parse(ConfigManager.GetStringFormConfig(PlayerConfigLabel.QuitTime));
  871. GameBeginTime = Time.time;
  872. }
  873. }
  874. OfflineUsingSkillList = new List<List<Skill>>();
  875. OfflineCoolSkillList = new List<Skill>();
  876. if (OfflineTime > IncomeCircleTimer)
  877. {
  878. int circle = 1 + Mathf.FloorToInt((OfflineTime - IncomeCircleTimer) / IncomeCircleTime);
  879. for (int i = 0; i < circle; i++)
  880. {
  881. OfflineUsingSkillList.Add(new List<Skill>());
  882. }
  883. }
  884. List<XmlAttributeCollection> attributeList = ConfigManager.GetSkillList();
  885. for (int i = 0; i < attributeList.Count; i++)
  886. {
  887. SkillRoot skillRoot = SkillDictionary[attributeList[i][0].Value];
  888. if (skillRoot is Skill)
  889. {
  890. skillRoot.RegistReference();
  891. skillRoot.Init(firstRegist, OfflineTime, OfflineUsingSkillList, attributeList[i]);
  892. }
  893. }
  894. if (OfflineFlag == false)
  895. {
  896. foreach (var skill in CoolSkillList)
  897. {
  898. skill.CoolTimer -= realOfflineTime;
  899. }
  900. }
  901. }
  902. public static void GetOfflineIncome()
  903. {
  904. double coin = 0;
  905. for (int i = 0; i < OfflineUsingSkillList.Count; i++)
  906. {
  907. for (int j = 0; j < OfflineCoolSkillList.Count; j++)
  908. {
  909. OfflineCoolSkillList[j].CoolTimer -= IncomeCircleTime;
  910. }
  911. for (int j = 0; j < OfflineUsingSkillList[i].Count; j++)
  912. {
  913. OfflineUsingSkillList[i][j].AnnulEffect();
  914. OfflineCoolSkillList.Add(OfflineUsingSkillList[i][j]);
  915. }
  916. TotalVisitPerson += CurrentPerson*IncomeCircleTime;
  917. coin += CircleIncome;
  918. }
  919. IncomeCircleTimer = (OfflineTime - IncomeCircleTimer)%IncomeCircleTime;
  920. for (int j = 0; j < OfflineCoolSkillList.Count; j++)
  921. {
  922. OfflineCoolSkillList[j].CoolTimer -= IncomeCircleTime - IncomeCircleTimer;
  923. }
  924. coin = (long) AdjustOfflineIncome(coin);
  925. AddCoin(coin, StaticsManager.ItemID.获得金币, StaticsManager.ConsumeModule.Income);
  926. ResourceManager.SetText(CanvasLabel.Ba_IconLab, Auxiliary.ShrinkBigNumberStr(coin));
  927. }
  928. public static double AdjustOfflineIncome(double offlineIncome)
  929. {
  930. offlineIncome = (long)Auxiliary.FmlParse(OfflineIncomeFml, "c", offlineIncome.ToString());
  931. if (offlineIncome > OfflineMaxCoin)
  932. {
  933. offlineIncome = OfflineMaxCoin;
  934. ResourceManager.SetText(CanvasLabel.Ba_Lab2, Language.GetStr(LanguageLabel.UI__Ba_Lab2));
  935. ResourceManager.SetActive(CanvasLabel.Ba_Lab2, true);
  936. }
  937. return offlineIncome;
  938. }
  939. public new static void SwitchLanguage()
  940. {
  941. Coin = Coin;
  942. AddDiamond(0, StaticsManager.ItemID.None, StaticsManager.ConsumeModule.None);
  943. }
  944. public static void Pay(string id, double amt, Current current, UnityAction succeedCallback, StaticsManager.ItemID itemId, StaticsManager.ConsumeModule consumeModule, bool navigate = true, bool useBubbleTweenNavigate = true, UnityAction navigateCall = null, int buyAmount = 1)
  945. {
  946. if (TutorialManager.PayExempt)
  947. {
  948. succeedCallback.SafeInvoke();
  949. return;
  950. }
  951. amt = Auxiliary.ShrinkNumber(amt);
  952. if (current == Current.Free)
  953. {
  954. succeedCallback.Invoke();
  955. }
  956. else if (current == Current.AD)
  957. {
  958. IAPManager.PlayAD(succeedCallback);
  959. }
  960. else if (current == Current.Cash)
  961. {
  962. IAPManager.TryPurchase(id);
  963. }
  964. else if (current == Current.Coin)
  965. {
  966. #region MyRegion
  967. if (Coin >= amt)
  968. {
  969. Coin -= amt;
  970. succeedCallback.SafeInvoke();
  971. StaticsManager.GetInstance().UseItem(itemId, StaticsManager.ItemType.金币, buyAmount.ToString(), consumeModule);
  972. }
  973. else
  974. {
  975. ResourceManager.Get(CanvasLabel.Fe_Info).TweenBacCG();
  976. if (navigate)
  977. {
  978. Bubble.Show
  979. (
  980. Language.GetStr(LanguageLabel.Common__ShortCoin),
  981. "",
  982. null,
  983. Lib.GoldSprite,
  984. () =>
  985. {
  986. navigateCall.SafeInvoke();
  987. if (useBubbleTweenNavigate)
  988. {
  989. TweenRoot tween = ResourceManager.Get(CanvasLabel.K_Bubble0).GetTweenScale();
  990. tween.AddEventOnetime
  991. (
  992. EventType.BackwardFinish,
  993. () =>
  994. {
  995. UIManager.NavigateToBuyCoin();
  996. }
  997. );
  998. }
  999. else
  1000. {
  1001. TweenRoot tween = ResourceManager.Get(CanvasLabel.F_Manage0).GetTweenVec();
  1002. tween.AddEventOnetime
  1003. (
  1004. EventType.ForwardFinish,
  1005. () =>
  1006. {
  1007. UIManager.NavigateToBuyCoin();
  1008. }
  1009. );
  1010. }
  1011. }
  1012. );
  1013. Bubble.Lab3.text = Language.GetStr(LanguageLabel.Common__NavigateCoin);
  1014. Bubble.Lab3.SetActive(true);
  1015. Bubble.Lab.SetActive(false);
  1016. }
  1017. else
  1018. {
  1019. Bubble.Show
  1020. (
  1021. null,
  1022. null,
  1023. null,
  1024. Lib.GoldSprite
  1025. );
  1026. Bubble.Lab3.text = Language.GetStr(LanguageLabel.Common__ShortCoin);
  1027. Bubble.Lab3.SetActive(true);
  1028. }
  1029. }
  1030. #endregion
  1031. }
  1032. else if (current == Current.Diamond)
  1033. {
  1034. #region MyRegion
  1035. if (Diamond >= amt)
  1036. {
  1037. Diamond -= amt;
  1038. TotalSpendDiamond += amt;
  1039. succeedCallback.SafeInvoke();
  1040. StaticsManager.GetInstance().PurchaseItem(itemId, StaticsManager.ItemType.钻石, buyAmount.ToString(), amt.ToString("0"), consumeModule);
  1041. }
  1042. else
  1043. {
  1044. ResourceManager.Get(CanvasLabel.Fe_Info).TweenBacCG();
  1045. if (navigate)
  1046. {
  1047. Bubble.Show
  1048. (
  1049. Language.GetStr(LanguageLabel.Common__ShortDiamond),
  1050. "",
  1051. null,
  1052. Lib.DiamondSprite,
  1053. () =>
  1054. {
  1055. navigateCall.SafeInvoke();
  1056. if (useBubbleTweenNavigate)
  1057. {
  1058. TweenRoot tween = ResourceManager.Get(CanvasLabel.K_Bubble0).GetTweenScale();
  1059. tween.AddEventOnetime
  1060. (
  1061. EventType.BackwardFinish,
  1062. () =>
  1063. {
  1064. UIManager.NavigateToBuyDiamond();
  1065. }
  1066. );
  1067. }
  1068. else
  1069. {
  1070. TweenRoot tween = ResourceManager.Get(CanvasLabel.F_Manage0).GetTweenVec();
  1071. tween.AddEventOnetime
  1072. (
  1073. EventType.ForwardFinish,
  1074. () =>
  1075. {
  1076. UIManager.NavigateToBuyDiamond();
  1077. }
  1078. );
  1079. }
  1080. }
  1081. );
  1082. Bubble.Lab3.text = Language.GetStr(LanguageLabel.Common__NavigateDiamond);
  1083. Bubble.Lab3.SetActive(true);
  1084. Bubble.Lab.SetActive(false);
  1085. }
  1086. else
  1087. {
  1088. Bubble.Show
  1089. (
  1090. null,
  1091. null,
  1092. null,
  1093. Lib.DiamondSprite
  1094. );
  1095. Bubble.Lab3.text = Language.GetStr(LanguageLabel.Common__ShortDiamond);
  1096. Bubble.Lab3.SetActive(true);
  1097. }
  1098. }
  1099. #endregion
  1100. }
  1101. else
  1102. {
  1103. throw new Exception(current.ToString());
  1104. }
  1105. }
  1106. public static void FirstTimeLoginCallback(JsonData jsonData)
  1107. {
  1108. if (!Initializer.Inited || !HttpManager.Inited || Inited)
  1109. {
  1110. return;
  1111. }
  1112. HttpManager.GetBuyPackLimitFlag();
  1113. if (HttpManager.IsConnect)
  1114. {
  1115. if (ConfigManager.GetStringFormConfig(PlayerConfigLabel.ID) == PlayerConfigLabel.DefaultID)
  1116. {
  1117. HttpManager.ID = HttpManager.LoginCallbackData["o"].ToString();
  1118. ResourceManager.SetText(CanvasLabel.L_UserLab, HttpManager.ID);
  1119. }
  1120. if (ConfigManager.GetStringFormConfig(PlayerConfigLabel.SerialNumber) == PlayerConfigLabel.DefaultSerialNumber)
  1121. {
  1122. HttpManager.SerialNumber = HttpManager.LoginCallbackData["i"].ToString();
  1123. }
  1124. }
  1125. InitAllSkill(true);
  1126. GetOfflineIncome();
  1127. SignManager.ShowPanels();
  1128. Analytics.SetUserId(HttpManager.ID);
  1129. Inited = true;
  1130. GardenLevel = GardenLevel;
  1131. if (!PlayerPrefManager.GetBool(PlayerPrefManager.INTERACT_CONFIG, false))
  1132. {
  1133. HttpManager.GetSelfConfig();
  1134. }
  1135. else
  1136. {
  1137. HttpManager.UploadConfig();
  1138. }
  1139. ConfigManager.SaveConfigDocument();
  1140. ConfigManager.SaveConfigDocumentToDisk();
  1141. }
  1142. public static void ReactiveLoginCallback(JsonData jsonData)
  1143. {
  1144. LoginFlag = false;
  1145. for (int i = 0; i < Initializer.RegistList.Count; i++)
  1146. {
  1147. Initializer.RegistList[i].Reactive();
  1148. }
  1149. }
  1150. public static void SwitchConfig(string id)
  1151. {
  1152. ResourceManager.SetText(CanvasLabel.La_Lab, Language.GetStr(LanguageLabel.UI__L_Downloading));
  1153. ResourceManager.SetActive(CanvasLabel.La_Lab, true);
  1154. ResourceManager.SetActive(CanvasLabel.La_Mask, true);
  1155. HttpManager.GetConfigByID(id, SwitchConfigCallback);
  1156. }
  1157. public static void SwitchConfigCallback(JsonData jsonData)
  1158. {
  1159. if (jsonData.Inst_Object.Keys.Contains("l"))
  1160. {
  1161. ResourceManager.Get(CanvasLabel.La_Info).TweenBacCG();
  1162. ResourceManager.SetText(CanvasLabel.La_Lab, Language.GetStr(LanguageLabel.UI__La_Lab0));
  1163. ConfigManager.ConfigDocument.LoadXml(jsonData["l"].ToString());
  1164. ConfigManager.ConfigRootNode = ConfigManager.ConfigDocument.SelectSingleNode(PlayerConfigLabel.RootNode);
  1165. ResourceManager.SetText(CanvasLabel.L_UserLab, ConfigManager.GetStringFormConfig(PlayerConfigLabel.ID));
  1166. HttpManager.ID = ConfigManager.GetStringFormConfig(PlayerConfigLabel.ID);
  1167. HttpManager.SerialNumber = ConfigManager.GetStringFormConfig(PlayerConfigLabel.SerialNumber);
  1168. Debug.Log(HttpManager.ID);
  1169. Debug.Log(HttpManager.SerialNumber);
  1170. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__La_Lab0), null, null, () => { Application.Quit(); }, null, false);
  1171. UploadConfigFlag = true;
  1172. DownloadConfigFlag = true;
  1173. ConfigManager.SaveConfigDocumentToDisk();
  1174. PlayerPrefs.SetString(Lib.ConfigPrefs, "");
  1175. }
  1176. else
  1177. {
  1178. ResourceManager.SetText(CanvasLabel.La_Lab, Language.GetStr(LanguageLabel.UI__La_Lab1));
  1179. ResourceManager.SetActive(CanvasLabel.La_Mask, false);
  1180. }
  1181. }
  1182. public void OnApplicationQuit()
  1183. {
  1184. if (!UploadConfigFlag)
  1185. {
  1186. VisitManager.ReverseConfigData();
  1187. ConfigManager.SaveConfigDocument();
  1188. ConfigManager.SaveConfigDocumentToDisk();
  1189. }
  1190. }
  1191. public void OnApplicationPause(bool pause)
  1192. {
  1193. if (pause)
  1194. {
  1195. InBackground = true;
  1196. AlreadyGetOfflineIncome = true;
  1197. if (DownloadConfigFlag)
  1198. {
  1199. return;
  1200. }
  1201. VisitManager.ReverseConfigData();
  1202. ConfigManager.SaveConfigDocument();
  1203. ConfigManager.SaveConfigDocumentToDisk();
  1204. }
  1205. else
  1206. {
  1207. StaticsManager.GetInstance().StartSession();
  1208. InBackground = false;
  1209. if (IsFirstFrame)
  1210. {
  1211. IsFirstFrame = false;
  1212. }
  1213. else
  1214. {
  1215. if (TutorialManager.NewplayerTutorial)
  1216. {
  1217. return;
  1218. }
  1219. if (!Initializer.Inited)
  1220. {
  1221. return;
  1222. }
  1223. if (!Initializer.IsGameActivated)
  1224. {
  1225. return;
  1226. }
  1227. if (DownloadConfigFlag)
  1228. {
  1229. return;
  1230. }
  1231. VisitManager.RecoverConfigData();
  1232. if (LoginFlag)
  1233. {
  1234. return;
  1235. }
  1236. if (ReactiveFlag)
  1237. {
  1238. ReactiveFlag = false;
  1239. return;
  1240. }
  1241. LoginFlag = true;
  1242. HttpManager.Login(ReactiveLoginCallback);
  1243. HttpManager.GetMailAwardData();
  1244. }
  1245. }
  1246. }
  1247. }