예제 #1
0
    public void UpdateTime(float time, bool IsAnimation = false)
    {
        // TODO: update the value of time.
        UITime.text = Contains.GetDisplayTime(time);

        if (IsAnimation)
        {
            UITime.rectTransform.DOScale(Vector3.one * 1.1f, 0.2f).OnComplete(() => {
                UITime.rectTransform.DOScale(Vector3.one, 0.1f);
            }).SetEase(Ease.OutBack);
        }
    }
예제 #2
0
    public override void Show()
    {
        base.Show();

        switch (GameManager.Instance.GetModeGame())
        {
        case Enums.ModeGame.Easy:

            UITitleMode.text = "Easy";

            break;

        case Enums.ModeGame.Medium:

            UITitleMode.text = "Medium";

            break;

        case Enums.ModeGame.Hard:

            UITitleMode.text = "Hard";

            break;

        default:

            UITitleMode.text = "Comming soon...";

            break;
        }

        // TODO: Set the value of best score.
        UIBestScoreValue.text = PlayerData.BestScore.ToString();

        // TODO: Set the value will be displayed on the best move.
        UIBestMoveValues.text = PlayerData.BestMove.ToString();

        // TODO: Set the value will be displayed on the best move.
        UIBestTimeValues.text = Contains.GetDisplayTime(PlayerData.BestTime);

        // TODO: Set the value will be displayed on the total played.
        UITotalPlayed.text = PlayerData.TotalPlayed.ToString();

        // TODO: Set the value will be displayed on the total win.
        UITotalWin.text = PlayerData.TotalWin.ToString();
    }
예제 #3
0
    private void OnEnable()
    {
        IsReadyToPress = false;

        Invoke("SetBool", 4f);

        //-----

        // TODO: Set the value of best score.
        UIScoreValue.text     = Contains.Score.ToString();
        UIBestScoreValue.text = PlayerData.BestScore.ToString();
        UIBestScoreValue.gameObject.SetActive(PlayerData.BestScore >= Contains.Score);
        UIBestScoreValue.transform.parent.Find("NewBest").gameObject.SetActive(PlayerData.BestScore < Contains.Score);

        // TODO: Set the value will be displayed on the best move.
        bool newBestFlag = PlayerData.BestMove >= Contains.Moves || PlayerData.BestMove == 0;

        UIMoveValues.text     = Contains.Moves.ToString();
        UIBestMoveValues.text = PlayerData.BestMove.ToString();
        UIBestMoveValues.gameObject.SetActive(!newBestFlag);
        UIBestMoveValues.transform.parent.Find("NewBest").gameObject.SetActive(newBestFlag);

        // TODO: Set the value will be displayed on the best move.
        newBestFlag           = PlayerData.BestTime >= Contains.Time || PlayerData.BestTime == 0;
        UITimeValues.text     = Contains.GetDisplayTime(Contains.Time);
        UIBestTimeValues.text = Contains.GetDisplayTime(PlayerData.BestTime);
        UIBestTimeValues.gameObject.SetActive(!newBestFlag);
        UIBestTimeValues.transform.parent.Find("NewBest").gameObject.SetActive(newBestFlag);

        // TODO: Set the total played.
        PlayerData.TotalWin++;

        // TODO: Save the datas.
        PlayerData.Save();
        AnalyticsController.sendEvent("WinGame", new Dictionary <string, object> {
            { "Type", GameManager.Instance.GameType }, { "Mode", GameManager.Instance.GetModeGame() }
        });
    }