Ejemplo n.º 1
0
        /**
         * <summary>Gets the text of an ITranslatable instance, based on the game's current language.</summary>
         * <param name = "translatable">The ITranslatable instance.</param>
         * <param name = "index">The index of the ITranslatable's array of translatable text</param>
         * <returns>The translatable text.</returns>
         */
        public string GetTranslatableText(ITranslatable translatable, int index = 0)
        {
            int    language     = Options.GetLanguage();
            string originalText = translatable.GetTranslatableString(index);
            int    lineID       = translatable.GetTranslationID(index);

            return(GetTranslation(originalText, lineID, language));
        }
Ejemplo n.º 2
0
        public static void AssignIDsToTranslatable(ITranslatable translatable, int[] lineIDs, bool isInScene, bool isMonoBehaviour)
        {
            bool isModified = false;

            for (int i = 0; i < lineIDs.Length; i++)
            {
                if (translatable.GetTranslationID(i) != lineIDs[i])
                {
                    translatable.SetTranslationID(i, lineIDs[i]);
                    isModified = true;
                }
            }

            if (isModified && isMonoBehaviour)
            {
                EditorUtility.SetDirty(translatable as MonoBehaviour);
            }
        }