Пример #1
0
        /// <summary>
        /// Standard starting point for Unity scripts.
        /// </summary>
        void Awake()
        {
            // The database has been properly setup.
            m_WrongDatabase = !SamplesHelper.VerifyDatabase();
            if (m_WrongDatabase)
            {
                wrongDatabasePanel.SetActive(true);
                tutorialPanel.SetActive(false);
                return;
            }

            tutorialPanel.SetActive(true);

            // - Initialize must always be called before working with any game foundation code.
            // - GameFoundation requires an IDataAccessLayer object that will provide and persist
            //   the data required for the various services (Inventory, Wallet, ...).
            // - For this sample we don't need to persist any data so we use the MemoryDataLayer
            //   that will store GameFoundation's data only for the play session.
            GameFoundation.Initialize(new MemoryDataLayer());

            m_NextButton         = GameObject.Find("Next Step").GetComponent <Button>();
            m_PreviousButton     = GameObject.Find("Previous Step").GetComponent <Button>();
            m_CurrentStepDisplay = GameObject.Find("Step Instructions").GetComponent <Text>();
            m_CurrentStepTitle   = GameObject.Find("Step Title").GetComponent <Text>();

            m_CurrentStepTitle.text   = m_TutorialTitles[m_CurrentStep];
            m_CurrentStepDisplay.text = m_TutorialSteps[m_CurrentStep];
            m_PreviousButton.enabled  = false;
        }
Пример #2
0
        private void Start()
        {
            // - Initialize must always be called before working with any game foundation code.
            // - GameFoundation requires an IDataAccessLayer object that will provide and persist
            //   the data required for the various services (Inventory, Wallet, ...).
            // - For this sample we don't need to persist any data so we use the MemoryDataLayer
            //   that will store GameFoundation's data only for the play session.
            m_DataLayer = new PersistenceDataLayer(
                new LocalPersistence("DataPersistence", new JsonDataSerializer()));
            if (!GameFoundation.IsInitialized)
            {
                GameFoundation.Initialize(m_DataLayer, OnGameFoundationInitialized, OnInitFailed);
            }

            m_softCurrencyDefinition = GameFoundation.catalogs.currencyCatalog.FindItem("coin");
            m_hardCurrencyDefinition = GameFoundation.catalogs.currencyCatalog.FindItem("gem");

            // Here we bind a listener that will set a walletChanged flag to callbacks on the Wallet Manager.
            // These callbacks will automatically be invoked anytime a currency balance is changed.
            // This prevents us from having to manually invoke RefreshUI every time we perform one of these actions.
            WalletManager.balanceChanged += OnCoinBalanceChanged;

            // We'll initialize our WalletManager's coin balance with 50 coins.
            // This will set the balance to 50 no matter what it's current balance is.
            WalletManager.GetBalance(m_softCurrencyDefinition);
            WalletManager.GetBalance(m_hardCurrencyDefinition);

            RefreshAllCurrencies();
        }
Пример #3
0
        /// <summary>
        /// Standard starting point for Unity scripts.
        /// </summary>
        void Start()
        {
            // The database has been properly setup.
            m_WrongDatabase = !SamplesHelper.VerifyDatabase();
            if (m_WrongDatabase)
            {
                wrongDatabasePanel.SetActive(true);
                return;
            }

            // - Initialize must always be called before working with any game foundation code.
            // - GameFoundation requires an IDataAccessLayer object that will provide and persist
            //   the data required for the various services (Inventory, Stats, ...).
            // - For this sample we don't need to persist any data so we use the MemoryDataLayer
            //   that will store GameFoundation's data only for the play session.
            GameFoundation.Initialize(new MemoryDataLayer());

            // Create a backpack inventory instance and keep the reference. Grab its sword reference as well.
            m_Backpack     = InventoryManager.CreateInventory("backpack", "MainBackpack", "Backpack");
            m_Sword        = m_Backpack.GetItem("sword");
            m_HealthPotion = m_Backpack.GetItem("healthPotion");

            // Setup our player stats instance.
            m_PlayerStats = new GameItem(CatalogManager.gameItemCatalog.GetGameItemDefinition("player"));

            // Here we bind our UI refresh method to callbacks on the inventory manager.
            // These callbacks will automatically be invoked anytime an inventory is added, or removed.
            // This prevents us from having to manually invoke RefreshUI every time we perform one of these actions.
            m_Backpack.onItemAdded           += RefreshUI;
            m_Backpack.onItemRemoved         += RefreshUI;
            m_Backpack.onItemQuantityChanged += RefreshUI;

            RefreshUI();
        }
