private void Awake() { Debug.Log("resource manager start"); _instance = this; }
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; } }