Ejemplo n.º 1
0
    public void ShowLevelInfo(Map map)
    {
        levelInfoBg.CrossFadeAlpha(1f, 0.2f, true);
        Image[] images = levelInfoBg.GetComponentsInChildren <Image> ();
        foreach (Image image in images)
        {
            image.CrossFadeAlpha(1f, 0.2f, true);
        }
        Text[] texts = levelInfoBg.GetComponentsInChildren <Text> ();
        foreach (Text text in texts)
        {
            text.CrossFadeAlpha(1f, 0.2f, true);
        }

        foreach (Text levelNameLabel in levelNameLabels)
        {
            levelNameLabel.text = map.title;
        }
        authorLabel.text = "by " + map.author;
        scoreLabel.text  = "Best Score: " + PlayerProgression.GetBestScore(map.name);
        timeLabel.text   = "Time Limit: " + UIHelpers.ConvertToSecondsTimeString(map.timeLimit);
        minesLabel.text  = "Mines: " + map.difficulty.ToString();

        if (PlayerProgression.HasCompletedLevel(map.name))
        {
            checkmark.enabled = true;
        }
        else
        {
            checkmark.enabled = false;
        }
    }
Ejemplo n.º 2
0
    public void ShowLevelInfo(string diff)
    {
        levelInfoBg.CrossFadeAlpha(1f, 0.2f, true);
        Image[] images = levelInfoBg.GetComponentsInChildren <Image> ();
        foreach (Image image in images)
        {
            image.CrossFadeAlpha(1f, 0.2f, true);
        }
        Text[] texts = levelInfoBg.GetComponentsInChildren <Text> ();
        foreach (Text text in texts)
        {
            text.CrossFadeAlpha(1f, 0.2f, true);
        }

        HighscoreSet scoreSet = PlayerProgression.GetClassicModeScores(diff);

        if (scoreSet.first > 0)
        {
            float time = ((float)scoreSet.first / 10);
            scores[0].text = UIHelpers.ConvertToSecondsTimeString(time);
        }
        else
        {
            scores[0].text = "--:--";
        }
        if (scoreSet.second > 0)
        {
            float time = ((float)scoreSet.second / 10);
            scores[1].text = UIHelpers.ConvertToSecondsTimeString(time);
        }
        else
        {
            scores[1].text = "--:--";
        }
        if (scoreSet.third > 0)
        {
            float time = ((float)scoreSet.third / 10);
            scores[2].text = UIHelpers.ConvertToSecondsTimeString(time);
        }
        else
        {
            scores[2].text = "--:--";
        }
        if (scoreSet.fourth > 0)
        {
            float time = ((float)scoreSet.fourth / 10);
            scores[3].text = UIHelpers.ConvertToSecondsTimeString(time);
        }
        else
        {
            scores[3].text = "--:--";
        }
        if (scoreSet.fifth > 0)
        {
            float time = ((float)scoreSet.fifth / 10);
            scores[4].text = UIHelpers.ConvertToSecondsTimeString(time);
        }
        else
        {
            scores[4].text = "--:--";
        }
    }
Ejemplo n.º 3
0
    public void SetupUI()
    {
        leftButton.interactable  = true;
        rightButton.interactable = true;

        HighscoreSet scoreSet;

        switch (currentDifficulty)
        {
        case Difficulty.Easy:
            foreach (Text difficultyLabel in difficultyLabels)
            {
                difficultyLabel.text = "Easy Difficulty";
            }
            scoreSet = PlayerProgression.GetClassicModeScores("easy");
            leftButton.interactable = false;
            break;

        case Difficulty.Medium:
            foreach (Text difficultyLabel in difficultyLabels)
            {
                difficultyLabel.text = "Medium Difficulty";
            }
            scoreSet = PlayerProgression.GetClassicModeScores("medium");
            break;

        case Difficulty.Hard:
            foreach (Text difficultyLabel in difficultyLabels)
            {
                difficultyLabel.text = "Hard Difficulty";
            }
            scoreSet = PlayerProgression.GetClassicModeScores("hard");
            rightButton.interactable = false;
            break;

        default:
            foreach (Text difficultyLabel in difficultyLabels)
            {
                difficultyLabel.text = "??? Difficulty";
            }
            scoreSet = new HighscoreSet();
            break;
        }

        if (scoreSet.first > 0)
        {
            float time = ((float)scoreSet.first / 10);
            scores[0].text = UIHelpers.ConvertToSecondsTimeString(time);
        }
        else
        {
            scores[0].text = "--:--";
        }
        if (scoreSet.second > 0)
        {
            float time = ((float)scoreSet.second / 10);
            scores[1].text = UIHelpers.ConvertToSecondsTimeString(time);
        }
        else
        {
            scores[1].text = "--:--";
        }
        if (scoreSet.third > 0)
        {
            float time = ((float)scoreSet.third / 10);
            scores[2].text = UIHelpers.ConvertToSecondsTimeString(time);
        }
        else
        {
            scores[2].text = "--:--";
        }
        if (scoreSet.fourth > 0)
        {
            float time = ((float)scoreSet.fourth / 10);
            scores[3].text = UIHelpers.ConvertToSecondsTimeString(time);
        }
        else
        {
            scores[3].text = "--:--";
        }
        if (scoreSet.fifth > 0)
        {
            float time = ((float)scoreSet.fifth / 10);
            scores[4].text = UIHelpers.ConvertToSecondsTimeString(time);
        }
        else
        {
            scores[4].text = "--:--";
        }
    }
