示例#1
0
    public void AddItem(string key, IItemObj obj = null)
    {
        ItemInfo info = new ItemInfo();

        info.itemKey = key;
        info.YInGrid = CurY;
        info.obj     = obj;

        if (infos.Count == 0 || infos[infos.Count - 1].iscutline)
        {
            infos.Add(new Line());
        }
        if (infos[infos.Count - 1].Count < colcount)
        {
            info.XInGrid = infos[infos.Count - 1].Count * cellwidth;
            infos[infos.Count - 1].Add(info);
        }
        else
        {
            infos.Add(new Line());
            info.XInGrid = 0;
            infos[infos.Count - 1].Add(info);
        }
        if (infos[infos.Count - 1].Count == colcount)
        {
            CurY += cellheight;
        }
        rect.GetComponent <UIWidget>().height = (int)CurY;
    }
示例#2
0
    public void AddCutLine(string key, IItemObj obj = null)
    {
        if (infos.Count != 0)
        {
            if (infos[infos.Count - 1].Count < colcount)
            {
                CurY += cellheight;
            }
        }
        ItemInfo info = new ItemInfo();

        info.itemKey = key;
        info.XInGrid = cellwidth * (colcount - 1) / 2;
        info.YInGrid = CurY - cellheight / 2 + cutLineHeight / 2;
        info.obj     = obj;

        infos.Add(new Line());
        infos[infos.Count - 1].iscutline = true;
        infos[infos.Count - 1].Add(info);

        CurY += cutLineHeight;
    }