protected void Start() { if (table != null) { table.Invoke("Start", table); } }
void Start() { if (luaClass != "") { lua = Util.GetTable(luaClass); if (lua.GetLuaFunction("New") != null) { lua = lua.Invoke("New", lua, gameObject)[0] as LuaTable; } } lua["param"] = param; lua.Invoke("Start", lua); }
public bool CheckPlayer(PlayerDisplay display, PlayerDisplay owner) { if (display == null || owner == null || !m_IsEnabled) { return(false); } if ((m_StandTypes != 0 && ((byte)display.StateType & m_StandTypes) != 0) || (m_PhysicsTypes != 0 && ((byte)display.PhysicsType & m_PhysicsTypes) != 0) || (m_MoveTypes != 0 && (m_MoveTypes & (byte)display.MoveType) != 0)) { return(false); } if (owner.ShowType == DisplayType.Projectile && m_NoProj) { return(false); } if (string.IsNullOrEmpty(m_LuaFuncName)) { return(true); } LuaTable luaPlayer = display.LuaPly; if (luaPlayer == null) { return(false); } bool ret = luaPlayer.Invoke <LuaTable, bool>(m_LuaFuncName, luaPlayer); return(ret); }
protected void Awake() { table = Util.GetTable(name); if (table != null) { table.Invoke("Awake", table, gameObject); } }
private static IEnumerator OnRequestDownload(long downloadSize) { hotUpdateClass = LuaFacade.GetTable("HotUpdate"); hotUpdateObject = hotUpdateClass.Invoke <LuaTable>("new"); hotUpdateClass.Call("Initialize", hotUpdateObject, downloadSize); yield return(null); while (!hotUpdateClass.Invoke <LuaTable, bool>("Response", hotUpdateObject)) { yield return(null); } if (hotUpdateClass.Invoke <LuaTable, bool>("Result", hotUpdateObject)) { AddressablesUpdater.Result = RequestDownloadResult.Agree; } else { AddressablesUpdater.Result = RequestDownloadResult.Disagree; } }
public object ExecuteTableMethod(LuaTable self, string methodName) { object ret = null; try{ ret = self.Invoke <LuaTable, object>(methodName, self); }catch (Exception e) { ret = e.Message; //Debug.LogException (e); } return(ret); }
void InitLuaSetting() { try { if (string.IsNullOrEmpty(fullLuaFileName)) { return; } fullLuaFileName = fullLuaFileName.ReplaceEx('\\', '/'); _luaClassName = fullLuaFileName.Substring(fullLuaFileName.LastIndexOf('/') + 1); if (string.IsNullOrEmpty(_luaClassName)) { return; } luaState.Require(fullLuaFileName); _luaTable = luaState.GetTable(_luaClassName); update = _luaTable.RawGetLuaFunction("Update"); lateUpdate = _luaTable.RawGetLuaFunction("LateUpdate"); fixedUpdate = _luaTable.RawGetLuaFunction("FixedUpdate"); onTriggerEnterFunc = _luaTable.RawGetLuaFunction("OnTriggerEnter"); onTriggerStayFunc = _luaTable.RawGetLuaFunction("OnTriggerStay"); onTriggerExitFunc = _luaTable.RawGetLuaFunction("OnTriggerExit"); if (isMulti) { LuaTable table = _luaTable.Invoke <LuaTable>("New"); if (table == null) { throw new LuaException(_luaClassName + " does not have a New function, GameObject is" + gameObject.name); } _luaTable.Dispose(); _luaTable = table; } LuaFunction luafunc = luaState.GetFunction("luaObjMgr.AddLuaUIObject"); luafunc.Call(gameObject, _luaTable); _luaTable.name = _luaClassName; _luaTable.RawSet("gameObject", gameObject); _luaTable.RawSet("transform", transform); _luaTable.RawSet("ID", ID); _luaTable.Call("Awake", _luaTable); isFinishLuaInit = true; } catch (Exception e) { luaState.ThrowLuaException(e); } }
private TaskStatus CallFunc(string name) { if (self == null) { return(TaskStatus.Failure); } try{ return((TaskStatus)self.Invoke <LuaTable, int>(name, self)); }catch (Exception e) { Debug.LogErrorFormat("CallFunc {0}", name); Debug.LogException(e); } return(TaskStatus.Failure); }
public LuaTable NewLuaPlayer(PlayerDisplay display) { if (m_LuaClass == null || display == null) { return(null); } LuaTable ret = m_LuaClass.Invoke <LuaTable, LuaTable>("new", m_LuaClass); if (ret != null) { ret.Call <LuaTable, PlayerDisplay>("OnInit", ret, display); } return(ret); }
public string Call_LuaPly_GetAIName(string cmdName) { if (string.IsNullOrEmpty(cmdName) || m_LuaPlayer == null) { return(string.Empty); } try { string ret = m_LuaPlayer.Invoke <LuaTable, string, string>("OnGetAICommandName", m_LuaPlayer, cmdName); return(ret); } catch (System.Exception e) { #if DEBUG Debug.LogError(e.ToString()); #endif } return(string.Empty); }
public LuaCommand(string commandName) { CommandName = commandName; commandClass = LuaFacade.GetTable(commandName); commandObject = commandClass.Invoke <LuaTable>("new"); }
public override string[] ListNotificationInterests() { return(mediatorClass.Invoke <LuaTable, string[]>("ListNotificationInterests", mediatorObject)); }
public LuaMediator(string mediatorName, object viewComponent = null) : base(mediatorName, viewComponent) { mediatorClass = LuaFacade.GetTable(mediatorName); mediatorObject = mediatorClass.Invoke <LuaTable>("new"); }
public LuaTable GetEmptyTable() { Assert.IsTrue(Started, "LuaState未启动"); return _UtilityScope.Invoke<LuaTable>("GetEmptyTable"); }
public LuaProxy(string proxyName, object data = null) : base(proxyName, data) { proxyClass = LuaFacade.GetTable(proxyName); proxyObject = proxyClass.Invoke <LuaTable>("new"); }