Пример #1
0
 private void Awake()
 {
     _instance      = this;
     priceText      = transform.Find("InventoryImage/JiaGeText").GetComponent <Text>();
     chuosheButton  = transform.Find("InventoryImage/ChuoSheImage").GetComponent <Button>();
     equipPopup     = GameObject.Find("EquipPopupImage").GetComponent <EquipPopup>();
     inventoryPopup = GameObject.Find("InventoryPopupImage").GetComponent <InventoryPopup>();
 }
Пример #2
0
    private void Awake()
    {
        _intance       = this;
        equipPopup     = transform.Find("EquipPopUP").GetComponent <EquipPopup>();
        inventoryPopup = transform.Find("InventoryPopup").GetComponent <InventoryPopup>();

        sellBtn      = transform.Find("Inventory/Sell").GetComponent <Button>();
        closeBtn     = transform.Find("ButtonClose").GetComponent <Button>();
        sellPriceTxt = transform.Find("Inventory/Price/Value").GetComponent <Text>();
        sellBtn.onClick.AddListener(onSell);
        closeBtn.onClick.AddListener(onClose);

        disableSellBtn();
    }
Пример #3
0
 private void Awake()
 {
     inventory = transform.Find("BagDetails/InventoryPopup").GetComponent <InventoryPopup>();
     equip     = transform.Find("BagDetails/EquipPopup").GetComponent <EquipPopup>();
     t1        = transform.Find("BagDetails/ToggleGroup/Toggle").GetComponent <Toggle>();                   //页数
     t2        = transform.Find("BagDetails/ToggleGroup/Toggle1").GetComponent <Toggle>();
     sc        = transform.Find("BagDetails/bagdetails/ScrInventory/Scrollbar").GetComponent <Scrollbar>(); //滚动
     t1.onValueChanged.AddListener(ison);
     close   = transform.Find("BagDetails/Closebtn").GetComponent <Button>();                               //关闭
     btnsale = transform.Find("BagDetails/btnsale").GetComponent <Button>();                                //出售按钮
     btnsale.onClick.AddListener(OnSale);
     pricesale = transform.Find("BagDetails/btnsale/saleprice").GetComponent <Text>();                      //出售价格
     DisableButton();
 }
Пример #4
0
    void Awake()
    {
        instance       = this;
        equipPopup     = transform.Find("EquipPopup").GetComponent <Equippopup>();
        inventoryPopup = transform.Find("InventoryPopup").GetComponent <InventoryPopup>();
        saleButton     = transform.Find("Inventory/btn-Sale").GetComponent <UIButton>();
        priceLabel     = transform.Find("Inventory/PriceBg/Label").GetComponent <UILabel>();
        closeButton    = transform.Find("Inventory/btn-close").GetComponent <UIButton>();
        upgradeButton  = transform.Find("EquipPopup/btn-Upgrade").GetComponent <UIButton>();
        DisBtn();
        priceLabel.text = "售价";
        EventDelegate ed1 = new EventDelegate(this, "OnSaleClick");

        saleButton.onClick.Add(ed1);
        EventDelegate ed2 = new EventDelegate(this, "HideKnapsak");

        closeButton.onClick.Add(ed2);
    }
Пример #5
0
    void Awake()
    {
        _Instance = this;
        tween     = this.GetComponent <TweenPosition>();

        equipPopup     = transform.Find("EquipPopup").GetComponent <EquipPopup>();
        inventoryPopup = transform.Find("InventoryPopup").GetComponent <InventoryPopup>();

        sellPriceLabel = transform.Find("Inventory/Sell/PriceLabel").GetComponent <UILabel>();
        sellBtn        = transform.Find("Inventory/SellBtn").GetComponent <UIButton>();

        EventDelegate ed = new EventDelegate(this, "OnSellClick");

        sellBtn.onClick.Add(ed);


        DisableSellBtn();
    }
Пример #6
0
    void Awake()
    {
        _instance     = this;
        equipPopup    = transform.Find("EquipPopup").GetComponent <EquipPopup>();
        inventoryPoup = transform.Find("InventoryPopup").GetComponent <InventoryPopup>();

        saleButton          = transform.Find("Inventory/ButtonSale").GetComponent <UIButton>();
        priceLabel          = transform.Find("Inventory/PriceBg/Label").GetComponent <UILabel>();
        tween               = this.GetComponent <TweenPosition>();
        closeKnapsackButton = transform.Find("CloseButton").GetComponent <UIButton>();
        DisableButton();
        EventDelegate ed = new EventDelegate(this, "OnSale");

        saleButton.onClick.Add(ed);
        EventDelegate ed2 = new EventDelegate(this, "OnKnapsackClose");

        closeKnapsackButton.onClick.Add(ed2);
    }
