Exemplo n.º 1
0
        public void Awake()
        {
            DontDestroyOnLoad(this);

            MethodInfo processAndRequestMethod = typeof(UILabel).GetMethod("ProcessAndRequest");

            processAndRequest = label => processAndRequestMethod?.Invoke(label, null);

            Memory    = new TranslationMemory(DataPath);
            Clipboard = gameObject.AddComponent <Clipboard>();
            Subtitles = gameObject.AddComponent <Subtitles>();

            InitConfig();

            Memory.LoadTranslations();

            TranslationHooks.TranslateText    += OnTranslateString;
            TranslationHooks.AssetTextureLoad += OnAssetTextureLoad;
            TranslationHooks.ArcTextureLoad   += OnTextureLoad;
            TranslationHooks.SpriteLoad       += OnTextureLoad;
            TranslationHooks.ArcTextureLoaded += OnArcTextureLoaded;
            TranslationHooks.TranslateGraphic += OnTranslateGraphic;
            TranslationHooks.PlaySound        += OnPlaySound;
            TranslationHooks.GetOppositePair  += OnGetOppositePair;
            TranslationHooks.GetOriginalText  += OnGetOriginalText;
            Logger.WriteLine("Hooking complete");
        }
Exemplo n.º 2
0
        public void Awake()
        {
            DontDestroyOnLoad(this);

            if (!Directory.Exists(DataPath))
            {
                Directory.CreateDirectory(DataPath);
            }

            ConfigPath = Path.Combine(DataPath, "IMGUITranslationLoader.ini");

            Preferences = !File.Exists(ConfigPath) ? new IniFile() : IniFile.FromFile(ConfigPath);

            Memory = new TranslationMemory(DataPath);

            InitConfig();

            Memory.LoadTranslations();

            TranslationHooks.Translate = Translate;
            Logger.WriteLine("Hooking complete");
        }