Example #1
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));
     }
 }
Example #2
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);
        }