Пример #4
0
    public void Start()
    {
        var datalayer = new MemoryDataLayer();

        //初始化游戏基础系统
        GameFoundation.Initialize(datalayer, OnloadFinish, OnInitFailed);
    }
Пример #5
0
        /// <summary>
        /// Standard starting point for Unity scripts.
        /// </summary>
        void Start()
        {
            // The database has been properly setup.
            m_WrongDatabase = !SamplesHelper.VerifyDatabase();
            if (m_WrongDatabase)
            {
                wrongDatabasePanel.SetActive(true);
                return;
            }

            // - Initialize must always be called before working with any game foundation code.
            // - GameFoundation requires an IDataAccessLayer object that will provide and persist
            //   the data required for the various services (Inventory, Stats, ...).
            // - For this sample we don't need to persist any data so we use the MemoryDataLayer
            //   that will store GameFoundation's data only for the play session.
            GameFoundation.Initialize(new MemoryDataLayer());

            // Grab a reference to the main, wallet, and store inventories.
            m_Main   = Inventory.main;
            m_Wallet = InventoryManager.wallet;
            m_Store  = InventoryManager.GetInventory("store");

            // Here we bind our UI refresh method to callbacks on the inventory manager.
            // These callbacks will automatically be invoked anytime an inventory is added, or removed.
            // This prevents us from having to manually invoke RefreshUI every time we perform one of these actions.
            m_Wallet.onItemAdded           += RefreshUI;
            m_Wallet.onItemRemoved         += RefreshUI;
            m_Wallet.onItemQuantityChanged += RefreshUI;

            m_ApplePrice = Random.Range(5, 26);
            RefreshUI();
        }
        /// <summary>
        /// Standard starting point for Unity scripts.
        /// </summary>
        private void Start()
        {
            // The database has been properly setup.
            m_WrongDatabase = !SamplesHelper.VerifyDatabase();
            if (m_WrongDatabase)
            {
                wrongDatabasePanel.SetActive(true);
                return;
            }

            // - Initialize must always be called before working with any game foundation code.
            // - GameFoundation requires an IDataAccessLayer object that will provide and persist
            //   the data required for the various services (Inventory, Wallet, ...).
            // - For this sample we will persist GameFoundation's data using a PersistenceDataLayer.
            //   We create it with a LocalPersistence setup to save/load these data in a JSON file
            //   named "DataPersistenceSampleV2" stored on the device.  Note: 'V2' appended
            //   to the filename to ensure old persistence from previous version of Game Foundation
            //   isn't used, causing Sample to throw at initialization.  This is only needed during
            //   the 'preview' phase of Game Foundation while the structure of persistent data is
            //   changing.
            m_DataLayer = new PersistenceDataLayer(
                new LocalPersistence("DataPersistenceSampleV2", new JsonDataSerializer()));

            GameFoundation.Initialize(m_DataLayer, OnGameFoundationInitialized, Debug.LogError);
        }
