示例#1
0
    /// <summary>
    /// Function that is used to display resolution UI information.
    /// </summary>
    void UpdateResUI(ResolutionScreenType type, int score)
    {
        var highscore = PlayerPrefs.GetInt(GameUtility.SavePrefKey);

        switch (type)
        {
        case ResolutionScreenType.Correct:
            uIElements.ResolutionBG.color           = parameters.CorrectBGColor;
            uIElements.ResolutionStateInfoText.text = "CORRECT!";
            uIElements.ResolutionScoreText.text     = "+" + score;
            break;

        case ResolutionScreenType.Incorrect:
            uIElements.ResolutionBG.color           = parameters.IncorrectBGColor;
            uIElements.ResolutionStateInfoText.text = "WRONG!";
            uIElements.ResolutionScoreText.text     = "-" + score;
            break;

        case ResolutionScreenType.Finish:
            uIElements.ResolutionBG.color           = parameters.FinalBGColor;
            uIElements.ResolutionStateInfoText.text = "FINAL SCORE";

            StartCoroutine(CalculateScore());
            uIElements.FinishUIElements.gameObject.SetActive(true);
            uIElements.HighScoreText.gameObject.SetActive(true);
            uIElements.HighScoreText.text = ((highscore > events.StartupHighscore) ? "<color=yellow>new </color>" : string.Empty) + "Highscore: " + highscore;
            break;
        }
    }
示例#2
0
    void UpdateResolutionUI(ResolutionScreenType type, int score)
    {
        var highScore = PlayerPrefs.GetInt(GameUtility.SavePrefKey);

        switch (type)
        {
        case ResolutionScreenType.Correct:
            uiElements.ResolutionBackground.color   = parameters.CorrectBgColor;
            uiElements.ResolutionStateInfoText.text = "Correct!";
            uiElements.ResolutionScoreText.text     = "+" + score;
            break;

        case ResolutionScreenType.Incorrect:
            uiElements.ResolutionBackground.color   = parameters.IncorrectBgColor;
            uiElements.ResolutionStateInfoText.text = "Wrong!";
            uiElements.ResolutionScoreText.text     = "-" + score;
            break;

        case ResolutionScreenType.Finish:
            uiElements.ResolutionBackground.color   = parameters.FinalBgColor;
            uiElements.ResolutionStateInfoText.text = "Final Score!";
            StartCoroutine(CalculateScore());

            uiElements.FinishedUIElements.gameObject.SetActive(true);
            uiElements.HighScoreText.gameObject.SetActive(true);
            // Display high score
            uiElements.HighScoreText.text = (highScore > events.StartupHighScore ? "<color=yellow>new </color>" : string.Empty) + "Highscore " + highScore;

            break;
        }
    }
    /// <summary>
    /// Function that is used to display resolution UI information.
    /// </summary>
    ///
    ///
    /// Rename the variable "score" to something more appropriate
    private void UpdateResUI(ResolutionScreenType type, string interventionText, int score)
    {
        var highscore = PlayerPrefs.GetInt(GameUtility.SavePrefKey);

        switch (type)
        {
        case ResolutionScreenType.Correct:
            uIElements.ResolutionBG.GetComponent <Image>().sprite = parameters.CorrectBGColor;
            uIElements.ResolutionStateInfoText.text = interventionText;
            uIElements.ResolutionScoreText.text     = $"+{score}";
            break;

        case ResolutionScreenType.Incorrect:
            uIElements.ResolutionBG.GetComponent <Image>().sprite = parameters.IncorrectBGColor;
            uIElements.ResolutionStateInfoText.text = interventionText;
            uIElements.ResolutionScoreText.text     = $"-{score}";
            break;

        case ResolutionScreenType.Finish:
            uIElements.ResolutionBG.color           = parameters.FinalBGColor;
            uIElements.ResolutionStateInfoText.text = "FINAL SCORE";

            StartCoroutine(CalculateScore());
            uIElements.FinishUIElements.gameObject.SetActive(true);
            uIElements.HighScoreText.gameObject.SetActive(true);
            uIElements.HighScoreText.text = ((highscore > events.StartupHighscore) ? "<color=yellow>new </color>" : string.Empty) + "Highscore: " + highscore;
            break;
        }
    }
示例#4
0
    void DisplayResolution(ResolutionScreenType type, int score)
    {
        UpdateResUI(type, score);
        uIElements.ResolutionScreenAnimator.SetInteger(resStateParaHash, 2);
        uIElements.MainCanvasGroup.blocksRaycasts = false;

        if (type != ResolutionScreenType.Finish)
        {
            if (IE_DisplayTimedResolution != null)
            {
                StopCoroutine(IE_DisplayTimedResolution);
            }
            IE_DisplayTimedResolution = DisplayTimedResolution();
            StartCoroutine(IE_DisplayTimedResolution);
        }
    }
    void DisplayResolution(ResolutionScreenType type, int score)
    {
        UpdateResUI(type, score);
        uIElements.ResScreenAnimator.SetInteger(resStateParameter, 2); //display popup animation
        uIElements.MainCanvas.blocksRaycasts = false;                  //recieve no imputs while animation is playing

        if (type != ResolutionScreenType.Finish)
        {
            if (IE_DisplayTimeResolution != null)
            {
                StopCoroutine(IE_DisplayTimeResolution);
            }
            IE_DisplayTimeResolution = DisplayTimeRes();
            StartCoroutine(IE_DisplayTimeResolution);
        }
    }
    void UpdateResUI(ResolutionScreenType type, int score)
    {
        //var highscore = PlayerPrefs.GetInt(GameUtility.SavePrefKey);

        switch (type)
        {
        case ResolutionScreenType.Correct:
            uIElements.ResolutionBG.color           = parameters.CorrectBGColor;
            uIElements.ResolutionStateInfoText.text = "CORRECT!";
            uIElements.ResolutionScoreText.text     = "Monster   -" + score + " HP";
            break;

        case ResolutionScreenType.Incorrect:
            uIElements.ResolutionBG.color           = parameters.IncorrectBGColor;
            uIElements.ResolutionStateInfoText.text = "WRONG!";
            uIElements.ResolutionScoreText.text     = "You   -" + score + " HP";
            break;

        case ResolutionScreenType.Finish:
            uIElements.ResolutionBG.color           = parameters.FinalBGColor;
            uIElements.ResolutionStateInfoText.text = "";

            if (events.npc_HP <= 0)
            {
                if (events.mode == "battle")
                {
                    uIElements.WinUIElements.gameObject.SetActive(true);
                }
                else
                {
                    uIElements.WinBattleUIElements.gameObject.SetActive(true);
                }

                events.status = "succeeded";
            }
            else
            {
                uIElements.LoseUIElements.gameObject.SetActive(true);
                events.status = "failed";
            }

            uIElements.FinishUIElements.gameObject.SetActive(true);
            StartCoroutine(SaveDataAfter());

            break;
        }
    }
示例#7
0
    /// <summary>
    /// Function that is used to display resolution UI information.
    /// </summary>
    void UpdateResUI(ResolutionScreenType type, int score)
    {
        var highscore = PlayerPrefs.GetInt(GameUtility.SavePrefKey);

        switch (type)
        {
        case ResolutionScreenType.Correct:

            uIElements.ResolutionBG.color           = parameters.CorrectBGColor;
            uIElements.ResolutionStateInfoText.text = "Хорошо!";
            uIElements.ResolutionScoreText.text     = "+" + score;
            break;

        case ResolutionScreenType.Incorrect:
            uIElements.ResolutionBG.color           = parameters.IncorrectBGColor;
            uIElements.ResolutionStateInfoText.text = "Плохо!";
            uIElements.ResolutionScoreText.text     = "-" + score;
            break;

        case ResolutionScreenType.Finish:
            //uIElements.ResolutionBG.color = parameters.FinalBGColor;

            if (check == false)
            {
                finalBG.SetActive(true);
                check = true;
            }
            else
            {
                finalBG.SetActive(true);
                check = false;
            }

            uIElements.ResultSrore.text = "Итог: " + events.CurrentFinalScore;
            uIElements.ResolutionStateInfoText.GetComponent <Text>().resizeTextForBestFit = false;
            uIElements.ResolutionStateInfoText.text = "Оценка: ";
            StartCoroutine(CalculateScore());
            uIElements.FinishUIElements.gameObject.SetActive(true);

            uIElements.HighScoreText.text = ((highscore > events.StartupHighscore) ? "<color=yellow>new </color>" : string.Empty) + "Рекорд: " + highscore;

            break;
        }
    }
示例#8
0
    void UpdateResUI(ResolutionScreenType type, int score)
    {
        switch (type)
        {
        case ResolutionScreenType.Correct:

            uIElements.ResolutionBG.color           = parameters.CorrectBGColor;
            uIElements.ResolutionStateInfoText.text = "CORRECT!";
            uIElements.ResolutionScoreText.text     = "+" + score;
            break;

        case ResolutionScreenType.Incorrect:

            uIElements.ResolutionBG.color           = parameters.IncorrectBGColor;
            uIElements.ResolutionStateInfoText.text = "WRONG!";
            uIElements.ResolutionScoreText.text     = "-" + score;
            break;

        case ResolutionScreenType.Finish:

            var highscore = PlayerPrefs.GetInt(GameUtility.SavePrefKey);

            uIElements.ResolutionBG.color           = parameters.FinalBGColor;
            uIElements.ResolutionStateInfoText.text = "FINAL SCORE";
            StartCoroutine(CalculateScore());



            uIElements.FinishUIElements.gameObject.SetActive(true);

            uIElements.HighScoreText.gameObject.SetActive(true);
            //Display highscore
            uIElements.HighScoreText.text = ((highscore > events.StartUpHighScore) ? "<color=yellow>new</color>" : string.Empty) + " Highscore: " + highscore;

            //upisivanje scora u bazu
            // var obj = GameObject.Find("/FormScene/Canvas/Panel/Login");
            //usernameid = obj.GetComponent();
            StartCoroutine(AddScore(userid.ToString(), score.ToString()));


            break;
        }
    }
示例#9
0
文件: UIManager.cs 项目: klemby/act
    /// <summary>
    /// Function that is used to display resolution UI information.
    /// </summary>
    void UpdateResUI(ResolutionScreenType type, int score)
    {
        var highscore = PlayerPrefs.GetInt(GameUtility.SavePrefKey);
        var happ      = webcam.staticMood["happiness"];
        var sad       = webcam.staticMood["sadness"];
        var glasses   = webcam.staticMood["glasses"];
        var gender    = webcam.staticMood["gender"];
        var age       = webcam.staticMood["age"];
        var surp      = webcam.staticMood["surprise"];

        switch (type)
        {
        case ResolutionScreenType.Correct:
            uIElements.ResolutionBG.color = parameters.CorrectBGColor;
            if (gender == 1)
            {
                if (age < 15)
                {
                    uIElements.ResolutionStateInfoText.text = "Good job BOY";
                }
                else if (age > 15 && happ > 0.5)
                {
                    uIElements.ResolutionStateInfoText.text = "Good job MAN!";
                }
                else
                {
                    uIElements.ResolutionStateInfoText.text = "Good job MAN!";
                }
            }
            if (gender == 0)
            {
                uIElements.ResolutionStateInfoText.text = "Good job GIRL!";
            }
            uIElements.ResolutionScoreText.text = "+" + score;
            break;

        case ResolutionScreenType.Incorrect:
            uIElements.ResolutionBG.color = parameters.IncorrectBGColor;
            uIElements.ResolutionBG.color = parameters.CorrectBGColor;
            if (gender == 1)
            {
                if (age < 15)
                {
                    uIElements.ResolutionStateInfoText.text = "Try again BOY";
                }
                else if (age > 15 && happ > 0.5)
                {
                    uIElements.ResolutionStateInfoText.text = "Why you laugh MAN ? WRONG!";
                }
                else if (sad > 0.5)
                {
                    uIElements.ResolutionStateInfoText.text = "WRONG! But dont be SAD MAN";
                }
                else if (glasses == 1)
                {
                    uIElements.ResolutionStateInfoText.text = "Clean your glasses MAN. WRONG!";
                }
                else if (surp > 0.2)
                {
                    uIElements.ResolutionStateInfoText.text = "Wrong! Why so surprised MAN?";
                }
                else
                {
                    uIElements.ResolutionStateInfoText.text = "Try again MAN!";
                }
            }
            if (gender == 0)
            {
                if (age < 15)
                {
                    uIElements.ResolutionStateInfoText.text = "Try again GIRL";
                }
                else if (age > 15 && happ > 0.5)
                {
                    uIElements.ResolutionStateInfoText.text = "Why you laugh GIRL ? WRONG!";
                }
                else if (sad > 0.5)
                {
                    uIElements.ResolutionStateInfoText.text = "WRONG! But dont be SAD GIRL";
                }
                else if (glasses == 1)
                {
                    uIElements.ResolutionStateInfoText.text = "Clean your glasses GIRL. WRONG!";
                }
                else if (surp > 0.2)
                {
                    uIElements.ResolutionStateInfoText.text = "Wrong! Why so surprised GIRL?";
                }
                else
                {
                    uIElements.ResolutionStateInfoText.text = "Try again GIRL!";
                }
            }
            uIElements.ResolutionScoreText.text = "-" + score;
            break;

        case ResolutionScreenType.Finish:
            uIElements.ResolutionBG.color           = parameters.FinalBGColor;
            uIElements.ResolutionStateInfoText.text = "FINAL SCORE";

            StartCoroutine(CalculateScore());
            uIElements.FinishUIElements.gameObject.SetActive(true);
            uIElements.HighScoreText.gameObject.SetActive(true);
            uIElements.HighScoreText.text = ((highscore > events.StartupHighscore) ? "<color=yellow>new </color>" : string.Empty) + "Highscore: " + highscore;
            break;
        }
    }
示例#10
0
    void UpdateResUI(ResolutionScreenType type, int score)
    {
        var highscore = PlayerPrefs.GetInt(GameUtillity.SavePrefKey + events.isLevel.ToString());

        switch (type)
        {
        case ResolutionScreenType.Correct:
            uIElements.ResolutionBG.color           = parameters.CorrectBGColor;
            uIElements.ResolutionStateInfoText.text = "Correct!";
            uIElements.ResolutionScoreText.text     = "+" + score;
            break;

        case ResolutionScreenType.Incorrect:
            uIElements.ResolutionBG.color           = parameters.IncorrectBGColor;
            uIElements.ResolutionStateInfoText.text = "Wrong!";
            uIElements.ResolutionScoreText.text     = "-" + score;
            break;

        case ResolutionScreenType.Finish:
            uIElements.ResolutionBG.color           = parameters.FinalBGColor;
            uIElements.ResolutionStateInfoText.text = "Final Score";
            uIElements.ResolutionScoreText.text     = highscore.ToString();
            StartCoroutine(CalculateScore());
            uIElements.FinishBg.gameObject.SetActive(true);
            uIElements.FinishUIElements.gameObject.SetActive(true);
            uIElements.HighScoreText.gameObject.SetActive(true);

            uIElements.HighScoreText.text = ((highscore > events.StartupHighscore) ? "<color=yellow>New </color>" + "Best: " + highscore : "Best: " + highscore);
            if (highscore > events.StartupHighscore)
            {
                PlayerPrefs.SetInt(GameUtillity.SavePrefKey + events.isLevel.ToString(), highscore);
            }

            var scorePreStar             = events.currentLevelMaxScore / 3;
            var isLevelAllStartCompleted = PlayerPrefs.GetInt(GameUtillity.SavePrefKey + events.isLevel.ToString() + "_State");
            var currentResult            = 0;
            if (events.CurrentFinalScore == events.currentLevelMaxScore)
            {
                currentResult = 3;
            }
            else
            {
                if (events.CurrentFinalScore <= scorePreStar * 2 && events.CurrentFinalScore > scorePreStar)
                {
                    currentResult = 2;
                }
                else
                {
                    if (events.CurrentFinalScore <= scorePreStar)
                    {
                        currentResult = 1;
                    }
                }
            }
            for (int i = 0; i < currentResult; i++)
            {
                uIElements.FinishStarGroup[i].sprite = uIElements.FinishStarActive;
            }

            if (isLevelAllStartCompleted != 3)
            {
                if (highscore == events.currentLevelMaxScore)
                {
                    PlayerPrefs.SetInt(GameUtillity.SavePrefKey + events.isLevel.ToString() + "_State", 3);


                    Debug.Log(uIElements.FinishStarGroup.Length);

                    if (events.isLevel >= PlayerPrefs.GetInt("LevelState"))
                    {
                        PlayerPrefs.SetInt("LevelState", events.isLevel + 1);
                    }
                }
                else
                {
                    if (highscore <= scorePreStar * 2 && highscore > scorePreStar)
                    {
                        PlayerPrefs.SetInt(GameUtillity.SavePrefKey + events.isLevel.ToString() + "_State", 2);
                        for (int i = 0; i < (uIElements.FinishStarGroup.Length - 1); i++)
                        {
                            uIElements.FinishStarGroup[i].sprite = uIElements.FinishStarActive;
                        }
                        if (events.isLevel >= PlayerPrefs.GetInt("LevelState"))
                        {
                            PlayerPrefs.SetInt("LevelState", events.isLevel + 1);
                        }
                    }
                    else
                    {
                        if (highscore <= scorePreStar && isLevelAllStartCompleted != 2)
                        {
                            PlayerPrefs.SetInt(GameUtillity.SavePrefKey + events.isLevel.ToString() + "_State", 1);
                            for (int i = 0; i < (uIElements.FinishStarGroup.Length - 2); i++)
                            {
                                uIElements.FinishStarGroup[i].sprite = uIElements.FinishStarActive;
                            }
                        }
                    }
                }
            }



            uIElements.FinishLevelTitle.text = "Level " + events.isLevel.ToString();
            events.StartupHighscore          = PlayerPrefs.GetInt(GameUtillity.SavePrefKey + events.isLevel.ToString());
            gameManager.FinishedQuestions    = new List <int>();
            //events.updateQuestionAnswer = null;
            break;
        }
    }