Exemplo n.º 1
0
        public void Update()
        {
            if (Input.GetKeyDown(KeyCode.KeypadEnter))
            {
                Logger.WriteLine("Reloading config");
                ReloadConfig();
                InitConfig();
                if (Settings.EnableStringReload)
                {
                    Logger.WriteLine("Reloading translations");
                    Memory.LoadTranslations();
                }
                // TODO: Enable full translation reloading?

                /*
                 * This is quite hard, as IMGUI renders everything immediately, and most of the objects that contain the GUI texts are removed almost instantly.
                 * Keeping track of all GUIContent that should be reloaded will vastly reduce the performance.
                 * Moreover, keepig track of a GUIContent does not guarantee that it is actually being used anymore (remember that GUI refreshes almost every frame).
                 * Testing the life cycle phase of an object is just too performance heavy for this real-time plug-in.
                 *
                 * As of this writing we will just leave full translation reloading alone.
                 * Until there's a better suggestion as to how it should be done, that is.
                 */
                //TranslateExisting();
            }
        }
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");
        }