Esempio n. 1
0
    public void SetResults(
        string title, string version, string acc,
        bool isScoreNew, int score, int perfect, int great, int good, int bad, int miss,
        bool isComboNew, int combo, bool isFullCombo)
    {
        acc = acc.Replace(" ", "");
        StringLerp titleLerp = new StringLerp("", title), versionLerp = new StringLerp("", version.ToUpper()),
                   accLerp = new StringLerp("0<size=15>%</size>", acc.Insert(acc.Length - 1, "<size=15>") + "</size>"),
                   scoreLerp = new StringLerp("0", score.ToString()), perfectLerp = new StringLerp("0", perfect.ToString()),
                   greatLerp = new StringLerp("0", great.ToString()), goodLerp = new StringLerp("0", good.ToString()),
                   badLerp = new StringLerp("0", bad.ToString()), missLerp = new StringLerp("0", miss.ToString()),
                   comboLerp = new StringLerp("0", combo.ToString());

        uiScoreNewText.gameObject.SetActive(isScoreNew);
        uiComboNewText.gameObject.SetActive(isComboNew);
        uiFullComboText.gameObject.SetActive(isFullCombo);
        uiRankText.text = "--";

        TweenManager.AddTween(tween.CreateTransition(step => {
            uiTitleText.text   = titleLerp.Lerp(step);
            uiVersionText.text = versionLerp.Lerp(step);
            uiAccText.text     = accLerp.Lerp(step);
            uiScoreText.text   = scoreLerp.Lerp(step);
            uiPerfectText.text = perfectLerp.Lerp(step);
            uiGreatText.text   = greatLerp.Lerp(step);
            uiGoodText.text    = goodLerp.Lerp(step);
            uiBadText.text     = badLerp.Lerp(step);
            uiMissText.text    = missLerp.Lerp(step);
            uiComboText.text   = comboLerp.Lerp(step);
        }));
    }
    IEnumerator Start()
    {
        eventSystem.enabled = false;

        yield return(Wait(2));

        uiWelcomePanel.gameObject.SetActive(true);
        yield return(TweenManager.AddTween(panelShowTween.CreateTransition(step => {
            uiWelcomePanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 5000), new Vector2(0, 0), step);
        })));

        yield return(Wait(2));

        yield return(TweenManager.AddTween(panelHideTween.CreateTransition(step => {
            uiWelcomePanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 0), new Vector2(0, -5000), step);
        })));

        uiWelcomePanel.gameObject.SetActive(false);

        uiLoginPanel.gameObject.SetActive(true);
        yield return(TweenManager.AddTween(panelShowTween.CreateTransition(step => {
            uiLoginPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 5000), new Vector2(0, 80), step);
        })));

        eventSystem.enabled = true;
        while (!isLoginFinished)
        {
            yield return(null);
        }
        eventSystem.enabled = false;

        yield return(TweenManager.AddTween(panelHideTween.CreateTransition(step => {
            uiLoginPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 80), new Vector2(0, -5000), step);
        })));

        uiLoginPanel.gameObject.SetActive(false);

        uiSongPanel.gameObject.SetActive(true);
        yield return(TweenManager.AddTween(panelShowTween.CreateTransition(step => {
            uiSongPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 5000), new Vector2(0, 0), step);
        })));

        eventSystem.enabled = true;
        while (!isSongSelectFinished)
        {
            yield return(null);
        }
        eventSystem.enabled = false;

        yield return(TweenManager.AddTween(panelHideTween.CreateTransition(step => {
            uiSongPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 0), new Vector2(0, -5000), step);
        })));

        uiSongPanel.gameObject.SetActive(false);

        uiCamera.enabled = false;
    }
Esempio n. 3
0
    IEnumerator Start()
    {
        eventSystem.enabled = false;

        yield return(Wait(1));

        uiWelcomePanel.gameObject.SetActive(true);
        yield return(TweenManager.AddTween(panelShowTween.CreateTransition(step => {
            uiWelcomePanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 5000), new Vector2(0, 0), step);
        })));

//		yield return Wait(1);

        TweenManager.AddTween(panelHideTween.CreateTransition(step => {
            uiWelcomePanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 0), new Vector2(0, -5000), step);
        }));
        uiWelcomePanel.gameObject.SetActive(false);


SONG_SELECT:
        uiSongPanel.gameObject.SetActive(true);
        yield return(TweenManager.AddTween(panelShowTween.CreateTransition(step => {
            uiSongPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 5000), new Vector2(0, 0), step);
        })));

        uiSongPanel.GetComponent <SongUiController>().FetchProgress();

        if (!isLoginFinished)
        {
            StartCoroutine(HandleAsyncLogin());
        }

        eventSystem.enabled = true;
        pointer.SetActive(true);

        isSongSelectFinished = false;
        selectedFileType     = -1;
        while (!isSongSelectFinished)
        {
            yield return(null);
        }
        eventSystem.enabled = false;
        pointer.SetActive(false);

        yield return(TweenManager.AddTween(panelHideTween.CreateTransition(step => {
            uiSongPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 0), new Vector2(0, -5000), step);
        })));

        if (!isLoginFinished)
        {
            OnLoginCancelButtonClicked();
        }

        uiSongPanel.gameObject.SetActive(false);

