Exemple #1
0
 public static void SetTextHook(ref string text, object __instance)
 {
     if (TranslationHooksEnabled)
     {
         text = DynamicTranslator.Translate(text, __instance);
     }
 }
Exemple #2
0
 public static void TextPropertyHook(ref string value, object __instance)
 {
     if (TranslationHooksEnabled)
     {
         value = DynamicTranslator.Translate(value, __instance);
     }
 }
Exemple #3
0
        public static void LoadSpriteHook(ref Image image)
        {
            var go    = image.gameObject;
            var path  = GameObjectUtils.AbsoluteTransform(go);
            var scene = go.scene.name;

            DynamicTranslator.TranslateImage(image, path, scene);
        }
Exemple #4
0
        public static bool SetCursorHook(ref Texture2D texture)
        {
            var scene = "Cursors";

            DynamicTranslator.RegisterTexture(texture, string.Empty, scene);
            DynamicTranslator.ReplaceTexture(texture, string.Empty, scene);
            return(true);
        }
Exemple #5
0
        public static void DoSpriteSwapHook(ref Selectable __instance, ref Sprite newSprite)
        {
            if (newSprite == null)
            {
                newSprite = __instance.image.sprite;
            }
            var go    = __instance.gameObject;
            var path  = GameObjectUtils.AbsoluteTransform(go);
            var scene = go.scene.name;

            DynamicTranslator.RegisterTexture(newSprite, path, scene);
            DynamicTranslator.ReplaceTexture(ref newSprite, path, scene);
        }
Exemple #6
0
 public static bool RegisterGraphicForCanvasHook(ref Canvas c, ref Graphic graphic)
 {
     if (graphic)
     {
         var go = graphic.gameObject;
         if (go == null)
         {
             return(true);
         }
         DynamicTranslator.TranslateComponents(go);
     }
     return(true);
 }
Exemple #7
0
 public static void SetTextHook3(ref string text, object __instance)
 {
     if (TranslationHooksEnabled)
     {
         TranslationHooksEnabled = false;
         try
         {
             text = DynamicTranslator.Translate(text, __instance);
         }
         finally
         {
             TranslationHooksEnabled = true;
         }
     }
 }
Exemple #8
0
 public static void SetTextHook2(ref StringBuilder text, object __instance)
 {
     if (TranslationHooksEnabled)
     {
         TranslationHooksEnabled = false;
         try
         {
             text = new StringBuilder(DynamicTranslator.Translate(text.ToString(), __instance));
         }
         finally
         {
             TranslationHooksEnabled = true;
         }
     }
 }
Exemple #9
0
 public static void TextPropertyHook2(ref string value, object __instance)
 {
     if (TranslationHooksEnabled)
     {
         TranslationHooksEnabled = false;
         try
         {
             value = DynamicTranslator.Translate(value, __instance);
         }
         finally
         {
             TranslationHooksEnabled = true;
         }
     }
 }
Exemple #10
0
 public static void OnEnableHook(Text __instance)
 {
     if (TranslationHooksEnabled)
     {
         TranslationHooksEnabled = false;
         try
         {
             var newText = DynamicTranslator.Translate(__instance.text, __instance);
             if (newText != null)
             {
                 __instance.text = newText;
             }
         }
         finally
         {
             TranslationHooksEnabled = true;
         }
     }
 }
Exemple #11
0
 public static void SetTextHook(ref string text)
 {
     text = DynamicTranslator.Translate(text);
 }
Exemple #12
0
 public static void TextPropertyHook(ref string value)
 {
     value = DynamicTranslator.Translate(value);
 }