예제 #1
0
        public TranslateTextInfo GetTextInfo(TranslateLanguage targetLanguage, TranslateLanguage defaultLanguage)
        {
            // 該当する言語を取得
            foreach (var info in m_TranslateTextInfos)
            {
                if (info == null)
                {
                    continue;
                }

                if (info.Language == targetLanguage)
                {
                    return(info);
                }
            }

            // もし該当しなければデフォルト言語を取得
            foreach (var info in m_TranslateTextInfos)
            {
                if (info == null)
                {
                    continue;
                }

                if (info.Language == defaultLanguage)
                {
                    return(info);
                }
            }

            // それでも該当しなければ null を返す
            return(null);
        }
        public IEnumerator TransitionOut()
        {
            _glitchView.SetAnalogNoiseIntensity = 1f;

            var count = 0f;

            while (true)
            {
                if (count >= TransitionOutTime)
                {
                    break;
                }
                count += Time.deltaTime;
                var num = Mathf.CeilToInt(TransitionOutTime - count);
                if (num <= 0)
                {
                    continue;
                }
                _textCountDown.text = $"{TranslateLanguage.NumberToGorilla(num)}";
                _glitchView.SetAnalogNoiseIntensity = (1f - (count / TransitionOutTime));
                yield return(null);
            }

            _glitchView.SetAnalogNoiseIntensity = 0f;
            yield break;
        }
예제 #3
0
 public int Translate(out TranslatedMessage translatedMessage, string text,
                      TranslateLanguage destinationLanguage, TranslateLanguage sourceLanguage = TranslateLanguage.None,
                      TranslateType type = TranslateType.Chat, ProfanityType profanity = ProfanityType.Off,
                      bool postProfanity = false, int timeout = 0)
 {
     return(Translate(out translatedMessage, text, GetTranslatedLanguage(destinationLanguage),
                      GetTranslatedLanguage(sourceLanguage), type, profanity, postProfanity, timeout));
 }
예제 #4
0
            public override void OnInspectorGUI()
            {
                base.OnInspectorGUI();

                EditorGUILayout.Space();
                m_GeneratePath = EditorGUILayout.TextField("Generate Path", m_GeneratePath);

                if (string.IsNullOrEmpty(m_GeneratePath))
                {
                    m_GeneratePath = "Assets/Constant/";
                }
                else
                {
                    string firstDirectory = m_GeneratePath;
                    int    idx            = m_GeneratePath.IndexOf("/");

                    if (idx >= 0)
                    {
                        firstDirectory = m_GeneratePath.Substring(0, idx);
                    }

                    if (firstDirectory != "Assets")
                    {
                        m_GeneratePath = "Assets" + m_GeneratePath.Replace(firstDirectory, "");
                    }
                }

                EditorGUILayout.Space();

                if (GUILayout.Button("Constantize TextSet Key"))
                {
                    if (!CanGenerate())
                    {
                        Debug.LogError("It cannot Constantize textSet key now!");
                        return;
                    }

                    if (ConstantizeTextSetKeys(target as TranslateManager))
                    {
                        EditorUtility.DisplayDialog("TranslateManager", "定数化が成功しました", "OK");
                    }
                    else
                    {
                        EditorUtility.DisplayDialog("TranslateManager", "定数化が失敗しました", "OK");
                    }
                }

                EditorGUILayout.Space();

                m_TargetLanguage = (TranslateLanguage)EditorGUILayout.EnumPopup("Change Target Language", m_TargetLanguage);

                if (GUILayout.Button("Change Language"))
                {
                    (target as TranslateManager).ChangeTranslateLanguage(m_TargetLanguage);
                }
            }
예제 #5
0
        public void ChangeTranslateLanguage(TranslateLanguage newLanguage)
        {
            if (newLanguage == m_CurrentTranslateLanguage)
            {
                return;
            }

            m_CurrentTranslateLanguage = newLanguage;

            EventUtility.SafeInvokeUnityEvent(m_OnChangeTranslateLanguage);
        }
예제 #6
0
        /// <summary>
        /// Returns true if ComAdobeCqSocialTranslationImplTranslationServiceConfigManagerProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of ComAdobeCqSocialTranslationImplTranslationServiceConfigManagerProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComAdobeCqSocialTranslationImplTranslationServiceConfigManagerProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     TranslateLanguage == other.TranslateLanguage ||
                     TranslateLanguage != null &&
                     TranslateLanguage.Equals(other.TranslateLanguage)
                     ) &&
                 (
                     TranslateDisplay == other.TranslateDisplay ||
                     TranslateDisplay != null &&
                     TranslateDisplay.Equals(other.TranslateDisplay)
                 ) &&
                 (
                     TranslateAttribution == other.TranslateAttribution ||
                     TranslateAttribution != null &&
                     TranslateAttribution.Equals(other.TranslateAttribution)
                 ) &&
                 (
                     TranslateCaching == other.TranslateCaching ||
                     TranslateCaching != null &&
                     TranslateCaching.Equals(other.TranslateCaching)
                 ) &&
                 (
                     TranslateSmartRendering == other.TranslateSmartRendering ||
                     TranslateSmartRendering != null &&
                     TranslateSmartRendering.Equals(other.TranslateSmartRendering)
                 ) &&
                 (
                     TranslateCachingDuration == other.TranslateCachingDuration ||
                     TranslateCachingDuration != null &&
                     TranslateCachingDuration.Equals(other.TranslateCachingDuration)
                 ) &&
                 (
                     TranslateSessionSaveInterval == other.TranslateSessionSaveInterval ||
                     TranslateSessionSaveInterval != null &&
                     TranslateSessionSaveInterval.Equals(other.TranslateSessionSaveInterval)
                 ) &&
                 (
                     TranslateSessionSaveBatchLimit == other.TranslateSessionSaveBatchLimit ||
                     TranslateSessionSaveBatchLimit != null &&
                     TranslateSessionSaveBatchLimit.Equals(other.TranslateSessionSaveBatchLimit)
                 ));
        }
