예제 #1
0
 private void SetInventories()
 {
     UserInventoryView = new InventoryView(InventoryOwner.User)
     {
         InventoryName = "UserInventory"
     };
     VendorInventoryView = new InventoryView(InventoryOwner.Vendor)
     {
         InventoryName = "VendorInventory"
     };
 }
    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);
    }
예제 #3
0
    void OnCursorIndexChanged(InventoryView sender)
    {
        if (sender != View)
        {
            return;
        }

        Index2 idx = sender.CursorIndex;

        _inventory.EquippedItemB = _inventory.GetEquippableSecondaryItem(idx.x, idx.y);
    }
예제 #4
0
        public InventoryViewModel(PlayerModel player, string inv_mode)
        {
            this.Player        = player;
            this.PlayerEquiped = player.Equiped;
            this.inv_mode      = inv_mode;
            AddPng             = new string[28];

            setItemAddPng();

            View = new InventoryView(this);
        }
예제 #5
0
 public void ClearSelections()
 {
     EquipmentInventory.DeselectAll();
     CargoEquipmentInventory.DeselectAll();
     ShipModsInventory.DeselectAll();
     _selectedItem           = null;
     _selectedItemContainer  = null;
     InstallButton.isEnabled = false;
     RemoveButton.isEnabled  = false;
     ActionSheet.Clear();
 }
예제 #6
0
    void Start()
    {
        InventoryView PlayerInventory = GetComponentInChildren <InventoryView>();

        if (PlayerInventory != null)
        {
            PlayerInventory.AddItem(new Item(Item.Type.Water), 15);
            // PlayerInventory.AddItem(new Item(Item.Type.Water), 13);
            // PlayerInventory.AddItem(new Item(Item.Type.Water), 62);
        }
    }
예제 #7
0
 public void ClearSelections()
 {
     CargoAmmoInventory.DeselectAll();
     VaultInventory.DeselectAll();
     _selectedItem            = null;
     _selectedItemContainer   = null;
     StoreButton.isEnabled    = false;
     RetrieveButton.isEnabled = false;
     QuantitySlider.alpha     = 0;
     NGUITools.SetActive(QuantitySlider.gameObject, false);
     ActionSheet.Clear();
 }
예제 #8
0
    public SerializableInventoryView(InventoryView view)
    {
        name    = view.name;
        filters = view.Filters.ToArray();
        sortBy  = view.Sorting;

        spaces = new string[view.Sets.Length];
        for (int i = 0; i < spaces.Length; ++i)
        {
            spaces[i] = view.Sets[i].space.name;
        }
    }
예제 #9
0
 public void ClearSelections()
 {
     WeaponInventory.DeselectAll();
     CargoAmmoInventory.DeselectAll();
     DefensivesInventory.DeselectAll();
     _selectedWeaponItem    = null;
     _selectedItemContainer = null;
     //_selectedAmmoItem = null;
     InstallButton.isEnabled = false;
     RemoveButton.isEnabled  = false;
     ActionSheet.Clear();
 }
예제 #10
0
 public static void AddEquipmentItem(InventoryView inventory, InventoryViewRow item, int quantity)
 {
     UpdateDatabase += () => {
         Context.Equipment.Add(new EquipmentElement()
         {
             Inventory = Context.Inventories.Where(x => x.Id == (int)inventory.Owner).FirstOrDefault(),
             Product   = Context.Products.Where(x => x.Id == item.ProductId).FirstOrDefault(),
             Quantity  = quantity
         });
         Context.SaveChanges();
     };
 }
예제 #11
0
    public override void LoadingEnd()
    {
        model.SetSlotCount();

        view = CreateView <InventoryView>();
        view.AddEvent(OnEventChangeCategory, Exit);
        view.SetSlotCount(model.inventorySlotCount, model.inventorySlotCountMax);

        int categoryIndex = PlayerPrefs.GetInt("InventoryCategory", 0);

        OnEventChangeCategory(categoryIndex);
    }
예제 #12
0
 public override void OnItemSecButtonClick(InventoryItemEntry itemEntry, InventoryView container)
 {
     if (itemEntry.ItemData.Item.Type == ItemType.Ammo && _selectedWeaponItem != null)
     {
         string ammoType = _selectedWeaponItem.Item.GetStringAttribute("Ammo Type");
         if (ammoType == itemEntry.ItemData.Item.GetStringAttribute("Ammo Type") && !string.IsNullOrEmpty(ammoType) && _selectedWeaponItem.Item.Type == ItemType.Weapon)
         {
             _selectedWeaponItem.RelatedItemID = itemEntry.ItemData.Item.ID;
             Refresh();
             OnItemSelect(_selectedItemEntry, _selectedItemContainer);
         }
     }
 }