//		uiCamera.enabled = false;

        uiRankPanel.gameObject.SetActive(true);
        uiScorePanel.gameObject.SetActive(true);
        uiHintPanel.gameObject.SetActive(true);
        rankPanelController.SetRank(new RankInfo[0]);
        yield return(TweenManager.AddTween(panelShowTween.CreateTransition(step => {
            uiRankPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 5000), new Vector2(-400, 0), step);
            uiScorePanel.anchoredPosition3D = Vector3.LerpUnclamped(new Vector3(0, 5000, 0), new Vector3(0, 70, 100), step);
            uiHintPanel.anchoredPosition3D = Vector3.LerpUnclamped(new Vector3(0, 0, 5000), Vector3.zero, step);
        })));

        StartCoroutine(HandleCloseHintPanel());

        rank.name  = GlobalStatic.Name;
        rank.rank  = "--";
        rank.score = 0;
        ranks.Clear();
        ranks.Add(rank);
        rankPanelController.SetRank(ranks.ToArray());

        LiveNote[] notes = null;

        if (selectedFileType == 0)
        {
            notes = osuFile.GetLiveNotes((x, y) => new Vector2((x - 0.5f) * 4, y * 1.5f - 0.5f));
            musicPlayer.Play(System.IO.Path.Combine(osuFile.path, osuFile.AudioFilename));
        }
        else              // selectedFileType == 1
        {
            using (var mapAsset = new FResource <TextAsset>("maps/" + live.map_path.Replace(".json", ""))) {
                var map = JsonUtility.FromJson <ApiLiveMap>(mapAsset.asset.text);
                System.Array.Sort(map.lane);
                notes = map.GetLiveNotes((x, _) => LlpLiveStarter.slots[Mathf.RoundToInt(x)] * 0.75f, 2);
            }
            musicPlayer.Play(System.IO.Path.Combine(Application.persistentDataPath, live.bgm_path));
        }

        livePlayer.notes = notes;
        livePlayer.StartGame();

SONG_START:
        uiErrorText.text = "";
        StartCoroutine(HandleRankInit());
        isSongFinished = false;
        while (!isSongFinished)
        {
            yield return(null);
        }

        yield return(TweenManager.AddTween(panelHideTween.CreateTransition(step => {
            uiRankPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(-400, 0), new Vector2(0, 5000), step);
            uiScorePanel.anchoredPosition3D = Vector3.LerpUnclamped(new Vector3(0, 70, 100), new Vector3(0, 5000, 0), step);
        })));

        uiResultPanel.gameObject.SetActive(true);
        acc = (300f * livePlayer.perfect + 200f * livePlayer.great + 100f * livePlayer.good + 50f * livePlayer.bad) / (300f * livePlayer.total);
        resultPanelUiController.SetResults(mapName, mapVersion, acc.ToString("P0"),
                                           false, livePlayer.score, livePlayer.perfect, livePlayer.great, livePlayer.good, livePlayer.bad, livePlayer.miss,
                                           false, livePlayer.maxCombo, livePlayer.maxCombo >= livePlayer.total);

        yield return(TweenManager.AddTween(panelShowTween.CreateTransition(step => {
            uiResultPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 5000), new Vector2(0, 0), step);
        })));

        if (GlobalStatic.IsLoggedIn)
        {
            StartCoroutine(HandleSubmitResult());
        }

        willRetry           = willShowMenu = false;
        eventSystem.enabled = true;
        pointer.SetActive(true);
//		uiCamera.enabled = true;
        while (!willRetry && !willShowMenu)
        {
            yield return(null);
        }
//		uiCamera.enabled = false;
        eventSystem.enabled = false;
        pointer.SetActive(false);

        yield return(TweenManager.AddTween(panelHideTween.CreateTransition(step => {
            uiResultPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 0), new Vector2(0, 5000), step);
        })));

        if (willRetry)
        {
            livePlayer.StartGame();
            MusicPlayer.Restart();
            yield return(TweenManager.AddTween(panelShowTween.CreateTransition(step => {
                uiRankPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 5000), new Vector2(-400, 0), step);
                uiScorePanel.anchoredPosition3D = Vector3.LerpUnclamped(new Vector3(0, 5000, 0), new Vector3(0, 70, 100), step);
            })));

            goto SONG_START;
        }
        else
        {
            goto SONG_SELECT;
        }
    }