/// <summary>
    /// Método UpdateTexts, que actualiza los textos localizados
    /// </summary>
    public void UpdateTexts()
    {
        if (!LocalizationSystem.isInit)
        {
            LocalizationSystem.Init();
        }

        LocalizedText[] localizedTexts = Resources.FindObjectsOfTypeAll <LocalizedText>();

        foreach (LocalizedText localizedText in localizedTexts)
        {
            localizedText.UpdateText();
        }

        // Si es un nivel
        if (SceneManager.GetActiveScene().name.Contains("Level"))
        {
            GameManager.instance.UpdateRobberiesTranslate();
        }

        // Si es el tutorial
        if (SceneManager.GetActiveScene().name.Equals("Tutorial"))
        {
            TutorialGameManager.instance.UpdateRobberiesTranslate();
            TutorialManager.instance.UpdateTutorialTranslate();
        }

        // Si es el menú principal
        if (SceneManager.GetActiveScene().name.Equals("MainMenu"))
        {
            MenuManager.instance.UpdateStartTranslate();
        }
    }
コード例 #2
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        EditorGUI.BeginProperty(position, label, property);
        position        = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
        position.width -= 34;
        position.height = 18;

        Rect valueRect = new Rect(position);

        valueRect.x     += 15;
        valueRect.width -= 15;

        Rect foldButtonRect = new Rect(position);

        foldButtonRect.width = 15;

        dropdown = EditorGUI.Foldout(foldButtonRect, dropdown, "");

        position.x     += 15;
        position.width -= 15;

        SerializedProperty key = property.FindPropertyRelative("key");

        key.stringValue = EditorGUI.TextField(position, key.stringValue);

        position.x     += position.width + 2;
        position.width  = 17;
        position.height = 17;

        Texture    searchIcon    = (Texture)Resources.Load("search");
        GUIContent searchContent = new GUIContent(searchIcon, "Search");

        if (GUI.Button(position, searchContent))
        {
            TextLocalizerSearchWindow.Open();
        }

        position.x += position.width + 2;

        Texture    storeIcon    = (Texture)Resources.Load("store");
        GUIContent storeContent = new GUIContent(storeIcon);

        if (GUI.Button(position, storeContent))
        {
            TextLocalizerEditWindow.Open(key.stringValue);
        }

        if (dropdown)
        {
            var      value = LocalizationSystem.GetLocalizedValue(key.stringValue);
            GUIStyle style = GUI.skin.box;
            height = style.CalcHeight(new GUIContent(value), valueRect.width);

            valueRect.height = height;
            valueRect.y     += 21;
            EditorGUI.LabelField(valueRect, value, EditorStyles.wordWrappedLabel);
        }

        EditorGUI.EndProperty();
    }
コード例 #3
0
 void Start()
 {
     text = GetComponent <TextMeshProUGUI>();
     lang = FindObjectOfType <LocalizationSystem>();
     lang.UpdateDict();
     text.text = lang.GetKey(key);
 }
コード例 #4
0
    public void OnGUI()
    {
        key = EditorGUILayout.TextField("Key :", key);
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Value:", GUILayout.MaxWidth(50));

        EditorStyles.textArea.wordWrap = true;
        value = EditorGUILayout.TextArea(value, EditorStyles.textArea, GUILayout.Height(100), GUILayout.Width(400));
        EditorGUILayout.EndHorizontal();

        if (GUILayout.Button("Add"))
        {
            if (LocalizationSystem.GetLocalizedValue(key) != string.Empty)
            {
                LocalizationSystem.Replace(key, value);
            }
            else
            {
                LocalizationSystem.Add(key, value);
            }
        }

        minSize = new Vector2(460, 250);
        maxSize = minSize;
    }
コード例 #5
0
    /// <summary>
    /// Método UpdateTutorialTranslate, que actualiza el texto correspondiente al tutorial
    /// </summary>
    public void UpdateTutorialTranslate()
    {
        string textSt = LocalizationSystem.GetLocalizedValue("TUTORIAL_TEXT_" + actualText);

        textSt            = textSt.Replace("\\n", "\n");
        tutorialText.text = textSt;
    }
