public int GetLikesValue(int fameRank, AnswerResultType resultType)
    {
        switch (fameRank)
        {
        case 0:
        case 1:
            return(result_0_1.GetLikesValue(resultType));

        case 2:
            return(result_2.GetLikesValue(resultType));

        case 3:
            return(result_3.GetLikesValue(resultType));

        case 4:
            return(result_4.GetLikesValue(resultType));

        case 5:
            return(result_5.GetLikesValue(resultType));

        default:
            Debug.LogError(string.Format("Incorrect fame rank ({0})", fameRank));
            return(0);
        }
    }
Beispiel #2
0
    /// <summary>
    /// Activates the UI that shows the opinion to give.
    /// </summary>
    /// <param name="answerID">The ID of the answer.</param>
    public void ShowChooseOpinion(string answer, string question, AnswerResultType resultType)
    {
        answerDisplay.SetActive(false);
        waitForAnswerDisplay.SetActive(false);

        RefreshPlayerInfos();

        chooseOpinionDisplay.SetActive(!_isLocal);
        waitForOpinionDisplay.SetActive(_isLocal);

        if (_isLocal)
        {
            scenarioDescription_waitOpinion.text = question;
            answerText_waitOpinion.text          = answer;
            societyResult.ShowResult(resultType, GameManager.currentPlayer.fame);
        }
        else
        {
            validateOpinionButton.interactable = true;
            validateOpinionText.SetActive(true);
            validatedOpinionIcon.SetActive(false);
            scenarioDescription_chooseOpinion.text = question;
            answerText_chooseOpinion.text          = answer;
            voteTitle.text = string.Format("Note {0}", GameManager.currentPlayer.character.GetFirstName());

            likesIncrementHandler.UpdateSettings(NetworkPlayer.LocalPlayerInstance.fame);
            maxVoteText.text = string.Format("Tu peux distribuer {0} votes au maximum", LikesIncrementHandler.maxValue);
        }
    }
    /// <summary>
    /// Show the opinion of the society depending on the value of likes given by the society.
    /// </summary>
    /// <param name="opinion">The likes value given by the society.</param>
    public void ShowResult(AnswerResultType resultType, float playerRank)
    {
        int rankLevel = Mathf.FloorToInt(playerRank);

        switch (rankLevel)
        {
        case 0:
        case 1:
            textResult.text = result_0_1.GetComment(resultType);
            break;

        case 2:
            textResult.text = result_2.GetComment(resultType);
            break;

        case 3:
            textResult.text = result_3.GetComment(resultType);
            break;

        case 4:
            textResult.text = result_4.GetComment(resultType);
            break;

        case 5:
            textResult.text = result_5.GetComment(resultType);
            break;
        }
    }
    public int GetLikesValue(AnswerResultType resultType)
    {
        foreach (AnswerResult result in answerResults)
        {
            if (result.resultType == resultType)
            {
                return(result.likesValue);
            }
        }

        Debug.LogError(string.Format("The result type '{0}' is not handled at this rank.", resultType.ToString()));

        return(0);
    }
    public string GetComment(AnswerResultType resultType)
    {
        foreach (SocietyResult result in societyResults)
        {
            if (result.resultType == resultType)
            {
                return(result.comment);
            }
        }

        Debug.LogError(string.Format("No text has been linked with the society for the resultType ({0}).", resultType.ToString()));

        return(string.Empty);
    }