private async Task InitInternalEntry() { try { string final_path = InternalLuaEntryPath; LuaRequireToPath(ref final_path); TextAsset ta = await Assets.LoadAsync <TextAsset>(final_path); object[] obj_result = mLuaVM.DoString(ta.bytes, final_path); LuaTable table = (LuaTable)obj_result[0]; List <string> init_list = table.Cast <List <string> >(); List <Task> list_task = new List <Task>(); foreach (var item in init_list) { list_task.Add(require_init_file(item)); } await Task.WhenAll(list_task); Assets.Release(ta); } catch (XException e) { throw e; } catch (Exception e) { Debug.LogException(e); } }
private void OnPerformStart(object arg) { LuaTable table = arg as LuaTable; var performRoot = table.Cast <LuaTable>(); _battleFSM.Context.SetVariable("PerformRoot", performRoot); _battleFSM.SwitchToState((int)SessionState.PerformState); }
public void Register(LuaTable tb) { CL_ILuaUIComponent luaUIComp = tb.Cast <CL_ILuaUIComponent>(); if (null != luaUIComp && !m_comps.ContainsKey(luaUIComp.unique_id)) { m_comps.Add(luaUIComp.unique_id, luaUIComp); } }
public void Unregister(LuaTable tb) { CL_ILuaUIComponent luaUIComp = tb.Cast <CL_ILuaUIComponent>(); if (null != luaUIComp) { m_comps.Remove(luaUIComp.unique_id); } }
static private void LoadLuaFiles() { LuaTable files = Call <LuaTable>("main_getLuaFiles"); foreach (var luaFile in files.Cast <List <string> >()) { //HSUtils.Log(luaFile); luaEnv.DoString(LoadLua(LuaManager.LUA_ROOT_MENU + luaFile.Replace(".lua", "")), luaFile); } files.Dispose(); files = null; }
public List <T> LoadLuaConfigFromString <T>(string _str) { LuaTable _luaTable = LoadLuaConfigFromStr(_str); if (_luaTable != null) { var _list = _luaTable.Cast <List <T> >(); return(_list); } else { return(null); } }
public List <T> LoadLuaConfigFromFile <T>(string _filePath) { LuaTable _luaTable = LoadLuaConfig(_filePath); if (_luaTable != null) { var _list = _luaTable.Cast <List <T> >(); return(_list); } else { return(null); } }
public Dictionary <TKey, TValue> LoadLuaConfigFromString <TKey, TValue>(string _str) { LuaTable _luaTable = LoadLuaConfigFromStr(_str); if (_luaTable != null) { var _dic = _luaTable.Cast <Dictionary <TKey, TValue> >(); return(_dic); } else { return(null); } }
/// <summary> /// 文件中读取,绝对路径 /// </summary> /// <typeparam name="TKey"></typeparam> /// <typeparam name="TValue"></typeparam> /// <param name="_filePath"></param> /// <returns></returns> public Dictionary <TKey, TValue> LoadLuaConfigFromFile <TKey, TValue>(string _filePath) { LuaTable _luaTable = LoadLuaConfig(_filePath); if (_luaTable != null) { var _dic = _luaTable.Cast <Dictionary <TKey, TValue> >(); return(_dic); } else { return(null); } }
public override void ConstructFromXML(XML xml) { base.ConstructFromXML(xml); Lua = LuaUIHelper.ConnectLua(this); callback = Lua.Cast <ILuaComponent>(); if (callback != null) { callback.Init(); } else { Debug.LogWarningFormat("Can't cast LuaTable to ILuaComponent"); } }
/// <summary> /// require会去搜索路径下找 /// 会在里面进行拼接.默认setting/xxx.lua /// </summary> /// <typeparam name="TKey"></typeparam> /// <typeparam name="TValue"></typeparam> /// <param name="_lua"></param> /// <returns></returns> public Dictionary <TKey, TValue> LoadLuaConfigFromLua <TKey, TValue>(string _lua) { // 简化 _lua = string.Format("{0}{1}", __LUACONFIGPATH, _lua); LuaTable _luaTable = m_require(_lua); if (_luaTable != null) { var _dic = _luaTable.Cast <Dictionary <TKey, TValue> >(); return(_dic); } else { return(null); } }
public static LuaTable ConnectLua(GComponent gcom) { LuaTable _peerTable = null; LuaFunction extendFunction = gcom.data as LuaFunction; if (extendFunction != null) { gcom.data = null; object[] obj = extendFunction.Call(gcom); _peerTable = obj[0] as LuaTable; _peerTable.Set("csuserdata", gcom); } ILuaComponent c = _peerTable.Cast <ILuaComponent>(); c.Init(); return(_peerTable); }
public void SetLuaTalbe(LuaTable peerTable) { _peerTable = peerTable; callback = peerTable.Cast <ILuaWindow>(); }
/// <summary> /// 发送添加回复请求。 /// </summary> /// <param name="list">回复列表。</param> public void SendApproveRequestForLua(LuaTable t) { SendApproveRequest(t.Cast <List <MsgData_cFriendApproveVO> >()); }
/// <summary> /// 发送推荐好友请求。 /// </summary> public void SendAddRecommendRequestForLua(LuaTable t) { SendAddRecommendRequest(t.Cast <List <long> >()); }
public void SetPathForLua(LuaTable tb) { List <Vector2> path = tb.Cast <List <Vector2> >(); SetPath(path); }
public void SetLuaTalbe(LuaTable peerTable) { mPeerTable = peerTable; mPeerTable = peerTable; callback = mPeerTable.Cast <IState>(); }
public void SetLuaTalbe(LuaTable peerTable) { mPeerTable = peerTable; callback = peerTable.Cast <ILuaTaskBase>(); }
public void SetLuaTalbe(LuaTable peerTable) { mLuaTable = peerTable; callback = mLuaTable.Cast <ILuaSceneBase>(); }
public void SetLuaTalbe(LuaTable t) { mLuatable = t; callBack = mLuatable.Cast <ILuaWindow>(); }
/// <summary> /// 发送一键出售请求。(给Lua调用) /// </summary> /// <param name="bag">背包类型。</param> /// <param name="pos">格子索引列表</param> public void SendFastSellRequestForLua(int bag, LuaTable tb) { List <int> pos = tb.Cast <List <int> >(); SendFastSellRequest(bag, pos); }