void Open(params string[] files) { if (files.Length <= 0) { return; } if (files.Length == 1) { recents.FileOpened(files[0]); } var lastFile = Path.GetFileName(files.Last()); Title = $"{lastFile} - ThnPlayer"; Audio.ReleaseAllSfx(); toReload = files; decompiled = files.Select(x => new DecompiledThn() { Name = Path.GetFileName(x), Text = ThnDecompile.Decompile(x) }).ToArray(); var ctx = new ThnScriptContext(null); cutscene = new Cutscene(ctx, GameData, new Rectangle(0, 0, Width, Height), this); cutscene.BeginScene(files.Select(x => new ThnScript(x))); }
void Open(params string[] files) { var lastFile = Path.GetFileName(files.Last()); Title = $"{lastFile} - ThnPlayer"; Audio.ReleaseAllSfx(); toReload = files; decompiled = files.Select(x => new DecompiledThn() { Name = Path.GetFileName(x), Text = ThnDecompile.Decompile(x) }).ToArray(); var ctx = new ThnScriptContext(files.Select(x => new ThnScript(x))); cutscene = new Cutscene(ctx, GameData, new Viewport(0, 0, Width, Height), this); }
protected override void Draw(double elapsed) { VertexBuffer.TotalDrawcalls = 0; EnableTextInput(); Viewport.Replace(0, 0, Width, Height); RenderState.ClearColor = new Color4(0.2f, 0.2f, 0.2f, 1f); RenderState.ClearAll(); // if (cutscene != null) { cutscene.Draw(); } // guiHelper.NewFrame(elapsed); ImGui.PushFont(ImGuiHelper.Noto); bool openLoad = false; //Main Menu ImGui.BeginMainMenuBar(); if (ImGui.BeginMenu("File")) { if (Theme.IconMenuItem("Load Game Data", "open", Color4.White, true)) { var folder = FileDialog.ChooseFolder(); if (folder != null) { if (GameConfig.CheckFLDirectory(folder)) { openLoad = true; LoadData(folder); } else { //Error dialog } } } if (Theme.IconMenuItem("Open Thn", "open", Color4.White, GameData != null)) { var file = FileDialog.Open(); if (file != null) { var script = new ThnScript(file); var ctx = new ThnScriptContext(new[] { script }); cutscene = new Cutscene(ctx, GameData, new Viewport(0, 0, Width, Height), this); } } if (Theme.IconMenuItem("Quit", "quit", Color4.White, true)) { Exit(); } ImGui.EndMenu(); } var h = ImGui.GetWindowHeight(); ImGui.EndMainMenuBar(); bool popupopen = true; if (openLoad) { ImGui.OpenPopup("Loading"); openLoad = false; } popupopen = true; if (ImGui.BeginPopupModal("Loading", ref popupopen, ImGuiWindowFlags.AlwaysAutoResize)) { if (loaded) { ImGui.CloseCurrentPopup(); } ImGuiExt.Spinner("##spinner", 10, 2, ImGuiNative.igGetColorU32(ImGuiCol.ButtonHovered, 1)); ImGui.SameLine(); ImGui.Text("Loading"); ImGui.EndPopup(); } ImGui.PopFont(); guiHelper.Render(RenderState); }