예제 #13
0
 public void ClearSelections()
 {
     CargoAmmoInventory.DeselectAll();
     TraderInventory.DeselectAll();
     _selectedItemEntry     = null;
     _selectedItemContainer = null;
     SellButton.isEnabled   = false;
     BuyButton.isEnabled    = false;
     QuantitySlider.alpha   = 0;
     TotalPriceValue.alpha  = 0;
     NGUITools.SetActive(QuantitySlider.gameObject, false);
     ActionSheet.Clear();
 }
예제 #14
0
        public async Task <IActionResult> CreateInventory([Bind(inventoryProperties)] InventoryView c)
        {
            c.ID = Guid.NewGuid().ToString();
            var d = new InventoryData()
            {
                ID = c.ID, Employee = c.Employee, ValidTo = c.ValidTo ?? DateTime.MaxValue, ValidFrom = c.ValidFrom ?? DateTime.MinValue
            };
            var o = new Inventory(d);
            await inventories.AddObject(o);

            await generateInventoryMuseals(d.ID);

            return(RedirectToAction("Index", "Home"));
        }
예제 #15
0
        /// <summary>
        /// 设置文本
        /// </summary>
        /// <param name="view"></param>
        private void SetForm(InventoryView view)
        {
            ctxtInventoryId.Text = view.InventoryId;
            ctxtStorageId.Text = view.StorageId;
            ctxtTextbookId.Text = view.TextbookId;

            ctxtAuthor.Text = view.Author;
            ctxtPress.Text = view.Press;
            ctxtTextbookNum.Text = view.Num;
            ctxtTextbookName.Text = view.Name;
            ctxtISBN.Text = view.Isbn;
            ctxtInventoryCount.Text = view.InventoryCount.ToString();
            ctxtShelfNumber.Text = view.ShelfNumber;
        }
예제 #16
0
        /// <summary>
        /// 设置文本
        /// </summary>
        /// <param name="view"></param>
        private void SetForm(InventoryView view)
        {
            ctxtInventoryId.Text = view.InventoryId;
            ctxtStorageId.Text   = view.StorageId;
            ctxtTextbookId.Text  = view.TextbookId;

            ctxtAuthor.Text         = view.Author;
            ctxtPress.Text          = view.Press;
            ctxtTextbookNum.Text    = view.Num;
            ctxtTextbookName.Text   = view.Name;
            ctxtISBN.Text           = view.Isbn;
            ctxtInventoryCount.Text = view.InventoryCount.ToString();
            ctxtShelfNumber.Text    = view.ShelfNumber;
        }
예제 #17
0
        public ResponseView SubmitInStock(InventoryView inventory, string instockCount, string loginName)
        {
            var count   = instockCount.ConvertToInt();
            var person  = new TbmisUserAppl(loginName).GetUser().TbmisUserName;
            var inve    = _adapter.Adapt <Inventory>(inventory);
            var inveNew = new Inventory();
            //var inveNew = inve;
            var repo   = ServiceLocator.Current.GetInstance <IInventoryRepository>();
            var result = new ResponseView();

            //是否已存在库存
            if (inve.ID != null && inve.ID != Guid.Empty)
            {
                //取出库存
                inveNew = repo.First(t => t.ID == inve.ID);
                //更新架位号
                inveNew.ShelfNumber = inve.ShelfNumber;
            }
            else
            {
                inveNew = inve;
            }

            //修改库存数量
            inveNew.InventoryCount += count;
            //创建库存异动记录
            InventoryService.CreateStockRecord <InStockRecord>(inveNew, person, count);

            try
            {
                if (inveNew.ID == null || inve.ID == Guid.Empty)
                {
                    repo.Add(inveNew);
                }
                else
                {
                    repo.Modify(inveNew);
                }

                repo.Context.Commit();
                return(result);
            }
            catch (Exception e)
            {
                result.IsSuccess = false;
                result.Message   = "入库操作失败";
                return(result);
            }
        }
예제 #18
0
    void Awake()
    {
        //There only should be one inventory view per scene.
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(this);
        }

        //When testing calls for it
        //Show ();
    }
