using System; using System.Collections.Generic; using CIG; using CIG3.ExtensionMethods; using CIGEnums; using SUISS.Core; using SUISSEngine; using UnityEngine; public sealed class CIGGameStats : GameStats { protected override void OnNewGameState() { base.OnNewGameState(); this.NumberOfDict.Clear(); this.CashCountDict.Clear(); this.NumberOfExpansionsPurchased = 0; this.NumberOfUnlockedLandElements = 0; this.NumberOfUnlockedElements = 0; this.NumberOfUsedElements = 0; this.NumberOfUpgrades = 0; this.NumberOfBuildings = 0; this.NumberOfLevel10Upgrades = 0; this.NumberOfRocksRemoved = 0; this.GlobalBuildingsBuilt = 0; this.GlobalBuildingsBuiltWithGold = 0; this.NumberOfGoldVideosWatched = 0; this.NumberOfVideosWatched = 0; this.NumberOfVideosClicked = 0; this.NumberOfInterstitialsWatched = 0; this.NumberOfInterstitialsClicked = 0; this.NumberOfFriendsInvited = 0; this.NumberOfGoldPackagesBought = 0; this.GlobalProfitPerHour = Currencies.Zero; this.CashCollected = 0m; this.TimesCollected = 0; this.SpeedupsExecuted = 0; this.SpeedupsExecutedWithGold = 0; this.NumberOfIslandsUnlocked = 0; this.GoldSpent = 0L; this.GoldSpent_Speedups = 0; this.GoldSpent_GoldBuildings = 0; this.GoldSpent_CashBuildings = 0; this.GoldSpent_CraneQueue = 0; this.CashSpent_BulldozerQueue = 0L; this.GoldSpent_Expansions = 0; this.GoldSpent_CashExchange = 0; this.GoldSpent_CraneHire = 0; this.GoldSpent_CranePurchase = 0; this.GoldSpent_ImmediateBuild = 0; this.GoldEarned_Ports = 0; this.DaysPlayedStreak = 0; this.FirstDateTimePlayed = DateTime.UtcNow; this.LastDatePlayed = this.FirstDateTimePlayed.Date; this.NumberOfDaysPlayed = 0; this.NumberOfDailyBonusStreaksCompleted = 0; this.NumberOfIAPsViewed = 0; this.NumberOfIAPsInitiated = 0; this.NumberOfIAPsPurchased = 0; this.NumberOfCurrencyMenuWatched = 0; this.NumberOfTimesAllDailyQuestsCompleted = 0; this.NumberOfScreenViews = 0; this.NumberOfBuildingActions = 0; this.NumberOfSupplementalBuildingsPurchased = 0; this.NumberOfVirtualCurrenciesSpent = 0; this.NumberOfQuestsCompleted = 0; this.NumberOfGoldBuildingsPurchased = 0; } public void OnNewBlockUnlocked(IsometricGrid grid, CIGExpansions.ExpansionBlock block) { int num = 0; int num2 = 0; for (int i = 0; i < block.Size.u; i++) { for (int j = 0; j < block.Size.v; j++) { if (grid[block.Origin.u + i, block.Origin.v + j].Type != -1) { num++; if (((SurfaceType)grid[block.Origin.u + i, block.Origin.v + j].Type).IsLand()) { num2++; } } } } this.NumberOfUnlockedLandElements += num2; this.NumberOfUnlockedElements += num; } public void OnTileBuilt(GridTile tile) { if (tile.status == GridTile.Status.Preview) { CityIsland current = CityIsland.Current; CIGExpansions.ExpansionBlock blockForIndex = current.expansions.GetBlockForIndex(tile.index); if (blockForIndex.Unlocked) { this.NumberOfUsedElements += tile.size.u * tile.size.v; } this.AddBuilding(tile.name); CIGBuilding component = tile.GetComponent(); if (component != null && !component.activatable) { this.NumberOfBuildings++; } CIGDecoration x = component as CIGDecoration; if (x != null) { this.GetCurrentIslandStats().DecorationsCount++; } } else if (tile.status == GridTile.Status.None) { Road component2 = tile.GetComponent(); if (component2 != null) { this.GetCurrentIslandStats().RoadCount++; } } } public void OnTileDestroyed(GridTile tile, GridTile.Status priorStatus) { if (priorStatus != GridTile.Status.Moving && priorStatus != GridTile.Status.Preview) { this.NumberOfUsedElements -= tile.size.u * tile.size.v; string name = tile.name; this.RemoveBuilding(name); this.RemoveCashBuilding(name); } if (tile.status == GridTile.Status.Destroyed) { Road component = tile.GetComponent(); if (component != null) { if (component.IsNormalRoad) { this.GetCurrentIslandStats().RoadCount--; } else { this.GetCurrentIslandStats().RoadCount -= 2; } } else { CIGBuilding component2 = tile.GetComponent(); if (component2 != null) { if (component2.CurrentLevel == component2.GetMaxLevel() && component2.GetMaxLevel() > 1) { this.GetCurrentIslandStats().MaxLevelBuildingCount--; } CIGDecoration x = component2 as CIGDecoration; if (x != null) { this.GetCurrentIslandStats().DecorationsCount--; } } } } } public void SetCurrentCityIsland(CityIsland cityIsland) { this._currentIsland = cityIsland; if (cityIsland != null && this.GetIslandStats(cityIsland.island) == null) { string sceneName = cityIsland.island.GetSceneName(); this.IslandStatsData[sceneName] = new Dictionary(); CIGIslandStats islandStats = this.GetIslandStats(cityIsland.island); islandStats.PopuplateStats(cityIsland); } } public CIGIslandStats GetCurrentIslandStats() { if (this._currentIsland == null) { return null; } return this.GetIslandStats(this._currentIsland.island); } public bool IsNewBuilding(string key) { if (string.IsNullOrEmpty(key)) { return false; } 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)) { DateTime dateTime = new DateTime(2014, 8, 21); return dateTime.Subtract(DateTime.Now).Days > 0; } return false; } public int CashCount(string objectName) { return this.CashCountDict.GetInt(objectName, 0); } public int NumberOf(string objectName) { return this.NumberOfDict.GetInt(objectName, 0); } private Dictionary GetDict(string key) { Dictionary dictionary = this.GetValue(key, null) as Dictionary; if (dictionary == null) { dictionary = new Dictionary(); this.SetValue(key, dictionary); } return dictionary; } private Dictionary NumberOfDict { get { return this.GetDict("NumberOf"); } } private Dictionary CashCountDict { get { return this.GetDict("CashCount"); } } public int NumberOfExpansionsPurchased { get { return this.GetValue("NumberOfExpansionsPurchased", 0); } private set { this.SetValue("NumberOfExpansionsPurchased", value); } } public int NumberOfExpansionsPurchasedWithGold { get { return this.GetValue("NumberOfExpansionsPurchasedWithgold", 0); } private set { this.SetValue("NumberOfExpansionsPurchasedWithgold", value); } } public int NumberOfUnlockedLandElements { get { return this.GetValue("NumberOfUnlockedLandElements", 0); } private set { this.SetValue("NumberOfUnlockedLandElements", value); } } public int NumberOfUnlockedElements { get { return this.GetValue("NumberOfUnlockedElements", 0); } private set { this.SetValue("NumberOfUnlockedElements", value); } } public int NumberOfUsedElements { get { return this.GetValue("NumberOfUsedElements", 0); } private set { this.SetValue("NumberOfUsedElements", value); } } public int NumberOfUpgrades { get { return this.GetValue("NumberOfUpgrades", 0); } private set { this.SetValue("NumberOfUpgrades", value); } } public int NumberOfBuildings { get { return this.GetValue("NumberOfBuildings", 0); } private set { this.SetValue("NumberOfBuildings", value); } } public int NumberOfLevel10Upgrades { get { return this.GetValue("NumberOfLevel10Upgrades", 0); } private set { this.SetValue("NumberOfLevel10Upgrades", value); } } public int NumberOfRocksRemoved { get { return this.GetValue("NumberOfRocksRemoved", 0); } private set { this.SetValue("NumberOfRocksRemoved", value); } } public int GlobalBuildingsBuilt { get { return this.GetValue("GlobalBuildingsBuilt", 0); } private set { this.SetValue("GlobalBuildingsBuilt", value); } } public int NumberOfGoldVideosWatched { get { return this.GetValue("GoldVideosWatched", 0); } private set { this.SetValue("GoldVideosWatched", value); } } public int NumberOfVideosWatched { get { return this.GetValue("VideosWatched", 0); } private set { this.SetValue("VideosWatched", value); } } public int NumberOfVideosClicked { get { return this.GetValue("GoldVideosClicked", 0); } private set { this.SetValue("GoldVideosClicked", value); } } public int NumberOfInterstitialsWatched { get { return this.GetValue("InterstitialsWatched", 0); } private set { this.SetValue("InterstitialsWatched", value); } } public int NumberOfInterstitialsClicked { get { return this.GetValue("InterstitialsClicked", 0); } private set { this.SetValue("InterstitialsClicked", value); } } public int NumberOfFriendsInvited { get { return this.GetValue("NumberOfFriendsInvited", 0); } private set { this.SetValue("NumberOfFriendsInvited", value); } } public int NumberOfGoldPackagesBought { get { return this.GetValue("NumberOfGoldPackagesBought", 0); } private set { this.SetValue("NumberOfGoldPackagesBought", value); } } public Currencies GlobalProfitPerHour { get { return this.GetValue("GlobalProfitPerHour", new Currencies()); } private set { this.SetValue("GlobalProfitPerHour", value); } } public decimal CashCollected { get { return this.GetValue("CashCollected", 0m); } private set { this.SetValue("CashCollected", value); } } public int TimesCollected { get { return this.GetValue("TimesCollected", 0); } private set { this.SetValue("TimesCollected", value); } } public int NumberOfTimesAllDailyQuestsCompleted { get { return this.GetValue("NumberOfTimesAllDailyQuestsCompleted", 0); } private set { this.SetValue("NumberOfTimesAllDailyQuestsCompleted", value); } } public int SpeedupsExecuted { get { return this.GetValue("SpeedupsExecuted", 0); } private set { this.SetValue("SpeedupsExecuted", value); } } public int SpeedupsExecutedWithGold { get { return this.GetValue("SpeedupsExecutedWithGold", 0); } private set { this.SetValue("SpeedupsExecutedWithGold", value); } } public int NumberOfIslandsUnlocked { get { return this.GetValue("NumberOfIslandsUnlocked", 0); } private set { this.SetValue("NumberOfIslandsUnlocked", value); } } public int GlobalBuildingsBuiltWithGold { get { return this.GetValue("GlobalBuildingsBuiltWithGold", 0); } private set { this.SetValue("GlobalBuildingsBuiltWithGold", value); } } public long GoldSpent { get { return this.GetValue("GoldSpent", 0L); } private set { this.SetValue("GoldSpent", value); } } public int GoldSpent_Speedups { get { return this.GetValue("GoldSpent_Speedups", 0); } private set { this.SetValue("GoldSpent_Speedups", value); } } public int GoldSpent_ImmediateBuild { get { return this.GetValue("GoldSpent_ImmediateBuildKey", 0); } private set { this.SetValue("GoldSpent_ImmediateBuildKey", value); } } public int GoldSpent_GoldBuildings { get { return this.GetValue("GoldSpent_GoldBuildings", 0); } private set { this.SetValue("GoldSpent_GoldBuildings", value); } } public int GoldSpent_DiscountedGoldBuildings { get { return this.GetValue("GoldSpent_DiscountedGoldBuildings", 0); } private set { this.SetValue("GoldSpent_DiscountedGoldBuildings", value); } } public int GoldSpent_CashBuildings { get { return this.GetValue("GoldSpent_CashBuildings", 0); } private set { this.SetValue("GoldSpent_CashBuildings", value); } } public int GoldSpent_CraneQueue { get { return this.GetValue("GoldSpent_CraneQueue", 0); } private set { this.SetValue("GoldSpent_CraneQueue", value); } } public long CashSpent_BulldozerQueue { get { return this.GetValue("CashSpent_BulldozerQueue", 0L); } private set { this.SetValue("CashSpent_BulldozerQueue", value); } } public int GoldSpent_Expansions { get { return this.GetValue("GoldSpent_Expansions", 0); } private set { this.SetValue("GoldSpent_Expansions", value); } } public int GoldSpent_CashExchange { get { return this.GetValue("GoldSpent_CashExchange", 0); } private set { this.SetValue("GoldSpent_CashExchange", value); } } public int GoldSpent_CraneHire { get { return this.GetValue("GoldSpent_CraneHire", 0); } private set { this.SetValue("GoldSpent_CraneHire", value); } } public int GoldSpent_CranePurchase { get { return this.GetValue("GoldSpent_CranePurchase", 0); } private set { this.SetValue("GoldSpent_CranePurchase", value); } } public int GoldEarned_Ports { get { return this.GetValue("GoldEarned_Ports", 0); } private set { this.SetValue("GoldEarned_Ports", value); } } public int DaysPlayedStreak { get { return this.GetValue("DaysPlayedStreak", 0); } private set { this.SetValue("DaysPlayedStreak", value); } } public int NumberOfTimesPlayed { get { return this.GetValue("NumberOfTimesPlayed", 0); } private set { this.SetValue("NumberOfTimesPlayed", value); } } public int NumberOfDaysPlayed { get { return this.GetValue("NumberOfDaysPlayed", 0); } private set { this.SetValue("NumberOfDaysPlayed", value); } } public int NumberOfDailyBonusStreaksCompleted { get { return this.GetValue("NumberOfDailyBonusStreaksCompleted", 0); } private set { this.SetValue("NumberOfDailyBonusStreaksCompleted", value); } } public int NumberOfIAPsViewed { get { return this.GetValue("NumberOfIAPsViewed", 0); } private set { this.SetValue("NumberOfIAPsViewed", value); } } public int NumberOfIAPsInitiated { get { return this.GetValue("NumberOfIAPsInitiated", 0); } private set { this.SetValue("NumberOfIAPsInitiated", value); } } public int NumberOfIAPsPurchased { get { return this.GetValue("NumberOfIAPsPurchased", 0); } private set { this.SetValue("NumberOfIAPsPurchased", value); } } public int NumberOfCurrencyMenuWatched { get { return this.GetValue("NumberOfCurrencyMenuWatched", 0); } private set { this.SetValue("NumberOfCurrencyMenuWatched", value); } } public int NumberOfScreenViews { get { return this.GetValue("NumberOfScreenViews", 0); } private set { this.SetValue("NumberOfScreenViews", value); } } public int NumberOfBuildingActions { get { return this.GetValue("NumberOfBuildingActions", 0); } private set { this.SetValue("NumberOfBuildingActions", value); } } public int NumberOfSupplementalBuildingsPurchased { get { return this.GetValue("NumberOfSupplementalBuildingsPurchased", 0); } private set { this.SetValue("NumberOfSupplementalBuildingsPurchased", value); } } public int NumberOfVirtualCurrenciesSpent { get { return this.GetValue("NumberOfVirtualCurrenciesSpent", 0); } private set { this.SetValue("NumberOfVirtualCurrenciesSpent", value); } } public int NumberOfQuestsCompleted { get { return this.GetValue("NumberOfQuestsCompleted", 0); } private set { this.SetValue("NumberOfQuestsCompleted", value); } } public int NumberOfGoldBuildingsPurchased { get { return this.GetValue("NumberOfGoldBuildingsPurchased", 0); } private set { this.SetValue("NumberOfGoldBuildingsPurchased", value); } } public int TotalNumberOfRoads { get { int num = 0; Dictionary islandStatsData = this.IslandStatsData; foreach (Island island in IslandExtensions.GetIslands()) { CIGIslandStats islandStats = this.GetIslandStats(island); if (islandStats != null) { num += islandStats.RoadCount; } } return num; } } public int TotalNumberOfMaxLevelBuildings { get { int num = 0; Dictionary islandStatsData = this.IslandStatsData; foreach (Island island in IslandExtensions.GetIslands()) { CIGIslandStats islandStats = this.GetIslandStats(island); if (islandStats != null) { num += islandStats.MaxLevelBuildingCount; } } return num; } } public int TotalNumberOfDecorations { get { int num = 0; Dictionary islandStatsData = this.IslandStatsData; foreach (Island island in IslandExtensions.GetIslands()) { CIGIslandStats islandStats = this.GetIslandStats(island); if (islandStats != null) { num += islandStats.DecorationsCount; } } return num; } } public void AddCashBuilding(string objectName) { if (this.CashCountDict.ContainsKey(objectName)) { this.CashCountDict[objectName] = 1 + this.CashCountDict.GetInt(objectName, 0); } else { this.CashCountDict[objectName] = 1; } } public void RemoveCashBuilding(string objectName) { if (this.CashCountDict.ContainsKey(objectName)) { this.CashCountDict[objectName] = Mathf.Max(0, this.CashCountDict.GetInt(objectName, 0) - 1); } else { this.CashCountDict[objectName] = 0; } } public int GetUniqueBuildingTypeCount() { int num = 0; foreach (string objectName in this.NumberOfDict.Keys) { if (this.NumberOf(objectName) > 0) { num++; } } return num; } public int GetTotalBuildingCount() { int num = 0; foreach (string objectName in this.NumberOfDict.Keys) { num += Math.Max(0, this.NumberOf(objectName)); } return num; } public void AddBuilding(string objectName) { if (this.NumberOfDict.ContainsKey(objectName)) { this.NumberOfDict[objectName] = 1 + this.NumberOfDict.GetInt(objectName, 0); } else { this.NumberOfDict[objectName] = 1; } } private void RemoveBuilding(string objectName) { if (this.NumberOfDict.ContainsKey(objectName)) { this.NumberOfDict[objectName] = Mathf.Max(0, this.NumberOfDict.GetInt(objectName, 0) - 1); } else { this.NumberOfDict[objectName] = 0; } } public void AddExpansionPurchased(bool boughtWithGold) { if (this.NumberOfExpansionsPurchased == 0) { } this.NumberOfExpansionsPurchased++; if (boughtWithGold) { int numberOfExpansionsPurchasedWithGold = this.NumberOfExpansionsPurchasedWithGold; this.NumberOfExpansionsPurchasedWithGold++; int numberOfExpansionsPurchased = this.NumberOfExpansionsPurchased; if (numberOfExpansionsPurchased != 1) { if (numberOfExpansionsPurchased != 2) { if (numberOfExpansionsPurchased == 3) { } } else { } } else { } } } public void AddNumberOfUpgrades(int delta) { this.NumberOfUpgrades += delta; } public void AddNumberOfLevel10Upgrades(int delta) { this.NumberOfLevel10Upgrades += delta; } public void AddNumberOfRocksRemoved(int delta) { this.NumberOfRocksRemoved += delta; } public void AddGlobalBuildingsBuilt(int delta) { this.GlobalBuildingsBuilt += delta; } public void AddNumberOfGoldVideosWatched(int delta) { this.NumberOfGoldVideosWatched += delta; } public void AddVideoWatched() { int numberOfVideosWatched = this.NumberOfVideosWatched; this.NumberOfVideosWatched++; } public void AddVideoClicked() { int numberOfVideosClicked = this.NumberOfVideosClicked; this.NumberOfVideosClicked++; } public void AddInterstitialWatched() { int numberOfInterstitialsWatched = this.NumberOfInterstitialsWatched; this.NumberOfInterstitialsWatched++; } public void AddInterstitialClicked() { int numberOfInterstitialsClicked = this.NumberOfInterstitialsClicked; this.NumberOfInterstitialsClicked++; } public void AddNumberOfFriendsInvited(int delta) { this.NumberOfFriendsInvited += delta; } public void AddNumberOfGoldPackagesBought(int delta) { this.NumberOfGoldPackagesBought += delta; } public void AddGlobalProfitPerHour(Currencies delta) { this.GlobalProfitPerHour += delta; } public void AddCashCollected(Currencies delta) { this.CashCollected += delta.GetValue("Cash"); this.TimesCollected++; } public void AddSpeedupsExecuted() { int speedupsExecuted = this.SpeedupsExecuted; this.SpeedupsExecuted++; if (SingletonMonobehaviour.Instance.HoursSinceCleanGame <= 24 && this.NumberOfTimesPlayed == 1) { } } public void AddSpeedupExecuted(int goldSpent) { this.AddSpeedupsExecuted(); if (SingletonMonobehaviour.IsAvailable && !SingletonMonobehaviour.Instance.IsFinished) { } if (goldSpent > 0) { this.AddGoldSpent(goldSpent); this.GoldSpent_Speedups += goldSpent; int speedupsExecutedWithGold = this.SpeedupsExecutedWithGold; this.SpeedupsExecutedWithGold++; if (SingletonMonobehaviour.Instance.HoursSinceCleanGame <= 24) { } } } public void AddIslandUnlocked() { this.NumberOfIslandsUnlocked++; } public void AddGoldBuilding() { this.GlobalBuildingsBuiltWithGold++; } public void AddGoldSpent_GoldBuildings(int spent) { this.AddGoldSpent(spent); this.GoldSpent_GoldBuildings += spent; this.AddGoldBuildingPurchased(); } public void AddGoldSpent_DiscountedGoldBuildings(int spent) { this.AddGoldSpent(spent); this.GoldSpent_DiscountedGoldBuildings += spent; } public void AddGoldSpent_CashBuildings(int spent) { int goldSpent_CashBuildings = this.GoldSpent_CashBuildings; this.AddGoldSpent(spent); this.GoldSpent_CashBuildings += spent; this.AddSupplementalBuildingPurchased(); } public void AddSupplementalBuildingPurchased() { int numberOfSupplementalBuildingsPurchased = this.NumberOfSupplementalBuildingsPurchased; this.NumberOfSupplementalBuildingsPurchased++; int hoursSinceCleanGame = SingletonMonobehaviour.Instance.HoursSinceCleanGame; if (hoursSinceCleanGame <= 24) { } if (hoursSinceCleanGame <= 48) { } if (hoursSinceCleanGame <= 72) { } } public void AddGoldSpent_CraneQueue(int spent) { this.AddGoldSpent(spent); this.GoldSpent_CraneQueue += spent; } public void AddGoldSpent_ImmediateBuild(int spent) { this.AddGoldSpent(spent); this.GoldSpent_ImmediateBuild += spent; } public void AddCashSpent_BulldozerQueue(int spent) { this.CashSpent_BulldozerQueue += (long)spent; } public void AddGoldSpent_Expansions(int spent) { this.AddGoldSpent(spent); this.GoldSpent_Expansions += spent; } public void AddGoldSpent_CashExchange(int spent) { this.AddGoldSpent(spent); this.GoldSpent_CashExchange += spent; } public void AddGoldSpent_CraneHire(int spent) { this.AddGoldSpent(spent); this.GoldSpent_CraneHire += spent; this.AddVirtualCurrencySpent(); } public void IncrementGoldEarned_Ports() { this.GoldEarned_Ports++; } public void AddDaysPlayedStreak(int days) { this.DaysPlayedStreak += days; } public void ResetDaysPlayedStreak() { this.DaysPlayedStreak = 0; } public void AddDailyBonusStreakCompleted() { int numberOfDailyBonusStreaksCompleted = this.NumberOfDailyBonusStreaksCompleted; this.NumberOfDailyBonusStreaksCompleted++; } public void AddIAPViewed() { int numberOfIAPsViewed = this.NumberOfIAPsViewed; this.NumberOfIAPsViewed++; if (SingletonMonobehaviour.Instance.HoursSinceCleanGame <= 24) { } } public void AddIAPInitiated() { int numberOfIAPsInitiated = this.NumberOfIAPsInitiated; this.NumberOfIAPsInitiated++; } public void AddIAPPurchased() { int numberOfIAPsPurchased = this.NumberOfIAPsPurchased; this.NumberOfIAPsPurchased++; int numberOfTimesPlayed = this.NumberOfTimesPlayed; if (numberOfTimesPlayed != 1) { if (numberOfTimesPlayed != 2) { if (numberOfTimesPlayed == 3) { } } else { } } else { } } public void AddCurrencyMenuWatched() { int numberOfCurrencyMenuWatched = this.NumberOfCurrencyMenuWatched; this.NumberOfCurrencyMenuWatched++; int numberOfTimesPlayed = this.NumberOfTimesPlayed; if (numberOfTimesPlayed != 1) { if (numberOfTimesPlayed == 2) { } } else { } if ((DateTime.UtcNow - this.FirstDateTimePlayed).TotalDays <= 7.0) { } } public void AddScreenViewed(string screenName) { this.AddScreenViewed(); } public void AddScreenViewed() { int numberOfScreenViews = this.NumberOfScreenViews; this.NumberOfScreenViews++; if (SingletonMonobehaviour.Instance.HoursSinceCleanGame <= 24) { } } public void AddBuildingAction() { int numberOfBuildingActions = this.NumberOfBuildingActions; this.NumberOfBuildingActions++; if (SingletonMonobehaviour.Instance.HoursSinceCleanGame <= 24) { } } public void AddVirtualCurrencySpent() { int numberOfVirtualCurrenciesSpent = this.NumberOfVirtualCurrenciesSpent; this.NumberOfVirtualCurrenciesSpent++; if (SingletonMonobehaviour.Instance.HoursSinceCleanGame <= 24) { } } public void AddQuestCompleted() { int numberOfQuestsCompleted = this.NumberOfQuestsCompleted; this.NumberOfQuestsCompleted++; } public void AddGoldBuildingPurchased() { int numberOfGoldBuildingsPurchased = this.NumberOfGoldBuildingsPurchased; this.NumberOfGoldBuildingsPurchased++; int hoursSinceCleanGame = SingletonMonobehaviour.Instance.HoursSinceCleanGame; if (this.NumberOfTimesPlayed == 1) { } if (hoursSinceCleanGame <= 24) { if (this.NumberOfTimesPlayed == 1) { } } if (hoursSinceCleanGame <= 48) { } if (hoursSinceCleanGame <= 72) { } } public void AddTimePlayed() { this.NumberOfTimesPlayed++; } public void AddDayPlayed() { int numberOfDaysPlayed = this.NumberOfDaysPlayed; this.NumberOfDaysPlayed++; } public void IncrementAllDailyQuestsAchieved() { this.NumberOfTimesAllDailyQuestsCompleted++; } private CIGIslandStats GetIslandStats(Island island) { if (this._cachedIslandStats.ContainsKey(island)) { return this._cachedIslandStats[island]; } string sceneName = island.GetSceneName(); Dictionary islandStatsData = this.IslandStatsData; if (islandStatsData.ContainsKey(sceneName) && islandStatsData[sceneName] is Dictionary) { this._cachedIslandStats[island] = new CIGIslandStats((Dictionary)islandStatsData[sceneName]); return this._cachedIslandStats[island]; } return null; } private Dictionary IslandStatsData { get { Dictionary dictionary = this.GetValue>("IslandStatsData", null); if (dictionary == null) { dictionary = new Dictionary(); this.SetValue("IslandStatsData", dictionary); } return dictionary; } } private void AddGoldSpent(int spent) { long goldSpent = this.GoldSpent; this.GoldSpent += (long)spent; long goldSpent2 = this.GoldSpent; int numberOfTimesPlayed = this.NumberOfTimesPlayed; if (numberOfTimesPlayed != 1) { if (numberOfTimesPlayed == 2) { } } else { } } private DateTime FirstDateTimePlayed { get { return DateTime.FromBinary(this.GetValue("FirstDateTimePlayed", DateTime.UtcNow.ToBinary())); } set { this.SetValue("FirstDateTimePlayed", value.ToBinary()); } } private DateTime LastDatePlayed { get { return DateTime.FromBinary(this.GetValue("LastDatePlayed", this.FirstDateTimePlayed.Date.ToBinary())); } set { this.SetValue("LastDatePlayed", value.ToBinary()); } } private void OnDeserialized() { this.AddTimePlayed(); CIGGameState instance = SingletonMonobehaviour.Instance; DateTime date = DateTime.UtcNow.Date; if (this.LastDatePlayed < date) { this.LastDatePlayed = date; this.AddDayPlayed(); } } private const StringComparison InvariantCultureIgnoreCase = StringComparison.InvariantCultureIgnoreCase; public const string NumberOfKey = "NumberOf"; public const string CashCountKey = "CashCount"; public const string NumberOfExpansionsPurchasedKey = "NumberOfExpansionsPurchased"; public const string NumberOfExpansionsPurchasedWithGoldKey = "NumberOfExpansionsPurchasedWithgold"; public const string NumberOfUnlockedLandElementsKey = "NumberOfUnlockedLandElements"; public const string NumberOfUnlockedElementsKey = "NumberOfUnlockedElements"; public const string NumberOfUsedElementsKey = "NumberOfUsedElements"; public const string NumberOfUpgradesKey = "NumberOfUpgrades"; public const string NumberOfBuildingsKey = "NumberOfBuildings"; public const string NumberOfLevel10UpgradesKey = "NumberOfLevel10Upgrades"; public const string NumberOfRocksRemovedKey = "NumberOfRocksRemoved"; public const string GlobalBuildingsBuiltKey = "GlobalBuildingsBuilt"; public const string GlobalBuildingsBuiltWithGoldKey = "GlobalBuildingsBuiltWithGold"; public const string NumberOfGoldVideosWatchedKey = "GoldVideosWatched"; public const string NumberOfVideosWatchedKey = "VideosWatched"; public const string NumberOfVideosClickedKey = "GoldVideosClicked"; public const string NumberOfInterstitialsWatchedKey = "InterstitialsWatched"; public const string NumberOfInterstitialsClickedKey = "InterstitialsClicked"; public const string NumberOfFriendsInvitedKey = "NumberOfFriendsInvited"; public const string NumberOfGoldPackagesBoughtKey = "NumberOfGoldPackagesBought"; public const string GlobalProfitPerHourKey = "GlobalProfitPerHour"; public const string CashCollectedKey = "CashCollected"; public const string TimesCollectedKey = "TimesCollected"; public const string SpeedupsExecutedKey = "SpeedupsExecuted"; public const string SpeedupsExecutedWithGoldKey = "SpeedupsExecutedWithGold"; public const string NumberOfIslandsUnlockedKey = "NumberOfIslandsUnlocked"; public const string GoldSpentKey = "GoldSpent"; public const string GoldSpent_SpeedupsKey = "GoldSpent_Speedups"; public const string GoldSpent_GoldBuildingsKey = "GoldSpent_GoldBuildings"; public const string GoldSpent_DiscountedGoldBuildingsKey = "GoldSpent_DiscountedGoldBuildings"; public const string GoldSpent_CashBuildingsKey = "GoldSpent_CashBuildings"; public const string GoldSpent_CraneQueueKey = "GoldSpent_CraneQueue"; public const string CashSpent_BulldozerQueueKey = "CashSpent_BulldozerQueue"; public const string GoldSpent_ExpansionsKey = "GoldSpent_Expansions"; public const string GoldSpent_CashExchangeKey = "GoldSpent_CashExchange"; public const string GoldSpent_CraneHireKey = "GoldSpent_CraneHire"; public const string GoldSpent_CranePurchaseKey = "GoldSpent_CranePurchase"; public const string GoldSpent_ImmediateBuildKey = "GoldSpent_ImmediateBuildKey"; public const string GoldEarned_PortsKey = "GoldEarned_Ports"; public const string DaysPlayedStreakKey = "DaysPlayedStreak"; public const string NumberOfTimesPlayedKey = "NumberOfTimesPlayed"; public const string IslandStatsDataKey = "IslandStatsData"; public const string FirstDateTimePlayedKey = "FirstDateTimePlayed"; public const string LastDatePlayedKey = "LastDatePlayed"; public const string NumberOfDaysPlayedKey = "NumberOfDaysPlayed"; public const string NumberOfDailyBonusStreaksCompletedKey = "NumberOfDailyBonusStreaksCompleted"; public const string NumberOfIAPsViewedKey = "NumberOfIAPsViewed"; public const string NumberOfIAPsInitiatedKey = "NumberOfIAPsInitiated"; public const string NumberOfIAPsPurchasedKey = "NumberOfIAPsPurchased"; public const string NumberOfCurrencyMenuWatchedKey = "NumberOfCurrencyMenuWatched"; public const string NumberOfTimerAllDailyQuestsCompletedKey = "NumberOfTimesAllDailyQuestsCompleted"; public const string NumberOfScreenViewsKey = "NumberOfScreenViews"; public const string NumberOfBuildingActionsKey = "NumberOfBuildingActions"; public const string NumberOfSupplementalBuildingsPurchasedKey = "NumberOfSupplementalBuildingsPurchased"; public const string NumberOfVirtualCurrenciesSpentKey = "NumberOfVirtualCurrenciesSpent"; public const string NumberOfQuestsCompletedKey = "NumberOfQuestsCompleted"; public const string NumberOfGoldBuildingsPurchasedKey = "NumberOfGoldBuildingsPurchased"; private CityIsland _currentIsland; private Dictionary _cachedIslandStats = new Dictionary(); }