Exemplo n.º 1
0
 void OnSelectItem(UIItemCommonGrid grid)
 {
     m_trans_select.transform.parent        = grid.transform;
     m_trans_select.transform.localPosition = Vector3.zero;
     m_selectdata = grid.Data;
     m_trans_select.gameObject.SetActive(true);
     // TipsManager.Instance.ShowItemTips(grid.Data.ItemThisId, grid.gameObject, false);
 }
Exemplo n.º 2
0
 public override void Release(bool depthRelease = true)
 {
     base.Release(depthRelease);
     if (null != m_iconCASD)
     {
         m_iconCASD.Release(true);
     }
     data = null;
 }
Exemplo n.º 3
0
    /// <summary>
    /// 添加 或者刷新item  此方法 默认刷新需要的图片在一个图集里面
    /// </summary>
    /// <param name="widget">父节点</param>
    /// <param name="itemName">名字</param>
    /// <param name="itemID">id</param>
    /// <param name="itemNum">数量 默认为0 会自己获取数量</param>
    static public void AttachParent(Transform widget, uint itemID, uint itemNum = 0, Action <UIItemCommonGrid> callback = null, bool showGetWay = true, uint needNum = 1)
    {
        UIManager uiMan    = DataManager.Manager <UIManager>();
        string    itemName = "ItemGrid";

        if (itemNum == 0)
        {
            itemNum = (uint)DataManager.Manager <ItemManager>().GetItemNumByBaseId(itemID);
        }
        ItemDefine.UIItemCommonData data = new ItemDefine.UIItemCommonData();
        table.ItemDataBase          db   = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(itemID);
        if (db != null)
        {
            data.IconName   = db.itemIcon;
            data.Num        = (uint)itemNum;
            data.DwObjectId = itemID;
            data.Qulity     = db.quality;
            data.ShowGetWay = showGetWay;
            data.NeedNum    = needNum;
        }
        Transform itemTrans = widget.Find(itemName);

        if (itemTrans != null)
        {
            UIItemCommonGrid grid = itemTrans.GetComponent <UIItemCommonGrid>();
            if (grid != null)
            {
                UIItem item = new UIItem(grid);

                item.SetGridData(data);
            }
            else
            {
                UIItem item = uiMan.GetUICommonItem(itemID, itemNum, 0, callback);
                if (item != null)
                {
                    item.Attach(widget, itemName);
                    item.SetGridData(data);
                }
            }
        }
        else
        {
            UIItem item = uiMan.GetUICommonItem(itemID, itemNum, 0, callback);
            if (item != null)
            {
                item.Attach(widget, itemName);
                item.SetGridData(data);
            }
        }
    }
Exemplo n.º 4
0
    public override void SetGridData(object data)
    {
        if (null == data)
        {
            return;
        }
        this.data = data as ItemDefine.UIItemCommonData;
        if (null != icon)
        {
            UIManager.GetTextureAsyn(this.data.IconName, ref m_iconCASD, () =>
            {
                if (null != icon)
                {
                    icon.mainTexture = null;
                }
            }, icon);
        }

        if (BorderIcon != null)
        {
            string bgName = ItemDefine.GetItemBorderIcon(this.data.Qulity);
            UIManager.GetAtlasAsyn(bgName, ref m_bgCASD, () =>
            {
                if (null != BorderIcon)
                {
                    BorderIcon.atlas = null;
                }
            }, BorderIcon);
        }
        if (null != num)
        {
            if (this.data.Num >= this.data.NeedNum)
            {
                num.text = this.data.Num >= 1 ? this.data.Num.ToString() : "";
                if (getlable != null)
                {
                    getlable.gameObject.SetActive(false);
                }
                if (blackSprite != null)
                {
                    blackSprite.gameObject.SetActive(false);
                }
            }
            else
            {
                num.text = "";
                SetShowGetWay(this.data.ShowGetWay);
            }
        }
    }
Exemplo n.º 5
0
    protected override void OnHide()
    {
        base.OnHide();
        m_trans_select.transform.parent = m_grid_root.transform;
        m_selectdata   = null;
        m_currTaskData = null;

        int count = m_lstUIItem.Count;

        while (count > 0)
        {
            m_lstUIItem[0].Release();
            m_lstUIItem.RemoveAt(0);
            count = m_lstUIItem.Count;
        }
        m_lstUIItem.Clear();
    }