Esempio n. 1
0
    public void SetContent(object content)
    {
        CraftClassCellInfo info = content as CraftClassCellInfo;

        if (info == null)
        {
            Debug.LogError("CraftCell.SetContent >> content error");
            return;
        }

        Image imgIcon = transform.FindChild("Icon").GetComponent <Image>();
        Text  txtName = transform.FindChild("Name").GetComponent <Text>();

        imgIcon.sprite = Resources.Load <Sprite>("ItemIcon/" + info.icon);
        imgIcon.SetNativeSize();
        txtName.text = info.name;
    }
Esempio n. 2
0
    // Use this for initialization
    public new void Start()
    {
        base.Start();
        LocalPlayer localPlayer = Helper.FindLocalPlayer();

        if (localPlayer != null)
        {
            BindBag(localPlayer.bag);
        }

        //合成类型列表
        craftClassInfo = new System.Object[ItemTypeTable.className.Count];
        for (int i = 0; i < craftClassInfo.Length; i++)
        {
            CraftClassCellInfo info = new CraftClassCellInfo();
            info.icon         = ItemTypeTable.classIcon[i];
            info.name         = ItemTypeTable.className[i];
            craftClassInfo[i] = (System.Object)info;
        }
        craftClassPanel.SetList(craftClassInfo, classCellPrefab);
        craftClassPanel.OnCellSelected += this.OnClassClick;
        //合成物品列表
        craftItemPanel.OnCellSelected += this.OnItemClick;
    }