Пример #7
0
	void Awake()
	{
	    _instance = this;
		equipPopup = transform.Find("EquipPopup").GetComponent<EquipPopup>();
		inventoryPopup = transform.Find("InventoryPopup").GetComponent<InventoryPopup>();


        saleButton = transform.Find("Inventory/ButtonSale").GetComponent<UIButton>();
	    priceLabel = transform.Find("Inventory/PriceBg/Label").GetComponent<UILabel>();
	    tween = this.GetComponent<TweenPosition>();
	    closeKnapsackButton = transform.Find("CloseButton").GetComponent<UIButton>();
        DisableButton();

        EventDelegate ed = new EventDelegate(this,"OnSale");
        saleButton.onClick.Add(ed);

        EventDelegate ed2 = new EventDelegate(this,"OnKnapsackClose");
        closeKnapsackButton.onClick.Add(ed2);
	}
Пример #8
0
    void Awake()
    {
        equip = transform.Find("EquipPanel/EquipPopup").GetComponent<EquipPopup>();
        inventoryPopup = transform.Find("InventoryPanel/inventoryPopup").GetComponent<InventoryPopup>();
       
        priceLabel = transform.Find("Inventory/PriceBg/Label").GetComponent<UILabel>();
        sellBtn = transform.Find("Inventory/SellButton").GetComponent<UIButton>();
        closeBtn = transform.Find("CloseButton").GetComponent<UIButton>();
        knapspackTween = this.GetComponent<TweenPosition>();

        //注册点击事件
        EventDelegate ed1 = new EventDelegate(this, "On_knapSpack_Close_Click");
        closeBtn.onClick.Add(ed1);
        EventDelegate ed3 = new EventDelegate(this, "On_knapspack_sell_Click");
        sellBtn.onClick.Add(ed3);

        DisenableButton();

    }
Пример #9
0
    void Awake()
    {
        _instance      = this;
        equipPopup     = transform.Find("equipContainer").GetComponent <EquipmentPopUp> ();
        inventoryPopup = transform.Find("alertContainer").GetComponent <InventoryPopup> ();
        salePopup      = transform.Find("Inventory/saleContainer").GetComponent <SalePopUp> ();
        tween          = this.GetComponent <TweenPosition> ();
        close_btn      = transform.Find("close_btn").GetComponent <UIButton> ();
        sale_btn       = transform.Find("Inventory/sale_btn").GetComponent <UIButton> ();


        EventDelegate ed = new EventDelegate(this, "OnBagClose");

        close_btn.onClick.Add(ed);
        DisableBtn();

        EventDelegate ed2 = new EventDelegate(this, "OnEnableSale");

        sale_btn.onClick.Add(ed2);
    }
Пример #10
0
    void Awake()
    {
        equip          = transform.Find("EquipPanel/EquipPopup").GetComponent <EquipPopup>();
        inventoryPopup = transform.Find("InventoryPanel/inventoryPopup").GetComponent <InventoryPopup>();

        priceLabel     = transform.Find("Inventory/PriceBg/Label").GetComponent <UILabel>();
        sellBtn        = transform.Find("Inventory/SellButton").GetComponent <UIButton>();
        closeBtn       = transform.Find("CloseButton").GetComponent <UIButton>();
        knapspackTween = this.GetComponent <TweenPosition>();

        //注册点击事件
        EventDelegate ed1 = new EventDelegate(this, "On_knapSpack_Close_Click");

        closeBtn.onClick.Add(ed1);
        EventDelegate ed3 = new EventDelegate(this, "On_knapspack_sell_Click");

        sellBtn.onClick.Add(ed3);

        DisenableButton();
    }
Пример #11
0
 private void Awake()
 {
     equipPopup      = transform.Find("EquipPopup").GetComponent <EquipPopup>();
     _inventoryPopup = transform.Find("InventoryPopup").GetComponent <InventoryPopup>();
 }
Пример #12
0
 public override void Awake()
 {
     base.Awake();
     equipPopup     = transform.Find("EquipPopup").GetComponent <EquipPopup>();
     inventoryPopup = transform.Find("InventoryPopup").GetComponent <InventoryPopup>();
 }
Пример #13
0
    public int InventoryAdd(Item item, int count)
    {
        InventoryPopup inventory = InventoryPop.GetComponent <InventoryPopup>();

        return(inventory.AddItem(item, count));
    }
