Ejemplo n.º 1
0
        public static bool OnGetSeedButton(out Button result, ref Button[] buttons, string str)
        {
            StringTranslationEventArgs args = new StringTranslationEventArgs
            {
                Text = str,
                Type = StringType.Unknown
            };

            GetOppositePair?.Invoke(null, args);

            string other = args.Translation;

            foreach (Button button in buttons)
            {
                Text text = button.GetComponentInChildren <Text>();
                if (text.text != str && (other == null || text.text != other))
                {
                    continue;
                }
                result = button;
                return(true);
            }
            result = null;
            return(false);
        }
        public static void OnYotogiKagHitRet(YotogiKagManager manager)
        {
            var args = new StringTranslationEventArgs {
                Text = manager.kag.GetText()
            };

            YotogiKagSubtitleCaptured?.Invoke(null, args);
        }
        public static void OnGetSeedType(ref string str)
        {
            var args = new StringTranslationEventArgs {
                Text = str, Type = StringType.Unknown
            };

            GetOriginalText?.Invoke(null, args);

            if (!string.IsNullOrEmpty(args.Translation))
            {
                str = args.Translation;
            }
        }
        public static void OnTranslateConstText(int tag, ref string text)
        {
            var args = new StringTranslationEventArgs {
                Text = text, Type = (StringType)tag
            };

            TranslateText?.Invoke(null, args);

            if (!string.IsNullOrEmpty(args.Translation))
            {
                text = args.Translation;
            }
        }
        public static void OnTranslateText(int tag, UILabel label, ref string text)
        {
            var args = new StringTranslationEventArgs {
                Text = label.text, TextContainer = label, Type = (StringType)tag
            };

            TranslateText?.Invoke(null, args);

            if (string.IsNullOrEmpty(args.Translation))
            {
                return;
            }
            text = args.Translation;
            label.useFloatSpacing = false;
            label.spacingX        = -1;
        }