예제 #7
0
        public TextSet GetTextSet(string key, TranslateLanguage targetLanguage)
        {
            if (string.IsNullOrEmpty(key))
            {
                return(null);
            }

            TranslateTextSet translateSet = null;

            foreach (var info in m_TranslaterTextSets)
            {
                if (info == null)
                {
                    continue;
                }

                if (info.TextSetKey == key)
                {
                    translateSet = info;
                    break;
                }
            }

            if (translateSet == null)
            {
                return(null);
            }

            var translateSetInfo = translateSet.GetTextInfo(m_CurrentTranslateLanguage, m_DefaultLanguage);

            if (translateSetInfo == null)
            {
                return(null);
            }

            if (translateSetInfo.UseDefaultTextSet)
            {
                var defaultSetInfo = m_DefaultTextSet.GetTextInfo(m_CurrentTranslateLanguage, m_DefaultLanguage);

                if (defaultSetInfo == null)
                {
                    return(translateSetInfo.TextSet);
                }

                defaultSetInfo.TextSet.Text = translateSetInfo.TextSet.Text;
                return(defaultSetInfo.TextSet);
            }

            return(translateSetInfo.TextSet);
        }
예제 #8
0
        public int GetIDFromLanguage(TranslateLanguage language)
        {
            switch (language)
            {
            case TranslateLanguage.English:
                return(0);

            case TranslateLanguage.Japanese:
                return(1);

            case TranslateLanguage.ChineseSimplified:
                return(2);

            case TranslateLanguage.ChineseTraditional:
                return(3);

            case TranslateLanguage.French:
                return(4);

            case TranslateLanguage.Italian:
                return(5);

            case TranslateLanguage.German:
                return(6);

            case TranslateLanguage.Korean:
                return(7);

            case TranslateLanguage.Portuguese:
                return(8);

            case TranslateLanguage.Russian:
                return(9);

            case TranslateLanguage.Spanish:
                return(10);

            case TranslateLanguage.Hindi:
                return(11);

            default:
                return(-1);
            }
        }
예제 #9
0
        public static string GetTranslatedLanguage(TranslateLanguage language)
        {
            if (language == TranslateLanguage.None)
            {
                return("");
            }

            if (language == TranslateLanguage.zh_cn)
            {
                return("zh-CN");
            }

            if (language == TranslateLanguage.zh_tw)
            {
                return("zh-TW");
            }

            return(language.ToString("G"));
        }
예제 #10
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (TranslateLanguage != null)
         {
             hashCode = hashCode * 59 + TranslateLanguage.GetHashCode();
         }
         if (TranslateDisplay != null)
         {
             hashCode = hashCode * 59 + TranslateDisplay.GetHashCode();
         }
         if (TranslateAttribution != null)
         {
             hashCode = hashCode * 59 + TranslateAttribution.GetHashCode();
         }
         if (TranslateCaching != null)
         {
             hashCode = hashCode * 59 + TranslateCaching.GetHashCode();
         }
         if (TranslateSmartRendering != null)
         {
             hashCode = hashCode * 59 + TranslateSmartRendering.GetHashCode();
         }
         if (TranslateCachingDuration != null)
         {
             hashCode = hashCode * 59 + TranslateCachingDuration.GetHashCode();
         }
         if (TranslateSessionSaveInterval != null)
         {
             hashCode = hashCode * 59 + TranslateSessionSaveInterval.GetHashCode();
         }
         if (TranslateSessionSaveBatchLimit != null)
         {
             hashCode = hashCode * 59 + TranslateSessionSaveBatchLimit.GetHashCode();
         }
         return(hashCode);
     }
 }
예제 #11
0
 public void SetTotalBanana()
 => _textBananaCount.text = TranslateLanguage.NumberToGorilla(_gameLoop.PlayerData.BananaCount.Value);
예제 #12
0
 public static void SetTranslateLanguage(TranslateLanguage translateLanguage)
 {
     PlayerPrefs.SetInt("translateLanguage", (int)translateLanguage);
 }
예제 #13
0
 public int SetTranslatedLanguage(TranslateLanguage targetLanguage, int timeout = 0)
 {
     return(SetTranslatedLanguage(GetTranslatedLanguage(targetLanguage), timeout));
 }
예제 #14
0
 //===========================[ Set Translated Languag ]=========================//
 public bool SetTranslatedLanguage(DoneDelegate callback, TranslateLanguage targetLanguage, int timeout = 0)
 {
     return(SetTranslatedLanguage(callback, GetTranslatedLanguage(targetLanguage), timeout));
 }
예제 #15
0
 public int Login(out bool ok, string token, Dictionary <string, string> attr, TranslateLanguage language = TranslateLanguage.None, int timeout = 0)
 {
     return(Login(out ok, token, attr, GetTranslatedLanguage(language), timeout));
 }
예제 #16
0
 public bool Login(AuthDelegate callback, string token, Dictionary <string, string> attr, TranslateLanguage language = TranslateLanguage.None, int timeout = 0)
 {
     return(Login(callback, token, attr, GetTranslatedLanguage(language), timeout));
 }