|
| 1 | +using EasyERPExplorer.Renderer; |
| 2 | +using ERPLoader; |
| 3 | +using ImGuiNET; |
| 4 | +using System.Diagnostics; |
| 5 | + |
| 6 | +namespace EasyERPExplorer.Windows |
| 7 | +{ |
| 8 | + class InfoWindow : ImGuiDrawWindow |
| 9 | + { |
| 10 | + private bool ShowSettingsWindow = false; |
| 11 | + private bool ShowLicenseWindow = false; |
| 12 | + private bool ShowAuthorWindow = false; |
| 13 | + private bool ShowAppInfoWindow = false; |
| 14 | + |
| 15 | + public override void Draw() |
| 16 | + { |
| 17 | + if (ImGui.BeginMainMenuBar()) |
| 18 | + { |
| 19 | + if (ImGui.BeginMenu("Settings")) |
| 20 | + { |
| 21 | + ImGui.MenuItem("View/Edit", null, ref ShowSettingsWindow); |
| 22 | + ImGui.EndMenu(); |
| 23 | + } |
| 24 | + |
| 25 | + if (ImGui.BeginMenu("About")) |
| 26 | + { |
| 27 | + ImGui.MenuItem("License", null, ref ShowLicenseWindow); |
| 28 | + ImGui.MenuItem("Author", null, ref ShowAuthorWindow); |
| 29 | + ImGui.MenuItem("EasyERPMod", null, ref ShowAppInfoWindow); |
| 30 | + ImGui.EndMenu(); |
| 31 | + } |
| 32 | + |
| 33 | + ImGui.EndMainMenuBar(); |
| 34 | + } |
| 35 | + |
| 36 | + if (ShowSettingsWindow && ImGui.Begin("Settings", ImGuiWindowFlags.AlwaysAutoResize)) |
| 37 | + { |
| 38 | + if (ImGui.Button("Save")) |
| 39 | + { |
| 40 | + Settings.Instance.SaveSettings(); |
| 41 | + } |
| 42 | + ImGui.SameLine(); |
| 43 | + if (ImGui.Button("Close")) |
| 44 | + { |
| 45 | + ShowSettingsWindow = false; |
| 46 | + } |
| 47 | + ImGui.Separator(); |
| 48 | + |
| 49 | + if (ImGui.BeginCombo("Font size", $"{Settings.Instance.ExplorerSettings.FontSize + 12}px")) |
| 50 | + { |
| 51 | + for (short i = 0; i < ImGuiController.Fonts.Count; i++) |
| 52 | + { |
| 53 | + if (ImGui.Selectable($"{i + 12}px")) |
| 54 | + { |
| 55 | + Settings.Instance.ExplorerSettings.FontSize = i; |
| 56 | + } |
| 57 | + } |
| 58 | + |
| 59 | + ImGui.EndCombo(); |
| 60 | + } |
| 61 | + |
| 62 | + ImGui.End(); |
| 63 | + } |
| 64 | + |
| 65 | + if (ShowLicenseWindow && ImGui.Begin("License", ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoCollapse)) |
| 66 | + { |
| 67 | + string license = @"Copyright (C) 2021 Duc Nguyen |
| 68 | +
|
| 69 | +This program is free software: you can redistribute it and/or modify |
| 70 | +it under the terms of the GNU General Public License as published by |
| 71 | +the Free Software Foundation, either version 3 of the License, or |
| 72 | +(at your option) any later version. |
| 73 | +
|
| 74 | +This program is distributed in the hope that it will be useful, |
| 75 | +but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 76 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 77 | +GNU General Public License for more details. |
| 78 | +
|
| 79 | +You should have received a copy of the GNU General Public License |
| 80 | +along with this program. If not, see <https://www.gnu.org/licenses/>."; |
| 81 | + |
| 82 | + ImGui.Text(license); |
| 83 | + if (ImGui.Button("Close")) |
| 84 | + { |
| 85 | + ShowLicenseWindow = false; |
| 86 | + } |
| 87 | + } |
| 88 | + |
| 89 | + if (ShowAuthorWindow && ImGui.Begin("Author", ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoCollapse)) |
| 90 | + { |
| 91 | + ImGui.Text("Hi, I'm Tom. A developer who cannot find a job then get too bored and create apps for fun."); ImGui.NewLine(); |
| 92 | + ImGui.Text("For now, that's all :)"); |
| 93 | + |
| 94 | + ImGui.NewLine(); |
| 95 | + if (ImGui.Button("Close")) |
| 96 | + { |
| 97 | + ShowAuthorWindow = false; |
| 98 | + } |
| 99 | + } |
| 100 | + |
| 101 | + if (ShowAppInfoWindow && ImGui.Begin("EasyERPMod", ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoCollapse)) |
| 102 | + { |
| 103 | + string version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString(3); |
| 104 | + ImGui.BulletText("EasyERPMod version " + version); |
| 105 | + ImGui.NewLine(); |
| 106 | + ImGui.Text("The app is created to help simplify modding process for F1 games using Ego Engine Modding."); |
| 107 | + if (ImGui.Button("GitHub")) |
| 108 | + { |
| 109 | + Process.Start("https://github.com/ducng99/EasyERPMod"); |
| 110 | + } |
| 111 | + ImGui.SameLine(); |
| 112 | + if (ImGui.Button("RaceDepartment")) |
| 113 | + { |
| 114 | + Process.Start("https://www.racedepartment.com/downloads/easyerpmod-make-modding-easier.44824/"); |
| 115 | + } |
| 116 | + |
| 117 | + ImGui.Separator(); |
| 118 | + if (ImGui.Button("Close")) |
| 119 | + { |
| 120 | + ShowAppInfoWindow = false; |
| 121 | + } |
| 122 | + } |
| 123 | + } |
| 124 | + } |
| 125 | +} |
0 commit comments