Ejemplo n.º 1
0
        void DrawCurrencyControl(Rect rect)
        {
            if (thisSystemIsReady)
            {
                Rect sub_0 = GetHorizontalSubRect(rect, 0, 2);                                //set
                Rect sub_1 = GetHorizontalSubRect(rect, 1, 2);                                //add

                IPlayerDataManager playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager();
                if (GUI.Button(
                        sub_0,
                        "Set Currency"
                        ))
                {
                    playerDataManager.SetCurrency(currency);
                }
                if (GUI.Button(
                        sub_1,
                        "Add 100"
                        ))
                {
                    int currency    = playerDataManager.GetCurrency();
                    int newCurrency = currency + 100;
                    playerDataManager.SetCurrency(newCurrency);
                }
            }
        }
        void MightWannaSaveDataHere(GameResultStats stats)
        {
            thisPlayerDataManager.SetFileIndex(0);
            if (!thisPlayerDataManager.PlayerDataIsLoaded())
            {
                thisPlayerDataManager.Load();
            }

            int currency    = thisPlayerDataManager.GetCurrency();
            int newCurrency = currency + stats.gainedCurrency + stats.scoreCurrencyBonus;

            thisPlayerDataManager.SetCurrency(newCurrency);

            int score     = stats.score;
            int highScore = thisPlayerDataManager.GetHighScore();

            if (score > highScore)
            {
                thisPlayerDataManager.SetHighScore(score);
            }

            thisPlayerDataManager.Save();
        }
 void UpdateCurrency(int newCurrency)
 {
     thisPlayerDataManager.SetCurrency(newCurrency);
     thisCurrencyPane.StartCurrencyUpdateProcess(newCurrency);
 }