void PlaceInvestment()
    {
        int Days;

        switch (SelectedDaysIndex)
        {
        default:
        case 0:
            Days = 1;
            break;

        case 1:
            Days = 3;
            break;

        case 2:
            Days = 6;
            break;

        case 3:
            Days = 14;
            break;
        }

        Investments.PlaceInvestment(ProcessInvestValueString(), CalculateReturn(), Days, SchemesData.Data[SelectedSchemeIndex].InvestmentRisk);
        Manager.UpdateMoneyText();
    }
Beispiel #2
0
    public void Sell()
    {
        if (Type == SellPanelCell.SellableItemType.Crystal)
        {
            TheRunGameManager.Instance.GameData.Data.Profile.CrystalsQuantities[ItemIndex] = 0;
        }
        else
        {
            TheRunGameManager.Instance.GameData.Data.Profile.PerksQuantities[ItemIndex] = 0;
        }

        Cell.SetQuantity(0);

        TheRunGameManager.Instance.GameData.Data.Profile.AddMoney(Total);
        TheRunGameManager.Instance.GameData.Save();

        MenuManager.UpdateMoneyText();

        Close();
    }
    void GetReward()
    {
        Sprite RewardSprite = null;;
        string RewardText   = string.Empty;

        switch (RewardIndex)
        {
        case 0:                 //Box01
        case 1:                 //Box02

            int Type = Random.Range(0, 3);

            switch (Type)
            {
            case 0:                             //Random Crystal

                int CrystalIndex = Random.Range(0, Crystals.Data.Length);
                RewardSprite = Crystals.Data[CrystalIndex].ItemSprite;
                RewardText   = Crystals.Data[CrystalIndex].ItemName;
                TheRunGameManager.Instance.GameData.Data.Profile.CrystalsQuantities[CrystalIndex]++;

                break;

            case 1:                             //Random Perk

                int PerkIndex = Random.Range(0, Perks.Data.Length);
                RewardSprite = Perks.Data[PerkIndex].ItemSprite;
                RewardText   = Perks.Data[PerkIndex].ItemName;
                TheRunGameManager.Instance.GameData.Data.Profile.PerksQuantities[PerkIndex]++;

                break;

            case 2:                             //Random Money

                int MoneyIndex = Random.Range(0, Money.Data.Length);
                RewardSprite = Money.Data[MoneyIndex].ItemSprite;
                RewardText   = Money.Data[MoneyIndex].ItemName;
                TheRunGameManager.Instance.GameData.Data.Profile.AddMoney(Money.Data[MoneyIndex].ItemValue);

                break;
            }

            break;

        case 2:                 //Card01
        case 3:                 //Card03

            uint TotalMinutes = (uint)(TheRunGameManager.Instance.GameData.Data.Profile.TotalPlayTime / 60f);
            long MoneyAmount  = 10000 * (TotalMinutes / 30);

            RewardSprite = Money.Data[0].ItemSprite;
            RewardText   = Globals.GetFormattedCurrency(MoneyAmount, true);
            TheRunGameManager.Instance.GameData.Data.Profile.AddMoney(MoneyAmount);

            break;
        }

        TheRunGameManager.Instance.GameData.Data.Profile.LastRewardTime.SetTimeFromNow(TimeSpan.FromHours(24));
        TheRunGameManager.Instance.GameData.Save();

        Manager.UpdateMoneyText();

        ClaimItemText.text    = RewardText;
        ClaimItemImage.sprite = RewardSprite;
    }