static int ClearClick(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UILuaBehaviour obj = (UILuaBehaviour)ToLua.CheckObject(L, 1, typeof(UILuaBehaviour)); obj.ClearClick(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int Init(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UILuaBehaviour obj = (UILuaBehaviour)ToLua.CheckObject(L, 1, typeof(UILuaBehaviour)); LuaTable arg0 = ToLua.CheckLuaTable(L, 2); obj.Init(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int RemoveClick(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UILuaBehaviour obj = (UILuaBehaviour)ToLua.CheckObject(L, 1, typeof(UILuaBehaviour)); UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.GameObject)); obj.RemoveClick(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int AddClick(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); UILuaBehaviour obj = (UILuaBehaviour)ToLua.CheckObject <UILuaBehaviour>(L, 1); UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckObject(L, 2, typeof(UnityEngine.GameObject)); LuaFunction arg1 = ToLua.CheckLuaFunction(L, 3); obj.AddClick(arg0, arg1); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_UsingOnDisable(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UILuaBehaviour obj = (UILuaBehaviour)o; bool arg0 = LuaDLL.luaL_checkboolean(L, 2); obj.UsingOnDisable = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index UsingOnDisable on a nil value" : e.Message)); } }
static int get_UsingOnDisable(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UILuaBehaviour obj = (UILuaBehaviour)o; bool ret = obj.UsingOnDisable; LuaDLL.lua_pushboolean(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index UsingOnDisable on a nil value" : e.Message)); } }
//private Dictionary<string, StaticAssetLoader> mUIPrefabLoaders = new Dictionary<string, StaticAssetLoader>(); //private List<GameObject> mUIList = new List<GameObject>(); //private Dictionary<string, GameObjectCache> mResCaches = new Dictionary<string, GameObjectCache>(); public void GetUIPrefab(string assetName, Transform parent, LuaTable luaTable, LuaFunction luaCallBack) { if (mResManager == null) { return; } string tmpAssetName = "uiprefab/" + assetName; if (AssetFileLoader.IsEditorLoadAsset) { tmpAssetName = "BuildByFile/" + tmpAssetName + ".prefab"; } StaticAssetLoader.Load(tmpAssetName, (bool isOk, Object resultObj) => { if (!isOk || resultObj == null) { Log.Error("GetUIPrefab is error:{0}", tmpAssetName); return; } GameObject go = resultObj as GameObject; if (go == null) { Log.Error("GetUIPrefab go is null:{0}", tmpAssetName); return; } go.name = assetName; go.layer = LayerMask.NameToLayer("UI"); Vector3 anchorPos = Vector3.zero; Vector2 sizeDel = Vector2.zero; Vector3 scale = Vector3.one; RectTransform rtTr = go.GetComponent <RectTransform>(); if (rtTr != null) { anchorPos = rtTr.anchoredPosition; sizeDel = rtTr.sizeDelta; scale = rtTr.localScale; } go.transform.SetParent(parent, false); if (rtTr != null) { rtTr.anchoredPosition = anchorPos; rtTr.sizeDelta = sizeDel; rtTr.localScale = scale; } UILuaBehaviour tmpBehaviour = Tools.SafeGetComponent <UILuaBehaviour>(go); tmpBehaviour.Init(luaTable); if (luaCallBack != null) { luaCallBack.BeginPCall(); luaCallBack.Push(go); luaCallBack.PCall(); luaCallBack.EndPCall(); luaCallBack.Dispose(); luaCallBack = null; } Debug.Log("CreatePanel::>> " + assetName); }); }
public void GetUIPrefab(string assetName, Transform parent, LuaTable luaTable, LuaFunction luaCallBack) { if (mResManager == null) { return; } string tmpAssetName = assetName; if (GameSetting.DevelopMode) { tmpAssetName = "UIPrefab/" + assetName; } mResManager.LoadPrefab(assetName + GameSetting.ExtName, tmpAssetName, delegate(UnityEngine.Object[] objs) { if (objs.Length == 0) { return; } GameObject prefab = objs[0] as GameObject; if (prefab == null) { return; } GameObject go = UnityEngine.GameObject.Instantiate(prefab) as GameObject; go.name = assetName; go.layer = LayerMask.NameToLayer("UI"); Vector3 anchorPos = Vector3.zero; Vector2 sizeDel = Vector2.zero; Vector3 scale = Vector3.one; RectTransform rtTr = go.GetComponent <RectTransform>(); if (rtTr != null) { anchorPos = rtTr.anchoredPosition; sizeDel = rtTr.sizeDelta; scale = rtTr.localScale; } go.transform.SetParent(parent, false); if (rtTr != null) { rtTr.anchoredPosition = anchorPos; rtTr.sizeDelta = sizeDel; rtTr.localScale = scale; } UILuaBehaviour tmpBehaviour = go.AddComponent <UILuaBehaviour>(); tmpBehaviour.Init(luaTable); if (luaCallBack != null) { luaCallBack.BeginPCall(); luaCallBack.Push(go); luaCallBack.PCall(); luaCallBack.EndPCall(); luaCallBack.Dispose(); luaCallBack = null; } Debug.Log("CreatePanel::>> " + assetName + " " + prefab); //mUIList.Add(go); }); }