Ejemplo n.º 1
0
    public void OnStart(GameObject mainObj, Main main, string resPath)
    {
        MainObject   = mainObj;
        MainScript   = main;
        ResourcePath = resPath;

        //GameTable.LoadTable();

        new UIManager();
        UIManager.Singleton.EnableJoystickAutoMap();
        //场景相关
        new ScenePathfinder();
        new SM.RandomRoomLevel();
        new EventManager();
        new EResultManager();
        ///////////////////////////////////////////////////////////////
        //new ActorManager();
        m_camera = new CameraController();
        m_camera.Init(GameObject.Find("Main Camera"));
        mSelectBoxObj = GameObject.Find("SelectBox");
//         CameraMaskRedFlash = GameObject.Find("CameraMaskRedFlash");
//         CameraMaskRedFlash.AddComponent("UrgentEventEffect");
//         CameraMaskRedFlash.SetActive(false);
        //m_nextState = new StateInitApp();
        //m_nextState = new StateLogin();
        GameResManager.Singleton.SetEntryAs(main);
        m_nextState = new StateStartup();
    }
Ejemplo n.º 2
0
    protected void OnFixedUpdate()
    {
        if (m_currentState == null)
        {
            if (GameResManager.Singleton.m_isPreLoadFinish)
            {//第一个state要等到PreLoad完成
                User.Singleton.OnInit();
                m_nextState = new StateStartup();
            }
        }
        if (null != m_currentState)
        {
            m_currentState.OnFixedUpdate();
            m_widgetManager.FixedUpdate();
        }

        if (null != m_nextState)
        {
            if (null != m_currentState)
            {
                m_currentState.OnExit();
                m_widgetManager.Clear();
                AnyObjectPoolMgr.Singleton.DestroyAll();
                Resources.UnloadUnusedAssets();
                for (int i = 0; i < 100; i++)
                {
                    GC.Collect();
                }
                //GC.WaitForPendingFinalizers();
            }
            m_currentState = m_nextState;
            m_nextState    = null;
            m_currentState.OnEnter();
        }
        GameResManager.Singleton.FixedUpdate();
    }