예제 #19
0
        public void SubmitInStockForModify()
        {
            var app  = ServiceLocator.Current.GetInstance <IInventoryAppl>();
            var view = new InventoryView
            {
                InventoryId    = "2",
                StorageId      = "1",
                TextbookId     = "98F77E4D-6D9B-4368-9AE4-001E8EFD4586",
                InventoryCount = 256,
                ShelfNumber    = "d3-6"
            };
            var result = app.SubmitInStock(view, "256", "dongxb");

            Assert.IsTrue(result.IsSuccess);
        }
예제 #20
0
        public PlayerInfoTable()
            : base(DrawHelper.CenteredToScreenWidth(600), DrawHelper.CenteredToScreenHeight(600), "Guest", 600, 600)
        {
            IsZeroApplicaple = true;

            Icons = new InfoIcon(265, 45, onInventory, onStats);

            Inventory = new InventoryView(100, 325);
            StatsView = new StatView(50, 125);

            AddChild(Inventory);
            AddChild(Icons);

            Title.SpriteColor = new Color(249, 214, 214);
            Title.Y           = 13;
        }
        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);
                    }
                }
            };
        }
예제 #22
0
    public override void OnItemSelect(InventoryItemEntry itemEntry, InventoryView container)
    {
        if (itemEntry != null)
        {
            _selectedItemContainer = container;
            _selectedItem          = itemEntry.ItemData;
            ActionSheet.SetItemTitle(itemEntry.ItemData.Item.DisplayName);

            //build description with item description and attributes
            ActionSheet.SetItemDesc(itemEntry.ItemData.Item.Description);
            ActionSheet.ListItemAttributes(itemEntry.ItemData.Item);


            ActionSheet.SetItemSubnote("", "");


            VaultInventory.DeselectAll();
            CargoAmmoInventory.DeselectAll();

            if (container == VaultInventory)
            {
                StoreButton.isEnabled    = false;
                RetrieveButton.isEnabled = true;
            }
            else if (container == CargoAmmoInventory && _currentStationData.HomeStationData != null && _currentStationData.HomeStationData.VaultSize > 0)
            {
                StoreButton.isEnabled    = true;
                RetrieveButton.isEnabled = false;
            }

            if (_selectedItem.Quantity > 1)
            {
                QuantitySlider.alpha = 1;
                NGUITools.SetActive(QuantitySlider.gameObject, true);
                QuantitySlider.value = 1;
                _selectedQuantity    = _selectedItem.Quantity;
                QuantityLabel.text   = _selectedItem.Quantity.ToString();
            }
            else
            {
                QuantitySlider.alpha = 0;
                _selectedQuantity    = 1;
                NGUITools.SetActive(QuantitySlider.gameObject, false);
            }
        }
    }
예제 #23
0
        public ActionResult Index()
        {
            var obj = new InventoryView();

            using (var client = new HttpClient())
            {
                var responseTask = client.GetAsync("https://localhost:44355/api/admin");
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <IEnumerable <Pizza> >();

                    readTask.Wait();

                    obj.pizzas = readTask.Result.ToList();
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "Server error. Please contact administrator.");
                }
            }
            using (var client = new HttpClient())
            {
                var responseTask = client.GetAsync("https://localhost:44355/api/inventory");
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <IEnumerable <PizzaStock> >();
                    readTask.Wait();

                    obj.quantities = readTask.Result.ToList();
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "Server error. Please contact administrator.");
                }
            }

            return(View(obj));
        }
예제 #24
0
        public InventoryBrowseState(Inventory pInventory, ShopController pShopController = null)
        {
            _inventory = pInventory;

            _model = new InventoryModel(_inventory);

            _controller = new InventoryController(_model);

            _view = new InventoryView(_controller, pShopController);
            _view.Subscribe(_model);
            AddChild(_view);
            Helper.AlignToCenter(_view, true, true);
            _view.x = Globals.offsetX;

            _messageView = new InventoryMessageView();
            _messageView.Subscribe(_model);
            AddChild(_messageView);
            Helper.AlignToCenter(_messageView, true, false);
        }
