Example #1
0
 public static void SetTextHook(ref string text, object __instance)
 {
     if (TranslationHooksEnabled)
     {
         text = DynamicTranslator.Translate(text, __instance);
     }
 }
Example #2
0
 public static void TextPropertyHook(ref string value, object __instance)
 {
     if (TranslationHooksEnabled)
     {
         value = DynamicTranslator.Translate(value, __instance);
     }
 }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
 }
Example #7
0
 public static void SetTextHook3(ref string text, object __instance)
 {
     if (TranslationHooksEnabled)
     {
         TranslationHooksEnabled = false;
         try
         {
             text = DynamicTranslator.Translate(text, __instance);
         }
         finally
         {
             TranslationHooksEnabled = true;
         }
     }
 }
Example #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;
         }
     }
 }
Example #9
0
 public static void TextPropertyHook2(ref string value, object __instance)
 {
     if (TranslationHooksEnabled)
     {
         TranslationHooksEnabled = false;
         try
         {
             value = DynamicTranslator.Translate(value, __instance);
         }
         finally
         {
             TranslationHooksEnabled = true;
         }
     }
 }
Example #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;
         }
     }
 }
Example #11
0
 public static void SetTextHook(ref string text)
 {
     text = DynamicTranslator.Translate(text);
 }
Example #12
0
 public static void TextPropertyHook(ref string value)
 {
     value = DynamicTranslator.Translate(value);
 }