Example #1
0
        /// <summary>
        /// 按钮1 使用、装备
        /// </summary>
        private void OnFuncButton1ClickOfKnapsack()
        {
            if (m_KnapsackModel.CanUse())
            {
                // 使用
                GameEntry.Controller.Knapsack.UseItem(m_KnapsackModel);
            }
            else if (m_KnapsackModel.CanEquip())
            {
                // 装备
                GameEntry.Controller.Knapsack.EquipItem(m_KnapsackModel);
            }

            OnCloseButtonClick();
        }
Example #2
0
        /// <summary>
        /// 设置背包界面道具信息
        /// </summary>
        /// <param name="model"></param>
        private void SetupKnapsackItemData(KnapsackModel model)
        {
            // 是否打开了商店
            if (GameEntry.UI.HasUIForm(UIFormId.ShopForm))
            {
                if (model.CanSell())
                {
                    m_FuncButton1.gameObject.SetActive(false);
                    m_FuncButton2.gameObject.SetActive(true);
                    m_FuncButton2.GetComponentInChildren <Text>().text = "出售";
                }
                else
                {
                    m_FuncButton1.gameObject.SetActive(false);
                    m_FuncButton2.gameObject.SetActive(false);
                }
            }
            else
            {
                if (model.CanUse())
                {
                    m_FuncButton1.gameObject.SetActive(true);
                    m_FuncButton1.GetComponentInChildren <Text>().text = "使用";
                }
                else if (model.CanEquip())
                {
                    m_FuncButton1.gameObject.SetActive(true);
                    m_FuncButton1.GetComponentInChildren <Text>().text = "装备";
                }

                if (model.CanDiscard())
                {
                    m_FuncButton2.gameObject.SetActive(true);
                    m_FuncButton2.GetComponentInChildren <Text>().text = "丢弃";
                }
                else
                {
                    m_FuncButton2.gameObject.SetActive(false);
                }
            }
        }