コード例 #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;
    }
コード例 #2
0
    //异步初始化 和热更资源 缓存表格等
    static private IEnumerator InitAssets(Action callback = null)
    {
        yield return(GameAssets.Init());

        initState = GameInitState.GameAssetsInited;
        yield return(InitAfterAssets());

        if (callback != null)
        {
            callback();
        }
    }
コード例 #3
0
 static int set_initState(IntPtr L)
 {
     try
     {
         GameInitState arg0 = (GameInitState)ToLua.CheckObject(L, 2, typeof(GameInitState));
         Game.initState = arg0;
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #4
0
    //资源热更后初始化的游戏资源
    static private IEnumerator InitAfterAssets()
    {
        // 表格管理
        mTableManager = new TableManager();
        tableManager.InitTable();
        //Start lua VM.
        LuaManager = Main.Instance.AddMainComponent <LuaManager>();
        LuaManager.OnInit();
        //UI framework.
        UIManager = UIManager.GetInstance();
        yield return(UIManager.InitUIManager());

        UpdateManager.GetInstance().StartHeartBeat();
        initState = GameInitState.Initialized;
    }