public void OnGUI() { try { if (Event.current.type != EventType.KeyUp) { return; } if (!Event.current.alt) { return; } switch (Event.current.keyCode) { case KeyCode.F1: TranslateConfig.Reload(); Resource.Reload(); ReTranslation(); Logger.Log(LogLevel.Info, $"Config reloaded."); break; case KeyCode.F5: TranslateConfig.IsDumpingText = !TranslateConfig.IsDumpingText; Logger.Log(LogLevel.Info, $"Dumping text {(TranslateConfig.IsDumpingText ? "Enabled" : "Disabled")}."); break; case KeyCode.F6: TranslateConfig.IsDumpingTexture = !TranslateConfig.IsDumpingTexture; Logger.Log(LogLevel.Info, $"Dumping texture {(TranslateConfig.IsDumpingTexture ? "Enabled" : "Disabled")}."); break; case KeyCode.F7: TranslateConfig.IsDumpingUI = !TranslateConfig.IsDumpingUI; Logger.Log(LogLevel.Info, $"Dumping ui {(TranslateConfig.IsDumpingUI ? "Enabled" : "Disabled")}."); break; case KeyCode.F8: TranslateConfig.IsDumpingSprite = !TranslateConfig.IsDumpingSprite; Logger.Log(LogLevel.Info, $"Dumping sprite {(TranslateConfig.IsDumpingSprite ? "Enabled" : "Disabled")}."); break; case KeyCode.F9: Dumper.DumpResource(CurrentScene); break; case KeyCode.F10: Dumper.DumpObjects(CurrentScene); break; } } catch (Exception ex) { Logger.Log(LogLevel.Error, ex); throw; } }
public ResourceDumper(TranslateConfig config) { _config = config; Directory.CreateDirectory(TextDumpDir); Directory.CreateDirectory(TextureDumpDir); Directory.CreateDirectory(UiDumpDir); Directory.CreateDirectory(SpriteDumpDir); Directory.CreateDirectory(ResourceDumpDir); Directory.CreateDirectory(ObjectDumpDir); }
public MaidTranslate() { try { TranslateConfig = new TranslateConfig(Config); Dumper = new ResourceDumper(TranslateConfig); Resource = new TranslationResource(); HookCenter.TextTranslation += OnTextTranslation; HookCenter.ArcTextureTranslation += OnArcTextureTranslation; HookCenter.ArcTextureLoaded += OnArcTextureLoaded; HookCenter.SpriteTextureTranslation += OnSpriteTextureTranslation; HookCenter.UITextureTranslation += OnUITextureTranslation; SceneManager.sceneLoaded += OnSceneLoaded; } catch (Exception ex) { Logger.Log(LogLevel.Error, ex); throw; } }