Example #1
0
    public void Refresh()
    {
        //make a list of all ship items in the hangar
        string stationID = GameManager.Inst.PlayerProgress.SpawnStationID;

        if (GameManager.Inst.WorldManager.DockableStationDatas.ContainsKey(stationID))
        {
            _currentStationData = GameManager.Inst.WorldManager.DockableStationDatas[stationID];
            if (_currentStationData.HomeStationData != null)
            {
                List <InvItemData> shipHangarItems = new List <InvItemData>();
                foreach (Loadout loadout in _currentStationData.HomeStationData.ShipsInHangar)
                {
                    shipHangarItems.Add(GetShipItemDataFromLoadout(loadout));
                }

                HangarInventory.Initialize(shipHangarItems);
                HangarInventory.RefreshLoadButtons();
                RefreshHangarSpace(_currentStationData.HomeStationData, shipHangarItems);
            }
            else
            {
                RefreshHangarSpace(null, null);
            }
        }
        //fill the current ship inventory
        List <InvItemData> dockedShipItems = new List <InvItemData>();

        dockedShipItems.Add(GetShipItemDataFromLoadout(GameManager.Inst.PlayerProgress.ActiveLoadout));
        DockedShipInventory.Initialize(dockedShipItems);
    }
Example #2
0
    public void Refresh()
    {
        if (GameManager.Inst.SceneType == SceneType.Station)
        {
            List <InvItemData> itemList = new List <InvItemData>();
            List <InvItemData> source   = null;
            float maxStorageSpace       = 0;
            if (InventoryType == InventoryType.CargoBay)
            {
                source          = CurrentLoadout.CargoBayItems;
                maxStorageSpace = GameManager.Inst.ItemManager.AllShipStats[CurrentLoadout.ShipID].CargoBaySize;
                Title.text      = "CARGO BAY";
                RefreshCargoSpace(source, maxStorageSpace);
            }
            else
            {
                source          = CurrentLoadout.AmmoBayItems;
                maxStorageSpace = GameManager.Inst.ItemManager.AllShipStats[CurrentLoadout.ShipID].AmmoBaySize;
                Title.text      = "AMMO BAY";
                RefreshAmmoSpace(source, maxStorageSpace);
            }

            foreach (InvItemData itemData in source)
            {
                if (InventoryItemTypes.Contains(itemData.Item.Type))
                {
                    itemList.Add(itemData);
                }
            }

            Inventory.Initialize(itemList);

            RefreshProposedCargoUsage(0);
        }
    }