Пример #7
0
        /// <summary>
        /// Standard starting point for Unity scripts.
        /// </summary>
        private void Start()
        {
            // The database has been properly setup.
            m_WrongDatabase = !SamplesHelper.VerifyDatabase();
            if (m_WrongDatabase)
            {
                wrongDatabasePanel.SetActive(true);
                return;
            }

            // - Initialize must always be called before working with any game foundation code.
            // - GameFoundation requires an IDataAccessLayer object that will provide and persist
            //   the data required for the various services (Inventory, Stats, ...).
            // - For this sample we don't need to persist any data so we use the MemoryDataLayer
            //   that will store GameFoundation's data only for the play session.
            GameFoundation.Initialize(new MemoryDataLayer());

            // We will create the sword and health potion inventoryItems in the InventoryManager and
            // store their references to get us started.
            m_Sword        = InventoryManager.CreateItem("sword");
            m_HealthPotion = InventoryManager.CreateItem("healthPotion");

            // Here we bind our UI refresh method to callbacks on the inventory manager.
            // These callbacks will automatically be invoked anytime an inventory is added, or removed.
            // This prevents us from having to manually invoke RefreshUI every time we perform one of these actions.
            InventoryManager.itemAdded   += OnInventoryItemChanged;
            InventoryManager.itemRemoved += OnInventoryItemChanged;

            RefreshUI();
        }
Пример #8
0
        /// <summary>
        /// Standard starting point for Unity scripts.
        /// </summary>
        private void Start()
        {
            // The database has been properly setup.
            m_WrongDatabase = !SamplesHelper.VerifyDatabase();
            if (m_WrongDatabase)
            {
                wrongDatabasePanel.SetActive(true);
                return;
            }

            // - Initialize must always be called before working with any game foundation code.
            // - GameFoundation requires an IDataAccessLayer object that will provide and persist
            //   the data required for the various services (Inventory, Wallet, ...).
            // - For this sample we don't need to persist any data so we use the MemoryDataLayer
            //   that will store GameFoundation's data only for the play session.
            GameFoundation.Initialize(new MemoryDataLayer());

            m_CoinDefinition = GameFoundation.catalogs.currencyCatalog.FindItem("coin");

            // Here we bind a listener that will set a walletChanged flag to callbacks on the Wallet Manager.
            // These callbacks will automatically be invoked anytime a currency balance is changed.
            // This prevents us from having to manually invoke RefreshUI every time we perform one of these actions.
            WalletManager.balanceChanged += OnCoinBalanceChanged;

            // We'll initialize our WalletManager's coin balance with 50 coins.
            // This will set the balance to 50 no matter what it's current balance is.
            WalletManager.SetBalance(m_CoinDefinition, 50);

            RefreshUI();
        }
Пример #9
0
        /// <summary>
        /// Standard starting point for Unity scripts.
        /// </summary>
        void Start()
        {
            // The database has been properly setup.
            m_WrongDatabase = !SamplesHelper.VerifyDatabase();
            if (m_WrongDatabase)
            {
                wrongDatabasePanel.SetActive(true);
                return;
            }

            // Initialize must always be called before working with any game foundation code.
            GameFoundation.Initialize(new MemoryDataLayer());

            // Grab a reference to the shopping cart inventory.
            m_ShoppingCart = InventoryManager.GetInventory("shoppingCart");

            // Grab a reference to the smoothie purchasable detail.
            m_SmoothieTransaction = CatalogManager.inventoryCatalog.GetItemDefinition("smoothie").GetDetailDefinition <PurchasableDetailDefinition>();

            // Here we bind our UI refresh method to callbacks on the inventory manager.
            // These callbacks will automatically be invoked anytime an inventory is added, or removed.
            // This prevents us from having to manually invoke RefreshUI every time we perform one of these actions.
            // For this sample, we'll only refresh the UI when a smoothie gets added to the shopping cart.
            m_ShoppingCart.onItemAdded           += RefreshUI;
            m_ShoppingCart.onItemQuantityChanged += RefreshUI;

            RefreshUI();
        }
