Exemple #1
0
 /// <summary>
 /// 触发lua事件
 /// </summary>
 /// <param name="eventname">事件名</param>
 public static void FireEvent(string eventname, params object[] args)
 {
     setEnv();
     if (luaGlobalEventSystem == null)
     {
         luaGlobalEventSystem = scriptEnv.GetInPath <LuaTable>("EventSys");
         fireEventFunc        = luaGlobalEventSystem.GetInPath <LuaFunction>("FireEvent");
     }
     if (luaGlobalEventSystem != null)
     {
         List <object> newArgs = new List <object>();
         newArgs.Add(luaGlobalEventSystem);
         newArgs.Add(eventname);
         newArgs.AddRange(args);
         fireEventFunc.Call(newArgs.ToArray());
     }
 }