コード例 #1
0
    public void UpdateResultItemData()
    {
        LogUtil.Log("UIPanelModeTypeChoice:UpdateResultItemData");

        UIUtil.SetLabelValue(labelResultItemStatus, GetStatusItemProgress());

        UIColors.UpdateColors();

        AppContentChoice choice = GetCurrentChoice();

        string typeValue = "CORRECT";
        string codeValue = "FALSE";

        if (isCorrect) //currentChoiceData.CheckChoices(true)) {
        {
            UIColors.UpdateColor(containerChoiceResultItem, UIColors.colorGreen);
            typeValue = "CORRECT!";
            GameAudioController.PlaySoundPlayerActionGood();
            choicesCorrect += 1;
        }
        else
        {
            UIColors.UpdateColor(containerChoiceResultItem, UIColors.colorRed);
            typeValue = "INCORRECT...";
            GameAudioController.PlaySoundPlayerActionBad();
        }

        foreach (AppContentChoiceItem choiceItem in choice.choices)
        {
            if (choiceItem != null)
            {
                if (choiceItem.IsTypeCorrect())
                {
                    codeValue = choiceItem.display;
                }
            }
        }

        if (choice != null)
        {
            string choiceResultType        = typeValue;
            string choiceResultValue       = codeValue;
            string choiceResultDescription = choice.description;
            string choiceResultDisplayName = choice.display_name;

            if (choice != null)
            {
                //choiceQuestion = choice.display_name + choice.code;
            }

            UIUtil.SetLabelValue(labelResultItemChoiceDisplayName, choiceResultDisplayName);
            UIUtil.SetLabelValue(labelResultItemChoiceDescription, choiceResultDescription);
            UIUtil.SetLabelValue(labelResultItemChoiceResultValue, choiceResultValue);
            UIUtil.SetLabelValue(labelResultItemChoiceResultType, choiceResultType);
        }
    }
コード例 #2
0
    public void UpdateDisplayStateResultsData()
    {
        LogUtil.Log("UIPanelModeTypeChoice:UpdateDisplayStateResultsData");

        UIColors.UpdateColors();

        UIUtil.SetLabelValue(labelResultsStatus, "Results");

        GameAudioController.PlaySoundPlayerActionGood();

        //double timeCompleted = 30; // TODO
        double coins         = 500;
        double choiceTotal   = choices.Count;
        double choicesResult = choicesCorrect / choiceTotal;

        coins = choicesCorrect * 100;

        string scoreFractionValue   = string.Format("{0}/{1}", choicesCorrect, choiceTotal);
        string scorePercentageValue = choicesResult.ToString("P0");
        //string scoreTitleValue = ;
        //string scoreTypeValue = "4/5";
        string scoreCoinsValue = coins.ToString("N0");

        UIUtil.SetSliderValue(sliderScore, choicesResult);

        UIUtil.SetLabelValue(labelResultsScoreFractionValue, scoreFractionValue);
        UIUtil.SetLabelValue(labelResultsScorePercentageValue, scorePercentageValue);
        //UIUtil.SetLabelValue(labelResultsTitle, choiceResultValue);
        //UIUtil.SetLabelValue(labelResultsType, choiceResultType);
        UIUtil.SetLabelValue(labelResultsCoinsValue, scoreCoinsValue);

        // REWARDS

        GameProfileRPGs.Current.AddCurrency(coins);

        GamePlayerProgress.SetStatCoins(coins);
        GamePlayerProgress.SetStatCoinsEarned(coins);

        double xpEarned = coins * 2;

        GamePlayerProgress.SetStatXP(xpEarned);

        GameProfileCharacters.Current.CurrentCharacterAddGamePlayerProgressXP(xpEarned);
        GameProfileCharacters.Current.CurrentCharacterAddGamePlayerProgressEnergy(1f); // refill
        GameProfileCharacters.Current.CurrentCharacterAddGamePlayerProgressHealth(1f); // refill

        GameController.ProcessLevelStats();


        /*
         * AppContentChoice choice = GetCurrentChoice();
         *
         * if(choice != null) {
         *
         *  string choiceTitle = "Loading...";
         *  string choiceQuestion = "Loading...";
         *
         *  if(choice != null) {
         *      choiceTitle = "Question";
         *      choiceQuestion = choice.display_name + choice.code;
         *  }
         *
         *  UIUtil.SetLabelValue(labelDisplayItemTitle, choiceTitle);
         *  UIUtil.SetLabelValue(labelDisplayItemQuestion, choiceQuestion);
         * }
         */
    }