Пример #10
0
        /// <summary>
        /// Standard starting point for Unity scripts.
        /// </summary>
        private void Start()
        {
            // The database has been properly setup.
            m_WrongDatabase = !SamplesHelper.VerifyDatabase();
            if (m_WrongDatabase)
            {
                wrongDatabasePanel.SetActive(true);
                return;
            }

            // - Initialize must always be called before working with any game foundation code.
            // - GameFoundation requires an IDataAccessLayer object that will provide and persist
            //   the data required for the various services (Inventory, Stats, ...).
            // - For this sample we don't need to persist any data so we use the MemoryDataLayer
            //   that will store GameFoundation's data only for the play session.
            GameFoundation.Initialize(new MemoryDataLayer());

            // Here we bind a listener that will set an inventoryChanged flag to callbacks on the Inventory Manager.
            // These callbacks will automatically be invoked anytime an item is added or removed.
            // This prevents us from having to manually invoke RefreshUI every time we perform one of these actions.
            InventoryManager.itemAdded   += OnInventoryItemChanged;
            InventoryManager.itemRemoved += OnInventoryItemChanged;

            // We'll call this to get our initial list of items to know the correct quantities for each aggregated item
            RefreshUniqueItems();
        }
        /// <summary>
        /// Standard starting point for Unity scripts.
        /// </summary>
        void Start()
        {
            // The database has been properly setup.
            m_WrongDatabase = !SamplesHelper.VerifyDatabase();
            if (m_WrongDatabase)
            {
                wrongDatabasePanel.SetActive(true);
                return;
            }

            // - Initialize must always be called before working with any game foundation code.
            // - GameFoundation requires an IDataAccessLayer object that will provide and persist
            //   the data required for the various services (Inventory, Stats, ...).
            // - For this sample we don't need to persist any data so we use the MemoryDataLayer
            //   that will store GameFoundation's data only for the play session.
            GameFoundation.Initialize(new MemoryDataLayer());

            // Here we bind our UI refresh method to callbacks on the inventory manager.
            // These callbacks will automatically be invoked anytime an inventory is added, or removed.
            // This prevents us from having to manually invoke RefreshUI every time we perform one of these actions.
            // If you want to have saving be done automatically, binding a Save method to these callbacks is a great way to accomplish this.
            InventoryManager.onInventoryAdded   += RefreshUI;
            InventoryManager.onInventoryRemoved += RefreshUI;

            RefreshUI();
        }
Пример #12
0
        public void Load()
        {
            // Don't forget to stop listening to events before un-initializing.
            WalletManager.balanceChanged -= OnCoinBalanceChanged;

            GameFoundation.Uninitialize();

            GameFoundation.Initialize(m_DataLayer, OnGameFoundationInitialized, Debug.LogError);
        }
Пример #13
0
        /// <summary>
        /// This will uninitialize game foundation and re-initialize it with data from the save file.
        /// This will set the current state of inventories and stats to be what's within the save file.
        /// </summary>
        public void Load()
        {
            // Don't forget to stop listening to events before uninitializing.
            InventoryManager.onInventoryAdded   -= RefreshUI;
            InventoryManager.onInventoryRemoved -= RefreshUI;

            GameFoundation.Uninitialize();

            GameFoundation.Initialize(m_DataLayer, OnGameFoundationInitialized, Debug.LogError);
        }
Пример #14
0
        public void Load()
        {
            // Don't forget to stop listening to events before un-initializing.
            InventoryManager.itemAdded   -= OnInventoryItemChanged;
            InventoryManager.itemRemoved -= OnInventoryItemChanged;

            GameFoundation.Uninitialize();

            GameFoundation.Initialize(mDataLayer, OnGameFoundationInit, Debug.LogError);
        }
Пример #15
0
    void Awake()
    {
        // Creates a new data layer for Game Foundation,
        // with the default parameters.
        //dataLayer = new PersistenceDataLayer(
        //        new LocalPersistence("game_foundation", new JsonDataSerializer()));// MemoryDataLayer();

        // Initializes Game Foundation with the data layer.
        GameFoundation.Initialize
            (new MemoryDataLayer(), OnInitSucceeded, OnInitFailed);
    }
Пример #16
0
        private void GameFoundationInitialization()
        {
            _memoryDataLayer = new MemoryDataLayer();

            if (!GameFoundation.IsInitialized)
            {
                GameFoundation.Initialize(_memoryDataLayer,
                                          () => { Debug.Log("Initializing GameFoundation Success EventBinding"); },
                                          e =>
                {
                    Debug.LogError(
                        $"Error in EventBinding GameFoundation Initialization \n {e.Source} \t {e.Message}");
                });
            }

            _mainWeapon = InventoryManager.CreateItem(equipement.mainWeaponRef);
        }
Пример #17
0
        /// <summary>
        /// Standard starting point for Unity scripts.
        /// </summary>
        void Awake()
        {
            // The database has been properly setup.
            m_WrongDatabase = !SamplesHelper.VerifyDatabase();
            if (m_WrongDatabase)
            {
                wrongDatabasePanel.SetActive(true);
                return;
            }

            // - Initialize must always be called before working with any game foundation code.
            // - GameFoundation requires an IDataAccessLayer object that will provide and persist
            //   the data required for the various services (Inventory, Wallet, ...).
            // - For this sample we don't need to persist any data so we use the MemoryDataLayer
            //   that will store GameFoundation's data only for the play session.
            GameFoundation.Initialize(new MemoryDataLayer());
        }
        /// <summary>
        /// Initialize Game Foundation.
        /// Called at startup as well as when reinitializing.
        /// </summary>
        private void InitializeGameFoundation()
        {
            // Disable all buttons for initialization.
            addAppleButton.interactable              = false;
            addOrangeButton.interactable             = false;
            removeAppleButton.interactable           = false;
            removeOrangeButton.interactable          = false;
            removeAllButton.interactable             = false;
            deleteAndReinitializeButton.interactable = false;

            // - Initialize must always be called before working with any game foundation code.
            // - GameFoundation requires an IDataAccessLayer object that will provide and persist
            //   the data required for the various services (Inventory, Wallet, ...).
            m_LocalPersistence = new LocalPersistence("GF_Sample10_DataPersistence", new JsonDataSerializer());
            m_DataLayer        = new PersistenceDataLayer(m_LocalPersistence);

            // Initialize Game Foundation, calls OnGameFoundationInitialized callback when complete.
            GameFoundation.Initialize(m_DataLayer, OnGameFoundationInitialized, Debug.LogError);
        }
Пример #19
0
        /// <summary>
        /// Standard starting point for Unity scripts.
        /// </summary>
        void Start()
        {
            // The database has been properly setup.
            m_WrongDatabase = !SamplesHelper.VerifyDatabase();
            if (m_WrongDatabase)
            {
                wrongDatabasePanel.SetActive(true);
                return;
            }

            // - Initialize must always be called before working with any game foundation code.
            // - GameFoundation requires an IDataAccessLayer object that will provide and persist
            //   the data required for the various services (Inventory, Stats, ...).
            // - For this sample we will persist GameFoundation's data using a PersistenceDataLayer.
            //   We create it with a LocalPersistence setup to save/load these data in a JSON file
            //   named "DataPersistenceSample" stored on the device.
            m_DataLayer = new PersistenceDataLayer(
                new LocalPersistence("DataPersistenceSample", new JsonDataSerializer()));

            GameFoundation.Initialize(m_DataLayer, OnGameFoundationInitialized, Debug.LogError);
        }
