Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

1552 linhas
35 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using CIG;
  4. using CIG3.ExtensionMethods;
  5. using CIGEnums;
  6. using SUISS.Core;
  7. using SUISSEngine;
  8. using UnityEngine;
  9. public sealed class CIGGameStats : GameStats<CIGGameStats>
  10. {
  11. protected override void OnNewGameState()
  12. {
  13. base.OnNewGameState();
  14. this.NumberOfDict.Clear();
  15. this.CashCountDict.Clear();
  16. this.NumberOfExpansionsPurchased = 0;
  17. this.NumberOfUnlockedLandElements = 0;
  18. this.NumberOfUnlockedElements = 0;
  19. this.NumberOfUsedElements = 0;
  20. this.NumberOfUpgrades = 0;
  21. this.NumberOfBuildings = 0;
  22. this.NumberOfLevel10Upgrades = 0;
  23. this.NumberOfRocksRemoved = 0;
  24. this.GlobalBuildingsBuilt = 0;
  25. this.GlobalBuildingsBuiltWithGold = 0;
  26. this.NumberOfGoldVideosWatched = 0;
  27. this.NumberOfVideosWatched = 0;
  28. this.NumberOfVideosClicked = 0;
  29. this.NumberOfInterstitialsWatched = 0;
  30. this.NumberOfInterstitialsClicked = 0;
  31. this.NumberOfFriendsInvited = 0;
  32. this.NumberOfGoldPackagesBought = 0;
  33. this.GlobalProfitPerHour = Currencies.Zero;
  34. this.CashCollected = 0m;
  35. this.TimesCollected = 0;
  36. this.SpeedupsExecuted = 0;
  37. this.SpeedupsExecutedWithGold = 0;
  38. this.NumberOfIslandsUnlocked = 0;
  39. this.GoldSpent = 0L;
  40. this.GoldSpent_Speedups = 0;
  41. this.GoldSpent_GoldBuildings = 0;
  42. this.GoldSpent_CashBuildings = 0;
  43. this.GoldSpent_CraneQueue = 0;
  44. this.CashSpent_BulldozerQueue = 0L;
  45. this.GoldSpent_Expansions = 0;
  46. this.GoldSpent_CashExchange = 0;
  47. this.GoldSpent_CraneHire = 0;
  48. this.GoldSpent_CranePurchase = 0;
  49. this.GoldSpent_ImmediateBuild = 0;
  50. this.GoldEarned_Ports = 0;
  51. this.DaysPlayedStreak = 0;
  52. this.FirstDateTimePlayed = DateTime.UtcNow;
  53. this.LastDatePlayed = this.FirstDateTimePlayed.Date;
  54. this.NumberOfDaysPlayed = 0;
  55. this.NumberOfDailyBonusStreaksCompleted = 0;
  56. this.NumberOfIAPsViewed = 0;
  57. this.NumberOfIAPsInitiated = 0;
  58. this.NumberOfIAPsPurchased = 0;
  59. this.NumberOfCurrencyMenuWatched = 0;
  60. this.NumberOfTimesAllDailyQuestsCompleted = 0;
  61. this.NumberOfScreenViews = 0;
  62. this.NumberOfBuildingActions = 0;
  63. this.NumberOfSupplementalBuildingsPurchased = 0;
  64. this.NumberOfVirtualCurrenciesSpent = 0;
  65. this.NumberOfQuestsCompleted = 0;
  66. this.NumberOfGoldBuildingsPurchased = 0;
  67. }
  68. public void OnNewBlockUnlocked(IsometricGrid grid, CIGExpansions.ExpansionBlock block)
  69. {
  70. int num = 0;
  71. int num2 = 0;
  72. for (int i = 0; i < block.Size.u; i++)
  73. {
  74. for (int j = 0; j < block.Size.v; j++)
  75. {
  76. if (grid[block.Origin.u + i, block.Origin.v + j].Type != -1)
  77. {
  78. num++;
  79. if (((SurfaceType)grid[block.Origin.u + i, block.Origin.v + j].Type).IsLand())
  80. {
  81. num2++;
  82. }
  83. }
  84. }
  85. }
  86. this.NumberOfUnlockedLandElements += num2;
  87. this.NumberOfUnlockedElements += num;
  88. }
  89. public void OnTileBuilt(GridTile tile)
  90. {
  91. if (tile.status == GridTile.Status.Preview)
  92. {
  93. CityIsland current = CityIsland.Current;
  94. CIGExpansions.ExpansionBlock blockForIndex = current.expansions.GetBlockForIndex(tile.index);
  95. if (blockForIndex.Unlocked)
  96. {
  97. this.NumberOfUsedElements += tile.size.u * tile.size.v;
  98. }
  99. this.AddBuilding(tile.name);
  100. CIGBuilding component = tile.GetComponent<CIGBuilding>();
  101. if (component != null && !component.activatable)
  102. {
  103. this.NumberOfBuildings++;
  104. }
  105. CIGDecoration x = component as CIGDecoration;
  106. if (x != null)
  107. {
  108. this.GetCurrentIslandStats().DecorationsCount++;
  109. }
  110. }
  111. else if (tile.status == GridTile.Status.None)
  112. {
  113. Road component2 = tile.GetComponent<Road>();
  114. if (component2 != null)
  115. {
  116. this.GetCurrentIslandStats().RoadCount++;
  117. }
  118. }
  119. }
  120. public void OnTileDestroyed(GridTile tile, GridTile.Status priorStatus)
  121. {
  122. if (priorStatus != GridTile.Status.Moving && priorStatus != GridTile.Status.Preview)
  123. {
  124. this.NumberOfUsedElements -= tile.size.u * tile.size.v;
  125. string name = tile.name;
  126. this.RemoveBuilding(name);
  127. this.RemoveCashBuilding(name);
  128. }
  129. if (tile.status == GridTile.Status.Destroyed)
  130. {
  131. Road component = tile.GetComponent<Road>();
  132. if (component != null)
  133. {
  134. if (component.IsNormalRoad)
  135. {
  136. this.GetCurrentIslandStats().RoadCount--;
  137. }
  138. else
  139. {
  140. this.GetCurrentIslandStats().RoadCount -= 2;
  141. }
  142. }
  143. else
  144. {
  145. CIGBuilding component2 = tile.GetComponent<CIGBuilding>();
  146. if (component2 != null)
  147. {
  148. if (component2.CurrentLevel == component2.GetMaxLevel() && component2.GetMaxLevel() > 1)
  149. {
  150. this.GetCurrentIslandStats().MaxLevelBuildingCount--;
  151. }
  152. CIGDecoration x = component2 as CIGDecoration;
  153. if (x != null)
  154. {
  155. this.GetCurrentIslandStats().DecorationsCount--;
  156. }
  157. }
  158. }
  159. }
  160. }
  161. public void SetCurrentCityIsland(CityIsland cityIsland)
  162. {
  163. this._currentIsland = cityIsland;
  164. if (cityIsland != null && this.GetIslandStats(cityIsland.island) == null)
  165. {
  166. string sceneName = cityIsland.island.GetSceneName();
  167. this.IslandStatsData[sceneName] = new Dictionary<string, object>();
  168. CIGIslandStats islandStats = this.GetIslandStats(cityIsland.island);
  169. islandStats.PopuplateStats(cityIsland);
  170. }
  171. }
  172. public CIGIslandStats GetCurrentIslandStats()
  173. {
  174. if (this._currentIsland == null)
  175. {
  176. return null;
  177. }
  178. return this.GetIslandStats(this._currentIsland.island);
  179. }
  180. public bool IsNewBuilding(string key)
  181. {
  182. if (string.IsNullOrEmpty(key))
  183. {
  184. return false;
  185. }
  186. if (key.Equals("beach_resort", StringComparison.InvariantCultureIgnoreCase) || key.Equals("bed_and_breakfast_2", StringComparison.InvariantCultureIgnoreCase) || key.Equals("cocktail_bar", StringComparison.InvariantCultureIgnoreCase) || key.Equals("hotel3", StringComparison.InvariantCultureIgnoreCase) || key.Equals("night_club", StringComparison.InvariantCultureIgnoreCase) || key.Equals("offices3", StringComparison.InvariantCultureIgnoreCase) || key.Equals("small_shopping_mall", StringComparison.InvariantCultureIgnoreCase) || key.Equals("museum_of_modern_art", StringComparison.InvariantCultureIgnoreCase) || key.Equals("prison", StringComparison.InvariantCultureIgnoreCase) || key.Equals("spa", StringComparison.InvariantCultureIgnoreCase) || key.Equals("futuristic_skyscraper_4", StringComparison.InvariantCultureIgnoreCase) || key.Equals("futuristic_skyscraper_5", StringComparison.InvariantCultureIgnoreCase) || key.Equals("house_skyscraper1", StringComparison.InvariantCultureIgnoreCase) || key.Equals("house_skyscraper4", StringComparison.InvariantCultureIgnoreCase))
  187. {
  188. DateTime dateTime = new DateTime(2014, 8, 21);
  189. return dateTime.Subtract(DateTime.Now).Days > 0;
  190. }
  191. return false;
  192. }
  193. public int CashCount(string objectName)
  194. {
  195. return this.CashCountDict.GetInt(objectName, 0);
  196. }
  197. public int NumberOf(string objectName)
  198. {
  199. return this.NumberOfDict.GetInt(objectName, 0);
  200. }
  201. private Dictionary<string, object> GetDict(string key)
  202. {
  203. Dictionary<string, object> dictionary = this.GetValue(key, null) as Dictionary<string, object>;
  204. if (dictionary == null)
  205. {
  206. dictionary = new Dictionary<string, object>();
  207. this.SetValue(key, dictionary);
  208. }
  209. return dictionary;
  210. }
  211. private Dictionary<string, object> NumberOfDict
  212. {
  213. get
  214. {
  215. return this.GetDict("NumberOf");
  216. }
  217. }
  218. private Dictionary<string, object> CashCountDict
  219. {
  220. get
  221. {
  222. return this.GetDict("CashCount");
  223. }
  224. }
  225. public int NumberOfExpansionsPurchased
  226. {
  227. get
  228. {
  229. return this.GetValue<int>("NumberOfExpansionsPurchased", 0);
  230. }
  231. private set
  232. {
  233. this.SetValue("NumberOfExpansionsPurchased", value);
  234. }
  235. }
  236. public int NumberOfExpansionsPurchasedWithGold
  237. {
  238. get
  239. {
  240. return this.GetValue<int>("NumberOfExpansionsPurchasedWithgold", 0);
  241. }
  242. private set
  243. {
  244. this.SetValue("NumberOfExpansionsPurchasedWithgold", value);
  245. }
  246. }
  247. public int NumberOfUnlockedLandElements
  248. {
  249. get
  250. {
  251. return this.GetValue<int>("NumberOfUnlockedLandElements", 0);
  252. }
  253. private set
  254. {
  255. this.SetValue("NumberOfUnlockedLandElements", value);
  256. }
  257. }
  258. public int NumberOfUnlockedElements
  259. {
  260. get
  261. {
  262. return this.GetValue<int>("NumberOfUnlockedElements", 0);
  263. }
  264. private set
  265. {
  266. this.SetValue("NumberOfUnlockedElements", value);
  267. }
  268. }
  269. public int NumberOfUsedElements
  270. {
  271. get
  272. {
  273. return this.GetValue<int>("NumberOfUsedElements", 0);
  274. }
  275. private set
  276. {
  277. this.SetValue("NumberOfUsedElements", value);
  278. }
  279. }
  280. public int NumberOfUpgrades
  281. {
  282. get
  283. {
  284. return this.GetValue<int>("NumberOfUpgrades", 0);
  285. }
  286. private set
  287. {
  288. this.SetValue("NumberOfUpgrades", value);
  289. }
  290. }
  291. public int NumberOfBuildings
  292. {
  293. get
  294. {
  295. return this.GetValue<int>("NumberOfBuildings", 0);
  296. }
  297. private set
  298. {
  299. this.SetValue("NumberOfBuildings", value);
  300. }
  301. }
  302. public int NumberOfLevel10Upgrades
  303. {
  304. get
  305. {
  306. return this.GetValue<int>("NumberOfLevel10Upgrades", 0);
  307. }
  308. private set
  309. {
  310. this.SetValue("NumberOfLevel10Upgrades", value);
  311. }
  312. }
  313. public int NumberOfRocksRemoved
  314. {
  315. get
  316. {
  317. return this.GetValue<int>("NumberOfRocksRemoved", 0);
  318. }
  319. private set
  320. {
  321. this.SetValue("NumberOfRocksRemoved", value);
  322. }
  323. }
  324. public int GlobalBuildingsBuilt
  325. {
  326. get
  327. {
  328. return this.GetValue<int>("GlobalBuildingsBuilt", 0);
  329. }
  330. private set
  331. {
  332. this.SetValue("GlobalBuildingsBuilt", value);
  333. }
  334. }
  335. public int NumberOfGoldVideosWatched
  336. {
  337. get
  338. {
  339. return this.GetValue<int>("GoldVideosWatched", 0);
  340. }
  341. private set
  342. {
  343. this.SetValue("GoldVideosWatched", value);
  344. }
  345. }
  346. public int NumberOfVideosWatched
  347. {
  348. get
  349. {
  350. return this.GetValue<int>("VideosWatched", 0);
  351. }
  352. private set
  353. {
  354. this.SetValue("VideosWatched", value);
  355. }
  356. }
  357. public int NumberOfVideosClicked
  358. {
  359. get
  360. {
  361. return this.GetValue<int>("GoldVideosClicked", 0);
  362. }
  363. private set
  364. {
  365. this.SetValue("GoldVideosClicked", value);
  366. }
  367. }
  368. public int NumberOfInterstitialsWatched
  369. {
  370. get
  371. {
  372. return this.GetValue<int>("InterstitialsWatched", 0);
  373. }
  374. private set
  375. {
  376. this.SetValue("InterstitialsWatched", value);
  377. }
  378. }
  379. public int NumberOfInterstitialsClicked
  380. {
  381. get
  382. {
  383. return this.GetValue<int>("InterstitialsClicked", 0);
  384. }
  385. private set
  386. {
  387. this.SetValue("InterstitialsClicked", value);
  388. }
  389. }
  390. public int NumberOfFriendsInvited
  391. {
  392. get
  393. {
  394. return this.GetValue<int>("NumberOfFriendsInvited", 0);
  395. }
  396. private set
  397. {
  398. this.SetValue("NumberOfFriendsInvited", value);
  399. }
  400. }
  401. public int NumberOfGoldPackagesBought
  402. {
  403. get
  404. {
  405. return this.GetValue<int>("NumberOfGoldPackagesBought", 0);
  406. }
  407. private set
  408. {
  409. this.SetValue("NumberOfGoldPackagesBought", value);
  410. }
  411. }
  412. public Currencies GlobalProfitPerHour
  413. {
  414. get
  415. {
  416. return this.GetValue<Currencies>("GlobalProfitPerHour", new Currencies());
  417. }
  418. private set
  419. {
  420. this.SetValue("GlobalProfitPerHour", value);
  421. }
  422. }
  423. public decimal CashCollected
  424. {
  425. get
  426. {
  427. return this.GetValue<decimal>("CashCollected", 0m);
  428. }
  429. private set
  430. {
  431. this.SetValue("CashCollected", value);
  432. }
  433. }
  434. public int TimesCollected
  435. {
  436. get
  437. {
  438. return this.GetValue<int>("TimesCollected", 0);
  439. }
  440. private set
  441. {
  442. this.SetValue("TimesCollected", value);
  443. }
  444. }
  445. public int NumberOfTimesAllDailyQuestsCompleted
  446. {
  447. get
  448. {
  449. return this.GetValue<int>("NumberOfTimesAllDailyQuestsCompleted", 0);
  450. }
  451. private set
  452. {
  453. this.SetValue("NumberOfTimesAllDailyQuestsCompleted", value);
  454. }
  455. }
  456. public int SpeedupsExecuted
  457. {
  458. get
  459. {
  460. return this.GetValue<int>("SpeedupsExecuted", 0);
  461. }
  462. private set
  463. {
  464. this.SetValue("SpeedupsExecuted", value);
  465. }
  466. }
  467. public int SpeedupsExecutedWithGold
  468. {
  469. get
  470. {
  471. return this.GetValue<int>("SpeedupsExecutedWithGold", 0);
  472. }
  473. private set
  474. {
  475. this.SetValue("SpeedupsExecutedWithGold", value);
  476. }
  477. }
  478. public int NumberOfIslandsUnlocked
  479. {
  480. get
  481. {
  482. return this.GetValue<int>("NumberOfIslandsUnlocked", 0);
  483. }
  484. private set
  485. {
  486. this.SetValue("NumberOfIslandsUnlocked", value);
  487. }
  488. }
  489. public int GlobalBuildingsBuiltWithGold
  490. {
  491. get
  492. {
  493. return this.GetValue<int>("GlobalBuildingsBuiltWithGold", 0);
  494. }
  495. private set
  496. {
  497. this.SetValue("GlobalBuildingsBuiltWithGold", value);
  498. }
  499. }
  500. public long GoldSpent
  501. {
  502. get
  503. {
  504. return this.GetValue<long>("GoldSpent", 0L);
  505. }
  506. private set
  507. {
  508. this.SetValue("GoldSpent", value);
  509. }
  510. }
  511. public int GoldSpent_Speedups
  512. {
  513. get
  514. {
  515. return this.GetValue<int>("GoldSpent_Speedups", 0);
  516. }
  517. private set
  518. {
  519. this.SetValue("GoldSpent_Speedups", value);
  520. }
  521. }
  522. public int GoldSpent_ImmediateBuild
  523. {
  524. get
  525. {
  526. return this.GetValue<int>("GoldSpent_ImmediateBuildKey", 0);
  527. }
  528. private set
  529. {
  530. this.SetValue("GoldSpent_ImmediateBuildKey", value);
  531. }
  532. }
  533. public int GoldSpent_GoldBuildings
  534. {
  535. get
  536. {
  537. return this.GetValue<int>("GoldSpent_GoldBuildings", 0);
  538. }
  539. private set
  540. {
  541. this.SetValue("GoldSpent_GoldBuildings", value);
  542. }
  543. }
  544. public int GoldSpent_DiscountedGoldBuildings
  545. {
  546. get
  547. {
  548. return this.GetValue<int>("GoldSpent_DiscountedGoldBuildings", 0);
  549. }
  550. private set
  551. {
  552. this.SetValue("GoldSpent_DiscountedGoldBuildings", value);
  553. }
  554. }
  555. public int GoldSpent_CashBuildings
  556. {
  557. get
  558. {
  559. return this.GetValue<int>("GoldSpent_CashBuildings", 0);
  560. }
  561. private set
  562. {
  563. this.SetValue("GoldSpent_CashBuildings", value);
  564. }
  565. }
  566. public int GoldSpent_CraneQueue
  567. {
  568. get
  569. {
  570. return this.GetValue<int>("GoldSpent_CraneQueue", 0);
  571. }
  572. private set
  573. {
  574. this.SetValue("GoldSpent_CraneQueue", value);
  575. }
  576. }
  577. public long CashSpent_BulldozerQueue
  578. {
  579. get
  580. {
  581. return this.GetValue<long>("CashSpent_BulldozerQueue", 0L);
  582. }
  583. private set
  584. {
  585. this.SetValue("CashSpent_BulldozerQueue", value);
  586. }
  587. }
  588. public int GoldSpent_Expansions
  589. {
  590. get
  591. {
  592. return this.GetValue<int>("GoldSpent_Expansions", 0);
  593. }
  594. private set
  595. {
  596. this.SetValue("GoldSpent_Expansions", value);
  597. }
  598. }
  599. public int GoldSpent_CashExchange
  600. {
  601. get
  602. {
  603. return this.GetValue<int>("GoldSpent_CashExchange", 0);
  604. }
  605. private set
  606. {
  607. this.SetValue("GoldSpent_CashExchange", value);
  608. }
  609. }
  610. public int GoldSpent_CraneHire
  611. {
  612. get
  613. {
  614. return this.GetValue<int>("GoldSpent_CraneHire", 0);
  615. }
  616. private set
  617. {
  618. this.SetValue("GoldSpent_CraneHire", value);
  619. }
  620. }
  621. public int GoldSpent_CranePurchase
  622. {
  623. get
  624. {
  625. return this.GetValue<int>("GoldSpent_CranePurchase", 0);
  626. }
  627. private set
  628. {
  629. this.SetValue("GoldSpent_CranePurchase", value);
  630. }
  631. }
  632. public int GoldEarned_Ports
  633. {
  634. get
  635. {
  636. return this.GetValue<int>("GoldEarned_Ports", 0);
  637. }
  638. private set
  639. {
  640. this.SetValue("GoldEarned_Ports", value);
  641. }
  642. }
  643. public int DaysPlayedStreak
  644. {
  645. get
  646. {
  647. return this.GetValue<int>("DaysPlayedStreak", 0);
  648. }
  649. private set
  650. {
  651. this.SetValue("DaysPlayedStreak", value);
  652. }
  653. }
  654. public int NumberOfTimesPlayed
  655. {
  656. get
  657. {
  658. return this.GetValue<int>("NumberOfTimesPlayed", 0);
  659. }
  660. private set
  661. {
  662. this.SetValue("NumberOfTimesPlayed", value);
  663. }
  664. }
  665. public int NumberOfDaysPlayed
  666. {
  667. get
  668. {
  669. return this.GetValue<int>("NumberOfDaysPlayed", 0);
  670. }
  671. private set
  672. {
  673. this.SetValue("NumberOfDaysPlayed", value);
  674. }
  675. }
  676. public int NumberOfDailyBonusStreaksCompleted
  677. {
  678. get
  679. {
  680. return this.GetValue<int>("NumberOfDailyBonusStreaksCompleted", 0);
  681. }
  682. private set
  683. {
  684. this.SetValue("NumberOfDailyBonusStreaksCompleted", value);
  685. }
  686. }
  687. public int NumberOfIAPsViewed
  688. {
  689. get
  690. {
  691. return this.GetValue<int>("NumberOfIAPsViewed", 0);
  692. }
  693. private set
  694. {
  695. this.SetValue("NumberOfIAPsViewed", value);
  696. }
  697. }
  698. public int NumberOfIAPsInitiated
  699. {
  700. get
  701. {
  702. return this.GetValue<int>("NumberOfIAPsInitiated", 0);
  703. }
  704. private set
  705. {
  706. this.SetValue("NumberOfIAPsInitiated", value);
  707. }
  708. }
  709. public int NumberOfIAPsPurchased
  710. {
  711. get
  712. {
  713. return this.GetValue<int>("NumberOfIAPsPurchased", 0);
  714. }
  715. private set
  716. {
  717. this.SetValue("NumberOfIAPsPurchased", value);
  718. }
  719. }
  720. public int NumberOfCurrencyMenuWatched
  721. {
  722. get
  723. {
  724. return this.GetValue<int>("NumberOfCurrencyMenuWatched", 0);
  725. }
  726. private set
  727. {
  728. this.SetValue("NumberOfCurrencyMenuWatched", value);
  729. }
  730. }
  731. public int NumberOfScreenViews
  732. {
  733. get
  734. {
  735. return this.GetValue<int>("NumberOfScreenViews", 0);
  736. }
  737. private set
  738. {
  739. this.SetValue("NumberOfScreenViews", value);
  740. }
  741. }
  742. public int NumberOfBuildingActions
  743. {
  744. get
  745. {
  746. return this.GetValue<int>("NumberOfBuildingActions", 0);
  747. }
  748. private set
  749. {
  750. this.SetValue("NumberOfBuildingActions", value);
  751. }
  752. }
  753. public int NumberOfSupplementalBuildingsPurchased
  754. {
  755. get
  756. {
  757. return this.GetValue<int>("NumberOfSupplementalBuildingsPurchased", 0);
  758. }
  759. private set
  760. {
  761. this.SetValue("NumberOfSupplementalBuildingsPurchased", value);
  762. }
  763. }
  764. public int NumberOfVirtualCurrenciesSpent
  765. {
  766. get
  767. {
  768. return this.GetValue<int>("NumberOfVirtualCurrenciesSpent", 0);
  769. }
  770. private set
  771. {
  772. this.SetValue("NumberOfVirtualCurrenciesSpent", value);
  773. }
  774. }
  775. public int NumberOfQuestsCompleted
  776. {
  777. get
  778. {
  779. return this.GetValue<int>("NumberOfQuestsCompleted", 0);
  780. }
  781. private set
  782. {
  783. this.SetValue("NumberOfQuestsCompleted", value);
  784. }
  785. }
  786. public int NumberOfGoldBuildingsPurchased
  787. {
  788. get
  789. {
  790. return this.GetValue<int>("NumberOfGoldBuildingsPurchased", 0);
  791. }
  792. private set
  793. {
  794. this.SetValue("NumberOfGoldBuildingsPurchased", value);
  795. }
  796. }
  797. public int TotalNumberOfRoads
  798. {
  799. get
  800. {
  801. int num = 0;
  802. Dictionary<string, object> islandStatsData = this.IslandStatsData;
  803. foreach (Island island in IslandExtensions.GetIslands())
  804. {
  805. CIGIslandStats islandStats = this.GetIslandStats(island);
  806. if (islandStats != null)
  807. {
  808. num += islandStats.RoadCount;
  809. }
  810. }
  811. return num;
  812. }
  813. }
  814. public int TotalNumberOfMaxLevelBuildings
  815. {
  816. get
  817. {
  818. int num = 0;
  819. Dictionary<string, object> islandStatsData = this.IslandStatsData;
  820. foreach (Island island in IslandExtensions.GetIslands())
  821. {
  822. CIGIslandStats islandStats = this.GetIslandStats(island);
  823. if (islandStats != null)
  824. {
  825. num += islandStats.MaxLevelBuildingCount;
  826. }
  827. }
  828. return num;
  829. }
  830. }
  831. public int TotalNumberOfDecorations
  832. {
  833. get
  834. {
  835. int num = 0;
  836. Dictionary<string, object> islandStatsData = this.IslandStatsData;
  837. foreach (Island island in IslandExtensions.GetIslands())
  838. {
  839. CIGIslandStats islandStats = this.GetIslandStats(island);
  840. if (islandStats != null)
  841. {
  842. num += islandStats.DecorationsCount;
  843. }
  844. }
  845. return num;
  846. }
  847. }
  848. public void AddCashBuilding(string objectName)
  849. {
  850. if (this.CashCountDict.ContainsKey(objectName))
  851. {
  852. this.CashCountDict[objectName] = 1 + this.CashCountDict.GetInt(objectName, 0);
  853. }
  854. else
  855. {
  856. this.CashCountDict[objectName] = 1;
  857. }
  858. }
  859. public void RemoveCashBuilding(string objectName)
  860. {
  861. if (this.CashCountDict.ContainsKey(objectName))
  862. {
  863. this.CashCountDict[objectName] = Mathf.Max(0, this.CashCountDict.GetInt(objectName, 0) - 1);
  864. }
  865. else
  866. {
  867. this.CashCountDict[objectName] = 0;
  868. }
  869. }
  870. public int GetUniqueBuildingTypeCount()
  871. {
  872. int num = 0;
  873. foreach (string objectName in this.NumberOfDict.Keys)
  874. {
  875. if (this.NumberOf(objectName) > 0)
  876. {
  877. num++;
  878. }
  879. }
  880. return num;
  881. }
  882. public int GetTotalBuildingCount()
  883. {
  884. int num = 0;
  885. foreach (string objectName in this.NumberOfDict.Keys)
  886. {
  887. num += Math.Max(0, this.NumberOf(objectName));
  888. }
  889. return num;
  890. }
  891. public void AddBuilding(string objectName)
  892. {
  893. if (this.NumberOfDict.ContainsKey(objectName))
  894. {
  895. this.NumberOfDict[objectName] = 1 + this.NumberOfDict.GetInt(objectName, 0);
  896. }
  897. else
  898. {
  899. this.NumberOfDict[objectName] = 1;
  900. }
  901. }
  902. private void RemoveBuilding(string objectName)
  903. {
  904. if (this.NumberOfDict.ContainsKey(objectName))
  905. {
  906. this.NumberOfDict[objectName] = Mathf.Max(0, this.NumberOfDict.GetInt(objectName, 0) - 1);
  907. }
  908. else
  909. {
  910. this.NumberOfDict[objectName] = 0;
  911. }
  912. }
  913. public void AddExpansionPurchased(bool boughtWithGold)
  914. {
  915. if (this.NumberOfExpansionsPurchased == 0)
  916. {
  917. }
  918. this.NumberOfExpansionsPurchased++;
  919. if (boughtWithGold)
  920. {
  921. int numberOfExpansionsPurchasedWithGold = this.NumberOfExpansionsPurchasedWithGold;
  922. this.NumberOfExpansionsPurchasedWithGold++;
  923. int numberOfExpansionsPurchased = this.NumberOfExpansionsPurchased;
  924. if (numberOfExpansionsPurchased != 1)
  925. {
  926. if (numberOfExpansionsPurchased != 2)
  927. {
  928. if (numberOfExpansionsPurchased == 3)
  929. {
  930. }
  931. }
  932. else
  933. {
  934. }
  935. }
  936. else
  937. {
  938. }
  939. }
  940. }
  941. public void AddNumberOfUpgrades(int delta)
  942. {
  943. this.NumberOfUpgrades += delta;
  944. }
  945. public void AddNumberOfLevel10Upgrades(int delta)
  946. {
  947. this.NumberOfLevel10Upgrades += delta;
  948. }
  949. public void AddNumberOfRocksRemoved(int delta)
  950. {
  951. this.NumberOfRocksRemoved += delta;
  952. }
  953. public void AddGlobalBuildingsBuilt(int delta)
  954. {
  955. this.GlobalBuildingsBuilt += delta;
  956. }
  957. public void AddNumberOfGoldVideosWatched(int delta)
  958. {
  959. this.NumberOfGoldVideosWatched += delta;
  960. }
  961. public void AddVideoWatched()
  962. {
  963. int numberOfVideosWatched = this.NumberOfVideosWatched;
  964. this.NumberOfVideosWatched++;
  965. }
  966. public void AddVideoClicked()
  967. {
  968. int numberOfVideosClicked = this.NumberOfVideosClicked;
  969. this.NumberOfVideosClicked++;
  970. }
  971. public void AddInterstitialWatched()
  972. {
  973. int numberOfInterstitialsWatched = this.NumberOfInterstitialsWatched;
  974. this.NumberOfInterstitialsWatched++;
  975. }
  976. public void AddInterstitialClicked()
  977. {
  978. int numberOfInterstitialsClicked = this.NumberOfInterstitialsClicked;
  979. this.NumberOfInterstitialsClicked++;
  980. }
  981. public void AddNumberOfFriendsInvited(int delta)
  982. {
  983. this.NumberOfFriendsInvited += delta;
  984. }
  985. public void AddNumberOfGoldPackagesBought(int delta)
  986. {
  987. this.NumberOfGoldPackagesBought += delta;
  988. }
  989. public void AddGlobalProfitPerHour(Currencies delta)
  990. {
  991. this.GlobalProfitPerHour += delta;
  992. }
  993. public void AddCashCollected(Currencies delta)
  994. {
  995. this.CashCollected += delta.GetValue("Cash");
  996. this.TimesCollected++;
  997. }
  998. public void AddSpeedupsExecuted()
  999. {
  1000. int speedupsExecuted = this.SpeedupsExecuted;
  1001. this.SpeedupsExecuted++;
  1002. if (SingletonMonobehaviour<CIGGameState>.Instance.HoursSinceCleanGame <= 24 && this.NumberOfTimesPlayed == 1)
  1003. {
  1004. }
  1005. }
  1006. public void AddSpeedupExecuted(int goldSpent)
  1007. {
  1008. this.AddSpeedupsExecuted();
  1009. if (SingletonMonobehaviour<CIGTutorialManager>.IsAvailable && !SingletonMonobehaviour<CIGTutorialManager>.Instance.IsFinished)
  1010. {
  1011. }
  1012. if (goldSpent > 0)
  1013. {
  1014. this.AddGoldSpent(goldSpent);
  1015. this.GoldSpent_Speedups += goldSpent;
  1016. int speedupsExecutedWithGold = this.SpeedupsExecutedWithGold;
  1017. this.SpeedupsExecutedWithGold++;
  1018. if (SingletonMonobehaviour<CIGGameState>.Instance.HoursSinceCleanGame <= 24)
  1019. {
  1020. }
  1021. }
  1022. }
  1023. public void AddIslandUnlocked()
  1024. {
  1025. this.NumberOfIslandsUnlocked++;
  1026. }
  1027. public void AddGoldBuilding()
  1028. {
  1029. this.GlobalBuildingsBuiltWithGold++;
  1030. }
  1031. public void AddGoldSpent_GoldBuildings(int spent)
  1032. {
  1033. this.AddGoldSpent(spent);
  1034. this.GoldSpent_GoldBuildings += spent;
  1035. this.AddGoldBuildingPurchased();
  1036. }
  1037. public void AddGoldSpent_DiscountedGoldBuildings(int spent)
  1038. {
  1039. this.AddGoldSpent(spent);
  1040. this.GoldSpent_DiscountedGoldBuildings += spent;
  1041. }
  1042. public void AddGoldSpent_CashBuildings(int spent)
  1043. {
  1044. int goldSpent_CashBuildings = this.GoldSpent_CashBuildings;
  1045. this.AddGoldSpent(spent);
  1046. this.GoldSpent_CashBuildings += spent;
  1047. this.AddSupplementalBuildingPurchased();
  1048. }
  1049. public void AddSupplementalBuildingPurchased()
  1050. {
  1051. int numberOfSupplementalBuildingsPurchased = this.NumberOfSupplementalBuildingsPurchased;
  1052. this.NumberOfSupplementalBuildingsPurchased++;
  1053. int hoursSinceCleanGame = SingletonMonobehaviour<CIGGameState>.Instance.HoursSinceCleanGame;
  1054. if (hoursSinceCleanGame <= 24)
  1055. {
  1056. }
  1057. if (hoursSinceCleanGame <= 48)
  1058. {
  1059. }
  1060. if (hoursSinceCleanGame <= 72)
  1061. {
  1062. }
  1063. }
  1064. public void AddGoldSpent_CraneQueue(int spent)
  1065. {
  1066. this.AddGoldSpent(spent);
  1067. this.GoldSpent_CraneQueue += spent;
  1068. }
  1069. public void AddGoldSpent_ImmediateBuild(int spent)
  1070. {
  1071. this.AddGoldSpent(spent);
  1072. this.GoldSpent_ImmediateBuild += spent;
  1073. }
  1074. public void AddCashSpent_BulldozerQueue(int spent)
  1075. {
  1076. this.CashSpent_BulldozerQueue += (long)spent;
  1077. }
  1078. public void AddGoldSpent_Expansions(int spent)
  1079. {
  1080. this.AddGoldSpent(spent);
  1081. this.GoldSpent_Expansions += spent;
  1082. }
  1083. public void AddGoldSpent_CashExchange(int spent)
  1084. {
  1085. this.AddGoldSpent(spent);
  1086. this.GoldSpent_CashExchange += spent;
  1087. }
  1088. public void AddGoldSpent_CraneHire(int spent)
  1089. {
  1090. this.AddGoldSpent(spent);
  1091. this.GoldSpent_CraneHire += spent;
  1092. this.AddVirtualCurrencySpent();
  1093. }
  1094. public void IncrementGoldEarned_Ports()
  1095. {
  1096. this.GoldEarned_Ports++;
  1097. }
  1098. public void AddDaysPlayedStreak(int days)
  1099. {
  1100. this.DaysPlayedStreak += days;
  1101. }
  1102. public void ResetDaysPlayedStreak()
  1103. {
  1104. this.DaysPlayedStreak = 0;
  1105. }
  1106. public void AddDailyBonusStreakCompleted()
  1107. {
  1108. int numberOfDailyBonusStreaksCompleted = this.NumberOfDailyBonusStreaksCompleted;
  1109. this.NumberOfDailyBonusStreaksCompleted++;
  1110. }
  1111. public void AddIAPViewed()
  1112. {
  1113. int numberOfIAPsViewed = this.NumberOfIAPsViewed;
  1114. this.NumberOfIAPsViewed++;
  1115. if (SingletonMonobehaviour<CIGGameState>.Instance.HoursSinceCleanGame <= 24)
  1116. {
  1117. }
  1118. }
  1119. public void AddIAPInitiated()
  1120. {
  1121. int numberOfIAPsInitiated = this.NumberOfIAPsInitiated;
  1122. this.NumberOfIAPsInitiated++;
  1123. }
  1124. public void AddIAPPurchased()
  1125. {
  1126. int numberOfIAPsPurchased = this.NumberOfIAPsPurchased;
  1127. this.NumberOfIAPsPurchased++;
  1128. int numberOfTimesPlayed = this.NumberOfTimesPlayed;
  1129. if (numberOfTimesPlayed != 1)
  1130. {
  1131. if (numberOfTimesPlayed != 2)
  1132. {
  1133. if (numberOfTimesPlayed == 3)
  1134. {
  1135. }
  1136. }
  1137. else
  1138. {
  1139. }
  1140. }
  1141. else
  1142. {
  1143. }
  1144. }
  1145. public void AddCurrencyMenuWatched()
  1146. {
  1147. int numberOfCurrencyMenuWatched = this.NumberOfCurrencyMenuWatched;
  1148. this.NumberOfCurrencyMenuWatched++;
  1149. int numberOfTimesPlayed = this.NumberOfTimesPlayed;
  1150. if (numberOfTimesPlayed != 1)
  1151. {
  1152. if (numberOfTimesPlayed == 2)
  1153. {
  1154. }
  1155. }
  1156. else
  1157. {
  1158. }
  1159. if ((DateTime.UtcNow - this.FirstDateTimePlayed).TotalDays <= 7.0)
  1160. {
  1161. }
  1162. }
  1163. public void AddScreenViewed(string screenName)
  1164. {
  1165. this.AddScreenViewed();
  1166. }
  1167. public void AddScreenViewed()
  1168. {
  1169. int numberOfScreenViews = this.NumberOfScreenViews;
  1170. this.NumberOfScreenViews++;
  1171. if (SingletonMonobehaviour<CIGGameState>.Instance.HoursSinceCleanGame <= 24)
  1172. {
  1173. }
  1174. }
  1175. public void AddBuildingAction()
  1176. {
  1177. int numberOfBuildingActions = this.NumberOfBuildingActions;
  1178. this.NumberOfBuildingActions++;
  1179. if (SingletonMonobehaviour<CIGGameState>.Instance.HoursSinceCleanGame <= 24)
  1180. {
  1181. }
  1182. }
  1183. public void AddVirtualCurrencySpent()
  1184. {
  1185. int numberOfVirtualCurrenciesSpent = this.NumberOfVirtualCurrenciesSpent;
  1186. this.NumberOfVirtualCurrenciesSpent++;
  1187. if (SingletonMonobehaviour<CIGGameState>.Instance.HoursSinceCleanGame <= 24)
  1188. {
  1189. }
  1190. }
  1191. public void AddQuestCompleted()
  1192. {
  1193. int numberOfQuestsCompleted = this.NumberOfQuestsCompleted;
  1194. this.NumberOfQuestsCompleted++;
  1195. }
  1196. public void AddGoldBuildingPurchased()
  1197. {
  1198. int numberOfGoldBuildingsPurchased = this.NumberOfGoldBuildingsPurchased;
  1199. this.NumberOfGoldBuildingsPurchased++;
  1200. int hoursSinceCleanGame = SingletonMonobehaviour<CIGGameState>.Instance.HoursSinceCleanGame;
  1201. if (this.NumberOfTimesPlayed == 1)
  1202. {
  1203. }
  1204. if (hoursSinceCleanGame <= 24)
  1205. {
  1206. if (this.NumberOfTimesPlayed == 1)
  1207. {
  1208. }
  1209. }
  1210. if (hoursSinceCleanGame <= 48)
  1211. {
  1212. }
  1213. if (hoursSinceCleanGame <= 72)
  1214. {
  1215. }
  1216. }
  1217. public void AddTimePlayed()
  1218. {
  1219. this.NumberOfTimesPlayed++;
  1220. }
  1221. public void AddDayPlayed()
  1222. {
  1223. int numberOfDaysPlayed = this.NumberOfDaysPlayed;
  1224. this.NumberOfDaysPlayed++;
  1225. }
  1226. public void IncrementAllDailyQuestsAchieved()
  1227. {
  1228. this.NumberOfTimesAllDailyQuestsCompleted++;
  1229. }
  1230. private CIGIslandStats GetIslandStats(Island island)
  1231. {
  1232. if (this._cachedIslandStats.ContainsKey(island))
  1233. {
  1234. return this._cachedIslandStats[island];
  1235. }
  1236. string sceneName = island.GetSceneName();
  1237. Dictionary<string, object> islandStatsData = this.IslandStatsData;
  1238. if (islandStatsData.ContainsKey(sceneName) && islandStatsData[sceneName] is Dictionary<string, object>)
  1239. {
  1240. this._cachedIslandStats[island] = new CIGIslandStats((Dictionary<string, object>)islandStatsData[sceneName]);
  1241. return this._cachedIslandStats[island];
  1242. }
  1243. return null;
  1244. }
  1245. private Dictionary<string, object> IslandStatsData
  1246. {
  1247. get
  1248. {
  1249. Dictionary<string, object> dictionary = this.GetValue<Dictionary<string, object>>("IslandStatsData", null);
  1250. if (dictionary == null)
  1251. {
  1252. dictionary = new Dictionary<string, object>();
  1253. this.SetValue("IslandStatsData", dictionary);
  1254. }
  1255. return dictionary;
  1256. }
  1257. }
  1258. private void AddGoldSpent(int spent)
  1259. {
  1260. long goldSpent = this.GoldSpent;
  1261. this.GoldSpent += (long)spent;
  1262. long goldSpent2 = this.GoldSpent;
  1263. int numberOfTimesPlayed = this.NumberOfTimesPlayed;
  1264. if (numberOfTimesPlayed != 1)
  1265. {
  1266. if (numberOfTimesPlayed == 2)
  1267. {
  1268. }
  1269. }
  1270. else
  1271. {
  1272. }
  1273. }
  1274. private DateTime FirstDateTimePlayed
  1275. {
  1276. get
  1277. {
  1278. return DateTime.FromBinary(this.GetValue<long>("FirstDateTimePlayed", DateTime.UtcNow.ToBinary()));
  1279. }
  1280. set
  1281. {
  1282. this.SetValue("FirstDateTimePlayed", value.ToBinary());
  1283. }
  1284. }
  1285. private DateTime LastDatePlayed
  1286. {
  1287. get
  1288. {
  1289. return DateTime.FromBinary(this.GetValue<long>("LastDatePlayed", this.FirstDateTimePlayed.Date.ToBinary()));
  1290. }
  1291. set
  1292. {
  1293. this.SetValue("LastDatePlayed", value.ToBinary());
  1294. }
  1295. }
  1296. private void OnDeserialized()
  1297. {
  1298. this.AddTimePlayed();
  1299. CIGGameState instance = SingletonMonobehaviour<CIGGameState>.Instance;
  1300. DateTime date = DateTime.UtcNow.Date;
  1301. if (this.LastDatePlayed < date)
  1302. {
  1303. this.LastDatePlayed = date;
  1304. this.AddDayPlayed();
  1305. }
  1306. }
  1307. private const StringComparison InvariantCultureIgnoreCase = StringComparison.InvariantCultureIgnoreCase;
  1308. public const string NumberOfKey = "NumberOf";
  1309. public const string CashCountKey = "CashCount";
  1310. public const string NumberOfExpansionsPurchasedKey = "NumberOfExpansionsPurchased";
  1311. public const string NumberOfExpansionsPurchasedWithGoldKey = "NumberOfExpansionsPurchasedWithgold";
  1312. public const string NumberOfUnlockedLandElementsKey = "NumberOfUnlockedLandElements";
  1313. public const string NumberOfUnlockedElementsKey = "NumberOfUnlockedElements";
  1314. public const string NumberOfUsedElementsKey = "NumberOfUsedElements";
  1315. public const string NumberOfUpgradesKey = "NumberOfUpgrades";
  1316. public const string NumberOfBuildingsKey = "NumberOfBuildings";
  1317. public const string NumberOfLevel10UpgradesKey = "NumberOfLevel10Upgrades";
  1318. public const string NumberOfRocksRemovedKey = "NumberOfRocksRemoved";
  1319. public const string GlobalBuildingsBuiltKey = "GlobalBuildingsBuilt";
  1320. public const string GlobalBuildingsBuiltWithGoldKey = "GlobalBuildingsBuiltWithGold";
  1321. public const string NumberOfGoldVideosWatchedKey = "GoldVideosWatched";
  1322. public const string NumberOfVideosWatchedKey = "VideosWatched";
  1323. public const string NumberOfVideosClickedKey = "GoldVideosClicked";
  1324. public const string NumberOfInterstitialsWatchedKey = "InterstitialsWatched";
  1325. public const string NumberOfInterstitialsClickedKey = "InterstitialsClicked";
  1326. public const string NumberOfFriendsInvitedKey = "NumberOfFriendsInvited";
  1327. public const string NumberOfGoldPackagesBoughtKey = "NumberOfGoldPackagesBought";
  1328. public const string GlobalProfitPerHourKey = "GlobalProfitPerHour";
  1329. public const string CashCollectedKey = "CashCollected";
  1330. public const string TimesCollectedKey = "TimesCollected";
  1331. public const string SpeedupsExecutedKey = "SpeedupsExecuted";
  1332. public const string SpeedupsExecutedWithGoldKey = "SpeedupsExecutedWithGold";
  1333. public const string NumberOfIslandsUnlockedKey = "NumberOfIslandsUnlocked";
  1334. public const string GoldSpentKey = "GoldSpent";
  1335. public const string GoldSpent_SpeedupsKey = "GoldSpent_Speedups";
  1336. public const string GoldSpent_GoldBuildingsKey = "GoldSpent_GoldBuildings";
  1337. public const string GoldSpent_DiscountedGoldBuildingsKey = "GoldSpent_DiscountedGoldBuildings";
  1338. public const string GoldSpent_CashBuildingsKey = "GoldSpent_CashBuildings";
  1339. public const string GoldSpent_CraneQueueKey = "GoldSpent_CraneQueue";
  1340. public const string CashSpent_BulldozerQueueKey = "CashSpent_BulldozerQueue";
  1341. public const string GoldSpent_ExpansionsKey = "GoldSpent_Expansions";
  1342. public const string GoldSpent_CashExchangeKey = "GoldSpent_CashExchange";
  1343. public const string GoldSpent_CraneHireKey = "GoldSpent_CraneHire";
  1344. public const string GoldSpent_CranePurchaseKey = "GoldSpent_CranePurchase";
  1345. public const string GoldSpent_ImmediateBuildKey = "GoldSpent_ImmediateBuildKey";
  1346. public const string GoldEarned_PortsKey = "GoldEarned_Ports";
  1347. public const string DaysPlayedStreakKey = "DaysPlayedStreak";
  1348. public const string NumberOfTimesPlayedKey = "NumberOfTimesPlayed";
  1349. public const string IslandStatsDataKey = "IslandStatsData";
  1350. public const string FirstDateTimePlayedKey = "FirstDateTimePlayed";
  1351. public const string LastDatePlayedKey = "LastDatePlayed";
  1352. public const string NumberOfDaysPlayedKey = "NumberOfDaysPlayed";
  1353. public const string NumberOfDailyBonusStreaksCompletedKey = "NumberOfDailyBonusStreaksCompleted";
  1354. public const string NumberOfIAPsViewedKey = "NumberOfIAPsViewed";
  1355. public const string NumberOfIAPsInitiatedKey = "NumberOfIAPsInitiated";
  1356. public const string NumberOfIAPsPurchasedKey = "NumberOfIAPsPurchased";
  1357. public const string NumberOfCurrencyMenuWatchedKey = "NumberOfCurrencyMenuWatched";
  1358. public const string NumberOfTimerAllDailyQuestsCompletedKey = "NumberOfTimesAllDailyQuestsCompleted";
  1359. public const string NumberOfScreenViewsKey = "NumberOfScreenViews";
  1360. public const string NumberOfBuildingActionsKey = "NumberOfBuildingActions";
  1361. public const string NumberOfSupplementalBuildingsPurchasedKey = "NumberOfSupplementalBuildingsPurchased";
  1362. public const string NumberOfVirtualCurrenciesSpentKey = "NumberOfVirtualCurrenciesSpent";
  1363. public const string NumberOfQuestsCompletedKey = "NumberOfQuestsCompleted";
  1364. public const string NumberOfGoldBuildingsPurchasedKey = "NumberOfGoldBuildingsPurchased";
  1365. private CityIsland _currentIsland;
  1366. private Dictionary<Island, CIGIslandStats> _cachedIslandStats = new Dictionary<Island, CIGIslandStats>();
  1367. }