예제 #1
0
    static int MoveToFront(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                cs.GuiObject obj = (cs.GuiObject)ToLua.CheckObject <cs.GuiObject>(L, 1);
                obj.MoveToFront();
                return(0);
            }
            else if (count == 2)
            {
                cs.GuiObject obj  = (cs.GuiObject)ToLua.CheckObject <cs.GuiObject>(L, 1);
                cs.EGuiLayer arg0 = (cs.EGuiLayer)ToLua.CheckObject(L, 2, typeof(cs.EGuiLayer));
                obj.MoveToFront(arg0);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: cs.GuiObject.MoveToFront"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #2
0
    static int Hide(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                cs.GuiObject obj = (cs.GuiObject)ToLua.CheckObject <cs.GuiObject>(L, 1);
                obj.Hide();
                return(0);
            }
            else if (count == 2)
            {
                cs.GuiObject obj  = (cs.GuiObject)ToLua.CheckObject <cs.GuiObject>(L, 1);
                bool         arg0 = LuaDLL.luaL_checkboolean(L, 2);
                obj.Hide(arg0);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: cs.GuiObject.Hide"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #3
0
 public static void CreateGuiScrollView()
 {
     GameObject[] arrObjSelect = Selection.GetFiltered <GameObject>(SelectionMode.ExcludePrefab);
     if (arrObjSelect != null && arrObjSelect.Length > 0)
     {
         GuiObject guiObject = Utility.FindGuiObjectOwner(arrObjSelect[0].transform);
         if (guiObject == null)
         {
             Logger.Error("UI控件必须在GuiObject节点下创建!!请选中GuiObject节点或其子节点,再创建");
         }
         else
         {
             GameObject obj = Resources.Load("Main/Prefab/GuiScrollView") as GameObject;
             if (obj)
             {
                 GameObject guiScrollView = GameObject.Instantiate(obj);
                 guiScrollView.transform.SetParent(arrObjSelect[0].transform, false);
             }
         }
     }
     else
     {
         Logger.Error("UI控件必须在GuiObject节点下创建!!请选中GuiObject节点或其子节点,再创建");
     }
 }
예제 #4
0
        public static void CreateGuiImage()
        {
            GameObject[] arrObjSelect = Selection.GetFiltered <GameObject>(SelectionMode.ExcludePrefab);
            if (arrObjSelect != null && arrObjSelect.Length > 0)
            {
                GuiObject guiObject = Utility.FindGuiObjectOwner(arrObjSelect[0].transform);
                if (guiObject == null)
                {
                    Logger.Error("UI控件必须在GuiObject节点下创建!!请选中GuiObject节点或其子节点,再创建");
                }
                else
                {
                    GameObject objImage = new GameObject("GuiImage");
                    objImage.transform.SetParent(arrObjSelect[0].transform, false);
                    objImage.AddComponent <GuiImage>();

                    Selection.activeObject = objImage;
                    EditorGUIUtility.PingObject(objImage);
                }
            }
            else
            {
                Logger.Error("UI控件必须在GuiObject节点下创建!!请选中GuiObject节点或其子节点,再创建");
            }
        }
예제 #5
0
    static int LoadGuiObject(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                cs.GuiScene  obj  = (cs.GuiScene)ToLua.CheckObject <cs.GuiScene>(L, 1);
                string       arg0 = ToLua.CheckString(L, 2);
                cs.GuiObject o    = obj.LoadGuiObject(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 3)
            {
                cs.GuiScene  obj  = (cs.GuiScene)ToLua.CheckObject <cs.GuiScene>(L, 1);
                string       arg0 = ToLua.CheckString(L, 2);
                string       arg1 = ToLua.CheckString(L, 3);
                cs.GuiObject o    = obj.LoadGuiObject(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: cs.GuiScene.LoadGuiObject"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #6
0
 static int Clear(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         cs.GuiObject obj = (cs.GuiObject)ToLua.CheckObject <cs.GuiObject>(L, 1);
         obj.Clear();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #7
0
 static int SetOpenOrder(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         cs.GuiObject obj  = (cs.GuiObject)ToLua.CheckObject <cs.GuiObject>(L, 1);
         int          arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         obj.SetOpenOrder(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #8
0
 static int SetOpenLayer(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         cs.GuiObject obj  = (cs.GuiObject)ToLua.CheckObject <cs.GuiObject>(L, 1);
         cs.EGuiLayer arg0 = (cs.EGuiLayer)ToLua.CheckObject(L, 2, typeof(cs.EGuiLayer));
         obj.SetOpenLayer(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #9
0
 static int GetControl(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         cs.GuiObject  obj  = (cs.GuiObject)ToLua.CheckObject <cs.GuiObject>(L, 1);
         int           arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         cs.GuiControl o    = obj.GetControl(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #10
0
 static int FindGuiObject(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         cs.GuiScene  obj  = (cs.GuiScene)ToLua.CheckObject <cs.GuiScene>(L, 1);
         string       arg0 = ToLua.CheckString(L, 2);
         cs.GuiObject o    = obj.FindGuiObject(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #11
0
 static int Initialize(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         cs.GuiObject obj  = (cs.GuiObject)ToLua.CheckObject <cs.GuiObject>(L, 1);
         string       arg0 = ToLua.CheckString(L, 2);
         bool         o    = obj.Initialize(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #12
0
 public void ResetOrderInLayer(EGuiLayer a_eGuiLayer, ref int a_nStartOrder)
 {
     for (int i = 0; i < m_listGuiInfos.Count; ++i)
     {
         GuiObject guiObject = m_listGuiInfos[i].guiObject;
         if (
             guiObject.GuiLayer == a_eGuiLayer &&
             (guiObject.State == EGuiState.FadeIn ||
              guiObject.State == EGuiState.Opened ||
              guiObject.State == EGuiState.FadeOut)
             )
         {
             guiObject.SetOpenOrder(a_nStartOrder);
             a_nStartOrder++;
         }
     }
 }
예제 #13
0
    static int get_Name(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            cs.GuiObject obj = (cs.GuiObject)o;
            string       ret = obj.Name;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index Name on a nil value"));
        }
    }
예제 #14
0
    static int get_Visible(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            cs.GuiObject obj = (cs.GuiObject)o;
            bool         ret = obj.Visible;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index Visible on a nil value"));
        }
    }
예제 #15
0
    static int get_OpenOrder(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            cs.GuiObject obj = (cs.GuiObject)o;
            int          ret = obj.OpenOrder;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index OpenOrder on a nil value"));
        }
    }
예제 #16
0
    static int get_GuiLayer(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            cs.GuiObject obj = (cs.GuiObject)o;
            cs.EGuiLayer ret = obj.GuiLayer;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index GuiLayer on a nil value"));
        }
    }
예제 #17
0
        private int _GenValidControlID(GuiControl target)
        {
            Transform currTrans = (target as GuiControl).transform;
            GuiObject guiObject = Utility.FindGuiObjectOwner(currTrans);

            int nCurrentMaxID = 0;

            GuiControl[] arrCtrls = guiObject.GetComponentsInChildren <GuiControl>();
            for (int i = 0; i < arrCtrls.Length; ++i)
            {
                if (arrCtrls[i].ID > nCurrentMaxID)
                {
                    nCurrentMaxID = arrCtrls[i].ID;
                }
            }
            Debug.Log("current id-->" + target.ID + "length--->" + arrCtrls.Length);
            //if (target.ID == nCurrentMaxID) target.setID(nCurrentMaxID+1);
            return(nCurrentMaxID);
        }
예제 #18
0
        public int GetMaxOrderInLayer(EGuiLayer a_eGuiLayer)
        {
            int nMaxOrder = 0;

            for (int i = 0; i < m_listGuiInfos.Count; ++i)
            {
                GuiObject guiObject = m_listGuiInfos[i].guiObject;
                if (
                    guiObject.GuiLayer == a_eGuiLayer &&
                    (guiObject.State == EGuiState.FadeIn ||
                     guiObject.State == EGuiState.Opened ||
                     guiObject.State == EGuiState.FadeOut) &&
                    nMaxOrder < guiObject.OpenOrder
                    )
                {
                    nMaxOrder = guiObject.OpenOrder;
                }
            }
            return(nMaxOrder);
        }
예제 #19
0
        private int _GenValidControlID()
        {
            Transform currTrans = (target as GuiControl).transform;
            GuiObject guiObject = Utility.FindGuiObjectOwner(currTrans);

            Assert.IsTrue(guiObject != null);

            int nCurrentMaxID = 0;

            GuiControl[] arrCtrls = guiObject.GetComponentsInChildren <GuiControl>();
            for (int i = 0; i < arrCtrls.Length; ++i)
            {
                if (arrCtrls[i].ID > nCurrentMaxID)
                {
                    nCurrentMaxID = arrCtrls[i].ID;
                }
            }

            return(nCurrentMaxID + 1);
        }
예제 #20
0
        public GuiObject LoadGuiObject(string a_strName, string a_strPath)
        {
            GuiObject guiObject = FindGuiObject(a_strName);

            if (guiObject == null)
            {
                AssetObj assetObj = AssetManager.Get().CreateAsset(a_strPath);
                Assert.IsTrue(assetObj.LoadState != EAssetLoadState.Loading);

                GameObject objRoot = assetObj.gameObject;
                Assert.IsTrue(objRoot != null);

                guiObject = objRoot.GetComponent <GuiObject>();
                Assert.IsNotNull(guiObject);
                objRoot.transform.SetParent(GuiManager.Get().UIRoot.transform, false);
                guiObject.Initialize(a_strName);

                GuiInfo guiInfo = new GuiInfo();
                guiInfo.assetObj  = assetObj;
                guiInfo.guiObject = guiObject;
                m_listGuiInfos.Add(guiInfo);
            }
            return(guiObject);
        }