public void StartDay()
        {
            dayNightController = PlayController.main.GetDayNightController();

            dayBar.minValue = dayNightController.GetTimerMinValue();
            dayBar.maxValue = dayNightController.GetTimerMaxValue();

            dayBar.value = dayBar.minValue;

            dayString = LocalisationService.GetTranslation(dayStringKey);

            dayStarted = true;
        }
        private void ShowRemove()
        {
            if (!showRemove)
            {
                return;
            }

            translationMap = LocalisationService.GetTranslationMap();

            GUILayout.BeginVertical("box");
            GUILayout.Space(8);
            searchString = EditorGUILayout.TextField("Search", searchString);
            GUILayout.Space(8);
            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(34));
            GUILayout.Label("Key", GUILayout.Width(128));
            GUILayout.Label("Value", GUILayout.Width(128));
            GUILayout.EndHorizontal();

            removeScroll = EditorGUILayout.BeginScrollView(removeScroll);

            EditorStyles.textArea.wordWrap = true;
            foreach (KeyValuePair <string, string> map in translationMap)
            {
                string keyString   = map.Key;
                string valueString = map.Value;

                if (IsSearchStringValid(keyString, valueString))
                {
                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button("x", GUILayout.Width(32)))
                    {
                        if (DecisionDialog("Removing Key Value Data"))
                        {
                            LocalisationService.Remove(keyString);
                        }
                    }
                    GUILayout.TextField(keyString, EditorStyles.textArea, GUILayout.Width(128));
                    GUILayout.TextField(valueString, EditorStyles.textArea, GUILayout.Width(128));
                    GUILayout.EndHorizontal();
                }
            }

            EditorGUILayout.EndScrollView();
            GUILayout.EndVertical();
        }
        private void ShowAdd()
        {
            if (!showAdd)
            {
                return;
            }

            translationMap = LocalisationService.GetTranslationMap();

            EditorStyles.textArea.wordWrap = true;

            GUILayout.BeginHorizontal();
            GUILayout.Label("Key", GUILayout.Width(64));
            addKey = EditorGUILayout.TextArea(addKey, EditorStyles.textArea);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Value", GUILayout.Width(64));
            addValue = EditorGUILayout.TextArea(addValue, EditorStyles.textArea);
            GUILayout.EndHorizontal();

            if (GUILayout.Button("Confirm"))
            {
                if (addKey == string.Empty || addValue == string.Empty)
                {
                    ConfirmationDialog("Key/Value is Empty");
                    return;
                }

                if (CanUseAddKey(addKey))
                {
                    ConfirmationDialog("[" + addKey + "] already exists. Use a different one.");
                    return;
                }

                if (DecisionDialog("Adding Key Value Data"))
                {
                    LocalisationService.Add(addKey, addValue);
                }
            }
        }
        private void ShowResults()
        {
            translationMap = LocalisationService.GetTranslationMap();

            GUILayout.BeginVertical("box");
            GUILayout.Space(8);
            searchString = EditorGUILayout.TextField("Search", searchString);
            GUILayout.Space(8);
            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(34));
            GUILayout.Label("Key", GUILayout.Width(128));
            GUILayout.Label("Value", GUILayout.Width(128));
            GUILayout.EndHorizontal();

            scroll = EditorGUILayout.BeginScrollView(scroll);

            foreach (KeyValuePair <string, string> map in translationMap)
            {
                string keyString   = map.Key;
                string valueString = map.Value;

                if (IsSearchStringValid(keyString, valueString))
                {
                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button("^", GUILayout.Width(32)))
                    {
                        textTranslator.key = keyString;
                    }
                    EditorStyles.textArea.wordWrap = true;
                    GUILayout.TextField(keyString, EditorStyles.textArea, GUILayout.Width(128));
                    GUILayout.TextField(valueString, EditorStyles.textArea, GUILayout.Width(128));
                    GUILayout.EndHorizontal();
                }
            }

            EditorGUILayout.EndScrollView();
            GUILayout.EndVertical();
        }
Esempio n. 5
0
 private void Start()
 {
     textField      = GetComponent <TMP_Text>();
     textField.text = LocalisationService.GetTranslation(key);
 }
 private void OnEnable()
 {
     translationMap = LocalisationService.GetTranslationMap();
 }
        private void ShowEdit()
        {
            if (!showEdit)
            {
                return;
            }

            translationMap = LocalisationService.GetTranslationMap();

            EditorStyles.textArea.wordWrap = true;

            GUILayout.BeginHorizontal();
            GUILayout.Label("Key", GUILayout.Width(64));
            GUILayout.TextField(editKey, EditorStyles.textArea);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Value", GUILayout.Width(64));
            editValue = EditorGUILayout.TextArea(editValue, EditorStyles.textArea);
            GUILayout.EndHorizontal();

            if (GUILayout.Button("Confirm"))
            {
                if (editValue == string.Empty)
                {
                    ConfirmationDialog("Value is Empty");
                    return;
                }

                if (!HasEditValueChanged(editValue))
                {
                    ConfirmationDialog("Value is the same");
                    return;
                }

                if (DecisionDialog("Editing Key Value Data"))
                {
                    LocalisationService.Edit(editKey, editValue);
                }
            }

            GUILayout.BeginVertical("box");
            GUILayout.Space(8);

            GUILayout.BeginHorizontal();
            GUILayout.Label("Search", GUILayout.Width(64));
            searchString = EditorGUILayout.TextField(searchString);
            GUILayout.EndHorizontal();
            GUILayout.Space(8);
            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(34));
            GUILayout.Label("Key", GUILayout.Width(128));
            GUILayout.Label("Value", GUILayout.Width(128));
            GUILayout.EndHorizontal();

            editScroll = EditorGUILayout.BeginScrollView(editScroll);

            foreach (KeyValuePair <string, string> map in translationMap)
            {
                string keyString   = map.Key;
                string valueString = map.Value;

                if (IsSearchStringValid(keyString, valueString))
                {
                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button("+", GUILayout.Width(32)))
                    {
                        editKey          = keyString;
                        editValue        = valueString;
                        currentEditValue = valueString;
                    }
                    GUILayout.TextField(keyString, EditorStyles.textArea, GUILayout.Width(128));
                    GUILayout.TextField(valueString, EditorStyles.textArea, GUILayout.Width(128));
                    GUILayout.EndHorizontal();
                }
            }

            EditorGUILayout.EndScrollView();
            GUILayout.EndVertical();
        }
Esempio n. 8
0
 public string GetTranslation(string pKey)
 {
     return(LocalisationService.GetTranslation(pKey));
 }
Esempio n. 9
0
 public void LoadLocalisationService()
 {
     LocalisationService.Load();
 }
Esempio n. 10
0
 public void SetLanguageCode(string pLanguageCode)
 {
     LocalisationService.SetLanguageCode(pLanguageCode);
 }