static int GetComponent(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(string))) { string arg0 = ToLua.ToString(L, 1); UnityGameFramework.Runtime.GameFrameworkComponent o = UnityGameFramework.Runtime.GameEntry.GetComponent(arg0); ToLua.Push(L, o); return(1); } else if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(System.Type))) { System.Type arg0 = (System.Type)ToLua.ToObject(L, 1); UnityGameFramework.Runtime.GameFrameworkComponent o = UnityGameFramework.Runtime.GameEntry.GetComponent(arg0); ToLua.Push(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityGameFramework.Runtime.GameEntry.GetComponent")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// 注册游戏框架组件。 /// </summary> /// <param name="gameFrameworkComponent">要注册的游戏框架组件。</param> internal static void RegisterComponent(GameFrameworkComponent gameFrameworkComponent) { if (gameFrameworkComponent == null) { Log.Error("Game Framework component is invalid."); return; } Type type = gameFrameworkComponent.GetType(); LinkedListNode <GameFrameworkComponent> current = s_GameFrameworkComponents.First; while (current != null) { if (current.Value.GetType() == type) { Log.Error("Game Framework component type '{0}' is already exist.", type.FullName); return; } current = current.Next; } s_GameFrameworkComponents.AddLast(gameFrameworkComponent); }
internal static void RegisterComponent(GameFrameworkComponent gameFrameworkComponent) { Type type = gameFrameworkComponent.GetType(); LinkedListNode <GameFrameworkComponent> current = s_GameFrameworkComponents.First; while (current != null) { if (current.Value.GetType() == type) { Log.Error(); return; } current = current.Next; } s_GameFrameworkComponents.AddLast(gameFrameworkComponent); }
/// <summary> /// 注册游戏框架组件。 /// </summary> /// <param name="gameFrameworkComponent">要注册的游戏框架组件。</param> internal static void RegisterComponent(GameFrameworkComponent gameFrameworkComponent) { if (gameFrameworkComponent == null) { throw new GameFrameworkException("Game framework component is invalid."); } Type type = gameFrameworkComponent.GetType(); foreach (GameFrameworkComponent component in s_GameFrameworkComponents) { if (component.GetType() == type) { throw new GameFrameworkException(string.Format("Game framework component type '{0}' is already exist.", type.FullName)); } } s_GameFrameworkComponents.AddLast(gameFrameworkComponent); }