Exemplo n.º 1
0
        private void UpdateText(LocaleText localeText)
        {
            var labelsParent = transform.Find("LoadConfirmPanel/Label");

            labelsParent.Find("Headline").GetComponent <Text>().text             = localeText.labels.Headline;
            labelsParent.Find("Title").GetComponent <Text>().text                = localeText.labels.Title;
            labelsParent.Find("Version").GetComponent <Text>().text              = localeText.labels.Version;
            labelsParent.Find("Author").GetComponent <Text>().text               = localeText.labels.Author;
            labelsParent.Find("Contact").GetComponent <Text>().text              = localeText.labels.Contact;
            labelsParent.Find("Reference").GetComponent <Text>().text            = localeText.labels.Reference;
            labelsParent.Find("PermissionAct").GetComponent <Text>().text        = localeText.labels.PermissionAct;
            labelsParent.Find("PermissionViolent").GetComponent <Text>().text    = localeText.labels.PermissionViolent;
            labelsParent.Find("PermissionSexual").GetComponent <Text>().text     = localeText.labels.PermissionSexual;
            labelsParent.Find("PermissionCommercial").GetComponent <Text>().text = localeText.labels.PermissionCommercial;
            labelsParent.Find("PermissionOther").GetComponent <Text>().text      = localeText.labels.PermissionOther;
            labelsParent.Find("DistributionLicense").GetComponent <Text>().text  = localeText.labels.DistributionLicense;
            labelsParent.Find("DistributionOther").GetComponent <Text>().text    = localeText.labels.DistributionOther;

            transform.Find("LoadConfirmPanel/BtnLoad/Text").GetComponent <Text>().text   = localeText.buttons.BtnLoad;
            transform.Find("LoadConfirmPanel/BtnCancel/Text").GetComponent <Text>().text = localeText.buttons.BtnCancel;

            var ui = gameObject.GetComponent <VRMPreviewUI>();

            ui.SetSelectionText(localeText.selections);
        }
Exemplo n.º 2
0
    /// <summary>
    /// 各UI要素に指定言語のテキストを適用
    /// </summary>
    /// <param name="localeText"></param>
    private void UpdateText(LocaleText localeText)
    {
        if (localeText == null || !targetTransform)
        {
            return;
        }

        var transforms = targetTransform.GetComponentsInChildren <Transform>(true);

        SetText(ref transforms, "TransparentToggle", localeText.labels.Transparent);
        SetText(ref transforms, "TopmostToggle", localeText.labels.Topmost);
        SetText(ref transforms, "MaximizeToggle", localeText.labels.Maximize);
        SetText(ref transforms, "ZoomModeDropdown", localeText.labels.ZoomMode);
        SetText(ref transforms, "LanguageDropdown", localeText.labels.Language);
        SetText(ref transforms, "MotionDropdown", localeText.labels.Motion);
        SetText(ref transforms, "MotionModeText", localeText.labels.Motion);
        SetText(ref transforms, "MotionToggleRandom", localeText.labels.Random);
        SetText(ref transforms, "FaceDropdown", localeText.labels.Face);
        SetText(ref transforms, "FaceModeText", localeText.labels.Face);
        SetText(ref transforms, "FaceToggleRandom", localeText.labels.Random);

        SetText(ref transforms, "OpenButton", localeText.buttons.Open);
        SetText(ref transforms, "QuitButton", localeText.buttons.Quit);
        SetText(ref transforms, "NextButton", localeText.buttons.Next);
        SetText(ref transforms, "BackButton", localeText.buttons.Back);

        SetText(ref transforms, "TabButtonModel", localeText.buttons.TabButtonModel);
        SetText(ref transforms, "TabButtonMotion", localeText.buttons.TabButtonMotion);
        SetText(ref transforms, "TabButtonConfig", localeText.buttons.TabButtonConfig);
    }
        public async void SetLocale(string lang = "en")
        {
            var path = Application.streamingAssetsPath + "/VRMLoaderUI/i18n/" + lang + ".json";

#if UNITY_WEBGL
            UnityWebRequest uwr = UnityWebRequest.Get(path);
            await uwr.SendWebRequest();

            if (uwr.isNetworkError || uwr.isHttpError)
            {
                throw new System.Exception("Cannot local file:" + path);
            }

            var json = System.Text.Encoding.UTF8.GetString(uwr.downloadHandler.data, 3, uwr.downloadHandler.data.Length - 3);
#else
            if (!File.Exists(path))
            {
                return;
            }
            var json = File.ReadAllText(path);
#endif
            _localeText = JsonUtility.FromJson <LocaleText>(json);

            UpdateText(_localeText);
        }
Exemplo n.º 4
0
        public void SetLocale(string lang = "en")
        {
            var path = Application.streamingAssetsPath + "/VRMLoaderUI/i18n/" + lang + ".json";

            StartCoroutine(GetJson(path, callback =>
            {
                var json    = System.Text.Encoding.UTF8.GetString(callback, 3, callback.Length - 3);
                _localeText = JsonUtility.FromJson <LocaleText>(json);
                UpdateText(_localeText);
            }));
        }
Exemplo n.º 5
0
        public void SetLocale(string lang = "en")
        {
            var path = Application.streamingAssetsPath + "/VRMLoaderUI/i18n/" + lang + ".json";

            if (!File.Exists(path))
            {
                return;
            }
            var json = File.ReadAllText(path);

            _localeText = JsonUtility.FromJson <LocaleText>(json);

            UpdateText(_localeText);
        }