コード例 #6
0
ファイル: ClientHandle.cs プロジェクト: JasonGras/Neoky
        public static void ForgotPasswordReturn(Packet _packet)
        {
            string _returnStatus = _packet.ReadString();
            int    _myId         = _packet.ReadInt();

            switch (_returnStatus)
            {
            case "FORGOT_PASSWORD_CONFIRMED":
                Debug.Log("Votre nouveau mot de passe a bien été mis a jours.");
                ForgotPasswordScript.ForgotPwd.UpdateSuccessSceneMessage(LocalizationSystem.GetLocalizedValue(Constants.forgot_password_success_lbl));
                ForgotPasswordScript.ForgotPwd.UpdateMyFinalForm();
                break;

            case "FORGOT_PASSWORD_CODE_EXPIRED_KO":
                ForgotPasswordScript.ForgotPwd.UpdateErrorSceneMessage(LocalizationSystem.GetLocalizedValue(Constants.forgot_password_code_expire_lbl));
                break;

            case "FORGOT_PASSWORD_CODE_MISMATCH_KO":
                ForgotPasswordScript.ForgotPwd.UpdateErrorSceneMessage(LocalizationSystem.GetLocalizedValue(Constants.forgot_password_code_mismatch_lbl));
                break;

            case "NEW_CODE_SEND_EMAIL":
                ForgotPasswordScript.ForgotPwd.UpdateMyForm();
                ForgotPasswordScript.ForgotPwd.UpdateSuccessSceneMessage(LocalizationSystem.GetLocalizedValue(Constants.code_send_success_lbl));
                break;

            default:
                Debug.Log("Une erreur technique est survenue, merci de réessayer ultérieurement.");
                break;
            }
        }
コード例 #7
0
 public override void Refresh()
 {
     if (LocalizationSystem.TryGetLocalisedValue(beforeText, out string value))
     {
         text.text = value;
     }
 }
コード例 #8
0
    private void Awake()
    {
        Debug.Assert(_localizationData != null);

        var key = "text";

        var value = _localizationData.GetString(key, English);

        Debug.LogFormat("English: {0}", value);

        value = _localizationData.GetString(key, Russian);
        Debug.LogFormat("Russian: {0}", value);

        value = _localizationData.GetString(key, German);
        Debug.LogFormat("German: {0}", value);

        _localizationSystem = new LocalizationSystem(_localizationData)
        {
            DefaultLanguage = English
        };

        Localizer.LocalizationSystem = _localizationSystem;

        _localizationSystem.CurrentLanguage = English;
    }
コード例 #9
0
    public void Cancel()
    {
        if (ValueChanged())
        {
            UISystem.instance.CreatePopup(LocalizationSystem.GetEntry("settings.valuechanged"), "menu.yes", "menu.no",
                                          () =>
            {
                Apply();
                UISystem.instance.CloseCurrentWindow();
                UISystem.instance.CloseWindow(gameObject);
            },
                                          () =>
            {
                if (m_TMPPref.CurrentLanguage != Core.instance.PlayerPrefs.CurrentLanguage)
                {
                    LocalizationSystem.ChangeLanguage(Core.instance.PlayerPrefs.CurrentLanguage);
                }

                UISystem.instance.CloseCurrentWindow();
                UISystem.instance.CloseWindow(gameObject);
                AudioMgr.PlayUISound("Cancel");
            });
        }
        else
        {
            UISystem.instance.CloseCurrentWindow();
            AudioMgr.PlayUISound("Cancel");
        }
    }
コード例 #10
0
ファイル: ClientHandle.cs プロジェクト: JasonGras/Neoky
        public static void SignUpReturn(Packet _packet)
        {
            string _returnStatus = _packet.ReadString();
            int    _myId         = _packet.ReadInt();

            Debug.Log($"Return Sign Up Status : {_returnStatus}");

            switch (_returnStatus)
            {
            case "ADHESION_ALREADY_EXIST":
                SignUpScript.SignUpInst.UpdateSceneSignUpErrorMessage(LocalizationSystem.GetLocalizedValue(Constants.sign_up_user_already_exist));
                break;

            case "ADHESION_OK":
                Debug.Log("Creation de Compte Finalisée.");
                SignUpScript.SignUpInst.UpdateSceneSignUpSuccessMessage(LocalizationSystem.GetLocalizedValue(Constants.signup_validation_email_lbl));
                break;

            case "ADHESION_KO":
                Debug.Log("Votre création de compte a échoué, merci de réessayer ultérieurement.");
                break;

            default:
                Debug.Log("Une erreur technique est survenue, merci de réessayer ultérieurement.");
                break;
            }
        }
コード例 #11
0
        public override void OnInspectorGUI()
        {
            this.DrawServices <LocalizationServiceItem>();

            CustomGUI.Splitter();

            GUILayout.Label("Languages", EditorStyles.boldLabel);

            EditorGUI.BeginDisabledGroup(true);

            var currentLangs = LocalizationSystem.GetLanguagesList();
            var langs        = System.Enum.GetValues(typeof(UnityEngine.SystemLanguage));

            foreach (var lang in langs)
            {
                var lng = (UnityEngine.SystemLanguage)lang;
                if (currentLangs.Contains(lng) == true)
                {
                    GUILayout.Toggle(true, lng.ToString());
                }
                else
                {
                    GUILayout.Toggle(false, lng.ToString());
                }
            }

            EditorGUI.EndDisabledGroup();
        }
