예제 #1
0
    /// Handler for the player logging in. Refreshes the recipe and
    /// character list from ChilliConnect
    ///
    /// @param chilliConnectId
    ///     The ChilliConnectId of the player logged in
    ///
    private void OnPlayerLoggedIn(string chilliConnectId)
    {
        EconomySystem.Get().GetPlayerCoinBalance();
        EconomySystem.Get().GetRecipeMetaData(AccountSystem.Get().TestGroup);
        EconomySystem.Get().GetPlayersCharacterList();

        m_loginLabel.text = "Logged in as " + chilliConnectId;
    }
예제 #2
0
    /// Registers handlers for economy and account system
    ///
    private void Start()
    {
        AccountSystem.Get().OnPlayerLoggedIn += OnPlayerLoggedIn;

        EconomySystem.Get().CurrencyBalanceRetrieved += CurrencyBalanceRetrieved;
        EconomySystem.Get().OnRecipeListPopulate     += (recipes) => m_recipeListUIController.populateRecipeList(recipes);
        EconomySystem.Get().OnCharacterListPopulate  += (characters) => m_characterListUIController.populateCharacterList(characters);
    }
예제 #3
0
 private void CheckCache()
 {
     if (_cachedToggle != toggleButton.craftActive)
     {
         _cachedShopSystem       = null;
         _cachedAdventurerSystem = null;
         _cachedToggle           = toggleButton.craftActive;
         _cachedTime             = DateTime.MinValue;
     }
 }
예제 #4
0
        private static string SetupText <TAgent, TScreen>(EconomySystem <TAgent, TScreen> economy, TAgent agent) where TAgent : AgentScreen <TScreen> where TScreen : Enum
        {
            var options    = economy.GetInputOptions(agent);
            var outputText = "";

            foreach (var option in options)
            {
                outputText += option.ActionNumber + ": " + option.Action + "\t";
            }
            return(outputText);
        }
예제 #5
0
        private void CheckEconomy <TAgent, TScreen>(AgentInput <TAgent, TScreen> agentSystem,
                                                    ref EconomySystem <TAgent, TScreen> cachedEconomySystem,
                                                    TAgent agent) where TAgent : AgentScreen <TScreen> where TScreen : Enum
        {
            var economySystem = agentSystem.GetEconomySystem(agent);
            var refreshTime   = economySystem.GetRefreshTime(agent);

            if (economySystem != cachedEconomySystem || _cachedTime != refreshTime)
            {
                cachedEconomySystem = economySystem;
                _cachedShopSystem   = null;

                inputText.text = SetupText(economySystem, agent);
                _cachedTime    = refreshTime;
            }
        }
예제 #6
0
 /// When the Create button is clicked, use the EconomySystem to
 /// to call a script on server that will generate a new character
 /// and add it to the users inventory
 ///
 private void OnCreateButtonClicked()
 {
     EconomySystem.Get().CookRecipe(m_recipe);
 }
예제 #7
0
 private void Awake()
 {
     Instance = this;
 }
예제 #8
0
 public EconomySystem()
 {
     s_singletonInstance = this;
 }