Пример #1
0
    /// <summary>
    /// Add a history event.
    /// </summary>
    /// <param name="historyEvent"></param>
    public void AddHistoryEvent(HistoryEvent historyEvent, string additionalText = "")
    {
        if (historyEvent == null)
        {
            Debug.LogWarning("History event could not be added because it is 'null'. Missing a proper configuration at a value script or an result of one of the scriptable objects (item, quest, etc.)?");
            return;
        }


        mDebug("Add " + historyEvent.ToString());

        //create new timeline data from the history event
        C_TimelineData timelineData = new C_TimelineData();

        if (vs != null)
        {
            timelineData.year         = Mathf.RoundToInt(vs.value);
            timelineData.historyEvent = historyEvent;
            timelineData.timelineKey  = historyEvent.name;
            timelineData.addText      = TextReplacement.TranslateAndReplace(additionalText);
            history.events.Add(timelineData);

            expandDisplayedHistory(timelineData);

            timelineChanged();

            save();
        }
        else
        {
            Debug.Log("Could not generate history event because the time value '" + timeValue.ToString() + "' is not available.");
        }
    }
Пример #2
0
    string buildResultText(int subLogSelection)
    {
        string result  = "";
        int    lineCnt = 0;

        //subLogSelection -1: use old log-system
        if (subLogSelection < 0)
        {
            foreach (string s in logs.gameLogs)
            {
                result = result + TextReplacement.TranslateAndReplace(s) + " ";

                lineCnt++;
                if (lineCnt >= textBreakEvery)
                {
                    result  = result + "\n\n";
                    lineCnt = 0;
                }
            }
            // Debug.Log("Sub log " + subLogSelection.ToString() + ":" + result);
            return(result);
        }
        else if (subLogSelection >= 0 && subLogSelection < splitLogs.subLogs.Count)
        {
            foreach (string s in splitLogs.subLogs[subLogSelection].gameLogs)
            {
                result = result + TextReplacement.TranslateAndReplace(s) + " ";

                lineCnt++;
                if (lineCnt >= textBreakEvery)
                {
                    result  = result + "\n\n";
                    lineCnt = 0;
                }
            }
            // Debug.Log("Sub log " + subLogSelection.ToString() + ":" + result);
            return(result);
        }
        else
        {
            result = "";
            Debug.LogWarning("There is no subLog '" + subLogSelection.ToString() + "'. Resulting string is empty");
            return(result);
        }
    }
    void actualizeIconsBaseOnValue()
    {
        //only compute, if the value changed
        if (value != oldValueForText)
        {
            //get through the list to get the new icon
            string newText = "";
            for (int i = 0; i < valueDependingTexts.Length; i++)
            {
                if (value >= valueDependingTexts[i].minValue)
                {
                    newText = TextReplacement.TranslateAndReplace(valueDependingTexts[i].text);
                }
            }

            textTarget.text = newText;
        }
        oldValueForText = value;
    }
Пример #4
0
    void showAchievementAnimation(achievementConfig ac)
    {
        int stage = getAchievementStageReached(ac);

        if (achievementAnimator != null)
        {
            if (anim_descriptionText != null)
            {
                anim_descriptionText.text = TextReplacement.TranslateAndReplace(ac.achievementStages[stage].description);
            }
            if (anim_titleText != null)
            {
                anim_titleText.text = TextReplacement.TranslateAndReplace(ac.achievementStages[stage].title);
            }
            if (anim_achievementImage != null)
            {
                anim_achievementImage.overrideSprite = ac.achievementStages[stage].sprite;
            }
            achievementAnimator.SetTrigger(triggerOnAchievement);
        }
    }
Пример #5
0
    //Try to translate and write the configurated texts to their text-fields.
    void writeTextFields()
    {
        writeEventTextField(textFields.titleText, TextReplacement.TranslateAndReplace(textFields.titleText.textContent));
        writeEventTextField(textFields.questionText, TextReplacement.TranslateAndReplace(textFields.questionText.textContent));
        writeEventTextField(textFields.answerLeft, TextReplacement.TranslateAndReplace(textFields.answerLeft.textContent));
        writeEventTextField(textFields.answerRight, TextReplacement.TranslateAndReplace(textFields.answerRight.textContent));
        writeEventTextField(textFields.answerUp, TextReplacement.TranslateAndReplace(textFields.answerUp.textContent));
        writeEventTextField(textFields.answerDown, TextReplacement.TranslateAndReplace(textFields.answerDown.textContent));


        if (textFields.additionalTexts != null)
        {
            foreach (eventText et in textFields.additionalTexts)
            {
                if (et != null && et.textContent != null && et.textField != null)
                {
                    //et.textField.text = TextReplacement.TranslateAndReplace(et.textContent);
                    writeEventTextField(et, TextReplacement.TranslateAndReplace(et.textContent));
                }
            }
        }
    }
 private void replace()
 {
     textField.text = TextReplacement.TranslateAndReplace(text);
     //Debug.Log("Replacement: " + textField.textField.text);
 }