Abstract base class which contains generic functions and properties.
Inheritance: UIObject
	public void AddUIObject(UIBaseObject obj, int order = -1)
	{
		Item item = new Item();
		item.obj = obj;
		item.sortingOrder = (order == -1) ? uiItems.Count : order;

		uiItems.Add(item);
		UpdateOrder(uiItems.Count - 1, item.sortingOrder);
	}	
コード例 #2
0
    public void SetSoringOrder(UIBaseObject obj, int order)
    {
        // Debug.Log(string.Format("<color=yellow>SetSoringOrder {0}->{1}</color>", obj, order));

        // for (int i = 0; i < uiItems.Count; i++)
        // {
        // 	Debug.Log(string.Format("<color=red>{0}->{1} ({2})</color>", uiItems[i].obj.GameObject.name, uiItems[i].sortingOrder, i));
        // }

        //search item
        for (int i = 0; i < uiItems.Count; i++)
        // foreach (Item item in uiItems)
        {
            if (uiItems[i].obj == obj)
            {
                UpdateOrder(i, order);
                return;
            }
        }

        AddUIObject(obj, order);
        //search postion by order, move in list, update order Item.Move(oldIndex, newindex)
    }