public override void IdleGame(object data)
 {
     UILoadGame.Hide();
     mainScreen.Show(null, () => {
     });
     inGameScreen.Hide();
     gameOverScreen.Hide();
 }
 IEnumerator WaitForLoading(Action onComplete)
 {
     while (UILoadGame.currentProcess < 1)
     {
         UILoadGame.Process();
         yield return(null);
     }
     UILoadGame.Hide();
     onComplete?.Invoke();
 }
    private IEnumerator DoPrepairDataToPlay(StageData stage, Action <bool> actionOnDone = null)
    {
        UIToast.ShowLoading(randomTip, 5f, UIToast.IconTip);
        UILoadGame.Init(true, null);

        while (UILoadGame.currentProcess < 0.1f)
        {
            UILoadGame.Process(0, 1, -1, LocalizedManager.Key("base_Loading") + LocalizedManager.Key("base_PleaseWait"));
            yield return(null);
        }

        if (UIToast.Status != UIAnimStatus.IsShow)
        {
            UIToast.ShowLoading(randomTip, 5f, UIToast.IconTip);
        }

        MusicManager.Stop(null, false, 0.25f);

        if (string.IsNullOrEmpty(currentMode))
        {
            currentMode = modes[0];
        }

        //Init game object
        elapsedTime    = 0f;
        loadMidiStatus = FileStatus.Download;
        loadMidiStatus = FileStatus.Success;

        GameStateManager.Init(null);

        while (GameStateManager.CurrentState == GameState.Init || UILoadGame.currentProcess < 1)
        {
            if (GameStateManager.CurrentState != GameState.Idle && elapsedTime < 5)
            {
                UILoadGame.Process();
                elapsedTime += Time.deltaTime;
                yield return(null);
            }
            else
            {
                yield return(UILoadGame.DoRollBack(() =>
                {
                    UIToast.Hide();
                    actionOnDone(false);
                }));

                yield break;
            }
        }

        UIToast.Hide();
        actionOnDone(true);
    }
    private void Awake()
    {
        instance = this;


        //0.0 -> 1.0
        FileExtend.OnProcessChanged += (process) =>
        {
            if (process > 0 && process < 1)
            {
                if (loadAudioStatus == FileStatus.Download)
                {
                    UILoadGame.Process(0.1f, 0.7f, process);
                }
                else if (loadMidiStatus == FileStatus.Download)
                {
                    UILoadGame.Process(0.7f, 0.8f, process);
                }
            }
        };
    }
예제 #5
0
 private void Awake()
 {
     instance = this;
 }