예제 #25
0
        private void CreateViews()
        {
            // Create shop view
            shopInventoryView = new InventoryView(shopController, inputManager, System.Drawing.Color.LightGoldenrodYellow);
            shopInventoryView.SetViewScreenPosition(0.5f, 0.25f);
            AddChild(shopInventoryView);
            Helper.AlignToCenter(shopInventoryView, true, false);

            // Create customer inventory view
            customerInventoryView = new InventoryView(customerController, inputManager, System.Drawing.Color.RosyBrown);
            customerInventoryView.SetViewScreenPosition(0.5f, 0.95f);
            AddChild(customerInventoryView);
            Helper.AlignToCenter(customerInventoryView, true, false);

            // Create message view
            shopMessageView = new ShopMessageView();
            AddChild(shopMessageView);
            Helper.AlignToCenter(shopMessageView, true, false);
        }
예제 #26
0
    void Start()
    {
        switch (GameManager.controllerType)
        {
        case ControllerType.Vive:
            m_inventoryView = m_inventoryViewVive;
            break;

        case ControllerType.Keyboard:
            m_inventoryView = m_inventoryViewPC;
            break;

        default:
            throw new Exception("Controller type error");
        }

        m_inventoryView.Init(m_inventoryModel);

        m_sceneObjects.AddRange(m_Objects.GetComponentsInChildren <Transform>());
        savedAttributes.takenObjectsList = new int[m_sceneObjects.Count];
    }
예제 #27
0
    //public int FreeSlot
    //{
    //    get
    //    {
    //        return freeSlot;
    //    }

    //    set
    //    {
    //        freeSlot = value;
    //    }
    //}

    void Awake()
    {
        database      = ItemDatabase.Instance(itemJSON);
        inventoryName = null;
        switch (inventory)
        {
        case Inventory.Ship:
            inventoryName = "ShipInventory";
            break;

        case Inventory.Base:
            inventoryName = "BaseInventory";
            break;

        default:
            Debug.LogError("No inventory selected !", this);
            break;
        }
        inventoryModel = GameObject.Find(inventoryName).GetComponent <InventoryModel>();
        inventoryView  = this.gameObject.GetComponent <InventoryView>();
        //FreeSlot = inventoryView.slotsAmount;
    }
예제 #28
0
    public override void OnItemSelect(InventoryItemEntry itemEntry, InventoryView container)
    {
        DockedShipInventory.DeselectAll();
        HangarInventory.DeselectAll();
        _selectedEntry = itemEntry;

        Loadout selectedLoadout = null;

        //check if item is active loadout
        if (itemEntry.ItemData.Item.Description == GameManager.Inst.PlayerProgress.ActiveLoadout.LoadoutID)
        {
            selectedLoadout = GameManager.Inst.PlayerProgress.ActiveLoadout;
        }
        else
        {
            //check if item is in hangar
            selectedLoadout = FindLoadoutInHangar(itemEntry.ItemData.Item.Description);
        }
        ShipInfoSheet.CurrentLoadout = selectedLoadout;
        ShipInfoSheet.Refresh();
        ShipDataSheet.CurrentLoadout = selectedLoadout;
        ShipDataSheet.Refresh();
    }
예제 #29
0
    void Awake()
    {
        //Inicialização dos componentes do jogo

        player        = GetComponent <Player>();
        storyView     = GameObject.Find("StoryText").GetComponent <StoryView>();
        playerView    = GameObject.Find("PlayerText").GetComponent <PlayerView>();
        inventoryView = GameObject.Find("InventoryText").GetComponent <InventoryView>();
        gamec         = GetComponent <CombatController>();

        //Subscrição de eventos do Player(Model)
        player.OnRoomUpdate       += storyView.ChangeRoom;
        Player.OnPlayerInfoChange += playerView.UpdateView;

        //Subscrição de eventos do Controller
        onGameStart  += player.PlayerStart;
        onRoomChange += player.RoomUpdate;

        //Subscrição de eventos do inventario
        Inventory.OnInventoryInfoChange += inventoryView.UpdateView;

        //Subscrição de evento de sistema(API) para receber Input
        inputField.onEndEdit.AddListener(AcceptStringInput);
    }
예제 #30
0
 /// <summary>
 /// Associate the given view with this Inventory.</summary>
 public void AddView(InventoryView view)
 {
     _views.Add(view);
     view.InitFromInventory(this);
 }
예제 #31
0
        private void btnInventory_Click(object sender, EventArgs e)
        {
            InventoryView inventory = new InventoryView();

            inventory.Show();
        }
 public ResponseView SubmitInStock(InventoryView inventory, string instockCount, string loginName)
 {
     return(_appl.SubmitInStock(inventory, instockCount, loginName));
 }