コード例 #12
0
    // Start is called before the first frame update
    void Start()
    {
        textField = GetComponent <TextMeshProUGUI>();
        string value = LocalizationSystem.GetLocalisedValue(key);

        textField.text = value;
    }
コード例 #13
0
    // Start is called before the first frame update
    void Start()
    {
        textBtn = GetComponent <InputField>().GetComponentInChildren <Text>();
        string value = LocalizationSystem.GetLocalizedValue(key);

        textBtn.text = value;
    }
コード例 #14
0
        /// <summary>
        /// Sets the popup to have the desired values. Use localization keys to get the text.
        /// </summary>
        /// <param name="titleKey"> Localization key of the title. </param>
        /// <param name="messageKey"> Localization key of the message. </param>
        /// <param name="additionalMessageKey"> Extra localization key for a second line message.</param>
        /// <param name="buttonSettings"> Buttons of the popup. Max of 5 buttons.
        /// Should follow order: Confirm, extras and then cancel.</param>
        /// <param name="popupExecutionState"> Does the game need to be paused? </param>
        /// <param name="callback"> Function to call when a button is pressed. </param>
        public void SetUpPopup(string titleKey, string messageKey, string additionalMessageKey, List <ButtonSettings> buttonSettings,
                               ExecutionState popupExecutionState, Action <int> callback)
        {
            popupOpen = true;
            titleText.UpdateKey(titleKey);
            messageText.TextMeshComponent.text =
                $"{LocalizationSystem.GetLocalizedValue(messageKey)} " +
                $"{Environment.NewLine} " +
                $"{(string.IsNullOrWhiteSpace(additionalMessageKey) ? string.Empty : LocalizationSystem.GetLocalizedValue(additionalMessageKey))}";

            buttons.Clear();

            foreach (var settings in buttonSettings)
            {
                var button = Instantiate(popupButtonPrefabs[(int)settings.highlightLevel], buttonParent).GetComponent <Button>();

                button.onClick.AddListener(() => callback(settings.id));
                button.onClick.AddListener(() => popupOpen = false);
                button.GetComponentInChildren <TextMeshLocalizer>().UpdateKey(settings.key);

                buttons.Add(button);
            }

            GameMaster.Instance.GameState = popupExecutionState;

            AnimateIn();

            StartCoroutine(nameof(PopupPauseRoutine));
        }
コード例 #15
0
 public void ChangeLanguage(int language) //Public method to change the language to a specified one (e.g On Button Clicks)
 {
     if (System.Enum.IsDefined(typeof(LocalizationSystem.Language), language))
     {
         LocalizationSystem.SetLanguage((LocalizationSystem.Language)language, true);
     }
 }
コード例 #16
0
 public void Pull()
 {
     this.screen.AddLine("Pulling...");
     LocalizationSystem.InitializeAsync(() => {
         this.screen.AddLine("Pull completed.");
         this.Version();
     });
 }
コード例 #17
0
ファイル: SignUpScript.cs プロジェクト: JasonGras/Neoky
 public void SignUpShowError(string _message)
 {
     if (!errorImageBG.gameObject.activeSelf)
     {
         errorImageBG.gameObject.SetActive(true);
     }
     errorMessage.text = LocalizationSystem.GetLocalizedValue(_message);
 }
コード例 #18
0
 private void Start()
 {
     m_RealText      = LocalizationSystem.GetEntry("intro.welcome") + " " + System.Environment.UserName;
     m_TextMesh      = GetComponent <TextMeshPro>();
     m_TextMesh.text = m_RealText;
     m_TextMesh.text = new string(m_RealText.ToCharArray().OrderBy(x => Random.value).ToArray());
     m_TextMat       = GetComponent <Renderer>().material;
 }
    /// <summary>
    /// Método UpdateEndGameScreen, que actualiza la UI de la pantalla final
    /// </summary>
    public void UpdateEndGameScreen()
    {
        // Texto de arriba
        endGameText.text = LocalizationSystem.GetLocalizedValue("ENDGAME_WIN");

        // Efecto de victoria
        GameObject victoryVFX = Instantiate(TutorialGameManager.instance.victoryVFX, endGameVFX.transform);
    }
コード例 #20
0
        /*public override string text {
         *
         *      get {
         *
         *              return base.text;
         *
         *      }
         *
         *      set {
         *
         *              base.text = LocalizationSystem.Get(this.localizationKey);
         *
         *      }
         *
         * }*/

        public void OnLocalizationChanged()
        {
            if (this.localizationKey.IsNone() == false)
            {
                //this.text = base.text;
                this.text = LocalizationSystem.Get(this.localizationKey);
            }
        }
コード例 #21
0
        // Start is called before the first frame update
        protected override void Start()
        {
            base.Start();

            if (hud)
            {
                hud.ShowDialogUI(LocalizationSystem.GetLocalisedValue("text_commander1"), LocalizationSystem.GetLocalisedValue("text_tutstart"));
            }
        }
コード例 #22
0
            protected override void OnCreate()
            {
                base.OnCreate();

                statusEffectManager = World.GetExistingSystem <StatusEffectManager>();
                localizationSystem  = World.GetExistingSystem <LocalizationSystem>();

                statusEffectsLocal = localizationSystem.LoadLocal("status_effects");

                unitStatusEffectList = new List <UnitReadStatusEffectSettings>();
            }
コード例 #23
0
ファイル: Config.cs プロジェクト: hematogen50g/Druncard
 public static string LowestCardBeatsAce()
 {
     if (Cards == MaxCards)
     {
         return(LocalizationSystem.GetLocalizedValue("two_beats_ace"));
     }
     else
     {
         return(LocalizationSystem.GetLocalizedValue("six_beats_ace"));
     }
 }
コード例 #24
0
    IEnumerator End()
    {
        UISystem.instance.SetMenuPresence(true);
        InterfaceUtilities.FadeToBlack(false, 2.0f);
        yield return(new WaitForSeconds(3.0f));

        InterfaceUtilities.AddCaption(LocalizationSystem.GetEntry("end.thanks"), new Vector2(400.0f, 100.0f), 40.0f, Color.white, true, false, 2.0f);
        yield return(new WaitForSeconds(5.0f));

        SceneManager.LoadScene(0);
    }
コード例 #25
0
 private void Start()
 {
     // add component of localization
     localizationSystem = FindObjectOfType <LocalizationSystem>();
     // add text component of dialog
     dialogText = GameObject.Find("DialogText").GetComponent <TextMeshProUGUI>();
     // add text component of button
     btnText = GameObject.Find("StartDialogText").GetComponent <TextMeshProUGUI>();
     // add animator component of dialog
     dialogAnimator = GameObject.Find("Dialog").GetComponent <Animator>();
     // add component of pause button, to activate it when need
     pauseBTN = GameObject.Find("PausedButton").GetComponent <Button>();
 }
 /// <summary>
 /// Método UpdateStartTranslate, que actualiza traducido el texto del inicio
 /// </summary>
 public void UpdateStartTranslate()
 {
     if (Application.isMobilePlatform)
     {
         iconImage.sprite = iconSprites[1];
         startText.text   = LocalizationSystem.GetLocalizedValue("START_MOBILE");
     }
     else
     {
         iconImage.sprite = iconSprites[0];
         startText.text   = LocalizationSystem.GetLocalizedValue("START_DESKTOP");
     }
 }
コード例 #27
0
        private void Load(string path, out Dictionary <string, int> languages, out Dictionary <string, string[]> valueTable)
        {
            languages  = new Dictionary <string, int>();
            valueTable = new Dictionary <string, string[]>();
            string text = File.ReadAllText(path, Encoding.UTF8);

            dataFormat = path.EndsWith("json") ? DataFormat.Json : DataFormat.CSV;
            LocalizationData data = LocalizationSystem.Load(text, dataFormat);

            languages     = data.Languages;
            valueTable    = data.DataTable;
            this.filePath = path;
        }
コード例 #28
0
 public bool CheckConfirmedNewPasswordPattern(string _text)
 {
     if (_text == newPassword.text)
     {
         return(true);
     }
     else
     {
         errorImageBG.gameObject.SetActive(true);
         errorMessage.text = LocalizationSystem.GetLocalizedValue(Constants.error_confirmed_password_format_lbl);
         //Debug.LogWarning("Le format du Mot de passe est incorrect.");
         return(false);
     }
 }
コード例 #29
0
 public void BackToMainMenu()
 {
     UISystem.instance.CreatePopup(LocalizationSystem.GetEntry("menu.confirmmain"), "menu.yes", "menu.no",
                                   () =>
     {
         UISystem.instance.ClearAll();
         UISystem.instance.LockUnlockPauseAction(false);
         SceneManager.LoadScene(0);
     },
                                   () =>
     {
         UISystem.instance.CloseCurrentWindow();
     });
 }
コード例 #30
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            LocalizationSystem.SetLanguage(LocalizationSystem.Language.English, true);
            Debug.Log("Set Language to English");
        }

        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            LocalizationSystem.SetLanguage(LocalizationSystem.Language.French, true);
            Debug.Log("Set Language to French");
        }
    }