Ejemplo n.º 1
0
    public void SetMultiRewardCoins(int time)
    {
        if (PlayerData.TotalTimeMultiRewardCoins == 0)
        {
            PlayerData._LastTimeMultiRewardCoins = Helper.GetUtcTimeString();
            PlayerData.SaveLastTimeMultiRewardCoins();
        }

        PlayerData.TotalTimeMultiRewardCoins = Mathf.Clamp(PlayerData.TotalTimeMultiRewardCoins + time, 0, GameConfig.MaxTimeMultiRewardCoins);
        PlayerData.SaveTotalTimeMultiRewardCoins();

        if (PlayerData.TotalTimeMultiRewardCoins > 0)
        {
            Contains.MultiRewardFromLuckyWheel = GameData.Instance.MultiRewardData.UpgradeValue + 1;
        }
        else
        {
            Contains.MultiRewardFromLuckyWheel = GameConfig.ValueEarnCoinsMultiTime;
        }

        this.PostActionEvent(ActionEnums.ActionID.RefreshUIEquipments, EquipmentEnums.GetKey(EquipmentEnums.AbilityId.MultiRewardCoins));
    }
Ejemplo n.º 2
0
    public static void Load()
    {
        // =============================== Start coins with 0 ================================ //
        //  Coins = double.Parse (LoadPref (KeyCoins, "0"));

        // =============================== Start with coins unit 0 ================================ //
        //  CoinUnit = LoadPref (KeyCoinsUnit, 0);

        // =============================== Start food with 0 ================================ //
        Food = double.Parse(LoadPref(KeyFood, "0"));

        // =============================== Start with food unit 0 ================================ //
        FoodUnit = LoadPref(KeyFoodUnit, 0);

        // =============================== Start with level unlocked is 1 ================================ //
        //LastLevelUnlocked = LoadPref (KeyLevelUnlocked, 1);

        // =============================== Start with number diamonds is zero ================================ //
        Diamonds = LoadPref(KeyDiamonds, 0);

        // =============================== Start with number of coca is zero ================================ //
        Coca = double.Parse(LoadPref(KeyCoca, "0"));

        // =============================== Get the unit of coca ================================ //
        CocaUnit = LoadPref(KeyCocaUnit, 0);

        // =============================== Start with level is 1 ================================ //
        Level = LoadPref(KeyLevel, 1);

        // =============================== Start with round 1 ================================ //
        LevelRound = LoadPref(KeyLevelRound, 1);

        // =============================== Get High level round ================================ //
        HighLevelRound = LoadPref(KeyHighLevelRound, 1);

        // =============================== Save Time Speed Up ================================ //
        TotalTimeSpeedUp = LoadPref(KeyTimeTotalSpeedUp, 0);

        // =============================== Save time for more cash ================================ //
        TotalTimeMoreCash = LoadPref(KeyTimeTotalMoreCash, 0);

        // =============================== Save Time Multi Reward Coins ================================ //
        TotalTimeMultiRewardCoins = LoadPref(KeyTotalTimeMultiRewardCoins, 0);

        // =============================== Start Exp With 0 ================================ //
        Exp = LoadPref(KeyExp, 0);

        // =============================== Add Shop Profit item ================================ //
        ShopItemProfitPercent = new List <int> ();

        var total = GameConfig.TotalItem;

        for (int i = 0; i < total; i++)
        {
            ShopItemProfitPercent.Add(LoadPref(string.Format(KeyNumberBuyItem, i.ToString()), 0));
        }

        // =============================== Add shop upgrade profit item ================================ //

        ShopItemUpgradeProfitPercent = new List <int> ();

        total = GameConfig.TotalItem;

        for (int i = 0; i < total; i++)
        {
            ShopItemUpgradeProfitPercent.Add(LoadPref(string.Format(KeyNumberUpgradeItem, i.ToString()), 0));
        }

        _LastCocaSaved     = Coca;
        _LastCocaUnitSaved = CocaUnit;

        // _LastCoinSaved     = Coins;
        // _LastCoinUnitSaved = CoinUnit;

        // =============================== Load Last Time Online ================================ //
        _LastTimeOnline = LoadPref(KeyTimeOnline, Helper.GetUtcTimeString());

        // =============================== Load Last Time Spin ================================ //
        _LastTimeSpinLucky = LoadPref(KeyTimeSpinLucky, Helper.GetDefaultUTCTimeString());

        // =============================== Get the number turn spin of player ================================ //
        _LastNumberTurnSpin = LoadPref(KeyNumberTurnSpin, GameConfig.MaxNumberTurnForSpin);

        // =============================== Time Watch Ads For Free Diamonds ================================ //
        _LastTimeWatchAdsForFreeDiamonds = LoadPref(KeyWatchAdsForFreeDiamonds, Helper.GetDefaultUTCTimeString());

        // =============================== Time appear bonus reward ================================ //
        _LastTimeAppearBonusReward = LoadPref(KeyLastTimeAppearBonusReward, Helper.GetDefaultUTCTimeString());

        // =============================== Time appear multi reward coins ================================ //
        _LastTimeMultiRewardCoins = LoadPref(KeyLastTimeMultiRewardCoins, Helper.GetDefaultUTCTimeString());

        // =============================== Time appear new quest ================================ //
        _LastTimeDailyQuest = LoadPref(KeyTimeDailyQuest, Helper.GetDefaultUTCTimeString());

        // =============================== Time appear bonus currency ================================ //
        _LastTimeAppearBonusCurrency = LoadPref(KeyLastTimeAppearBonusCurrency, Helper.GetDefaultUTCTimeString());

        // =============================== Time for speed up ================================ //
        _LastTimeForSpeedUp = LoadPref(KeyTimeForSpeedUp, Helper.GetDefaultUTCTimeString());

        // =============================== Time for watch ads ================================ //
        _LastTimeForMoreCash = LoadPref(KeyTimeForMoreCash, Helper.GetDefaultUTCTimeString());

        // =============================== Add the tutorials ================================ //

        TutorialId = new List <int> ();

        var size = TutorialEnums.GetSizeTutorial();

        for (int i = 0; i < size; i++)
        {
            TutorialId.Add(LoadPref(string.Format(KeyTutorialId, i.ToString()), 0));
        }

        // =============================== Load The default language ================================ //
        DefaultLanguage = LoadPref(KeyDefaultLanguage, LanguageEnums.GetLanguageSupportDefault());

        // =============================== Add the mission value ================================ //

        MissionId = new List <int> ();

        size = MissionEnums.GetSize();

        for (int i = 0; i < size; i++)
        {
            MissionId.Add(LoadPref(string.Format(KeyMissionId, i.ToString()), 0));
        }

        // =============================== Add the mission level ================================ //

        MissionLevel = new List <int> ();

        size = MissionEnums.GetSize();

        for (int i = 0; i < size; i++)
        {
            MissionLevel.Add(LoadPref(string.Format(KeyMissionLevel, i.ToString()), 0));
        }

        // =============================== Load the equipment upgrade ================================ //

        EquipmentUpgrade = new List <int> ();

        size = EquipmentEnums.GetLength();

        for (int i = 0; i < size; i++)
        {
            EquipmentUpgrade.Add(LoadPref(string.Format(KeyEquipmentUpgrade, i.ToString()), 0));
        }

        // =============================== Load Unlock Node Grids ================================ //

        UnlockGrid = new List <int> ();

        length_unlock_grid = LoadPref(KeyLengthUnlockGrid, 0);

        for (int i = 0; i < length_unlock_grid; i++)
        {
            UnlockGrid.Add(LoadPref(string.Format(KeyUnlockGrid, i), 0));
        }

        // =============================== Get the last the state watch ads for spin ================================ //

        IsWatchAdsForSpin = LoadPref(KeyWatchAdsForSpin, 0) == 1;
    }