Пример #20
0
        /// <summary>
        /// Standard starting point for Unity scripts.
        /// </summary>
        void Start()
        {
            // The database has been properly setup.
            m_WrongDatabase = !SamplesHelper.VerifyDatabase();
            if (m_WrongDatabase)
            {
                wrongDatabasePanel.SetActive(true);
                return;
            }

            // Initialize must always be called before working with any game foundation code.
            GameFoundation.Initialize(new MemoryDataLayer());

            // Grab references to the transactions.
            m_AppleIngredientTransaction    = GameFoundation.catalogs.transactionCatalog.FindTransaction <VirtualTransaction>("appleIngredient");
            m_OrangeIngredientTransaction   = GameFoundation.catalogs.transactionCatalog.FindTransaction <VirtualTransaction>("orangeIngredient");
            m_BananaIngredientTransaction   = GameFoundation.catalogs.transactionCatalog.FindTransaction <VirtualTransaction>("bananaIngredient");
            m_BroccoliIngredientTransaction = GameFoundation.catalogs.transactionCatalog.FindTransaction <VirtualTransaction>("broccoliIngredient");
            m_CarrotIngredientTransaction   = GameFoundation.catalogs.transactionCatalog.FindTransaction <VirtualTransaction>("carrotIngredient");
            m_FruitSmoothieTransaction      = GameFoundation.catalogs.transactionCatalog.FindTransaction <VirtualTransaction>("fruitSmoothie");
            m_VeggieSmoothieTransaction     = GameFoundation.catalogs.transactionCatalog.FindTransaction <VirtualTransaction>("veggieSmoothie");

            // Here we bind listeners that will set an inventoryChanged flag to callbacks on the Inventory Manager.
            // These callbacks will automatically be invoked anytime an inventory item is added or removed.
            // This prevents us from having to manually invoke RefreshUI every time we perform one of these actions.
            InventoryManager.itemAdded   += OnInventoryItemChanged;
            InventoryManager.itemRemoved += OnInventoryItemChanged;

            // Here we bind listeners to callbacks on the Transaction Manager.
            // These callbacks will automatically be invoked during the processing of a transaction.
            TransactionManager.transactionInitiated  += OnTransactionInitiated;
            TransactionManager.transactionProgressed += OnTransactionProgress;
            TransactionManager.transactionSucceeded  += OnTransactionSucceeded;
            TransactionManager.transactionFailed     += OnTransactionFailed;

            // We'll initialize our WalletManager with some coin for smoothie ingredient purchases.
            WalletManager.AddBalance("coin", 100);

            RefreshUI();
        }
Пример #21
0
        /// <summary>
        /// Standard starting point for Unity scripts.
        /// </summary>
        private void Start()
        {
            // The database has been properly setup.
            m_WrongDatabase = !SamplesHelper.VerifyDatabase();
            if (m_WrongDatabase)
            {
                wrongDatabasePanel.SetActive(true);
                return;
            }

            // - Initialize must always be called before working with any game foundation code.
            // - GameFoundation requires an IDataAccessLayer object that will provide and persist
            //   the data required for the various services (Inventory, Wallet, ...).
            // - For this sample we don't need to persist any data so we use the MemoryDataLayer
            //   that will store GameFoundation's data only for the play session.
            GameFoundation.Initialize(new MemoryDataLayer());

            // For this sample, we're focusing on swords and health, so let's remove all others from the Inventory.
            // Note: this is helpful since we have an initial allocation of 2 apples and 1 orange.
            InventoryManager.RemoveAllItems();

            // We will create the sword and health potion inventoryItems in the InventoryManager and
            // store their references to get us started.
            m_Sword        = InventoryManager.CreateItem("sword");
            m_HealthPotion = InventoryManager.CreateItem("healthPotion");

            // Here we bind our UI refresh method to callbacks on the inventory manager.
            // These callbacks will automatically be invoked anytime an inventory item is added, or removed.
            // This allows us to refresh the UI as soon as the changes are applied.
            InventoryManager.itemAdded   += OnInventoryItemChanged;
            InventoryManager.itemRemoved += OnInventoryItemChanged;

            // These events will automatically be invoked when sword's or potion's properties are changed.
            m_Sword.propertyChanged        += OnItemPropertyChanged;
            m_HealthPotion.propertyChanged += OnItemPropertyChanged;

            RefreshUI();
        }
