Пример #1
0
    IEnumerator Spin_Coroutine()
    {
        PlayerPersistantInfo ppi = PPIManager.Instance.GetLocalPPI();

        if (ppi.Chips <= 0)
        {
            yield break;
        }

        if (m_SlotMachine.Spin() == false)
        {
            yield break;
        }

        //use ticket
        m_NeedsFetchPPI = true;

        UpdateButtons();

        ppi.AddChips(-1);

        RefreshValues();

        m_SpinButton.IsDisabled = true;

        int reward = 0;

        while (m_SlotMachine.IsBusy)
        {
            if (m_SlotMachine.Reward != reward)
            {
                reward = m_SlotMachine.Reward;
                m_GoldsLabel.SetNewText((m_Prize + reward).ToString());
            }

            yield return(new WaitForEndOfFrame());
        }

        if (m_SlotMachine.Reward > 0)
        {
            m_Prize += m_SlotMachine.Reward;

            ppi.AddGold(m_SlotMachine.Reward);

            //Owner.ShowPopup("SlotMachineReward", "", string.Format(TextDatabase.instance[0505003], m_SlotMachine.Reward));
        }

        RefreshValues();
        UpdateButtons();

        if (ppi.Chips <= 0)
        {
            yield return(StartCoroutine(BuyChips_Coroutine()));
        }
    }