public unsafe bool CustomTreeNode(string label) { var style = ImGui.GetStyle(); var storage = ImGui.GetStateStorage(); uint id = ImGui.GetID(label); int opened = storage.GetInt(id, 0); float x = ImGui.GetCursorPosX(); ImGui.BeginGroup(); if (ImGui.InvisibleButton(label, new Vector2(-1, ImGui.GetFontSize() + style.FramePadding.Y * 2))) { opened = storage.GetInt(id, 0); // opened = p_opened == p_opened; } bool hovered = ImGui.IsItemHovered(); bool active = ImGui.IsItemActive(); if (hovered || active) { var col = ImGui.GetStyle().Colors[(int)(active ? ImGuiCol.HeaderActive : ImGuiCol.HeaderHovered)]; ImGui.GetWindowDrawList().AddRectFilled(ImGui.GetItemRectMin(), ImGui.GetItemRectMax(), ImGui.ColorConvertFloat4ToU32(col)); } ImGui.SameLine(); ImGui.ColorButton("color_btn", opened == 1 ? new Vector4(1, 1, 1, 1) : new Vector4(1, 0, 0, 1)); ImGui.SameLine(); ImGui.Text(label); ImGui.EndGroup(); if (opened == 1) { ImGui.TreePush(label); } return(opened != 0); }
internal void Display() { ActiveEntity = _entityState.Entity; ImGui.BeginGroup(); void ContextButton(Type T) { //Creates a context button if it is valid if (EntityUIWindows.checkIfCanOpenWindow(T, _entityState)) { bool buttonresult = ImGui.SmallButton(GlobalUIState.namesForMenus[T]); EntityUIWindows.openUIWindow(T, _entityState, _state, buttonresult, true); } } //Creates all the context buttons ContextButton(typeof(SelectPrimaryBlankMenuHelper)); ContextButton(typeof(PinCameraBlankMenuHelper)); ContextButton(typeof(RenameWindow)); ContextButton(typeof(WeaponTargetingControl)); ContextButton(typeof(CargoTransfer)); ContextButton(typeof(ColonyPanel)); ContextButton(typeof(PlanetaryWindow)); ContextButton(typeof(GotoSystemBlankMenuHelper)); ContextButton(typeof(WarpOrderWindow)); ContextButton(typeof(ChangeCurrentOrbitWindow)); ImGui.EndGroup(); }
public void Draw() { var font = ImGui.GetFont(); if (Children.Count <= 0) { DrawDelegate?.Invoke(); if (Tooltip?.Length > 0) { ImGui.SameLine(); ImGui.TextDisabled("(?)"); if (ImGui.IsItemHovered(ImGuiHoveredFlags.None)) { ImGui.SetTooltip(Tooltip); } } return; } for (var i = 0; i < 5; i++) { ImGui.Spacing(); } ImGui.BeginGroup(); var contentRegionAvail = ImGui.GetContentRegionAvail(); var firstCursorPos = ImGui.GetCursorPos().Translate(10, font.FontSize * -0.66f); ImGui.BeginChild(Unique, new Vector2(contentRegionAvail.X, font.FontSize * 2 * (Children.Count + 0.2f)), true); foreach (var child in Children) { child.Draw(); } var secondCursorPos = ImGui.GetCursorPos().Translate(0, font.FontSize); ImGui.EndChild(); ImGui.SetCursorPos(firstCursorPos); ImGui.Text(Name); if (Tooltip?.Length > 0) { ImGui.SameLine(); ImGui.TextDisabled("(?)"); if (ImGui.IsItemHovered(ImGuiHoveredFlags.None)) { ImGui.SetTooltip(Tooltip); } } ImGui.SetCursorPos(secondCursorPos); ImGui.EndGroup(); DrawDelegate?.Invoke(); }
private void DrawVersion() { if (_editMode) { ImGui.BeginGroup(); ImGui.Text("(Version "); ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, ZeroVector); ImGui.SameLine(); var version = Meta !.Version; if (ImGuiCustom.ResizingTextInput(LabelEditVersion, ref version, 16) && version != Meta.Version) { Meta.Version = version; _selector.SaveCurrentMod(); } ImGui.SameLine(); ImGui.Text(")"); ImGui.PopStyleVar(); ImGui.EndGroup(); } else if (Meta !.Version.Length > 0) { ImGui.Text($"(Version {Meta.Version})"); } }
protected void EnumCheckboxes <T>(string propertyName, T value) where T : struct, Enum { ImGui.Text(propertyName); ImGui.BeginGroup(); int intValue = Convert.ToInt32(value, CultureInfo.InvariantCulture); var powerOfTwoValues = Enum.GetValues(typeof(T)) .OfType <T>() .Select(x => (Convert.ToInt32(x, CultureInfo.InvariantCulture), x)) .Where(x => x.Item1 != 0 && (x.Item1 & (x.Item1 - 1)) == 0) .OrderBy(x => x.Item1); foreach (var(i, flag) in powerOfTwoValues) { bool isChecked = (intValue & i) != 0; ImGui.Checkbox($"{propertyName}_{flag}_{_id}", ref isChecked); if (isChecked != ((intValue & i) != 0)) { var id = Resolve <IEditorAssetManager>().GetIdForAsset(Asset); int newIntValue = isChecked ? intValue | i : intValue & ~i; var newValue = (T)Enum.ToObject(typeof(T), newIntValue); Raise(new EditorSetPropertyEvent(id, propertyName, value, newValue)); } } ImGui.EndGroup(); }
private static void AddSubtractAction(string id, float step, Action <float> action) { var save = false; ImGui.BeginGroup(); ImGui.PushButtonRepeat(true); if (ImGui.ArrowButton($"##Subtract{id}", ImGuiDir.Down)) { action(-step); save = true; } ImGui.SameLine(); if (ImGui.ArrowButton($"##Add{id}", ImGuiDir.Up)) { action(step); save = true; } ImGui.PopButtonRepeat(); ImGui.SameLine(); ImGui.TextUnformatted(id); ImGui.EndGroup(); if (!save) { return; } Cammy.Config.Save(); if (CurrentPreset == PresetManager.activePreset) { CurrentPreset.Apply(); } }
private void ShowFiles(string currentDir) { foreach (string file in Directory.GetFiles(currentDir)) { ImGui.BeginGroup(); string icon = ""; for (int i = 0; i < audiosFormat.Length; i++) { if (Path.GetExtension(file).Contains(audiosFormat[i])) { icon = Icon.FILEAUDIOO; } } for (int i = 0; i < filesFormat.Length; i++) { if (Path.GetExtension(file).Contains(filesFormat[i])) { icon = Icon.FILETEXT; } } for (int i = 0; i < imagesFormat.Length; i++) { if (Path.GetExtension(file).Contains(imagesFormat[i])) { icon = Icon.FILEIMAGEO; } } for (int i = 0; i < videoFormat.Length; i++) { if (Path.GetExtension(file).Contains(videoFormat[i])) { icon = Icon.FILEVIDEOO; } } if (!icon.Equals("")) { ImGui.PushStyleVar(ImGuiStyleVar.ButtonTextAlign, new Vector2(0f, 0.5f)); if (ImGui.Button(icon + " " + Path.GetFileName(file), new System.Numerics.Vector2(ImGui.GetContentRegionAvail().X, 25.0f))) { } ImGui.PopStyleVar(); } ImGui.EndGroup(); } }
private void DrawWebsite() { ImGui.BeginGroup(); if (_editMode) { ImGui.TextColored(GreyColor, "from"); ImGui.SameLine(); var website = Meta !.Website; if (ImGuiCustom.ResizingTextInput(LabelEditWebsite, ref website, 512) && website != Meta.Website) { Meta.Website = website; _selector.SaveCurrentMod(); } } else if (Meta !.Website.Length > 0) { if (_currentWebsite != Meta.Website) { _currentWebsite = Meta.Website; _validWebsite = Uri.TryCreate(Meta.Website, UriKind.Absolute, out var uriResult) && (uriResult.Scheme == Uri.UriSchemeHttps || uriResult.Scheme == Uri.UriSchemeHttp); } if (_validWebsite) { if (ImGui.SmallButton(ButtonOpenWebsite)) { try { var process = new ProcessStartInfo(Meta.Website) { UseShellExecute = true, }; Process.Start(process); } catch (System.ComponentModel.Win32Exception) { // Do nothing. } } if (ImGui.IsItemHovered()) { ImGui.SetTooltip(Meta.Website); } } else { ImGui.TextColored(GreyColor, "from"); ImGui.SameLine(); ImGui.Text(Meta.Website); } } ImGui.EndGroup(); }
public static void BeginGroupFrame() { var style = ImGui.GetStyle(); ImGui.BeginGroup(); ImGui.Dummy(new Vector2(0, style.FramePadding.Y)); if (style.FramePadding.X > 0) { ImGui.Indent(style.FramePadding.X); } }
private void RenderStatisticsWindow() { if (ImGui.Begin("Statistics", ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.HorizontalScrollbar)) { // set position and size of the window ImGui.SetWindowPos(new System.Numerics.Vector2((int)(0.25 * Window.Size.X), (int)(0.7 * Window.Size.Y))); ImGui.SetWindowSize(new System.Numerics.Vector2((int)(0.3 * Window.Size.X - 2), (int)(0.3 * Window.Size.Y))); if (ManipulatorHandler.Count > 0) { var quarterWidth = 0.25f * ImGui.GetWindowContentRegionWidth(); int selectedIndex = -1; ImGui.PushStyleVar(ImGuiStyleVar.ChildRounding, 5); if (ImGui.BeginChild("ManipulatorStat", new System.Numerics.Vector2(quarterWidth, ImGui.GetContentRegionAvail().Y), true, ImGuiWindowFlags.HorizontalScrollbar)) { foreach (var manipulator in ManipulatorHandler.Manipulators) { if (ImGui.Selectable($"Manip {++selectedIndex}")) { _selectedStatIndex = selectedIndex; } } ImGui.EndChild(); } ImGui.SameLine(); ImGui.BeginGroup(); if (_selectedStatIndex != -1) { ImGui.Text($"Manipulator {_selectedStatIndex}"); ImGui.Separator(); RenderAlgorithmStatistics(ManipulatorHandler.Manipulators[_selectedStatIndex]); } ImGui.EndGroup(); } else { ImGui.Text("No manipulators on the scene."); } } }
public static bool HorizontalAlignmentSelector(string name, ref Alignment selectedAlignment, VerticalAlignment verticalAlignment = VerticalAlignment.Middle) { var changed = false; ImGui.PushStyleVar(ImGuiStyleVar.FrameBorderSize, 2); ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.One); ImGui.PushID(name); ImGui.BeginGroup(); ImGui.PushFont(UiBuilder.IconFont); var alignments = verticalAlignment switch { VerticalAlignment.Top => new[] { Alignment.TopLeft, Alignment.Top, Alignment.TopRight }, VerticalAlignment.Bottom => new[] { Alignment.BottomLeft, Alignment.Bottom, Alignment.BottomRight }, _ => new[] { Alignment.Left, Alignment.Center, Alignment.Right }, }; ImGui.PushStyleColor(ImGuiCol.Border, selectedAlignment == alignments[0] ? 0xFF00A5FF: 0x0); if (ImGui.Button($"{(char) FontAwesomeIcon.AlignLeft}##{name}")) { selectedAlignment = alignments[0]; changed = true; } ImGui.PopStyleColor(); ImGui.SameLine(); ImGui.PushStyleColor(ImGuiCol.Border, selectedAlignment == alignments[1] ? 0xFF00A5FF : 0x0); if (ImGui.Button($"{(char) FontAwesomeIcon.AlignCenter}##{name}")) { selectedAlignment = alignments[1]; changed = true; } ImGui.PopStyleColor(); ImGui.SameLine(); ImGui.PushStyleColor(ImGuiCol.Border, selectedAlignment == alignments[2] ? 0xFF00A5FF : 0x0); if (ImGui.Button($"{(char) FontAwesomeIcon.AlignRight}##{name}")) { selectedAlignment = alignments[2]; changed = true; } ImGui.PopStyleColor(); ImGui.PopFont(); ImGui.PopStyleVar(); ImGui.SameLine(); ImGui.Text(name); ImGui.EndGroup(); ImGui.PopStyleVar(); ImGui.PopID(); return(changed); }
private void DrawAuthor() { ImGui.BeginGroup(); ImGui.TextColored(GreyColor, "by"); ImGui.SameLine(); var author = Meta !.Author; if (ImGuiCustom.InputOrText(_editMode, LabelEditAuthor, ref author, 64) && author != Meta.Author) { Meta.Author = author; _selector.SaveCurrentMod(); } ImGui.EndGroup(); }
private void PlayerList() { ImGui.BeginChild( "###PlayerTrack_PlayerList_Child", new Vector2(205 * ImGuiHelpers.GlobalScale, 0), true); if (DateUtil.CurrentTime() > this.lastPlayerListRefresh) { this.players = this.plugin.PlayerService.GetSortedPlayers(this.searchInput); this.lastPlayerListRefresh += this.plugin.Configuration.PlayerListRefreshFrequency; } // use clipper to avoid performance hit on large player lists ImGuiListClipperPtr clipper; unsafe { clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper()); } clipper.Begin(this.players.Length); while (clipper.Step()) { for (var i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) { ImGui.BeginGroup(); var color = this.plugin.PlayerService.GetPlayerListColor(this.players[i]); ImGui.PushStyleColor(ImGuiCol.Text, color); if (ImGui.Selectable( "###PlayerTrack_Player_Selectable_" + i, this.plugin.WindowManager.Panel !.SelectedPlayer == this.players[i], ImGuiSelectableFlags.AllowDoubleClick)) { // suppress double clicks if (ImGui.IsMouseDoubleClicked(ImGuiMouseButton.Left)) { // ignored } // hide right panel if clicking same user while already open else if (this.plugin.WindowManager.Panel !.SelectedPlayer?.Key == this.players[i].Key && this.plugin.Configuration.CurrentView == View.PlayerDetail) { this.ClearSelectedPlayer(); this.plugin.WindowManager.Panel !.HidePanel(); }
private bool DrawAlignmentSelector(string name, ref Alignment selectedAlignment) { var changed = false; ImGui.PushStyleVar(ImGuiStyleVar.FrameBorderSize, 2); ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.One); ImGui.PushID(name); ImGui.BeginGroup(); ImGui.PushFont(UiBuilder.IconFont); ImGui.PushStyleColor(ImGuiCol.Border, selectedAlignment == Alignment.Left ? 0xFF00A5FF: 0x0); if (ImGui.Button($"{(char) FontAwesomeIcon.AlignLeft}##{name}")) { selectedAlignment = Alignment.Left; changed = true; } ImGui.PopStyleColor(); ImGui.SameLine(); ImGui.PushStyleColor(ImGuiCol.Border, selectedAlignment == Alignment.Center ? 0xFF00A5FF : 0x0); if (ImGui.Button($"{(char) FontAwesomeIcon.AlignCenter}##{name}")) { selectedAlignment = Alignment.Center; changed = true; } ImGui.PopStyleColor(); ImGui.SameLine(); ImGui.PushStyleColor(ImGuiCol.Border, selectedAlignment == Alignment.Right ? 0xFF00A5FF : 0x0); if (ImGui.Button($"{(char) FontAwesomeIcon.AlignRight}##{name}")) { selectedAlignment = Alignment.Right; changed = true; } ImGui.PopStyleColor(); ImGui.PopFont(); ImGui.PopStyleVar(); ImGui.SameLine(); ImGui.Text(name); ImGui.EndGroup(); ImGui.PopStyleVar(); ImGui.PopID(); return(changed); }
internal void Display() { ActiveEntity = _entityState.Entity; ImGui.BeginGroup(); if (ImGui.SmallButton("Pin Camera")) { _state.Camera.PinToEntity(_entityState.Entity); ImGui.CloseCurrentPopup(); } //if entity can move if (_entityState.Entity.HasDataBlob <PropulsionDB>()) { if (ImGui.SmallButton("Orbit")) { OrbitOrderWindow.GetInstance(_entityState).IsActive = true; _state.ActiveWindow = OrbitOrderWindow.GetInstance(_entityState); } } if (_entityState.Entity.HasDataBlob <FireControlAbilityDB>()) { if (ImGui.SmallButton("Fire Control")) { var instance = WeaponTargetingControl.GetInstance(_entityState); instance.SetOrderEntity(_entityState); instance.IsActive = true; _state.ActiveWindow = instance; } } if (ImGui.SmallButton("Rename")) { RenameWindow.GetInstance(_entityState).IsActive = true; _state.ActiveWindow = RenameWindow.GetInstance(_entityState); ImGui.CloseCurrentPopup(); } //if entity can target //if entity can mine || refine || build //econOrderwindow ImGui.EndGroup(); }
/// <inheritdoc /> public override void Draw() { if (!this.plugin.Configuration.Enabled) { ImGui.Text(Loc.Localize("PluginDisabled", "PriceCheck is disabled.")); } else { try { var items = this.plugin.PriceService.GetItems().ToList(); if (items is { Count : > 0 }) { ImGui.BeginGroup(); ImGui.Columns(2); foreach (var item in items) { if (this.plugin.Configuration.UseOverlayColors) { ImGui.TextColored(item.OverlayColor, item.ItemName); ImGui.NextColumn(); ImGui.TextColored(item.OverlayColor, item.Message); } else { ImGui.Text(item.ItemName); ImGui.NextColumn(); ImGui.Text(item.Message); } ImGui.NextColumn(); ImGui.Separator(); } ImGui.EndGroup(); if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) { ImGui.OpenPopup("###PriceCheck_Overlay_Popup"); } }
public void Draw() { if (Mods == null) { return; } // Selector pane ImGui.BeginGroup(); ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, ZeroVector); DrawModsSelectorFilter(); // Inlay selector list ImGui.BeginChild(LabelSelectorList, new Vector2(SelectorPanelWidth, -ImGui.GetFrameHeightWithSpacing()), true); if (Mods.ModSettings != null) { for (var modIndex = 0; modIndex < Mods.ModSettings.Count; modIndex++) { var settings = Mods.ModSettings[modIndex]; var modName = settings.Mod.Meta.Name; if (_modFilter.Length > 0 && !_modNamesLower ![modIndex].Contains(_modFilter))
protected void EnumRadioButtons <T>(string propertyName, T value) where T : struct, Enum { ImGui.Text(propertyName); ImGui.BeginGroup(); var enumValues = Enum.GetValues(typeof(T)).OfType <T>(); foreach (var enumValue in enumValues) { bool isSelected = Equals(value, enumValue); if (ImGui.RadioButton($"{propertyName}_{enumValue}_{_id}", isSelected)) { if (isSelected) { continue; } var id = Resolve <IEditorAssetManager>().GetIdForAsset(Asset); Raise(new EditorSetPropertyEvent(id, propertyName, value, enumValue)); } } ImGui.EndGroup(); }
public override void Render() { if (_lastKnownObjectValue != Getter()) { UpdateValue(); } ImGui.BeginGroup(); RenderLabel(); if (ImGui.InputText("##" + Label, ref _currentValue, 32, ImGuiInputTextFlags.EnterReturnsTrue)) { if (int.TryParse(_currentValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out int newValue)) { Setter(newValue); } UpdateValue(); } ImGui.PopItemWidth(); ImGui.EndGroup(); }
private void DrawTempFolder() { ImGui.SetNextItemWidth(400 * ImGuiHelpers.GlobalScale); ImGui.BeginGroup(); var save = ImGui.InputText(LabelTempFolder, ref _newTempDirectory, 255, ImGuiInputTextFlags.EnterReturnsTrue); ImGuiCustom.HoverTooltip("The folder used to store temporary meta manipulation files.\n" + "Leave this blank if you have no reason not to.\n" + "A folder 'penumbrametatmp' will be created as a subdirectory to the specified directory.\n" + "If none is specified (i.e. this is blank) this folder will be created in the root folder instead."); ImGui.SameLine(); if (ImGui.Button(LabelOpenTempFolder)) { if (!Directory.Exists(_base._modManager.TempPath.FullName) || !_base._modManager.TempWritable) { return; } Process.Start(new ProcessStartInfo(_base._modManager.TempPath.FullName) { UseShellExecute = true, }); } ImGui.EndGroup(); if (_newTempDirectory == _config.TempDirectory) { return; } if (save || DrawPressEnterWarning(_config.TempDirectory, 400)) { _base._modManager.SetTempDirectory(_newTempDirectory); _newTempDirectory = _config.TempDirectory; } }
public static unsafe void SeStringToText(SeString seStr) { var pushColorCount = 0; ImGui.BeginGroup(); foreach (var p in seStr.Payloads) { switch (p) { case UIForegroundPayload c: if (c.ColorKey == 0) { ImGui.PushStyleColor(ImGuiCol.Text, 0xFFFFFFFF); pushColorCount++; break; } var r = (c.UIColor.UIForeground >> 0x18) & 0xFF; var g = (c.UIColor.UIForeground >> 0x10) & 0xFF; var b = (c.UIColor.UIForeground >> 0x08) & 0xFF; var a = (c.UIColor.UIForeground >> 0x00) & 0xFF; ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(r / 255f, g / 255f, b / 255f, 1)); pushColorCount++; break; case TextPayload t: ImGui.Text($"{t.Text}"); ImGui.SameLine(); break; } } ImGui.EndGroup(); if (pushColorCount > 0) { ImGui.PopStyleColor(pushColorCount); } }
private void DrawSplash(rgatSettings.PathRecord[] recentBins, rgatSettings.PathRecord[] recentTraces) { ImGui.PushStyleVar(ImGuiStyleVar.CellPadding, Vector2.Zero); ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, Vector2.Zero); ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, Vector2.Zero); ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.Zero); ImGui.PushStyleVar(ImGuiStyleVar.ItemInnerSpacing, Vector2.Zero); float regionHeight = ImGui.GetContentRegionAvail().Y; float regionWidth = ImGui.GetContentRegionAvail().X; float buttonBlockWidth = Math.Min(400f, regionWidth / 2.1f); float headerHeight = ImGui.GetWindowSize().Y / 3; float blockHeight = (regionHeight * 0.95f) - headerHeight; float blockStart = headerHeight + 40f; ImFontPtr titleFont = Controller.rgatLargeFont ?? Controller._originalFont !.Value; ImGui.PushFont(titleFont); Vector2 titleSize = ImGui.CalcTextSize("rgat"); ImGui.SetCursorScreenPos(new Vector2((ImGui.GetWindowContentRegionMax().X / 2) - (titleSize.X / 2), (ImGui.GetWindowContentRegionMax().Y / 5) - (titleSize.Y / 2))); ImGui.Text("rgat"); ImGui.PopFont(); //ImGui.PushStyleColor(ImGuiCol.ChildBg, 0xff0000ff); //ImGui.PushStyleColor(ImGuiCol.ChildBg, new WritableRgbaFloat(0, 0, 0, 255).ToUint()); bool boxBorders = false; //ImGui.PushStyleColor(ImGuiCol.HeaderHovered, 0x45ffffff); _splashHeaderHover = ImGui.GetMousePos().Y < (ImGui.GetWindowSize().Y / 3f); //ImGui.PopStyleColor(); //Run group float voidspace = Math.Max(0, (regionWidth - (2 * buttonBlockWidth)) / 3); float runGrpX = voidspace; float iconTableYSep = 18; float iconTitleYSep = 10; ImGuiTableFlags tblflags = ImGuiTableFlags.NoHostExtendX; if (boxBorders) { tblflags |= ImGuiTableFlags.Borders; } ImGui.SetCursorPos(new Vector2(runGrpX, blockStart)); ImGui.PushStyleColor(ImGuiCol.ChildBg, Themes.GetThemeColourUINT(Themes.eThemeColour.WindowBackground)); if (ImGui.BeginChild("##RunGroup", new Vector2(buttonBlockWidth, blockHeight), boxBorders)) { ImGui.PushFont(Controller.SplashLargeFont ?? Controller._originalFont !.Value); float captionHeight = ImGui.CalcTextSize("Load Binary").Y; if (ImGui.BeginTable("##LoadBinBtnBox", 3, tblflags)) { Vector2 LargeIconSize = Controller.LargeIconSize; float iconColumnWidth = 200; float paddingX = (buttonBlockWidth - iconColumnWidth) / 2; ImGui.TableSetupColumn("##BBSPadL", ImGuiTableColumnFlags.WidthFixed, paddingX); ImGui.TableSetupColumn("##LoadBinBtnIcn", ImGuiTableColumnFlags.WidthFixed, iconColumnWidth); ImGui.TableSetupColumn("##BBSPadR", ImGuiTableColumnFlags.WidthFixed, paddingX); ImGui.TableNextRow(); ImGui.TableSetColumnIndex(1); Vector2 selectableSize = new Vector2(iconColumnWidth, captionHeight + LargeIconSize.Y + iconTitleYSep + 12); if (ImGui.Selectable("##Load Binary", false, ImGuiSelectableFlags.None, selectableSize)) { ToggleLoadExeWindow(); } Controller.PushUnicodeFont(); Widgets.SmallWidgets.MouseoverText("Load an executable or DLL for examination. It will not be executed at this stage."); ImGui.PopFont(); ImGui.SetCursorPosY(ImGui.GetCursorPosY() - ImGui.GetItemRectSize().Y); ImGuiUtils.DrawHorizCenteredText("Load Binary"); ImGui.SetCursorPosX(ImGui.GetCursorPosX() + (iconColumnWidth / 2) - (LargeIconSize.X / 2)); ImGui.SetCursorPosY(ImGui.GetCursorPosY() + iconTitleYSep); Controller.PushBigIconFont(); ImGui.Text($"{ImGuiController.FA_ICON_SAMPLE}"); //If you change this be sure to update ImGuiController.BuildFonts ImGui.PopFont(); ImGui.EndTable(); } ImGui.PopFont(); ImGui.SetCursorPosY(ImGui.GetCursorPosY() + iconTableYSep); Vector2 tableSz = new Vector2(buttonBlockWidth, ImGui.GetContentRegionAvail().Y - 25); ImGui.PushStyleVar(ImGuiStyleVar.CellPadding, new Vector2(0, 2)); if (ImGui.BeginTable("#RecentBinTableList", 1, ImGuiTableFlags.ScrollY, tableSz)) { ImGui.Indent(5); ImGui.TableSetupColumn("Recent Binaries" + $"{(rgatState.ConnectedToRemote ? " (Remote Files)" : "")}"); ImGui.TableSetupScrollFreeze(0, 1); ImGui.TableHeadersRow(); if (recentBins?.Length > 0) { int bincount = Math.Min(GlobalConfig.Settings.UI.MaxStoredRecentPaths, recentBins.Length); for (var bini = 0; bini < bincount; bini++) { var entry = recentBins[bini]; ImGui.TableNextRow(); if (ImGui.TableNextColumn()) { if (DrawRecentPathEntry(entry, menu: false)) { if (File.Exists(entry.Path) || rgatState.ConnectedToRemote) { if (!LoadSelectedBinary(entry.Path, rgatState.ConnectedToRemote) && !_badPaths.Contains(entry.Path)) { _badPaths.Add(entry.Path); } } else if (!_missingPaths.Contains(entry.Path) && rgatState.ConnectedToRemote is false) { _scheduleMissingPathCheck = true; _missingPaths.Add(entry.Path); } } } } } ImGui.EndTable(); } ImGui.PopStyleVar(); ImGui.EndChild(); } ImGui.SetCursorPosY(blockStart); ImGui.SetCursorPosX(runGrpX + buttonBlockWidth + voidspace); if (ImGui.BeginChild("##LoadGroup", new Vector2(buttonBlockWidth, blockHeight), boxBorders)) { ImGui.PushFont(Controller.SplashLargeFont ?? Controller._originalFont !.Value); float captionHeight = ImGui.CalcTextSize("Load Trace").Y; if (ImGui.BeginTable("##LoadBtnBox", 3, tblflags)) { Vector2 LargeIconSize = Controller.LargeIconSize; float iconColumnWidth = 200; float paddingX = (buttonBlockWidth - iconColumnWidth) / 2; ImGui.TableSetupColumn("##LBSPadL", ImGuiTableColumnFlags.WidthFixed, paddingX); ImGui.TableSetupColumn("##LoadBtnIcn", ImGuiTableColumnFlags.WidthFixed, iconColumnWidth); ImGui.TableSetupColumn("##LBSPadR", ImGuiTableColumnFlags.WidthFixed, paddingX); ImGui.TableNextRow(); ImGui.TableSetColumnIndex(1); Vector2 selectableSize = new Vector2(iconColumnWidth, captionHeight + LargeIconSize.Y + iconTitleYSep + 12); if (ImGui.Selectable("##Load Trace", false, ImGuiSelectableFlags.None, selectableSize)) { ToggleLoadTraceWindow(); } Controller.PushUnicodeFont(); Widgets.SmallWidgets.MouseoverText("Load a previously generated trace"); ImGui.PopFont(); ImGui.SetCursorPosY(ImGui.GetCursorPosY() - ImGui.GetItemRectSize().Y); ImGuiUtils.DrawHorizCenteredText("Load Trace"); ImGui.SetCursorPosX(ImGui.GetCursorPosX() + (iconColumnWidth / 2) - (LargeIconSize.X / 2) + 8); //shift a bit to the right to balance it ImGui.SetCursorPosY(ImGui.GetCursorPosY() + iconTitleYSep); Controller.PushBigIconFont(); ImGui.Text($"{ImGuiController.FA_ICON_LOADFILE}");//If you change this be sure to update ImGuiController.BuildFonts ImGui.PopFont(); ImGui.EndTable(); } ImGui.PopFont(); ImGui.SetCursorPosY(ImGui.GetCursorPosY() + iconTableYSep); Vector2 tableSz = new Vector2(buttonBlockWidth, ImGui.GetContentRegionAvail().Y - 25); ImGui.PushStyleVar(ImGuiStyleVar.CellPadding, new Vector2(0, 2)); if (ImGui.BeginTable("#RecentTraceTableList", 1, ImGuiTableFlags.ScrollY, tableSz)) { ImGui.Indent(5); ImGui.TableSetupColumn("Recent Traces"); ImGui.TableSetupScrollFreeze(0, 1); ImGui.TableHeadersRow(); if (recentTraces?.Length > 0) { int traceCount = Math.Min(GlobalConfig.Settings.UI.MaxStoredRecentPaths, recentTraces.Length); for (var traceI = 0; traceI < traceCount; traceI++) { var entry = recentTraces[traceI]; ImGui.TableNextRow(); if (ImGui.TableNextColumn()) { if (DrawRecentPathEntry(entry, false)) { if (File.Exists(entry.Path)) { System.Threading.Tasks.Task.Run(() => LoadTraceByPath(entry.Path)); /* * if (!LoadTraceByPath(entry.Path) && !_badPaths.Contains(entry.Path)) * { * _badPaths.Add(entry.Path); * }*/ } else if (!_missingPaths.Contains(entry.Path)) { _scheduleMissingPathCheck = true; _missingPaths.Add(entry.Path); } } } } } ImGui.EndTable(); } ImGui.PopStyleVar(); ImGui.EndChild(); } ImGui.PopStyleVar(5); ImGui.BeginGroup(); string versionString = $"rgat {CONSTANTS.PROGRAMVERSION.RGAT_VERSION}"; float width = ImGui.CalcTextSize(versionString).X; ImGui.SetCursorPos(ImGui.GetContentRegionMax() - new Vector2(width + 25, 40)); ImGui.Text(versionString); if (GlobalConfig.NewVersionAvailable) { Version currentVersion = CONSTANTS.PROGRAMVERSION.RGAT_VERSION_SEMANTIC; Version newVersion = GlobalConfig.Settings.Updates.UpdateLastCheckVersion; string updateString; if (newVersion.Major > currentVersion.Major || (newVersion.Major == currentVersion.Major && newVersion.Minor > currentVersion.Minor)) { updateString = "New version available "; } else { updateString = "Updates available "; } updateString += $"({newVersion})"; Vector2 textSize = ImGui.CalcTextSize(updateString); ImGui.SetCursorPos(ImGui.GetContentRegionMax() - new Vector2(textSize.X + 25, 55)); if (ImGui.Selectable(updateString, false, flags: ImGuiSelectableFlags.None, size: new Vector2(textSize.X, textSize.Y))) { ImGui.OpenPopup("New Version Available"); } if (ImGui.IsItemHovered()) { Updates.ChangesCounts(out int changes, out int versions); if (changes > 0) { ImGui.BeginTooltip(); ImGui.Text($"Click to see {changes} changes in {versions} newer rgat versions"); ImGui.EndTooltip(); } } } ImGui.EndGroup(); ImGui.PopStyleColor(); if (GlobalConfig.Settings.UI.EnableTortoise) { _splashRenderer?.Draw(); } if (StartupProgress < 1) { float originalY = ImGui.GetCursorPosY(); float ypos = ImGui.GetWindowSize().Y - 12; ImGui.SetCursorPosY(ypos); ImGui.ProgressBar((float)StartupProgress, new Vector2(-1, 4f)); ImGui.SetCursorPosY(originalY); } if (ImGui.IsPopupOpen("New Version Available")) { ImGui.SetNextWindowSize(new Vector2(600, 500), ImGuiCond.FirstUseEver); ImGui.SetNextWindowPos((ImGui.GetWindowSize() / 2) - new Vector2(600f / 2f, 500f / 2f), ImGuiCond.Appearing); bool isopen = true; if (ImGui.BeginPopupModal("New Version Available", ref isopen, flags: ImGuiWindowFlags.Modal)) { Updates.DrawChangesDialog(); isopen = isopen && !ImGui.IsKeyDown(ImGui.GetKeyIndex(ImGuiKey.Escape)); if (!isopen) { ImGui.CloseCurrentPopup(); } ImGui.EndPopup(); } } }
private void DrawElementSelector() { ImGui.GetIO().WantCaptureKeyboard = true; ImGui.GetIO().WantCaptureMouse = true; ImGui.GetIO().WantTextInput = true; if (ImGui.IsKeyPressed((int)VirtualKey.ESCAPE)) { elementSelectorActive = false; FreeExclusiveDraw(); return; } ImGui.SetNextWindowPos(Vector2.Zero); ImGui.SetNextWindowSize(ImGui.GetIO().DisplaySize); ImGui.SetNextWindowBgAlpha(0.3f); ImGui.Begin("ElementSelectorWindow", ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoScrollWithMouse | ImGuiWindowFlags.NoScrollbar); var drawList = ImGui.GetWindowDrawList(); var y = 100f; foreach (var s in new[] { "Select an Element", "Press ESCAPE to cancel" }) { var size = ImGui.CalcTextSize(s); var x = ImGui.GetWindowContentRegionWidth() / 2f - size.X / 2; drawList.AddText(new Vector2(x, y), 0xFFFFFFFF, s); y += size.Y; } var mousePos = ImGui.GetMousePos(); var windows = GetAtkUnitBaseAtPosition(mousePos); ImGui.SetCursorPosX(100); ImGui.SetCursorPosY(100); ImGui.BeginChild("noClick", new Vector2(800, 2000), false, ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoBackground | ImGuiWindowFlags.NoScrollWithMouse); ImGui.BeginGroup(); ImGui.Text($"Mouse Position: {mousePos.X}, {mousePos.Y}\n"); var i = 0; foreach (var a in windows) { var name = Helper.Common.PtrToUTF8(new IntPtr(a.UnitBase->Name)); ImGui.Text($"[Addon] {name}"); ImGui.Indent(15); foreach (var n in a.Nodes) { var nSelected = i++ == elementSelectorIndex; if (nSelected) { ImGui.PushStyleColor(ImGuiCol.Text, 0xFF00FFFF); } // ImGui.Text($"{((int)n.ResNode->Type >= 1000 ? ((ULDComponentInfo*)((AtkComponentNode*) n.ResNode)->Component->UldManager.Objects)->ComponentType.ToString() + "ComponentNode" : n.ResNode->Type.ToString() + "Node")}"); PrintNode(n.ResNode, false, null, true); if (nSelected) { ImGui.PopStyleColor(); } if (nSelected && ImGui.IsMouseClicked(ImGuiMouseButton.Left)) { elementSelectorActive = false; FreeExclusiveDraw(); selectedUnitBase = a.UnitBase; var l = new List <ulong>(); l.Add((ulong)n.ResNode); var nextNode = n.ResNode->ParentNode; while (nextNode != null) { l.Add((ulong)nextNode); nextNode = nextNode->ParentNode; } elementSelectorFind = l.ToArray(); elementSelectorCountdown = 100; elementSelectorScrolled = false; } drawList.AddRectFilled(n.State.Position, n.State.SecondPosition, (uint)(nSelected ? 0x4400FFFF: 0x0000FF00)); } ImGui.Indent(-15); } if (i != 0) { elementSelectorIndex -= (int)ImGui.GetIO().MouseWheel; while (elementSelectorIndex < 0) { elementSelectorIndex += i; } while (elementSelectorIndex >= i) { elementSelectorIndex -= i; } } ImGui.EndGroup(); ImGui.EndChild(); ImGui.End(); }
public void Draw() { var size = ImGui.GetFont(); if (Children.Count > 0) { for (var i = 0; i < 5; i++) { ImGui.Spacing(); } ImGui.BeginGroup(); var contentRegionAvail = ImGui.GetContentRegionAvail(); var OverChild = ImGui.GetCursorPos().Translate(10, size.FontSize * -0.66f); ImGui.BeginChild(Unique, new Vector2(contentRegionAvail.X, size.FontSize * 2 * (Children.Count + 0.2f)), true); foreach (var child in Children) { child.Draw(); } // var fontContainer = Fonts.Last().Value; // ImGui.PushFont(fontContainer.Atlas); var getCursor = ImGui.GetCursorPos().Translate(0, size.FontSize); ImGui.EndChild(); ImGui.SetCursorPos(OverChild); ImGui.Text(Name); if (Tooltip?.Length > 0) { ImGui.SameLine(); ImGui.TextDisabled("(?)"); if (ImGui.IsItemHovered(ImGuiHoveredFlags.None)) { ImGui.SetTooltip(Tooltip); } } ImGui.SetCursorPos(getCursor); ImGui.EndGroup(); DrawDelegate?.Invoke(); // ImGui.PopFont(); } else { DrawDelegate?.Invoke(); if (Tooltip?.Length > 0) { ImGui.SameLine(); ImGui.TextDisabled("(?)"); if (ImGui.IsItemHovered(ImGuiHoveredFlags.None)) { ImGui.SetTooltip(Tooltip); } } } }
public void DrawConfigEditor(RemindMeConfig mainConfig, RemindMe plugin, ref Guid?deletedMonitor, ref MonitorDisplay copiedDisplay) { ImGui.Indent(10); if (ImGui.Checkbox($"Enabled##{this.Guid}", ref this.Enabled)) { mainConfig.Save(); } if (ImGui.Checkbox($"Lock Display##{this.Guid}", ref this.Locked)) { mainConfig.Save(); } ImGui.SameLine(); ImGui.SetNextItemWidth(150); if (ImGui.InputText($"###displayName{this.Guid}", ref this.Name, 32)) { mainConfig.Save(); } if (ImGui.Checkbox($"Clickable##{this.Guid}", ref this.AllowClicking)) { mainConfig.Save(); } ImGui.SameLine(); ImGui.TextDisabled("A clickable display will allow selecting targets from status effects\nbut may get in the way of other activity."); ImGui.Separator(); if (ImGui.Combo($"Display Type##{Guid}", ref DisplayType, _displayTypes, _displayTypes.Length)) { mainConfig.Save(); } if ((DisplayType == 1 || DisplayType == 2) && ImGui.Checkbox($"Right to Left##{Guid}", ref DirectionRtL)) { mainConfig.Save(); } if ((DisplayType == 0 || DisplayType == 2) && ImGui.Checkbox($"Bottom to Top##{Guid}", ref DirectionBtT)) { mainConfig.Save(); } if (DisplayType == 2 && ImGui.Checkbox($"Vertical Stack##{Guid}", ref IconVerticalStack)) { mainConfig.Save(); } ImGui.Separator(); ImGui.Separator(); ImGui.Text("Colours"); ImGui.Separator(); if (ImGui.ColorEdit4($"Ability Ready##{Guid}", ref AbilityReadyColor)) { mainConfig.Save(); } if (ImGui.ColorEdit4($"Ability Cooldown##{Guid}", ref AbilityCooldownColor)) { mainConfig.Save(); } if (ImGui.ColorEdit4($"Status Effect##{Guid}", ref StatusEffectColor)) { mainConfig.Save(); } if (ImGui.ColorEdit4($"Bar Background##{Guid}", ref BarBackgroundColor)) { mainConfig.Save(); } if (ImGui.ColorEdit4($"Text##{Guid}", ref TextColor)) { mainConfig.Save(); } ImGui.Separator(); ImGui.Separator(); ImGui.Text("Display Options"); ImGui.Separator(); if (ImGui.Checkbox($"Hide outside of combat##{this.Guid}", ref this.OnlyInCombat)) { mainConfig.Save(); } if (OnlyInCombat) { ImGui.Indent(20); if (ImGui.Checkbox($"Keep visible for###keepVisibleOutsideCombat{this.Guid}", ref this.KeepVisibleOutsideCombat)) { mainConfig.Save(); } ImGui.SameLine(); ImGui.SetNextItemWidth(100); if (ImGui.InputInt($"seconds after exiting combat.###keepVisibleOutsideCombatSeconds{this.Guid}", ref KeepVisibleOutsideCombatSeconds)) { mainConfig.Save(); } if (KeepVisibleOutsideCombatSeconds < 0) { KeepVisibleOutsideCombatSeconds = 0; mainConfig.Save(); } ImGui.Indent(-20); } if (ImGui.Checkbox($"Don't show complete cooldowns##{this.Guid}", ref this.OnlyShowCooldown)) { OnlyShowReady = false; mainConfig.Save(); } if (ImGui.Checkbox($"Only show complete cooldowns##{this.Guid}", ref this.OnlyShowReady)) { OnlyShowCooldown = false; mainConfig.Save(); } if (ImGui.Checkbox($"Fill bar to complete##{this.Guid}", ref this.FillToComplete)) { mainConfig.Save(); } if (DisplayType < 2 && ImGui.Checkbox($"Reverse fill direction##{this.Guid}", ref this.ReverseFill)) { mainConfig.Save(); } if (DisplayType == 2) { ImGui.BeginGroup(); plugin.DrawBar(ImGui.GetCursorScreenPos(), new Vector2(22, 22), 0.45f, IconDisplayFillDirection, new Vector4(0.3f, 0.3f, 0.3f, 1), new Vector4(0.8f, 0.8f, 0.8f, 1), 3); ImGui.SameLine(); ImGui.Text("Fill Direction"); ImGui.EndGroup(); if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) { IconDisplayFillDirection = (RemindMe.FillDirection)((((int)IconDisplayFillDirection) + 1) % Enum.GetValues(typeof(RemindMe.FillDirection)).Length); } } if (ImGui.Checkbox($"Show Ability Icon##{this.Guid}", ref this.ShowActionIcon)) { mainConfig.Save(); } if (this.ShowActionIcon) { switch (DisplayType) { case 0: { ImGui.SameLine(); ImGui.SetNextItemWidth(75); var v = ReverseSideIcon ? 1 : 0; var text = ReverseSideIcon ? "Right" : "Left"; ImGui.SliderInt($"###actionIconReverse##{Guid}", ref v, 0, 1, text); if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) { ReverseSideIcon = !ReverseSideIcon; } break; } case 1: { ImGui.SameLine(); var v = ReverseSideIcon ? 1 : 0; var text = ReverseSideIcon ? "Top" : "Bottom"; ImGui.VSliderInt($"###actionIconReverse##{Guid}", new Vector2(60, 25), ref v, 0, 1, text); if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) { ReverseSideIcon = !ReverseSideIcon; } break; } } ImGui.SameLine(); ImGui.SetNextItemWidth(100); if (ImGui.SliderFloat($"###actionIconScale{this.Guid}", ref this.ActionIconScale, 0.1f, 1f, "Scale")) { mainConfig.Save(); } } if ((DisplayType == 0 || DisplayType == 1) && ImGui.Checkbox($"Show Skill Name##{this.Guid}", ref this.ShowSkillName)) { mainConfig.Save(); } if (DisplayType == 0 && this.ShowSkillName) { ImGui.SameLine(); ImGui.SetNextItemWidth(75); var v = SkillNameRight ? 1 : 0; var text = SkillNameRight ? "Right" : "Left"; ImGui.SliderInt("###skillNameAlign", ref v, 0, 1, text); if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) { SkillNameRight = !SkillNameRight; } } if ((DisplayType == 0 || DisplayType == 1) && ShowSkillName && ImGui.Checkbox($"Show Status Effect Target Name##{this.Guid}", ref this.ShowStatusEffectTarget)) { mainConfig.Save(); } if ((DisplayType == 0 || DisplayType == 1) && ShowSkillName && ShowStatusEffectTarget && ImGui.Checkbox($"Only show target name on status effects##{this.Guid}", ref this.StatusOnlyShowTargetName)) { mainConfig.Save(); } if (ImGui.Checkbox($"Show Countdown##{this.Guid}", ref this.ShowCountdown)) { mainConfig.Save(); } if (ShowCountdown) { switch (DisplayType) { case 0: { ImGui.SameLine(); ImGui.SetNextItemWidth(75); var v = ReverseCountdownSide ? 0 : 1; var text = ReverseCountdownSide ? "Left" : "Right"; ImGui.SliderInt($"###actionCountdownReverse##{Guid}", ref v, 0, 1, text); if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) { ReverseCountdownSide = !ReverseCountdownSide; } break; } case 1: { ImGui.SameLine(); var v = ReverseCountdownSide ? 0 : 1; var text = ReverseCountdownSide ? "Bottom" : "Top"; ImGui.VSliderInt($"###countdownReverse##{Guid}", new Vector2(60, 25), ref v, 0, 1, text); if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) { ReverseCountdownSide = !ReverseCountdownSide; } break; } } ImGui.Indent(20); if (ImGui.Checkbox($"Show Countup while ready##{this.Guid}", ref this.ShowCountdownReady)) { mainConfig.Save(); } ImGui.Indent(-20); } if (ImGui.Checkbox($"Pulse when ready##{this.Guid}", ref this.PulseReady)) { mainConfig.Save(); } if (this.PulseReady) { ImGui.SameLine(); ImGui.SetNextItemWidth(100); if (ImGui.SliderFloat($"###pulseSpeed{this.Guid}", ref this.PulseSpeed, 0.5f, 2f, "Speed")) { mainConfig.Save(); } ImGui.SameLine(); ImGui.SetNextItemWidth(100); if (ImGui.SliderFloat($"###pulseIntensity{this.Guid}", ref this.PulseIntensity, 0.1f, 2f, "Intensity")) { mainConfig.Save(); } } ImGui.Separator(); if (ImGui.Checkbox($"###limitDisplay{this.Guid}", ref this.LimitDisplayTime)) { mainConfig.Save(); } ImGui.SameLine(); ImGui.Text("Only show when below"); ImGui.SameLine(); ImGui.SetNextItemWidth(90); if (ImGui.InputInt($"seconds##limitSeconds{this.Guid}", ref LimitDisplayTimeSeconds)) { mainConfig.Save(); } if (ImGui.Checkbox($"###limitDisplayReady{this.Guid}", ref this.LimitDisplayReadyTime)) { mainConfig.Save(); } ImGui.SameLine(); ImGui.Text("Don't show ready abilities after"); ImGui.SameLine(); ImGui.SetNextItemWidth(90); if (ImGui.InputInt($"seconds##limitReadySeconds{this.Guid}", ref LimitDisplayReadyTimeSeconds)) { mainConfig.Save(); } ImGui.Separator(); if (ImGui.InputInt($"Bar Height##{this.Guid}", ref this.RowSize, 1, 5)) { if (this.RowSize < 8) { this.RowSize = 8; } mainConfig.Save(); } if (ImGui.InputInt($"Bar Spacing##{this.Guid}", ref this.BarSpacing, 1, 2)) { if (this.BarSpacing < 0) { this.BarSpacing = 0; } mainConfig.Save(); } if (ImGui.InputFloat($"Text Scale##{this.Guid}", ref this.TextScale, 0.01f, 0.1f)) { if (this.RowSize < 8) { this.RowSize = 8; } mainConfig.Save(); } if (ImGui.InputInt($"Update Interval##{this.Guid}", ref this.UpdateInterval, 1, 50)) { if (this.UpdateInterval < 1) { this.UpdateInterval = 1; } mainConfig.Save(); } ImGui.Separator(); if (tryCopy) { ImGui.Text("Copy with actions and statuses?"); ImGui.SameLine(); ImGui.PushStyleColor(ImGuiCol.Button, 0x88888800); ImGui.PushStyleColor(ImGuiCol.ButtonHovered, 0x99999900); ImGui.PushStyleColor(ImGuiCol.ButtonActive, 0xAAAAAA00); if (ImGui.Button($"Yes##copyWithActionsAndStatus{Guid}")) { tryCopy = false; copiedDisplay = MakeCopy(true); } if (ImGui.IsItemHovered()) { ImGui.SetTooltip("Copy the display and all the configured reminders."); } ImGui.SameLine(); if (ImGui.Button($"No##copyWithActionsAndStatus{Guid}")) { tryCopy = false; copiedDisplay = MakeCopy(false); } if (ImGui.IsItemHovered()) { ImGui.SetTooltip("Only copy the base display settings."); } ImGui.PopStyleColor(3); ImGui.SameLine(); if (ImGui.Button($"Don't Copy##{Guid}")) { tryCopy = false; } } else if (tryDelete) { ImGui.Text("Delete this display?"); ImGui.SameLine(); if (ImGui.Button($"Don't Delete##{Guid}")) { tryDelete = false; } ImGui.SameLine(); ImGui.PushStyleColor(ImGuiCol.Button, 0x88000088); ImGui.PushStyleColor(ImGuiCol.ButtonHovered, 0x99000099); ImGui.PushStyleColor(ImGuiCol.ButtonActive, 0xAA0000AA); if (ImGui.Button($"Delete this display##{Guid}confirm")) { deletedMonitor = Guid; } ImGui.PopStyleColor(3); } else { ImGui.PushStyleColor(ImGuiCol.Button, 0x88000088); ImGui.PushStyleColor(ImGuiCol.ButtonHovered, 0x99000099); ImGui.PushStyleColor(ImGuiCol.ButtonActive, 0xAA0000AA); if (ImGui.Button($"Delete this display##{Guid}")) { tryDelete = true; } ImGui.PopStyleColor(3); ImGui.SameLine(); ImGui.Dummy(new Vector2(15 * ImGui.GetIO().FontGlobalScale, 1)); ImGui.SameLine(); ImGui.PushStyleColor(ImGuiCol.Button, 0x88888800); ImGui.PushStyleColor(ImGuiCol.ButtonHovered, 0x99999900); ImGui.PushStyleColor(ImGuiCol.ButtonActive, 0xAAAAAA00); if (ImGui.Button($"Copy this display##{Guid}")) { tryCopy = true; } ImGui.PopStyleColor(3); } ImGui.Separator(); ImGui.Indent(-10); }
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(); }
/// <inheritdoc /> public override void Draw() { ImGui.SetNextWindowSize(new Vector2(350 * ImGuiHelpers.GlobalScale, 150 * ImGuiHelpers.GlobalScale), ImGuiCond.FirstUseEver); if (this.plugin.Configuration.Enabled) { var lootRolls = this.plugin.LootRollsDisplay; if (lootRolls !.Count > 0) { var col1 = 200f * ImGuiHelpers.GlobalScale; var col2 = 258f * ImGuiHelpers.GlobalScale; ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("MonitorItemName", "Item")); ImGui.SameLine(col1); ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("MonitorRollers", "Rollers")); ImGui.SameLine(col2); ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("MonitorWinner", "Winner")); foreach (var lootRoll in lootRolls.ToList()) { ImGui.BeginGroup(); ImGui.Text(lootRoll.ItemNameAbbreviated); ImGui.SameLine(col1 - 7f); ImGui.Text(lootRoll.RollerCount + " / " + lootRoll.Rollers.Count); ImGui.SameLine(col2 - 7f); ImGui.Text(lootRoll.Winner); ImGui.EndGroup(); if (!ImGui.IsItemHovered()) { continue; } ImGui.BeginTooltip(); ImGui.PushTextWrapPos(ImGui.GetFontSize() * 35.0f); ImGui.TextColored(ImGuiColors.DalamudViolet, lootRoll.ItemName); ImGui.Separator(); foreach (var roller in lootRoll.Rollers) { if (roller.HasRolled) { ImGui.TextColored(roller.RollColor, roller.PlayerName); ImGui.SameLine(); ImGui.PushFont(UiBuilder.IconFont); ImGui.TextColored(roller.RollColor, FontAwesomeIcon.Check.ToIconString()); ImGui.PopFont(); } else if (lootRoll.IsWon) { ImGui.TextColored(roller.RollColor, roller.PlayerName); ImGui.SameLine(); ImGui.PushFont(UiBuilder.IconFont); ImGui.TextColored(roller.RollColor, FontAwesomeIcon.Times.ToIconString()); ImGui.PopFont(); } else { ImGui.TextColored(roller.RollColor, roller.PlayerName); } } ImGui.PopTextWrapPos(); ImGui.EndTooltip(); } } else { ImGui.Text(Loc.Localize("WaitingForItems", "Waiting for items.")); } }
internal override void Display() { if (_sysState != null) { PreFrameSetup(); } if (IsActive) { var size = new System.Numerics.Vector2(200, 100); var pos = new System.Numerics.Vector2(_state.MainWinSize.X / 2 - size.X / 2, _state.MainWinSize.Y / 2 - size.Y / 2); ImGui.SetNextWindowSize(size, ImGuiCond.FirstUseEver); ImGui.SetNextWindowPos(pos, ImGuiCond.FirstUseEver); if (ImGui.Begin("Weapon Targeting", ref IsActive, _flags)) { int selectable = 0; bool selected = false; ImGui.BeginGroup(); foreach (var fc in _shipFCDB.FireControlInstances) { var fcAbility = fc.GetAbilityState <FireControlAbilityState>(); if (ImGui.Selectable("FC " + selectable, selected, ImGuiSelectableFlags.None, _selectableBtnSize)) { _selectedItemIndex = selectable; _selectedFCGuid = fc.ID; _selectedFCAssignedWeapons = new List <Guid>(); foreach (var item in fcAbility.AssignedWeapons) { _selectedFCAssignedWeapons.Add(item.ID); } } /* * ImGui.Text("Assigned Weapons: "); * foreach (var weapon in fc.AssignedWeapons) * { * bool isEnabled = weapon.GetDataBlob<ComponentInstanceInfoDB>().IsEnabled; * if (ImGui.Checkbox(weaponNames[weapon.Guid], ref isEnabled)) * { * //give an enable/disable order. * } * }*/ ImGui.Text("Target: "); ImGui.SameLine(); if (fcAbility.Target == null || !fcAbility.Target.IsValid) { ImGui.Text("No Target"); } else { ImGui.Text(fcAbility.Target.GetDataBlob <NameDB>().GetName(_state.Faction)); } selectable++; if (fcAbility.IsEngaging) { if (ImGui.Button("Cease Fire")) { OpenFire(fc.ID, SetOpenFireControlOrder.FireModes.CeaseFire); } } else { if (ImGui.Button("Open Fire")) { OpenFire(fc.ID, SetOpenFireControlOrder.FireModes.OpenFire); } } } ImGui.EndGroup(); if (_selectedItemIndex > -1) { ImGui.SameLine(); ImGui.BeginGroup(); { ImGui.BeginGroup(); //ImGui.BeginChild("AssignedWeapons", true); ImGui.Text("Assigned Weapons"); foreach (var wpn in _selectedFCAssignedWeapons.ToArray()) { if (ImGui.Button(_weaponNames[wpn])) { _unAssignedWeapons.Add(wpn); _selectedFCAssignedWeapons.Remove(wpn); SetWeaponsFireControlOrder.CreateCommand(_state.Game, _state.PrimarySystemDateTime, _state.Faction.Guid, _orderingEntity.Guid, _selectedFCGuid, _selectedFCAssignedWeapons); } } ImGui.EndGroup(); ImGui.BeginGroup(); //ImGui.EndChild(); //ImGui.BeginChild("Un Assigned Weapons", true); ImGui.Text("Un Assigned Weapons"); foreach (var wpn in _unAssignedWeapons.ToArray()) { if (ImGui.Button(_weaponNames[wpn])) { _selectedFCAssignedWeapons.Add(wpn); _unAssignedWeapons.Remove(wpn); SetWeaponsFireControlOrder.CreateCommand(_state.Game, _state.PrimarySystemDateTime, _state.Faction.Guid, _orderingEntity.Guid, _selectedFCGuid, _selectedFCAssignedWeapons); } } ImGui.EndGroup(); //ImGui.EndChild(); } ImGui.EndGroup(); ImGui.SameLine(); ImGui.BeginGroup(); { ImGui.Text("Set Target"); foreach (var item in _systemEntityNames) { if (ImGui.SmallButton(item.Value)) { SetTargetFireControlOrder.CreateCommand(_state.Game, _state.PrimarySystemDateTime, _state.Faction.Guid, _orderingEntity.Guid, _selectedFCGuid, item.Key); } } } ImGui.EndGroup(); ImGui.SameLine(); ImGui.BeginGroup(); { ImGui.Text("Range in AU"); foreach (var item in _sensorContacts) { var targetEntity = _sensorContacts[item.Key]; double distance = _orderingEntity.GetDataBlob <PositionDB>().GetDistanceTo_AU(targetEntity.Position); ImGui.Text(distance.ToString()); } } ImGui.EndGroup(); } } ImGui.End(); if (!IsActive) { OnClose(); } } }
public static void beginBorderedGroup() { ImGui.BeginGroup(); }
public void DrawMainWindow() { if (!Visible) { return; } ImGui.PushStyleColor(ImGuiCol.TitleBgActive, orangeColor); ImGui.PushStyleColor(ImGuiCol.CheckMark, orangeColor); var scale = ImGui.GetIO().FontGlobalScale; var size = new Vector2(320 * scale, 280 * scale); ImGui.SetNextWindowSize(size, ImGuiCond.Always); ImGui.SetNextWindowSizeConstraints(size, size); if (ImGui.Begin($"Burning Down the House", ref this.visible, ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse | ImGuiWindowFlags.NoResize)) { ImGui.BeginGroup(); if (ImGui.Checkbox("Place Anywhere", ref this.placeAnywhere)) { // Set the place anywhere based on the checkbox state. this.memory.SetPlaceAnywhere(this.placeAnywhere); } // Disabled if the housing mode isn't on and there isn't a selected item. var disabled = !(this.memory.IsHousingModeOn() && this.memory.selectedItem != IntPtr.Zero); var indoors = this.memory.IsIndoors(); // Set the opacity based on if housing is on. if (disabled) { ImGui.PushStyleVar(ImGuiStyleVar.Alpha, .3f); } ImGui.PushItemWidth(73f); if (ImGui.DragFloat("##xdrag", ref this.memory.position.X, this.drag)) { this.memory.WritePosition(this.memory.position); } ImGui.SameLine(0, 4); var xHover = ImGui.IsMouseHoveringRect(ImGui.GetItemRectMin(), ImGui.GetItemRectMax()); // Push disabled style for outdoors Y axis. if (!indoors) { ImGui.PushStyleVar(ImGuiStyleVar.Alpha, .3f); } if (ImGui.DragFloat("##ydrag", ref this.memory.position.Y, this.drag)) { this.memory.WritePosition(this.memory.position); } // Pop disabled style for outdoors Y axis. if (!indoors) { ImGui.PopStyleVar(); } ImGui.SameLine(0, 4); var yHover = ImGui.IsMouseHoveringRect(ImGui.GetItemRectMin(), ImGui.GetItemRectMax()); if (ImGui.DragFloat("##zdrag", ref this.memory.position.Z, this.drag)) { this.memory.WritePosition(this.memory.position); } ImGui.SameLine(0, 4); var zHover = ImGui.IsMouseHoveringRect(ImGui.GetItemRectMin(), ImGui.GetItemRectMax()); ImGui.Text("position"); if (ImGui.DragFloat("##rydrag", ref this.memory.rotation.Y, this.drag)) { this.memory.WriteRotation(this.memory.rotation); } ImGui.SameLine(0, 4); var ryHover = ImGui.IsMouseHoveringRect(ImGui.GetItemRectMin(), ImGui.GetItemRectMax()); ImGui.Text("rotation"); ImGui.PopItemWidth(); // Mouse wheel direction. var delta = ImGui.GetIO().MouseWheel *this.drag; // Move position based on which control is being hovered. if (xHover) { this.memory.position.X += delta; } if (yHover) { this.memory.position.Y += delta; } if (zHover) { this.memory.position.Z += delta; } if (xHover || yHover || zHover) { this.memory.WritePosition(this.memory.position); } // Move rotation based on which control is being hovered. if (ryHover) { this.memory.rotation.Y += delta; } if (ryHover && delta > 0) { this.memory.WriteRotation(this.memory.rotation); } if (ImGui.InputFloat("x coord", ref this.memory.position.X, this.drag)) { this.memory.WritePosition(this.memory.position); } xHover = ImGui.IsMouseHoveringRect(ImGui.GetItemRectMin(), ImGui.GetItemRectMax()); // Push disabled style for outdoors Y axis. if (!indoors) { ImGui.PushStyleVar(ImGuiStyleVar.Alpha, .3f); } if (ImGui.InputFloat("y coord", ref this.memory.position.Y, this.drag)) { this.memory.WritePosition(this.memory.position); } // Pop disabled style for outdoors Y axis. if (!indoors) { ImGui.PopStyleVar(); } yHover = ImGui.IsMouseHoveringRect(ImGui.GetItemRectMin(), ImGui.GetItemRectMax()); if (ImGui.InputFloat("z coord", ref this.memory.position.Z, this.drag)) { this.memory.WritePosition(this.memory.position); } zHover = ImGui.IsMouseHoveringRect(ImGui.GetItemRectMin(), ImGui.GetItemRectMax()); if (ImGui.InputFloat("ry degree", ref this.memory.rotation.Y, this.drag)) { this.memory.WriteRotation(this.memory.rotation); } ryHover = ImGui.IsMouseHoveringRect(ImGui.GetItemRectMin(), ImGui.GetItemRectMax()); // Mouse wheel direction. delta = ImGui.GetIO().MouseWheel *this.drag; // Move position based on which control is being hovered. if (xHover) { this.memory.position.X += delta; } if (yHover) { this.memory.position.Y += delta; } if (zHover) { this.memory.position.Z += delta; } if (xHover || yHover || zHover) { this.memory.WritePosition(this.memory.position); } // Move rotation based on which control is being hovered. if (ryHover) { this.memory.rotation.Y += delta; } if (ryHover && delta > 0) { this.memory.WriteRotation(this.memory.rotation); } ImGui.NewLine(); if (disabled) { ImGui.PopStyleVar(); } // Drag ammount for the inputs. ImGui.InputFloat("drag", ref this.drag, 0.05f); } ImGui.End(); ImGui.PopStyleColor(2); }