Пример #22
0
        /// <summary>
        /// Standard starting point for Unity scripts.
        /// </summary>
        private void Start()
        {
            // The database has been properly setup.
            m_WrongDatabase = !SamplesHelper.VerifyDatabase();
            if (m_WrongDatabase)
            {
                wrongDatabasePanel.SetActive(true);
                return;
            }

            // - Initialize must always be called before working with any game foundation code.
            // - GameFoundation requires an IDataAccessLayer object that will provide and persist
            //   the data required for the various services (Inventory, Stats, ...).
            // - For this sample we don't need to persist any data so we use the MemoryDataLayer
            //   that will store GameFoundation's data only for the play session.
            GameFoundation.Initialize(new MemoryDataLayer());

            // The Inventory Manager starts empty, so we will add a selection of items to the inventory.
            InitializeInventoryItems();

            NoCategoryFilter();
            RefreshUI();
        }
Пример #23
0
        /// <summary>
        /// Standard starting point for Unity scripts.
        /// </summary>
        void Awake()
        {
            // The database has been properly setup.
            m_WrongDatabase = !SamplesHelper.VerifyDatabase();
            if (m_WrongDatabase)
            {
                wrongDatabasePanel.SetActive(true);
                return;
            }

            // - Initialize must always be called before working with any game foundation code.
            // - GameFoundation requires an IDataAccessLayer object that will provide and persist
            //   the data required for the various services (Inventory, Stats, ...).
            // - For this sample we don't need to persist any data so we use the MemoryDataLayer
            //   that will store GameFoundation's data only for the play session.
            GameFoundation.Initialize(new MemoryDataLayer(), () =>
            {
                // After GameFoundation's Initializing completed,
                // sets coins and gems to make sure that there is enough currency for this sample.
                WalletManager.SetBalance("coin", 500);
                WalletManager.SetBalance("gem", 50);
            });
        }
Пример #24
0
        /// <summary>
        /// Standard starting point for Unity scripts.
        /// </summary>
        void Start()
        {
            // The database has been properly setup.
            m_WrongDatabase = !SamplesHelper.VerifyDatabase();
            if (m_WrongDatabase)
            {
                wrongDatabasePanel.SetActive(true);
                return;
            }

            // - Initialize must always be called before working with any game foundation code.
            // - GameFoundation requires an IDataAccessLayer object that will provide and persist
            //   the data required for the various services (Inventory, Stats, ...).
            // - For this sample we don't need to persist any data so we use the MemoryDataLayer
            //   that will store GameFoundation's data only for the play session.
            GameFoundation.Initialize(new MemoryDataLayer());

            // Grab a reference to the shopping cart
            m_ShoppingCart = InventoryManager.GetInventory("shoppingCart");

            FruitCategory();
            RefreshUI();
        }
        /// <summary>
        /// Uninitializes Game Foundation, deletes persistence data, then reinitializes Game Foundation.
        /// Note: Because Game Foundation is initialized again, all Initial Allocation items will be added again.
        /// </summary>
        public void DeleteAndReinitializeGameFoundation()
        {
            GameFoundation.Uninitialize();

            m_LocalPersistence.Delete(InitializeGameFoundation);
        }
 private void Awake()
 {
     GameFoundation.Initialize();
 }
Пример #27
0
 void InitGameFoundation()
 {
     mDataLayer = new PersistenceDataLayer(new LocalPersistence(PERSISTENCE_SAVE_NAME, new JsonDataSerializer()));
     GameFoundation.Initialize(mDataLayer, OnGameFoundationInit, Debug.LogError);
 }
Пример #28
0
 void Awake()
 {
     GameFoundation.Initialize(new MemoryDataLayer());
 }