/// <summary> /// Resets game data. /// </summary> public void ResetGameData() { // Take the first launch reward (so it can be given again) m_firstLaunchReward.Take(); // Reset coin balance to 0 SetCoinBalance(0); // Unequip equipped character EquippableVG vg = StoreInventory.GetEquippedVirtualGood(CRCAssets.GetCharactersCategory()); if (vg != null) { StoreInventory.UnEquipVirtualGood(vg.ItemId); } // Remove all characters from inventory for (int index = 0; index < CRCAssets.CharactersLTVGArray.Length; ++index) { VirtualGood charVG = CRCAssets.CharactersLTVGArray[index]; if (charVG != null) { charVG.ResetBalance(0); } } // Reset other data SoomlaDataSystem dataSystem = (SoomlaDataSystem)Locator.GetDataSystem(); dataSystem.ResetGameData(); // Reset all characters to unused for (int index = 0; index < CRCAssets.CharactersLTVGArray.Length; ++index) { dataSystem.SetCharacterUsed((CharacterType)index, false); } }
/// <summary> /// Equips the specified character. /// </summary> /// <param name="character">The character to equip.</param> public void EquipCharacter(CharacterType character) { StoreInventory.EquipVirtualGood(CRCAssets.CharactersLTVGArray[(int)character].ItemId); // When a character is equipped, it is considered "used" SoomlaDataSystem dataSystem = (SoomlaDataSystem)Locator.GetDataSystem(); dataSystem.SetCharacterUsed(character, true); }
/// <summary> /// Initializes this instance. /// </summary> public void Initialize(SoomlaDataSystem dataSystem) { m_dataSystem = dataSystem; // Read gift count and next gift time from save file m_claimedGiftCount = m_dataSystem.GetGiftCount(); long nextGiftTimeUTC = m_dataSystem.GetNextGiftTime(); // Create DateTime struct from the saved UTC value if (nextGiftTimeUTC > 0) { m_nextGiftTime = new DateTime(nextGiftTimeUTC, DateTimeKind.Utc); } // If no gift time is saved, recalculate next gift time else { UpdateNextGiftTime(m_claimedGiftCount); } // Set the initialized flag m_isInitialized = true; }