コード例 #1
0
ファイル: ResourceManager.cs プロジェクト: luoyikun/UnityMMO
 private void Awake()
 {
     Debug.Log("resource manager start");
     _instance = this;
 }
コード例 #2
0
ファイル: Main.cs プロジェクト: qipa/UnityMMO
        private void Update()
        {
            if (cur_state == State.Playing)
            {
                return;
            }
            switch (cur_state)
            {
            case State.CheckExtractResource:
                if (cur_sub_state == SubState.Enter)
                {
                    cur_sub_state = SubState.Update;
                    this.gameObject.AddComponent <AssetsHotFixManager>();
                    AssetsHotFixManager.Instance.CheckExtractResource(delegate() {
                        Debug.Log("Main.cs CheckExtractResource OK!!!");
                        JumpToState(State.UpdateResourceFromNet);
                    });
                }
                break;

            case State.UpdateResourceFromNet:
                if (cur_sub_state == SubState.Enter)
                {
                    cur_sub_state = SubState.Update;
                    AssetsHotFixManager.Instance.UpdateResource(delegate() {
                        Debug.Log("Main.cs UpdateResourceFromNet OK!!!");
                        JumpToState(State.InitAssetBundle);
                    });
                }
                break;

            case State.InitAssetBundle:
                if (cur_sub_state == SubState.Enter)
                {
                    cur_sub_state = SubState.Update;
                    ResourceManager.GetInstance().Initialize(AppConfig.AssetDir, delegate() {
                        Debug.Log("Main.cs ResourceManager Initialize OK!!!");
                        JumpToState(State.StartLogin);
                    });
                }
                break;

            case State.StartLogin:
                if (cur_sub_state == SubState.Enter)
                {
                    cur_sub_state = SubState.Update;
                    XLuaManager.Instance.InitLuaEnv();
                    XLuaManager.Instance.StartLogin(delegate() {
                        Debug.Log("Main.cs XLuaManager StartLogin OK!!!");
                        JumpToState(State.StartGame);
                    });
                }
                break;

            case State.StartGame:
                if (cur_sub_state == SubState.Enter)
                {
                    cur_sub_state = SubState.Update;
                    this.gameObject.AddComponent <UnityMMO.MainWorld>();
                    UnityMMO.MainWorld.Instance.StartGame();
                    JumpToState(State.Playing);
                }
                break;
            }
        }