Ejemplo n.º 1
0
    //初始化游戏基础
    static public void InitGameBase()
    {
        //设置Log
        Application.logMessageReceived         += OnLog;
        Application.logMessageReceivedThreaded += OnLog;
        //初始化游戏引擎的一些设置
        GameSettings.OnInit();
        // MVC
        GameFacade.GetInstance().OnInit();
        // 场景管理
        mSceneManager = MySceneManager.GetInstance();
        mSceneManager.OnInit();
        //添加全局FPS组件
        Main.Instance.AddMainComponent <ShowFPS>();
        //添加全局InGameLog组件
        Main.Instance.AddMainComponent <InGameLog>();
        // 对象池管理
        GameObject poolRoot = new GameObject("GameObjectPool");

        poolRoot.transform.SetParent(Main.Instance.transform);
        GameObjectPool.GetInstance().root = poolRoot;
        //Network
        NetManager.GetInstance().OnInit();
        //Add temp entrance.
        Main.Instance.AddMainComponent <TempEntrance>();

        initState = GameInitState.GameBaseInited;
    }
 static int OnInit(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         MySceneManager obj = (MySceneManager)ToLua.CheckObject(L, 1, typeof(MySceneManager));
         obj.OnInit();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }