public void init(LocalizationText localizationTextToUse)
    {
        localizationText = localizationTextToUse;

        if (!displayList && !displayNewKeyForm)
        {
            if (GUILayout.Button("List of the keys"))
            {
                displayList = true;
            }

            if (GUILayout.Button("Add a key"))
            {
                newTexts          = new string[localizationText.fileAndLang.Count];
                langs             = new string[localizationText.fileAndLang.Count];
                displayNewKeyForm = true;
            }
        }

        if (displayList)
        {
            displayKey();
        }

        if (displayNewKeyForm)
        {
            addKey();
        }
    }
Ejemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            LocalizationText localizationText = target as LocalizationText;

            localizationText.LanguageId = (LanguageId)EditorGUILayout.EnumPopup("语言id", localizationText.LanguageId);
            base.OnInspectorGUI();
        }
Ejemplo n.º 3
0
    void Start()
    {
        //Load audio settings
        float value = PlayerPrefs.GetFloat("sound", 1);

        AudioListener.volume = value;

        //load language settings
        //german or english is supported for now
        SystemLanguage lang = Application.systemLanguage;

        if (lang == SystemLanguage.German)
        {
            LocalizationText.SetLanguage("DE");
        }
        else
        {
            LocalizationText.SetLanguage("EN");
        }

        menuCanvas.SetActive(true);
        settingsCanvas.SetActive(false);
        singleplayerCanvas.SetActive(false);
        localMulitplayerCanvas.SetActive(false);
    }
Ejemplo n.º 4
0
    public void setUp()
    {
        //Needs to be reset every setup. Else it will stay true once made true once.
        isCharacterEquipped = false;

        //Was added to avoid NullPointerException
        //In retrospect, this isn't needed because the button would only be active if the dimension was available.
        //But there's no point in resructuring the whole code, so whatever.
        dimensionAvailable = globalDataPreserver.Instance.characterChoices.TryGetValue(sceneIndex, out cachedChoices);

        if (dimensionAvailable && cachedChoices.availableCharacterIndexes.Contains(characterIndex))
        {
            equippingVisual.SetActive(true);
            buyingVisual.SetActive(false);
            isCharacterBought = true;

            if (cachedChoices.selectedCharacter == characterIndex)
            {
                isCharacterEquipped = true;
                equipText.text      = LocalizationText.GetText("equipped");
            }
            else
            {
                equipText.text = LocalizationText.GetText("equip");
            }
        }
        else
        {
            equippingVisual.SetActive(false);
            buyingVisual.SetActive(true);
            priceText.text = price.ToString();
        }
    }
    public void localize()
    {
        if (normalText)
        {
            normalText.text = LocalizationText.GetText(key);
            if (LocalizationText.GetLanguage().Equals("RU"))
            {
                normalText.font = russianFontUI;
            }
            else
            {
                normalText.font = normalFontUI;
            }
            return;
        }

        textMeshPro.text = LocalizationText.GetText(key);
        if (LocalizationText.GetLanguage().Equals("RU"))
        {
            textMeshPro.font = russianFontTMP;
        }
        else
        {
            textMeshPro.font = normalFontTMP;
        }
    }
Ejemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        text       = GetComponent <Text> ();
        lastUpdate = Time.time;

        original  = LocalizationText.GetText(text.text);
        text.text = original;
    }
Ejemplo n.º 7
0
        static public void AddText(MenuCommand menuCommand)
        {
            GameObject       go  = new GameObject("Text");
            LocalizationText txt = go.AddComponent <LocalizationText>();

            PlaceUIElementRoot(go, menuCommand);
            InitValue(txt);
        }
Ejemplo n.º 8
0
 // Token: 0x060003BF RID: 959 RVA: 0x00011467 File Offset: 0x0000F867
 private static IDictionary <string, string> GetContent()
 {
     if (LocalizationText._content == null || LocalizationText._content.Count == 0)
     {
         LocalizationText.CreateContent();
     }
     return(LocalizationText._content);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 初始化值为了和Text的初始值保持一致
        /// </summary>
        /// <param name="txt"></param>
        public static void InitValue(LocalizationText txt)
        {
            txt.color = new Color(50f / 255f, 50f / 255f, 50f / 255f);
            RectTransform contentRT = txt.GetComponent <RectTransform>();

            contentRT.sizeDelta  = new Vector2(160f, 30f);
            txt.gameObject.layer = LayerMask.NameToLayer(UI_LAYER_NAME);
        }
    public void playDenialSong()
    {
        audioSource.PlayOneShot(beepSound);

#if UNITY_ANDROID && !UNITY_EDITOR
        toastScript.showToastOnUiThread(LocalizationText.GetText("shop toast"));
#endif
    }
    public override void OnInspectorGUI()
    {
        LocalizationText component = (LocalizationText)target;

        base.OnInspectorGUI();
        component.KeyString  = EditorGUILayout.TextField("Key String", component.KeyString);
        component.CustomFont = (UIFont)EditorGUILayout.ObjectField("Custom Font", component.CustomFont, typeof(UIFont), true);
    }
Ejemplo n.º 12
0
    static void showSigningInToast()
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        ToastMessageScript toast = new ToastMessageScript();
        toast.initialize();
        toast.showToastOnUiThread(LocalizationText.GetText("signing in"), true);
#endif
    }
Ejemplo n.º 13
0
    static void showErrorToast()
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        ToastMessageScript toast = new ToastMessageScript();
        toast.initialize();
        toast.showToastOnUiThread(LocalizationText.GetText("google sign-in error"), true);
#endif
    }
 // Token: 0x060003C5 RID: 965 RVA: 0x000116AE File Offset: 0x0000FAAE
 private void Update()
 {
     if (LocalizationText.GetLanguage() != this._language)
     {
         this._language = LocalizationText.GetLanguage();
         this.SetAllText();
     }
 }
Ejemplo n.º 15
0
 static void LocalizationTextDefaultSetting(LocalizationText lt)
 {
     lt.raycastTarget      = false;
     lt.supportRichText    = false;
     lt.alignment          = TextAnchor.MiddleCenter;
     lt.horizontalOverflow = HorizontalWrapMode.Overflow;
     lt.verticalOverflow   = VerticalWrapMode.Overflow;
 }
Ejemplo n.º 16
0
        protected override void OnEnable()
        {
            base.OnEnable();
            m_Text            = serializedObject.FindProperty("m_Text");
            m_LocalizationKey = serializedObject.FindProperty("m_LocalizationKey");
            m_FontData        = serializedObject.FindProperty("m_FontData");
            m_KeyString       = serializedObject.FindProperty("m_KeyString");

            targetComp = target as LocalizationText;
        }
Ejemplo n.º 17
0
 // Update is called once per frame
 void Update()
 {
     //You dont need to change anything here
     //if the language should have been changed it will set all texts referred in SetAllText to the new one.
     if (LocalizationText.GetLanguage() != _language)
     {
         _language = LocalizationText.GetLanguage();
         SetAllText();
     }
 }
Ejemplo n.º 18
0
 /// Called when the user stops looking on the GameObject, after OnGazeEnter
 /// was already called.
 public void OnGazeExit()
 {
     SetGazedAt(false);
     if (gameObject.name.Equals("ButtonStartRec"))
     {
         Transform        btnTransform     = gameObject.transform.Find("ApiButtonText");
         LocalizationText localizationText = btnTransform.gameObject.GetComponent <LocalizationText>();
         localizationText.UpdateKey("voice_say_content_2");
     }
 }
Ejemplo n.º 19
0
    public void startSingleplayer()
    {
        tickSound.Play();

        MenuAttributes.vsKi = true;
        //MenuAttributes.difficulty = 1; is already set in the DifficultyScript
        MenuAttributes.firstPlayerName = LocalizationText.GetText("you");

        SceneManager.LoadScene("singleplayer");
    }
Ejemplo n.º 20
0
 // Update is called once per frame
 void Update()
 {
     progressBarRef.value = Mathf.Clamp01(GameController.Instance.traveledDistance / GameController.Instance.maxDistance);
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         TwoOptionPanel.Instance.StartOptionPanel(LocalizationText.GetText("Restart"), () => { TCUtils.TCSceneTransitionHelper.Instance.StartLoadingScene(gameSceneName); },
                                                  LocalizationText.GetText("Quit"), () => { TCUtils.TCSceneTransitionHelper.Instance.StartLoadingScene(menuSceneName); }, null
                                                  );
     }
     progressText.text = ((int)(GameController.Instance.traveledDistance / showDistanceScale)) + "/" + ((int)(GameController.Instance.maxDistance / showDistanceScale));
 }
Ejemplo n.º 21
0
 public void init(LocalizationText localizationTextToUse)
 {
     localizationText = localizationTextToUse;
     // display localizedText edition
     if (localizationText != null)
     {
         EditorGUILayout.BeginHorizontal();
         displayLanguage();
         displayLanguageFields();
         EditorGUILayout.EndHorizontal();
     }
 }
Ejemplo n.º 22
0
    public override void OnInspectorGUI()
    {
        LocalizationText component = (LocalizationText)target;

        base.OnInspectorGUI();
        component.KeyString  = EditorGUILayout.TextField("Key String", component.KeyString);
        component.CustomFont = (UIFont)EditorGUILayout.ObjectField("Custom Font", component.CustomFont, typeof(UIFont), true);
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Is Open Localize", GUILayout.Width(140f));
        component.IsOpenLocalize = EditorGUILayout.Toggle(component.IsOpenLocalize);
        EditorGUILayout.EndHorizontal();
    }
Ejemplo n.º 23
0
    public void NextLanguage()
    {
        string currentLanguage = LocalizationText.GetLanguage();

        if (currentLanguage.Equals(Chinese))
        {
            InitializeLanguage(English);
        }
        else
        {
            InitializeLanguage(Chinese);
        }
    }
Ejemplo n.º 24
0
        public int GetPageNumber()
        {
            GameObject textControllObj = GameObject.Find("TextControlTip");

            if (textControllObj != null)
            {
                LocalizationText localizationText = textControllObj.GetComponent <LocalizationText>();
                return(localizationText.key == "voice_say_content" ? 0 : 2);
            }
            else
            {
                return(1);
            }
        }
 // Token: 0x060003C7 RID: 967 RVA: 0x00011708 File Offset: 0x0000FB08
 private void SetAllText()
 {
     if (this.WelcomeText != null)
     {
         this.WelcomeText.GetComponent <TextMesh>().text = LocalizationText.GetText("lblDoor111");
     }
     if (this.lblCastle != null)
     {
         this.lblCastle.GetComponent <TextMesh>().text = LocalizationText.GetText("lblCastle");
     }
     if (this.CarName != null)
     {
         this.CarName.GetComponent <TextMesh>().text = LocalizationText.GetText("CarName");
     }
 }
    public void init(LocalizationText localizationTextToUse)
    {
        localizationText = localizationTextToUse;

        if (newTexts == null || newTexts.Length != localizationText.getTextElementCount())
        {
            newTexts = new LocalizationElement[localizationText.getTextElementCount()];
            for (int i = 0; i < newTexts.Length; i++)
            {
                newTexts[i] = new LocalizationElement();
            }
        }

        displayForm();
    }
Ejemplo n.º 27
0
        private LocalizationText GetByKey(string fullKey, bool create = false)
        {
            var localizations = GetLocalizations();
            var text          = localizations.FirstOrDefault(t => t.Key == fullKey);

            if (text == null && create)
            {
                text = new LocalizationText
                {
                    Lang = _lang,
                    Key  = fullKey
                };
                DataModelContext.Set <LocalizationText>().Add(text);
            }
            return(text);
        }
Ejemplo n.º 28
0
    private void InitializeLanguage(string language)
    {
        LocalizationText.SetLanguage(language);

        foreach (var o in disableForEnglishUI)
        {
            o.SetActive(!language.Equals(English));
        }
        foreach (var o in enableForEnglishUI)
        {
            o.SetActive(language.Equals(English));
        }
        for (int i = 0; i < localizationTexts.Length; ++i)
        {
            localizationTexts[i].text = LocalizationText.GetText(textIds[i]);
        }
    }
    public void setUp()
    {
        isDimensionBought = globalDataPreserver.Instance.characterChoices.ContainsKey(sceneIndex);

        if (isDimensionBought)
        {
            equippingVisual.SetActive(true);
            buyingVisual.SetActive(false);
            equipText.text = LocalizationText.GetText("bought");
        }
        else
        {
            equippingVisual.SetActive(false);
            buyingVisual.SetActive(true);
            priceText.text = price.ToString();
        }
    }
Ejemplo n.º 30
0
    // Token: 0x060003C1 RID: 961 RVA: 0x0001160C File Offset: 0x0000FA0C
    private static void CreateContent()
    {
        XmlDocument xmlDocument = new XmlDocument();

        xmlDocument.LoadXml(Resources.Load("LocalizationText").ToString());
        if (xmlDocument == null)
        {
            Console.WriteLine("Couldnt Load Xml");
            return;
        }
        if (LocalizationText._content != null)
        {
            LocalizationText._content.Clear();
        }
        XmlNode xNode = xmlDocument.ChildNodes.Item(1).ChildNodes.Item(0);

        LocalizationText.AddContent(xNode);
    }