Example #3
0
        public void Initialize(PlayerModel player, GameConfig gameConfig)
        {
            inventoryView.Initialize(gameConfig.PlayerConfig.InventoryConfig);
            inventoryView.Subscribe(player.Inventory);
            inventoryView.Hide();

            pickupNotification.Initialize(gameConfig.ControlsConfig);
            _pickupSystem = new PickupSystem(player.Inventory, pickupNotification);
            pickupNotification.Hide();
        }
    private void Initialize()
    {
        _inventoryModel      = new InventoryModel(_playerInventory);
        _inventoryController = new InventoryController(_inventoryModel);

        var shopController = gameObject.GetComponent <ShopBrowseState>().ShopController();

        _inventoryView = GetComponentInChildren <InventoryView>();
        _inventoryView.Subscribe(_inventoryModel);
        _inventoryView.Initialize(shopController, _inventoryController);
    }
        private void ConfigureBottleAndInventory()
        {
            _btnGroupMilk.AddButton(_btnMilkFormula);
            _btnGroupMilk.AddButton(_btnBreastMilk);
            _btnGroupMilk.Toggled += (sender, item, index) =>
            {
                _gridMilkOptions.IsVisible = item == _btnBreastMilk;
                if (_gridMilkOptions.IsVisible == false)
                {
                    _btnGroupBreastMilk.UpdateCurrentButton(null);
                }
                this.InvalidateMeasure();
            };

            _btnGroupBreastMilk.AddButton(_btnMilkFridge);
            _btnGroupBreastMilk.AddButton(_btnMilkFreezer);
            _btnGroupBreastMilk.AddButton(_btnMilkOther);

            _btnGroupBreastMilk.Toggled += (sender, item, index) =>
            {
                if (!_updatingMilkStorageFromCode)
                {
                    if (item == _btnMilkFridge)
                    {
                        InventoryView.Initialize(InventoryFilter.Fridge);
                        ViewModel.ShowInventoryCommand?.Execute(true);
                        LeftPageType = null;
                    }
                    else if (item == _btnMilkFreezer)
                    {
                        InventoryView.Initialize(InventoryFilter.Freezer);
                        ViewModel.ShowInventoryCommand?.Execute(true);
                        LeftPageType = null;
                    }
                    else if (item == _btnMilkOther)
                    {
                        InventoryView.Initialize(InventoryFilter.Other);
                        ViewModel.ShowInventoryCommand?.Execute(true);
                        LeftPageType = null;
                    }
                    else
                    {
                        ViewModel.ShowInventoryCommand?.Execute(false);
                    }
                }
            };
        }
    public void Refresh()
    {
        //make a list of all items trader is selling
        string stationID = GameManager.Inst.PlayerProgress.SpawnStationID;

        ClearSelections();
        if (GameManager.Inst.WorldManager.DockableStationDatas.ContainsKey(stationID))
        {
            _currentStationData = GameManager.Inst.WorldManager.DockableStationDatas[stationID];

            ShipInventorySheet.InventoryItemTypes = _itemTypeFilter;
            if (_itemTypeFilter.Contains(ItemType.Ammo))
            {
                ShipInventorySheet.InventoryType = InventoryType.AmmoBay;
            }
            else
            {
                ShipInventorySheet.InventoryType = InventoryType.CargoBay;
            }
            ShipInventorySheet.Refresh();
            ShipInventorySheet.RefreshLoadButtons(null);

            if (_currentStationData != null && _currentStationData.TraderSaleItems != null)
            {
                List <InvItemData> displayedItems = new List <InvItemData>();
                foreach (SaleItem saleItem in _currentStationData.TraderSaleItems)
                {
                    ItemStats   itemStats = GameManager.Inst.ItemManager.GetItemStats(saleItem.ItemID);
                    Item        item      = new Item(itemStats);
                    InvItemData invItem   = new InvItemData();
                    invItem.Item     = item;
                    invItem.Quantity = saleItem.Quantity;
                    if (_itemTypeFilter.Contains(itemStats.Type))
                    {
                        displayedItems.Add(invItem);
                    }
                }

                TraderInventory.Initialize(displayedItems);
                TraderInventory.RefreshLoadButtons();
            }

            RefreshPrices();
            RefreshPlayerMoney();
        }
    }
Example #7
0
    public void Refresh()
    {
        //make a list of all items in the vault
        string stationID = GameManager.Inst.PlayerProgress.SpawnStationID;

        ClearSelections();
        if (GameManager.Inst.WorldManager.DockableStationDatas.ContainsKey(stationID))
        {
            _currentStationData = GameManager.Inst.WorldManager.DockableStationDatas[stationID];

            ShipInventorySheet.InventoryItemTypes = _itemTypeFilter;
            if (_itemTypeFilter.Contains(ItemType.Ammo))
            {
                ShipInventorySheet.InventoryType = InventoryType.AmmoBay;
            }
            else
            {
                ShipInventorySheet.InventoryType = InventoryType.CargoBay;
            }
            ShipInventorySheet.Refresh();
            ShipInventorySheet.RefreshLoadButtons(null);

            if (_currentStationData.HomeStationData != null)
            {
                List <InvItemData> allVaultItems  = _currentStationData.HomeStationData.ItemsInVault;
                List <InvItemData> displayedItems = new List <InvItemData>();
                foreach (InvItemData item in allVaultItems)
                {
                    if (_itemTypeFilter.Contains(item.Item.Type))
                    {
                        displayedItems.Add(item);
                    }
                }
                VaultInventory.Initialize(displayedItems);
                VaultInventory.RefreshLoadButtons();



                RefreshVaultSpace(_currentStationData.HomeStationData, allVaultItems);
            }
        }
    }
 private void SetupViews()
 {
     shopInventoryView.Initialize(shopController, inputManager);
     customerInventoryView.Initialize(customerController, inputManager);
 }
Example #9
0
#pragma warning restore 0649

        public void Initialize()
        {
            _inventoryViewInstance = Instantiate(_inventoryViewPrefab, _canvas.transform);
            _inventoryViewInstance.Initialize();
        }
 /// <summary>
 /// Gets called when this page is about to show and performs the initialization
 /// </summary>
 public override void AboutToShow()
 {
     base.AboutToShow();
     InventoryView.Initialize();
 }