Пример #14
0
        /// <summary>
        /// Validates the product inventory for items currently added in basket
        /// </summary>
        /// <param name="fixQuantity">Indicate if the quantity need to be fixed as per available stock. If no then it will only record warning messages</param>
        /// <returns>returns true if no issues found</returns>
        protected bool ValidateInventory(bool fixQuantity = false)
        {
            bool recalculateRequried = false;
            // VALIDATE INVENTORY
            List <string> warningMessages = new List <string>();

            if (_StoreInventoryEnabled)
            {
                Dictionary <string, InventoryInfo> inventories = new Dictionary <string, InventoryInfo>();
                string        tempMessage;
                InventoryInfo info;
                foreach (BasketItem item in _Basket.Items)
                {
                    if (item.OrderItemType != OrderItemType.Product || item.IsChildItem)
                    {
                        continue;
                    }
                    info = GetInventoryInfo(inventories, item);
                    bool enforceInv = info.InventoryStatus.InventoryMode != InventoryMode.None &&
                                      info.InventoryStatus.AllowBackorder == false;
                    if (enforceInv)
                    {
                        // inventory needs to be enforced
                        if (item.Quantity > info.NowAvailable)
                        {
                            if (fixQuantity)
                            {
                                if (info.NowAvailable < 1)
                                {
                                    item.Quantity = 0;
                                }
                                else
                                {
                                    item.Quantity = (short)info.NowAvailable;
                                }
                                item.Save();

                                recalculateRequried = true;
                            }
                            else
                            {
                                tempMessage = GetInventoryStockMessage(item, info);
                                warningMessages.Add(tempMessage);
                            }
                        }

                        // if this was a kit product and some quanity of it getting included
                        // update the inventories for all its component products
                        if (item.Product.KitStatus == KitStatus.Master && item.Quantity > 0)
                        {
                            InventoryInfo info1;
                            foreach (InventoryManagerData invd1 in info.InventoryStatus.ChildItemInventoryData)
                            {
                                info1 = inventories[invd1.ProductId + "_" + invd1.OptionList + "_"];
                                if (invd1.InventoryMode != InventoryMode.None &&
                                    invd1.AllowBackorder == false)
                                {
                                    // ensure that none of the component product exceeds inventory
                                    int effectiveQuantity = item.Quantity * invd1.Multiplier;
                                    if (effectiveQuantity > info1.NowAvailable)
                                    {
                                        if (fixQuantity)
                                        {
                                            if (info1.NowAvailable < 1)
                                            {
                                                item.Quantity = 0;
                                            }
                                            else
                                            {
                                                item.Quantity = (short)(info1.NowAvailable / invd1.Multiplier);
                                            }
                                        }
                                        else
                                        {
                                            tempMessage = GetInventoryStockMessage(item, info1);
                                            warningMessages.Add(tempMessage);
                                        }
                                    }
                                    info1.NowAvailable -= item.Quantity * invd1.Multiplier;
                                    inventories[invd1.ProductId + "_" + invd1.OptionList + "_"] = info1;
                                }
                            }
                        }

                        info.NowAvailable -= item.Quantity;
                    }

                    int curQty = item.Quantity;
                    tempMessage = ValidateMinMaxLimits(item, info);
                    if (!string.IsNullOrEmpty(tempMessage))
                    {
                        warningMessages.Add(tempMessage);
                        if (enforceInv)
                        {
                            info.NowAvailable += curQty - item.Quantity;
                        }
                    }
                }

                // CHECK IF WE NEED TO DISPLAY THE WARNINGS
                if (!fixQuantity && warningMessages.Count > 0)
                {
                    InventoryMessages.DataSource = warningMessages;
                    InventoryMessages.DataBind();
                    InventoryPopup.Show();
                }
                else if (warningMessages.Count > 0)
                {
                    InventoryPopup.Hide();
                    // save the basket
                    _Basket.Save();
                }
            }

            if (recalculateRequried)
            {
                IBasketService service = AbleContext.Resolve <IBasketService>();
                service.Combine(_Basket);
                service.Recalculate(_Basket);
            }

            return(warningMessages.Count == 0);
        }
Пример #15
0
    public void InventoryMoneySetting(int money)
    {
        InventoryPopup inventory = InventoryPop.GetComponent <InventoryPopup>();

        inventory.SetMoney(money);
    }
Пример #16
0
    public void InventoryUseUpdate(int slotNum)
    {
        InventoryPopup inventory = InventoryPop.GetComponent <InventoryPopup>();

        inventory.UseItem(slotNum);
    }
Пример #17
0
    public void InventoryUISetting(List <Item> itemList)
    {
        InventoryPopup inventory = InventoryPop.GetComponent <InventoryPopup>();

        inventory.Setting(itemList);
    }