Ejemplo n.º 4
0
    protected override void OnOpen()
    {
        ribbon.SetActive(false);

        SoundController.PauseMusic(3.0f);

        switch (GameController.CurrentState.currentMode)
        {
        case GameMode.Adventure:

            float T      = GameController.CurrentState.victory ? HUD.FinalTime / GameController.CurrentBoard.map.timeLimit * 100 : 0;
            float D      = GameController.CurrentBoard.map.pointsMultiplier;
            float N      = (float)GameController.CurrentState.flippedSpaces / (float)GameController.CurrentBoard.slots.Length * 100;
            int   bonus  = GameController.CurrentState.victory ? 10 : 2;
            int   points = (int)((T * T + N * N) * D) * bonus;

            foreach (Text title in titleLabels)
            {
                title.text = GameController.CurrentState.victory ? "Swiped it!" : "Busted!";
            }
            label1.text = "Total Points";
            value1.text = points.ToString();
            label2.text = "Time Remaining";
            value2.text = UIHelpers.ConvertToSecondsTimeString(HUD.FinalTime);
            label3.text = "Mines Flagged Incorrectly";
            value3.text = GameController.CurrentState.mislocatedBombs.ToString();
            label4.text = "";
            value4.text = "";

            if (GameController.CurrentState.victory)
            {
                GameController.CompleteLevel(points);
                actionButton.SetActive(true);

                if (GameController.IsFinalLevel())
                {
                    actionButton.transform.GetChild(0).GetComponent <Text> ().text = "FINISH";
                    PlayerProgression.CompleteWorld(GameController.CurrentWorld);
                }
                else
                {
                    actionButton.transform.GetChild(0).GetComponent <Text> ().text = "NEXT LEVEL";
                }
                SoundController.PlaySoundEffect(Sounds.VICTORY);

                if (points >= GameController.CurrentBoard.map.pointTarget)
                {
                    Invoke("TargetReached", 2.5f);
                }
            }
            else
            {
                actionButton.SetActive(false);
                SoundController.PlaySoundEffect(Sounds.DEFEAT);
            }

            break;

        case GameMode.Classic:
            foreach (Text title in titleLabels)
            {
                title.text = GameController.CurrentState.victory ? "Success!" : "Defeat!";
            }

            actionButton.SetActive(true);
            actionButton.transform.GetChild(0).GetComponent <Text>().text = "CHANGE DIFFICULTY";

            label1.text = "Total Time";
            value1.text = UIHelpers.ConvertToSecondsTimeString(HUD.FinalTime);
            label2.text = "Mines Flagged Correctly";
            value2.text = GameController.CurrentState.locatedBombs.ToString();
            label3.text = "Mines Flagged Incorrectly";
            value3.text = GameController.CurrentState.mislocatedBombs.ToString();
            label4.text = "Mines Remaining";
            value4.text = GameController.CurrentState.remainingBombs.ToString();

            SoundController.PlaySoundEffect(GameController.CurrentState.victory ? Sounds.VICTORY : Sounds.DEFEAT);

            if (GameController.CurrentState.victory)
            {
                PlayerProgression.CompleteClassicMode(GameController.CurrentBoard.map.name, HUD.FinalTime);
            }
            break;
        }

        foreach (GameObject work in fireworks)
        {
            work.SetActive(GameController.CurrentState.victory);
        }
    }