예제 #1
0
        /// <summary>
        /// 初始化控件中道具的信息显示
        /// </summary>
        /// <param name="index"></param>
        /// <param name="Prop"></param>
        public void InitButton(int index, PropsItem Prop)
        {
            PropsDef def = Prop.GetDefinition();

            Elements[index].Show(index, def.Icon, def.CommonProperty.Name, PropsThirdText(def, Prop.Usage), true);
            Elements[index].RegisterClickEvent(() =>
            {
                AddPropToWarehouseAction(Prop);
                PropsItems.RemoveAt(index);
                Hide();
            });
        }
예제 #2
0
    public bool EquipProp(int Index)
    {
        if (passiveItems.Count == MAX_PASSIVEITEM_COUNT)
        {
            Debug.Log("慢了,无法在进行装备被动物品");
            return(false);
        }
        PropsItem item = props[Index];

        if (item.GetDefinition().EquipItem)
        {
            passiveItems.Add(item);
            props.RemoveAt(Index);
        }
        else
        {
            Debug.Log("无法装备的物品");
            return(false);
        }

        return(true);
    }