public static unsafe void TintGlyphs(byte *data, int atlasWidth, int atlasHeight, ImFontPtr font) { foreach (var t in tints) { var glyph = ImGuiExt.igFontFindGlyph(font.NativePtr, t.Item1); var color = t.Item2; var offx = (int)(glyph->U0 * atlasWidth); var width = (int)(glyph->U1 * atlasWidth) - offx; var offy = (int)(glyph->V0 * atlasHeight); var height = (int)(glyph->V1 * atlasHeight) - offy; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { var offset = ((offy + y) * atlasWidth + offx + x) * 4; var r = data[offset + 2] / 255f; var g = data[offset + 1] / 255f; var b = data[offset] / 255f; r *= color.R; g *= color.G; b *= color.B; data[offset + 2] = (byte)(r * 255f); data[offset + 1] = (byte)(g * 255f); data[offset] = (byte)(b * 255f); } } } }
void DrawPlaybackControl() { ImGuiWindowFlags window_flags = ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoSavedSettings | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoMove; Vector2 window_pos = new Vector2(Screen.width / 2, Screen.height - 10.0f); Vector2 window_pos_pivot = new Vector2(0.5f, 1.0f); ImGui.SetNextWindowPos(window_pos, ImGuiCond.Always, window_pos_pivot); ImGui.SetNextWindowBgAlpha(0.35f); ImGui.SetNextWindowSize(new Vector2(Screen.width / 2, 0)); ImGui.Begin("Playback Control", window_flags); { var len = 0.0f; if (ass.clip != null) { len = ass.clip.length; } ImGuiExt.TextCenter($"{currentTime:0.00}/{len:0.00}"); if (ImGuiExt.ButtonCenter(ass.isPlaying ? "ll" : " > ")) { TogglePlaystate(); } ImGui.SetNextItemWidth(Screen.width / 2); if (ImGui.SliderFloat("", ref currentTime, 0, len)) { ass.time = currentTime; } } ImGui.End(); }
public void ModelTab() { ImGui.BeginChild("##tabinner"); if (ImGui.Button("Add")) { modelSelector = new FileSelector(context.FlDirectory); modelSelector.Filter = FileSelector.MakeFilter(".3db", ".cmp"); modelSelector.Open(); } string newfile; if ((newfile = modelSelector.Draw()) != null) { var name = Path.GetFileName(newfile); resources.Models.Add(new InterfaceModel() { Name = name, Path = newfile }); } ImGui.Columns(2); ImGui.BeginChild("##items"); for (int i = 0; i < resources.Models.Count; i++) { if (ImGui.Selectable(ImGuiExt.IDWithExtra(resources.Models[i].Name, i.ToString()), _selModelIndex == i)) { _selModelIndex = i; drawable = context.GetModel(resources.Models[i].Path); modelName.SetText(resources.Models[i].Name); } } ImGui.EndChild(); ImGui.NextColumn(); ImGui.BeginChild("##pane"); if (_selModelIndex >= 0 && _selModelIndex < resources.Models.Count) { var mdl = resources.Models[_selModelIndex]; ImGui.SameLine(ImGui.GetColumnWidth() - 65); if (ImGui.Button("Delete")) { resources.Models.RemoveAt(_selModelIndex); _selModelIndex = -1; } ImGui.AlignTextToFramePadding(); ImGui.Text("Name: "); ImGui.SameLine(); modelName.InputText("##Name", ImGuiInputTextFlags.None); mdl.Name = modelName.GetText(); ImGui.Text($"Path: {mdl.Path}"); ImGui.InputFloat("Offset X", ref mdl.X); ImGui.InputFloat("Offset Y", ref mdl.Y); ImGui.InputFloat("Scale X", ref mdl.XScale); ImGui.InputFloat("Scale Y", ref mdl.YScale); DoViewport(mdl); } ImGui.EndChild(); ImGui.EndChild(); }
public override void Draw() { //Main Window Contents if (propertiesOpen && !statePlaying) { ImGui.Columns(2, "##alecolumns", true); if (firstProperties) { ImGui.SetColumnWidth(0, 300); firstProperties = false; } ImGui.BeginChild("##leftpanel"); DoProperties(); ImGui.EndChild(); ImGui.NextColumn(); } if (TabHandler.VerticalTab("Properties", propertiesOpen)) { propertiesOpen = !propertiesOpen; } //Viewport ImGui.SameLine(); ImGui.BeginChild("##maincontent"); var totalH = ImGui.GetWindowHeight(); ImGuiExt.SplitterV(2f, ref h1, ref h2, 8, 8, -1); h1 = totalH - h2 - 24f; ImGui.BeginChild("###viewport", new Vector2(-1, h1), false, ImGuiWindowFlags.None); if (validXml) { DoViewport(mainWindow.RenderDelta); } else { ImGui.Text(exceptionText); } ImGui.EndChild(); //Text ImGui.BeginChild("###text", new Vector2(-1, h2), false, ImGuiWindowFlags.None); xmlEditor.Render("##texteditor"); if (xmlEditor.TextChanged()) { TextChanged(); } var coords = xmlEditor.GetCoordinates(); editingObject = null; if (validXml) { editingObject = FindEditingObject(coords.Y + 1, coords.X + 1); } ImGui.EndChild(); ImGui.EndChild(); }
void DrawKeyframesEditor() { ImGui.SetNextWindowPos(new Vector2(Screen.width - 10, 30), ImGuiCond.Once, new Vector2(1.0f, 0.0f)); ImGui.SetNextWindowSize(new Vector2(350, Screen.height - 125), ImGuiCond.Once); ImGui.Begin("KeyFrames", ImGuiWindowFlags.NoSavedSettings); { ImGui.BeginGroup(); ImGui.BeginChild("Left", new Vector2(100, -ImGui.GetFrameHeightWithSpacing()), true); { for (int i = 0; i < activeObject.KeyFrames.Count; i++) { var kf = activeObject.KeyFrames[i]; if (ImGui.Selectable($"{i}: {kf.Time:0.00}s", activeObject.SelectKeyFrameIndex == i)) { activeObject.SelectKeyFrameIndex = i; } } } ImGui.EndChild(); if (ImGui.Button("+")) { UpdateOrNewKeyframe(); } if (activeObject.KeyFrames.Count > 0) { ImGui.SameLine(); if (ImGui.Button("-")) { activeObject.KeyFrames.RemoveAt(activeObject.SelectKeyFrameIndex); } } ImGui.EndGroup(); ImGui.SameLine(); if (activeObject.KeyFrames.Count > 0 && activeObject.SelectedKeyFrame != null) { var kf = activeObject.SelectedKeyFrame; ImGui.BeginGroup(); ImGui.BeginChild("Keyframe prop", new Vector2(0, 0), true); float step = 0.1f; float step_fast = 0.5f; if (ImGuiExt.InputScalarFloat("Time", ImGuiDataType.Float, ref kf._time, ref step, ref step_fast, "%.2f", ImGuiInputTextFlags.None)) { // to raise the event then sort the keyframes kf.Time = kf._time; activeObject.SelectKeyFrameIndex = activeObject.KeyFrames.IndexOf(kf); } bool modified = false; if (ImGui.DragFloat3("Position", ref kf.Position)) { modified = true; } if (ImGui.DragFloat3("Rotation", ref kf.Rotation)) { modified = true; } if (!activeObject.IsCamera) { if (ImGui.DragFloat3("Scale", ref kf.Scale)) { modified = true; } if (ImGui.ColorPicker4("Color", ref kf.Color)) { modified = true; } } ImGui.Spacing(); ImGui.Spacing(); ImGui.Combo("Mode", ref kf.InterpolationMode, Easings.interpolationModes, Easings.interpolationModes.Length); if (ImGui.Button("Jump to")) { ass.time = kf.Time; currentTime = kf.Time; modified = true; } if (currentTime != kf.Time) { if (ImGui.Button("Duplicate")) { var newKey = new KeyFrame { Time = currentTime, Position = kf.Position, Rotation = kf.Rotation }; if (!activeObject.IsCamera) { newKey.Scale = kf.Scale; newKey.Color = kf.Color; } activeObject.KeyFrames.Add(newKey); activeObject.SelectKeyFrameIndex = activeObject.KeyFrames.IndexOf(newKey); } } if (modified) { UpdateAll(); } ImGui.EndChild(); ImGui.EndGroup(); } } ImGui.End(); }
public void ColorTab() { ImGui.BeginChild("##tabinner"); if (ImGui.Button("Add")) { resources.Colors.Add(new InterfaceColor() { Name = "Color" + resources.Colors.Count, Color = Color4.White }); } ImGui.Separator(); ImGui.Columns(2); ImGui.BeginChild("##items"); for (int i = 0; i < resources.Colors.Count; i++) { if (ImGui.Selectable(ImGuiExt.IDWithExtra(resources.Colors[i].Name, i.ToString()), _selColIndex == i)) { _selColIndex = i; colorName.SetText(resources.Colors[i].Name); } } ImGui.EndChild(); ImGui.NextColumn(); ImGui.BeginChild("##pane"); if (_selColIndex >= 0 && _selColIndex < resources.Colors.Count) { var clr = resources.Colors[_selColIndex]; ImGui.SameLine(ImGui.GetColumnWidth() - 65); if (ImGui.Button("Delete")) { resources.Colors.RemoveAt(_selColIndex); _selColIndex = -1; } ImGui.Separator(); ImGui.AlignTextToFramePadding(); ImGui.Text("Name: "); ImGui.SameLine(); colorName.InputText("##Name", ImGuiInputTextFlags.None); clr.Name = colorName.GetText(); if (clr.Animation == null) { ColorPickerSimple(clr); if (ImGui.Button("Make Animated")) { clr.Animation = new InterfaceColorAnimation() { Color1 = clr.Color }; } } else { ColorPickerAnimated(clr); if (ImGui.Button("Make Simple")) { clr.Color = clr.Animation.Color1; clr.Animation = null; } } } ImGui.EndChild(); ImGui.EndChild(); }
public void ImageTab() { ImGui.BeginChild("##tabinner"); if (ImGui.Button("Add Normal")) { resources.Images.Add(new InterfaceImage() { Name = "Image" + resources.Images.Count }); } ImGui.SameLine(); if (ImGui.Button("Add Triangle")) { resources.Images.Add(new InterfaceImage() { Name = "Image" + resources.Images.Count, Type = InterfaceImageKind.Triangle }); } ImGui.Separator(); ImGui.Columns(2); ImGui.BeginChild("##items"); for (int i = 0; i < resources.Images.Count; i++) { if (ImGui.Selectable(ImGuiExt.IDWithExtra(resources.Images[i].Name, i.ToString()), _selTexIndex == i)) { _selTexIndex = i; imageName.SetText(resources.Images[i].Name); imageId.SetText(resources.Images[i].TexName ?? ""); } } ImGui.EndChild(); ImGui.NextColumn(); ImGui.BeginChild("##pane"); if (_selTexIndex >= 0 && _selTexIndex < resources.Images.Count) { var img = resources.Images[_selTexIndex]; ImGui.SameLine(ImGui.GetColumnWidth() - 65); if (ImGui.Button("Delete")) { resources.Images.RemoveAt(_selTexIndex); _selTexIndex = -1; } ImGui.Separator(); var ft2 = context.ResourceManager.FindTexture(img.TexName) as Texture2D; if (foundTexture != ft2) { if (foundTexture != null) { ImGuiHelper.DeregisterTexture(foundTexture); } foundTexture = ft2; if (ft2 != null) { foundTextureId = ImGuiHelper.RegisterTexture(foundTexture); } } ImGui.AlignTextToFramePadding(); ImGui.Text("Name: "); ImGui.SameLine(); imageName.InputText("##Name", ImGuiInputTextFlags.None); img.Name = imageName.GetText(); ImGui.AlignTextToFramePadding(); ImGui.Text("Texture: "); ImGui.SameLine(); imageId.InputText("##Texture", ImGuiInputTextFlags.None); img.TexName = imageId.GetText(); if (img.Type != InterfaceImageKind.Triangle) { bool flip = img.Flip; ImGui.Checkbox("Flip", ref flip); img.Flip = flip; } //DRAW. No controls below here DoImagePreview(img); } ImGui.EndChild(); ImGui.EndChild(); }
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 (world != null) { if (wireFrame) { RenderState.Wireframe = true; } world.Renderer.Draw(); RenderState.Wireframe = false; } // guiHelper.NewFrame(elapsed); ImGui.PushFont(ImGuiHelper.Noto); //Main Menu ImGui.BeginMainMenuBar(); if (ImGui.BeginMenu("File")) { if (Theme.IconMenuItem("Open", "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("Quit", "quit", Color4.White, true)) { Exit(); } ImGui.EndMenu(); } if (world != null) { if (ImGui.MenuItem("Change System (F6)")) { sysIndex = sysIndexLoaded; openChangeSystem = true; } } if (ImGui.BeginMenu("View")) { if (ImGui.MenuItem("Debug Text", "", showDebug, true)) { showDebug = !showDebug; } if (ImGui.MenuItem("Wireframe", "", wireFrame, true)) { wireFrame = !wireFrame; } if (ImGui.MenuItem("Infocard", "", infocardOpen, true)) { infocardOpen = !infocardOpen; } if (ImGui.MenuItem("VSync", "", vSync, true)) { vSync = !vSync; SetVSync(vSync); } ImGui.EndMenu(); } var h = ImGui.GetWindowHeight(); ImGui.EndMainMenuBar(); //Other Windows if (world != null) { if (showDebug) { ImGui.SetNextWindowPos(new Vector2(0, h), ImGuiCond.Always, Vector2.Zero); ImGui.Begin("##debugWindow", ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoBringToFrontOnFocus); ImGui.Text(string.Format(DEBUG_TEXT, curSystem.Name, curSystem.Nickname, camera.Position.X, camera.Position.Y, camera.Position.Z, DebugDrawing.SizeSuffix(GC.GetTotalMemory(false)), (int)Math.Round(RenderFrequency), VertexBuffer.TotalDrawcalls, VertexBuffer.TotalBuffers)); ImGui.End(); } ImGui.SetNextWindowSize(new Vector2(100, 100), ImGuiCond.FirstUseEver); if (infocardOpen) { if (ImGui.Begin("Infocard", ref infocardOpen)) { var szX = Math.Max(20, ImGui.GetWindowWidth()); var szY = Math.Max(20, ImGui.GetWindowHeight()); if (icard == null) { icard = new InfocardControl(this, systemInfocard, szX); } icard.Draw(szX); } ImGui.End(); } } //dialogs must be children of window or ImGui default "Debug" window appears if (openChangeSystem) { ImGui.OpenPopup("Change System"); openChangeSystem = false; } bool popupopen = true; if (ImGui.BeginPopupModal("Change System", ref popupopen, ImGuiWindowFlags.AlwaysAutoResize)) { ImGui.Combo("System", ref sysIndex, systems, systems.Length); if (ImGui.Button("Ok")) { if (sysIndex != sysIndexLoaded) { camera.UpdateProjection(); camera.Free = false; camera.Zoom = 5000; Resources.ClearTextures(); curSystem = GameData.GetSystem(systems[sysIndex]); systemInfocard = GameData.GetInfocard(curSystem.Infocard, fontMan); if (icard != null) { icard.SetInfocard(systemInfocard); } GameData.LoadAllSystem(curSystem); world.LoadSystem(curSystem, Resources); sysIndexLoaded = sysIndex; } ImGui.CloseCurrentPopup(); } ImGui.SameLine(); if (ImGui.Button("Cancel")) { ImGui.CloseCurrentPopup(); } ImGui.EndPopup(); } if (openLoad) { ImGui.OpenPopup("Loading"); openLoad = false; } popupopen = true; if (ImGui.BeginPopupModal("Loading", ref popupopen, ImGuiWindowFlags.AlwaysAutoResize)) { if (world != null) { ImGui.CloseCurrentPopup(); } ImGuiExt.Spinner("##spinner", 10, 2, ImGuiNative.igGetColorU32(ImGuiCol.ButtonHovered, 1)); ImGui.SameLine(); ImGui.Text("Loading"); ImGui.EndPopup(); } ImGui.PopFont(); guiHelper.Render(RenderState); }
public string Draw() { bool pOpen = true; ImGui.SetNextWindowSize(new Vector2(300, 300), ImGuiCond.FirstUseEver); if (ImGui.BeginPopupModal(ImGuiExt.IDWithExtra("File Selector", unique), ref pOpen)) { bool hasFilename = fileNameSelected >= 0 && fileNameSelected < fileNames.Length; string selected = hasFilename ? fileNames[fileNameSelected] : "None"; ImGui.Text($"Selected: {selected}"); ImGui.SameLine(); if (ImGuiExt.Button("Open", hasFilename)) { ImGui.CloseCurrentPopup(); return(BuildFullPath(fileNames[fileNameSelected])); } ImGui.SameLine(); if (ImGui.Button("Cancel")) { ImGui.CloseCurrentPopup(); } ImGui.Separator(); if (ImGui.Button("/")) { pathBar = new List <string>(); Populate(); } ImGui.SameLine(); for (int i = 0; i < pathBar.Count; i++) { if (ImGui.Button(ImGuiExt.IDWithExtra(pathBar[i], i))) { pathBar = pathBar.Take(i + 1).ToList(); Populate(); } ImGui.SameLine(); } ImGui.Dummy(new Vector2(1, 1)); ImGui.BeginChild("##currentDir", new Vector2(-1, -1), true); for (int i = 0; i < directoryNames.Length; i++) { IconSelectable( ImGuiExt.IDWithExtra(directoryNames[i], i), "folder", Color4.White, false, out bool doubleClicked ); if (doubleClicked) { pathBar.Add(directoryNames[i]); Populate(); } } for (int i = 0; i < fileNames.Length; i++) { if (IconSelectable( ImGuiExt.IDWithExtra(fileNames[i], -i), "file", Color4.White, fileNameSelected == i, out bool doubleClicked)) { fileNameSelected = i; } if (doubleClicked) { ImGui.CloseCurrentPopup(); return(BuildFullPath(fileNames[fileNameSelected])); } } ImGui.EndChild(); ImGui.EndPopup(); } return(null); }
public void Open() { Populate(); ImGui.OpenPopup(ImGuiExt.IDWithExtra("File Selector", unique)); }
private void DrawHotbar(RaptureHotbarModule *hotbarModule, HotBar *hotbar) { ImGui.Columns(8); ImGuiExt.SetColumnWidths(35); ImGui.Text($"##"); ImGui.NextColumn(); ImGui.Text("Command"); ImGui.NextColumn(); ImGui.Text("Icon"); ImGui.NextColumn(); ImGui.Text("Name"); ImGui.NextColumn(); ImGui.Text("Cooldown"); ImGui.NextColumn(); ImGuiExt.NextRow(); ImGui.Separator(); ImGui.Separator(); for (var i = 0; i < 16; i++) { var slot = hotbar->Slot[i]; if (slot == null) { break; } if (slot->CommandType == HotbarSlotType.Empty) { ImGui.PushStyleColor(ImGuiCol.Text, slot->CommandType == HotbarSlotType.Empty ? 0x99999999 : 0xFFFFFFFF); DebugManager.ClickToCopyText($"{i+1:00}", $"{(ulong)slot:X}"); ImGui.NextColumn(); ImGui.Text("Empty"); ImGui.PopStyleColor(); ImGuiExt.NextRow(); ImGui.Separator(); continue; } var adjustedId = slot->CommandType == HotbarSlotType.Action ? ActionManager.Instance()->GetAdjustedActionId(slot->CommandId) : slot->CommandId; DebugManager.ClickToCopyText($"{i+1:00}", $"{(ulong)slot:X}"); ImGui.NextColumn(); ImGui.Text($"{slot->CommandType} : {slot->CommandId}"); if (slot->CommandType == HotbarSlotType.Action) { ImGui.Text($"Adjusted: {adjustedId}"); } ImGui.NextColumn(); var iconGood = false; if (slot->Icon >= 0) { var icon = Plugin.IconManager.GetIconTexture(slot->Icon % 1000000, slot->Icon >= 1000000); if (icon != null) { ImGui.Image(icon.ImGuiHandle, new Vector2(32)); iconGood = true; } } if (!iconGood) { ImGui.GetWindowDrawList().AddRect(ImGui.GetCursorScreenPos(), ImGui.GetCursorScreenPos() + new Vector2(32), 0xFF0000FF, 4); ImGui.GetWindowDrawList().AddText(ImGui.GetCursorScreenPos(), 0xFFFFFFFF, $"{slot->Icon}"); ImGui.Dummy(new Vector2(32)); } ImGui.SameLine(); ImGui.Text($"{slot->IconTypeA} : {slot->IconA}\n{slot->IconTypeB} : {slot->IconB}"); ImGui.NextColumn(); switch (slot->CommandType) { case HotbarSlotType.Empty: { break; } case HotbarSlotType.Action: { var action = Service.Data.Excel.GetSheet <Action>().GetRow(slot->CommandId); if (action == null) { ImGui.TextDisabled("Not Found"); } else { ImGui.TextWrapped($"{action.Name}"); } break; } case HotbarSlotType.Item: { var item = Service.Data.GetExcelSheet <Item>().GetRow(slot->CommandId % 500000); if (item == null) { ImGui.TextDisabled("Not Found"); } else { ImGui.TextWrapped($"{item.Name}"); } break; } case HotbarSlotType.CraftAction: { var action = Service.Data.GetExcelSheet <CraftAction>().GetRow(slot->CommandId); if (action == null) { ImGui.TextDisabled("Not Found"); } else { ImGui.TextWrapped($"{action.Name}"); } break; } case HotbarSlotType.GeneralAction: { var action = Service.Data.GetExcelSheet <GeneralAction>().GetRow(slot->CommandId); if (action == null) { ImGui.TextDisabled("Not Found"); } else { ImGui.TextWrapped($"{action.Name}"); } break; } case HotbarSlotType.MainCommand: { var action = Service.Data.GetExcelSheet <MainCommand>().GetRow(slot->CommandId); if (action == null) { ImGui.TextDisabled("Not Found"); } else { ImGui.TextWrapped($"{action.Name}"); } break; } case HotbarSlotType.ExtraCommand: { var rawSheet = Service.Data.Excel.GetSheetRaw("ExtraCommand"); var parser = rawSheet.GetRowParser(slot->CommandId); var name = parser.ReadColumn <SeString>(0); ImGui.Text($"{name}"); break; } case HotbarSlotType.GearSet: { var gearsetModule = RaptureGearsetModule.Instance(); var gearset = gearsetModule->Gearset[(int)slot->CommandId]; ImGui.Text($"{Encoding.UTF8.GetString(gearset->Name, 0x2F)}"); break; } case HotbarSlotType.Macro: { ImGui.Text($"{(slot->CommandId >= 256 ? "Shared" : "Individual")} #{slot->CommandId%256}"); break; } case HotbarSlotType.Emote: { ImGui.Text($"{Service.Data.Excel.GetSheet<Emote>().GetRow(slot->CommandId)?.Name ?? "Invalid"}"); break; } case HotbarSlotType.EventItem: { var item = Service.Data.GetExcelSheet <EventItem>().GetRow(slot->CommandId); if (item == null) { ImGui.TextDisabled("Not Found"); } else { ImGui.TextWrapped($"{item.Name}"); } break; } case HotbarSlotType.Mount: { var m = Service.Data.Excel.GetSheet <Mount>().GetRow(slot->CommandId); if (m == null) { ImGui.TextDisabled("Not Found"); } else { ImGui.TextWrapped($"{m.Singular}"); } break; } case HotbarSlotType.Minion: { var m = Service.Data.Excel.GetSheet <Companion>().GetRow(slot->CommandId); if (m == null) { ImGui.TextDisabled("Not Found"); } else { ImGui.TextWrapped($"{m.Singular}"); } break; } default: { ImGui.TextDisabled("Name Not Supprorted"); break; } } ImGui.NextColumn(); var cooldownGroup = -1; switch (slot->CommandType) { case HotbarSlotType.Action: { var action = Service.Data.Excel.GetSheet <Action>().GetRow((uint)adjustedId); if (action == null) { ImGui.TextDisabled("Not Found"); break; } cooldownGroup = action.CooldownGroup; break; } case HotbarSlotType.Item: { var item = Service.Data.Excel.GetSheet <Item>().GetRow(slot->CommandId); if (item == null) { ImGui.TextDisabled("Not Found"); break; } var cdg = ActionManager.Instance()->GetRecastGroup(2, slot->CommandId); if (cdg < 81) { cooldownGroup = (int)(cdg + 1); } break; } case HotbarSlotType.GeneralAction: { var action = Service.Data.Excel.GetSheet <GeneralAction>().GetRow(slot->CommandId); if (action?.Action == null) { ImGui.TextDisabled("Not Found"); break; } cooldownGroup = ActionManager.Instance()->GetRecastGroup(5, slot->CommandId); break; } } if (cooldownGroup > 0) { ImGui.Text($"Cooldown Group: {cooldownGroup}"); var cooldown = ActionManager.Instance()->GetRecastGroupDetail(cooldownGroup); DebugManager.ClickToCopyText($"{(ulong)cooldown:X}"); if (cooldown != null) { ImGui.Text($"{cooldown->IsActive} / {cooldown->Elapsed} / {cooldown->Total}"); } else { ImGui.Text("Failed"); } } ImGuiExt.NextRow(); ImGui.Separator(); } ImGui.Columns(); }
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); }
protected override void Draw(double elapsed) { VertexBuffer.TotalDrawcalls = 0; EnableTextInput(); RenderContext.ReplaceViewport(0, 0, Width, Height); RenderContext.ClearColor = new Color4(0.2f, 0.2f, 0.2f, 1f); RenderContext.ClearAll(); // if (world != null) { if (wireFrame) { RenderContext.Wireframe = true; } world.Renderer.Draw(); RenderContext.Wireframe = false; } // guiHelper.NewFrame(elapsed); ImGui.PushFont(ImGuiHelper.Noto); //Main Menu ImGui.BeginMainMenuBar(); if (ImGui.BeginMenu("File")) { if (Theme.IconMenuItem(Icons.Open, "Open", true)) { var folder = FileDialog.ChooseFolder(); if (folder != null) { if (GameConfig.CheckFLDirectory(folder)) { openLoad = true; LoadData(folder); } else { //Error dialog } } } if (Theme.IconMenuItem(Icons.Quit, "Quit", true)) { Exit(); } ImGui.EndMenu(); } if (world != null) { if (ImGui.MenuItem("Change System (F6)")) { sysIndex = sysIndexLoaded; openChangeSystem = true; } } if (ImGui.BeginMenu("View")) { if (ImGui.MenuItem("Debug Text", "", showDebug, true)) { showDebug = !showDebug; } if (ImGui.MenuItem("Wireframe", "", wireFrame, true)) { wireFrame = !wireFrame; } if (ImGui.MenuItem("Infocard", "", infocardOpen, true)) { infocardOpen = !infocardOpen; } if (ImGui.MenuItem("Universe Map", "", universeOpen, true)) { universeOpen = !universeOpen; } if (ImGui.MenuItem("Controls", "", controlsOpen, true)) { controlsOpen = !controlsOpen; } if (ImGui.MenuItem("VSync", "", vSync, true)) { vSync = !vSync; SetVSync(vSync); } ImGui.EndMenu(); } var h = ImGui.GetWindowHeight(); ImGui.EndMainMenuBar(); //Other Windows if (camera != null && controlsOpen) { if (ImGui.Begin("Controls", ref controlsOpen)) { ImGui.Text("WSAD - Movement"); ImGui.Text("Arrow Keys - Rotation"); ImGui.SliderFloat("Move Speed", ref camera.MoveSpeed, 1, 12000); if (ImGui.Button(LOWSPEED.ToString())) { camera.MoveSpeed = LOWSPEED; } ImGui.SameLine(); if (ImGui.Button(MEDSPEED.ToString())) { camera.MoveSpeed = MEDSPEED; } ImGui.SameLine(); if (ImGui.Button(HIGHSPEED.ToString())) { camera.MoveSpeed = HIGHSPEED; } ImGui.End(); } } if (world != null) { if (showDebug) { ImGui.SetNextWindowPos(new Vector2(0, h), ImGuiCond.Always, Vector2.Zero); ImGui.Begin("##debugWindow", ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoBringToFrontOnFocus); ImGui.Text(string.Format(DEBUG_TEXT, curSystem.Name, curSystem.Nickname, camera.Position.X, camera.Position.Y, camera.Position.Z, DebugDrawing.SizeSuffix(GC.GetTotalMemory(false)), (int)Math.Round(RenderFrequency), VertexBuffer.TotalDrawcalls, VertexBuffer.TotalBuffers)); ImGui.End(); } if (infocardOpen) { ImGui.SetNextWindowSize(new Vector2(300, 300), ImGuiCond.FirstUseEver); if (ImGui.Begin("Infocard", ref infocardOpen)) { var szX = Math.Max(20, ImGui.GetWindowWidth()); var szY = Math.Max(20, ImGui.GetWindowHeight()); if (icard == null) { icard = new InfocardControl(this, systemInfocard, szX); } icard.Draw(szX); ImGui.End(); } } if (universeOpen) { ImGui.SetNextWindowSize(new Vector2(300, 300), ImGuiCond.FirstUseEver); if (ImGui.Begin("Map", ref universeOpen)) { ImGui.BeginTabBar("##maptabs"); if (ImGui.BeginTabItem("Universe")) { var szX = Math.Max(20, ImGui.GetWindowWidth()); var szY = Math.Max(20, ImGui.GetWindowHeight() - 50); string result = UniverseMap.Draw(universeBackgroundRegistered, GameData, (int)szX, (int)szY, 20); if (result != null) { for (int i = 0; i < systems.Length; i++) { if (result.Equals(systems[i], StringComparison.OrdinalIgnoreCase)) { sysIndex = i; ChangeSystem(); break; } } } ImGui.EndTabItem(); } if (ImGui.BeginTabItem("System")) { var szX = Math.Max(20, ImGui.GetWindowWidth()); var szY = Math.Max(20, ImGui.GetWindowHeight() - 70); systemMap.Draw((int)szX, (int)szY, elapsed); ImGui.EndTabItem(); } ImGui.EndTabBar(); ImGui.End(); } } } //dialogs must be children of window or ImGui default "Debug" window appears if (openChangeSystem) { ImGui.OpenPopup("Change System"); openChangeSystem = false; } bool popupopen = true; if (ImGui.BeginPopupModal("Change System", ref popupopen, ImGuiWindowFlags.AlwaysAutoResize)) { ImGui.Combo("System", ref sysIndex, systems, systems.Length); if (ImGui.Button("Ok")) { ChangeSystem(); ImGui.CloseCurrentPopup(); } ImGui.SameLine(); if (ImGui.Button("Cancel")) { ImGui.CloseCurrentPopup(); } ImGui.EndPopup(); } if (openLoad) { ImGui.OpenPopup("Loading"); openLoad = false; } popupopen = true; if (ImGui.BeginPopupModal("Loading", ref popupopen, ImGuiWindowFlags.AlwaysAutoResize)) { if (world != null) { ImGui.CloseCurrentPopup(); } ImGuiExt.Spinner("##spinner", 10, 2, ImGui.GetColorU32(ImGuiCol.ButtonHovered, 1)); ImGui.SameLine(); ImGui.Text("Loading"); ImGui.EndPopup(); } ImGui.PopFont(); guiHelper.Render(RenderContext); }
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(); } Typewriter.Render(); // guiHelper.NewFrame(elapsed); ImGui.PushFont(ImGuiHelper.Noto); bool openLoad = false; bool openMultiple = false; isMultipleOpen = 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) { Open(file); } } if (Theme.IconMenuItem("Open Multiple", "open", Color4.White, GameData != null)) { openFiles = new List <string>(); openMultiple = true; } if (Theme.IconMenuItem("Quit", "quit", Color4.White, true)) { Exit(); } ImGui.EndMenu(); } if (ImGui.BeginMenu("View")) { ImGui.MenuItem("Decompiled", "", ref decompiledOpen); ImGui.EndMenu(); } if (toReload != null && ImGui.MenuItem("Reload (F5)")) { Reload(); } 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, ImGui.GetColorU32(ImGuiCol.ButtonHovered, 1)); ImGui.SameLine(); ImGui.Text("Loading"); ImGui.EndPopup(); } popupopen = true; if (openMultiple) { ImGui.OpenPopup("Open Multiple"); } if (ImGui.BeginPopupModal("Open Multiple", ref popupopen, ImGuiWindowFlags.AlwaysAutoResize)) { isMultipleOpen = true; if (ImGui.Button("+")) { var file = FileDialog.Open(); if (file != null) { openFiles.Add(file); } } ImGui.BeginChild("##files", new Vector2(200, 200), true, ImGuiWindowFlags.HorizontalScrollbar); int j = 0; foreach (var f in openFiles) { ImGui.Selectable(ImGuiExt.IDWithExtra(f, j++)); } ImGui.EndChild(); if (ImGuiExt.Button("Open", openFiles.Count > 0)) { ImGui.CloseCurrentPopup(); Open(openFiles.ToArray()); } } if (decompiled != null) { if (decompiledOpen) { ImGui.SetNextWindowSize(new Vector2(300, 300), ImGuiCond.FirstUseEver); int j = 0; if (ImGui.Begin("Decompiled", ref decompiledOpen)) { ImGui.BeginTabBar("##tabs", ImGuiTabBarFlags.Reorderable); foreach (var file in decompiled) { var tab = ImGuiExt.IDWithExtra(file.Name, j++); if (ImGui.BeginTabItem(tab)) { if (ImGui.Button("Copy")) { SetClipboardText(file.Text); } ImGui.SetNextItemWidth(-1); var th = ImGui.GetWindowHeight() - 100; ImGui.PushFont(ImGuiHelper.SystemMonospace); ImGui.InputTextMultiline("##src", ref file.Text, uint.MaxValue, new Vector2(0, th), ImGuiInputTextFlags.ReadOnly); ImGui.PopFont(); ImGui.EndTabItem(); } } ImGui.EndTabBar(); } } } ImGui.PopFont(); guiHelper.Render(RenderState); }
public override void Draw() { var raptureGearsetModule = RaptureGearsetModule.Instance(); ImGui.Text("RaptureGearsetModule:"); ImGui.SameLine(); DebugManager.ClickToCopyText($"{(ulong)raptureGearsetModule:X}"); ImGui.SameLine(); ImGui.Text($"{Encoding.ASCII.GetString(raptureGearsetModule->ModuleName, 15)}"); ImGui.Columns(5); ImGui.Text($"##"); ImGuiExt.SetColumnWidths(35f, 120); ImGui.NextColumn(); ImGui.Text("Address"); ImGui.NextColumn(); ImGui.Text("Name"); ImGui.NextColumn(); ImGui.Text("Items"); ImGuiExt.NextRow(); ImGui.Separator(); ImGui.Separator(); for (var i = 0; i < 101; i++) { var gearset = raptureGearsetModule->Gearset[i]; if (gearset->ID != i) { break; } if (!gearset->Flags.HasFlag(RaptureGearsetModule.GearsetFlag.Exists)) { continue; } ImGui.Text($"{gearset->ID:00}"); ImGui.NextColumn(); DebugManager.ClickToCopyText($"{(ulong) gearset:X}"); ImGui.NextColumn(); ImGui.Text(Encoding.UTF8.GetString(gearset->Name, 0x2F)); ImGui.NextColumn(); ImGui.Text("MainHand"); ImGui.SameLine(); ImGui.Text($"[{gearset->MainHand.ItemID}]"); ImGui.Text("OffHand"); ImGui.SameLine(); ImGui.Text($"[{gearset->OffHand.ItemID}]"); ImGui.Text("Head"); ImGui.SameLine(); ImGui.Text($"[{gearset->Head.ItemID}]"); ImGui.Text("Body"); ImGui.SameLine(); ImGui.Text($"[{gearset->Body.ItemID}]"); ImGui.Text("Hands"); ImGui.SameLine(); ImGui.Text($"[{gearset->Hands.ItemID}]"); ImGui.Text("Belt"); ImGui.SameLine(); ImGui.Text($"[{gearset->Belt.ItemID}]"); ImGui.Text("Legs"); ImGui.SameLine(); ImGui.Text($"[{gearset->Legs.ItemID}]"); ImGui.Text("Feet"); ImGui.SameLine(); ImGui.Text($"[{gearset->Feet.ItemID}]"); ImGui.Text("Ears"); ImGui.SameLine(); ImGui.Text($"[{gearset->Ears.ItemID}]"); ImGui.Text("Neck"); ImGui.SameLine(); ImGui.Text($"[{gearset->Neck.ItemID}]"); ImGui.Text("Wrists"); ImGui.SameLine(); ImGui.Text($"[{gearset->Wrists.ItemID}]"); ImGui.Text("RingRight"); ImGui.SameLine(); ImGui.Text($"[{gearset->RingRight.ItemID}]"); ImGui.Text("SoulStone"); ImGui.SameLine(); ImGui.Text($"[{gearset->SoulStone.ItemID}]"); ImGuiExt.NextRow(); ImGui.Separator(); } ImGui.Columns(); }
public unsafe void Draw() { bool openNew = false; if (IsOpen) { ImGui.SetNextWindowSize(new Vector2(300, 350), ImGuiCond.FirstUseEver); ImGui.Begin("Project", ref IsOpen); if (ImGui.Button("New")) { openNew = true; newFileBuffer = new byte[48]; } ImGui.BeginChild("##files", Vector2.Zero, true); for (int i = 0; i < files.Length; i++) { ImGui.Selectable(ImGuiExt.IDWithExtra(files[i], i)); if (ImGui.IsItemHovered() && ImGui.IsMouseDoubleClicked(0)) { if (files[i].EndsWith(".lua", true, CultureInfo.InvariantCulture)) { window.OpenLua(Path.Combine(folder, files[i])); } else { window.OpenXml(Path.Combine(folder, files[i])); } } } ImGui.EndChild(); ImGui.End(); } if (openNew) { ImGui.OpenPopup("New File"); } if (ImGui.BeginPopupModal("New File")) { ImGui.InputText("##filename", newFileBuffer, 48, ImGuiInputTextFlags.CallbackCharFilter, Callback); if (ImGui.Button("Ok")) { int length = 0; for (length = 0; length < 48; length++) { if (newFileBuffer[length] == 0) { break; } } if (length == 0) { ImGui.CloseCurrentPopup(); } else { var str = Encoding.UTF8.GetString(newFileBuffer, 0, length); str = str.Trim(); if (string.IsNullOrEmpty(str) || string.IsNullOrWhiteSpace(str)) { ImGui.CloseCurrentPopup(); } else { bool create = true; foreach (var f in files) { if (f.Equals(str, StringComparison.OrdinalIgnoreCase)) { create = false; break; } } if (create) { File.WriteAllText(Path.Combine(folder, str), ""); } ImGui.CloseCurrentPopup(); } } } ImGui.SameLine(); if (ImGui.Button("Cancel")) { ImGui.CloseCurrentPopup(); } } }