FairyGUI.GList.ItemIndexToChildIndex C# (CSharp) Method

ItemIndexToChildIndex() public method

public ItemIndexToChildIndex ( int index ) : int
index int
return int
        public int ItemIndexToChildIndex(int index)
        {
            if (!_virtual)
                return index;

            if (_layout == ListLayoutType.Pagination)
            {
                return GetChildIndex(_virtualItems[index].obj);
            }
            else
            {
                if (_loop && _numItems > 0)
                {
                    int j = _firstIndex % _numItems;
                    if (index >= j)
                        index = _firstIndex + (index - j);
                    else
                        index = _firstIndex + _numItems + (j - index);
                }
                else
                    index -= _firstIndex;

                return index;
            }
        }

Usage Example

 static int ItemIndexToChildIndex(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GList obj  = (FairyGUI.GList)ToLua.CheckObject(L, 1, typeof(FairyGUI.GList));
         int            arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         int            o    = obj.ItemIndexToChildIndex(arg0);
         LuaDLL.lua_pushinteger(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }