/// <summary> /// Show all properties and fields of the provided object via ImGui. /// </summary> /// <param name="obj">The object to show.</param> public static void ShowObject(object obj) { var type = obj.GetType(); ImGui.Text($"Object Dump({type.Name}) for {obj}({obj.GetHashCode()})"); ImGuiHelpers.ScaledDummy(5); ImGui.TextColored(ImGuiColors.DalamudOrange, "-> Properties:"); ImGui.Indent(); foreach (var propertyInfo in type.GetProperties()) { ImGui.TextColored(ImGuiColors.DalamudOrange, $" {propertyInfo.Name}: {propertyInfo.GetValue(obj)}"); } ImGui.Unindent(); ImGuiHelpers.ScaledDummy(5); ImGui.TextColored(ImGuiColors.HealerGreen, "-> Fields:"); ImGui.Indent(); foreach (var fieldInfo in type.GetFields()) { ImGui.TextColored(ImGuiColors.HealerGreen, $" {fieldInfo.Name}: {fieldInfo.GetValue(obj)}"); } ImGui.Unindent(); }
private void DrawTex() { ImGui.InputText("Tex Path", ref this.inputTexPath, 255); ImGui.InputFloat2("UV0", ref this.inputTexUv0); ImGui.InputFloat2("UV1", ref this.inputTexUv1); ImGui.InputFloat4("Tint", ref this.inputTintCol); ImGui.InputFloat2("Scale", ref this.inputTexScale); if (ImGui.Button("Load Tex")) { try { this.debugTex = this.dalamud.Data.GetImGuiTexture(this.inputTexPath); this.inputTexScale = new Vector2(this.debugTex.Width, this.debugTex.Height); } catch (Exception ex) { Log.Error(ex, "Could not load tex."); } } ImGuiHelpers.ScaledDummy(10); if (this.debugTex != null) { ImGui.Image(this.debugTex.ImGuiHandle, this.inputTexScale, this.inputTexUv0, this.inputTexUv1, this.inputTintCol); ImGuiHelpers.ScaledDummy(5); Util.ShowObject(this.debugTex); } }
private void PlayerCustomize() { if (this.SelectedPlayer == null) { return; } const float sameLineOffset = 70f; if (this.SelectedPlayer.Customize != null) { ImGui.Text(Loc.Localize("Gender", "Gender")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset); ImGui.Text(this.SelectedPlayer.CharaCustomizeData.Gender == 0 ? Loc.Localize("GenderMale", "Male") : Loc.Localize("GenderFemale", "Female")); ImGui.Text(Loc.Localize("Race", "Race")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset); ImGui.Text(PlayerTrackPlugin.DataManager.Race(this.SelectedPlayer.CharaCustomizeData.Race, this.SelectedPlayer.CharaCustomizeData.Gender)); ImGui.Text(Loc.Localize("Tribe", "Tribe")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset); ImGui.Text(PlayerTrackPlugin.DataManager.Tribe(this.SelectedPlayer.CharaCustomizeData.Tribe, this.SelectedPlayer.CharaCustomizeData.Gender)); ImGui.Text(Loc.Localize("Height", "Height")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset); ImGui.Text(string.Format( Loc.Localize("PlayerHeightValue", "{0} in"), CharHeightUtil.CalcInches(this.SelectedPlayer.CharaCustomizeData.Height, this.SelectedPlayer.CharaCustomizeData.Race, this.SelectedPlayer.CharaCustomizeData.Tribe, this.SelectedPlayer.CharaCustomizeData.Gender))); ImGuiHelpers.ScaledDummy(5f); if (this.SelectedPlayer.Customize is { Length : > 0 })
/// <inheritdoc/> public override void Draw() { var screenSize = ImGui.GetMainViewport().Size; var windowSize = ImGui.GetWindowSize(); this.Position = (screenSize - windowSize) / 2; ImGui.BeginChild("scrolling", Vector2.Zero, false, ImGuiWindowFlags.NoScrollbar); ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.Zero); ImGuiHelpers.ScaledDummy(0, 340f); ImGui.Text(string.Empty); ImGui.SameLine(150f); ImGui.Image(this.logoTexture.ImGuiHandle, ImGuiHelpers.ScaledVector2(190f, 190f)); ImGuiHelpers.ScaledDummy(0, 20f); var windowX = ImGui.GetWindowSize().X; foreach (var creditsLine in this.creditsText.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None)) { var lineLenX = ImGui.CalcTextSize(creditsLine).X; ImGui.Dummy(new Vector2((windowX / 2) - (lineLenX / 2), 0f)); ImGui.SameLine(); ImGui.TextUnformatted(creditsLine); } ImGui.PopStyleVar(); if (this.creditsThrottler.Elapsed.TotalMilliseconds > (1000.0f / CreditFPS)) { var curY = ImGui.GetScrollY(); var maxY = ImGui.GetScrollMaxY(); if (curY < maxY - 1) { ImGui.SetScrollY(curY + 1); } } ImGui.EndChild(); }
private void DrawForcedCollectionSelector() { var index = _currentForcedIndex; if (ImGui.Combo("##Forced Collection", ref index, _collectionNamesWithNone) && index != _currentForcedIndex) { _manager.Collections.SetForcedCollection(_collections[index]); _currentForcedIndex = index; } ImGuiCustom.HoverTooltip( "Mods in the forced collection are always loaded if not overwritten by anything in the current or character-based collection.\n" + "Please avoid mixing meta-manipulating mods in Forced and other collections, as this will probably not work correctly."); ImGui.SameLine(); ImGuiHelpers.ScaledDummy(24, 0); ImGui.SameLine(); ImGui.Text("Forced Collection"); }
private void DrawDefaultCollectionSelector() { var index = _currentDefaultIndex; if (ImGui.Combo("##Default Collection", ref index, _collectionNamesWithNone) && index != _currentDefaultIndex) { _manager.Collections.SetDefaultCollection(_collections[index]); _currentDefaultIndex = index; } ImGuiCustom.HoverTooltip( "Mods in the default collection are loaded for any character that is not explicitly named in the character collections below.\n" + "They also take precedence before the forced collection."); ImGui.SameLine(); ImGuiHelpers.ScaledDummy(24, 0); ImGui.SameLine(); ImGui.Text("Default Collection"); }
private void Lodestone() { const float sameLineOffset = 140f; var isLodestoneAvailable = this.plugin.LodestoneService.IsLodestoneAvailable(); var requests = this.plugin.LodestoneService.GetRequests(); // heading WindowManager.SpacerNoTabs(); ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("Lodestone", "Lodestone")); // lodestone state ImGui.Text(Loc.Localize("LodestoneStatus", "Status")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset); if (isLodestoneAvailable) { ImGui.TextColored(ImGuiColors.HealerGreen, Loc.Localize("LodestoneAvailable", "Available")); } else { ImGui.TextColored(ImGuiColors.DPSRed, Loc.Localize("LodestoneUnavailable", "Unavailable")); } // total requests ImGui.Text(Loc.Localize("LodestoneTotalRequests", "Request Count")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset); ImGui.Text(requests.Length.ToString()); // requests ImGuiHelpers.ScaledDummy(new Vector2(0, 5f)); ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("LodestoneRequestsInQueue", "Requests In Queue")); if (requests.Any()) { foreach (var request in requests) { ImGui.Text(request.PlayerName + " (" + request.WorldName + ")"); } } else { ImGui.Text(Loc.Localize("LodestoneNoRequests", "There are no pending lodestone requests.")); } }
public void Draw() { if (!ImGui.BeginTabItem("Collections")) { return; } using var raii = ImGuiRaii.DeferredEnd(ImGui.EndTabItem) .Push(ImGui.EndChild); if (ImGui.BeginChild("##CollectionHandling", new Vector2(-1, ImGui.GetTextLineHeightWithSpacing() * 6), true)) { DrawCurrentCollectionSelector(true); ImGuiHelpers.ScaledDummy(0, 10); DrawNewCollectionInput(); } raii.Pop(); DrawCharacterCollectionSelectors(); }
private void DrawToast() { ImGui.InputText("Toast text", ref this.inputTextToast, 200); ImGui.Combo("Toast Position", ref this.toastPosition, new[] { "Bottom", "Top", }, 2); ImGui.Combo("Toast Speed", ref this.toastSpeed, new[] { "Slow", "Fast", }, 2); ImGui.Combo("Quest Toast Position", ref this.questToastPosition, new[] { "Centre", "Right", "Left" }, 3); ImGui.Checkbox("Quest Checkmark", ref this.questToastCheckmark); ImGui.Checkbox("Quest Play Sound", ref this.questToastSound); ImGui.InputInt("Quest Icon ID", ref this.questToastIconId); ImGuiHelpers.ScaledDummy(new Vector2(10, 10)); if (ImGui.Button("Show toast")) { this.dalamud.Framework.Gui.Toast.ShowNormal(this.inputTextToast, new ToastOptions { Position = (ToastPosition)this.toastPosition, Speed = (ToastSpeed)this.toastSpeed, }); } if (ImGui.Button("Show Quest toast")) { this.dalamud.Framework.Gui.Toast.ShowQuest(this.inputTextToast, new QuestToastOptions { Position = (QuestToastPosition)this.questToastPosition, DisplayCheckmark = this.questToastCheckmark, IconId = (uint)this.questToastIconId, PlaySound = this.questToastSound, }); } if (ImGui.Button("Show Error toast")) { this.dalamud.Framework.Gui.Toast.ShowError(this.inputTextToast); } }
/// <inheritdoc/> public override void Draw() { ImGui.Text($"The in-game addon has been updated to version D{this.assemblyVersion}."); ImGuiHelpers.ScaledDummy(10); ImGui.Text("The following changes were introduced:"); ImGui.TextWrapped(ChangeLog); ImGuiHelpers.ScaledDummy(5); ImGui.TextColored(ImGuiColors.DalamudRed, " !!! ATTENTION !!!"); ImGui.TextWrapped(UpdatePluginsInfo); ImGuiHelpers.ScaledDummy(10); ImGui.Text("Thank you for using our tools!"); ImGuiHelpers.ScaledDummy(10); ImGui.PushFont(UiBuilder.IconFont); if (ImGui.Button(FontAwesomeIcon.Download.ToIconString())) { Service <DalamudInterface> .Get().OpenPluginInstaller(); } if (ImGui.IsItemHovered()) { ImGui.PopFont(); ImGui.SetTooltip("Open Plugin Installer"); ImGui.PushFont(UiBuilder.IconFont); } ImGui.SameLine(); if (ImGui.Button(FontAwesomeIcon.LaughBeam.ToIconString())) { Process.Start("https://discord.gg/3NMcUV5"); } if (ImGui.IsItemHovered()) { ImGui.PopFont(); ImGui.SetTooltip("Join our Discord server"); ImGui.PushFont(UiBuilder.IconFont); } ImGui.SameLine(); if (ImGui.Button(FontAwesomeIcon.Globe.ToIconString())) { Process.Start("https://github.com/goatcorp/FFXIVQuickLauncher"); } if (ImGui.IsItemHovered()) { ImGui.PopFont(); ImGui.SetTooltip("See our GitHub repository"); ImGui.PushFont(UiBuilder.IconFont); } ImGui.PopFont(); ImGui.SameLine(); ImGuiHelpers.ScaledDummy(20, 0); ImGui.SameLine(); if (ImGui.Button("Close")) { this.IsOpen = false; } }
/// <summary> /// Create a dummy scaled for use with tabs. /// </summary> public static void SpacerWithTabs() { ImGuiHelpers.ScaledDummy(1f); }
/// <summary> /// Create a dummy scaled for use without tabs. /// </summary> public static void SpacerNoTabs() { ImGuiHelpers.ScaledDummy(28f); }
public override void Draw() { if (ImGui.BeginPopupModal("Choose Path")) { ImGui.Text("Enter path:\n\n"); ImGui.InputText("###ScratchPathInput", ref this.pathInput, 1000); if (ImGui.Button("OK", new Vector2(120, 0))) { ImGui.CloseCurrentPopup(); this.watcher.Load(this.pathInput); this.pathInput = string.Empty; } ImGui.SetItemDefaultFocus(); ImGui.SameLine(); if (ImGui.Button("Cancel", new Vector2(120, 0))) { ImGui.CloseCurrentPopup(); } ImGui.EndPopup(); } if (ImGui.BeginMenuBar()) { if (ImGui.BeginMenu("File")) { if (ImGui.MenuItem("Load & Watch")) { ImGui.OpenPopup("Choose Path"); } ImGui.EndMenu(); } ImGui.EndMenuBar(); } var flags = ImGuiTabBarFlags.Reorderable | ImGuiTabBarFlags.TabListPopupButton | ImGuiTabBarFlags.FittingPolicyScroll; if (ImGui.BeginTabBar("ScratchDocTabBar", flags)) { if (ImGui.TabItemButton("+", ImGuiTabItemFlags.Trailing | ImGuiTabItemFlags.NoTooltip)) { this.documents.Add(new ScratchpadDocument()); } var docs = this.documents.Concat(this.watcher.TrackedScratches).ToArray(); for (var i = 0; i < docs.Length; i++) { var isOpen = true; if (ImGui.BeginTabItem(docs[i].Title + (docs[i].HasUnsaved ? "*" : string.Empty) + "###ScratchItem" + i, ref isOpen)) { if (ImGui.InputTextMultiline("###ScratchInput" + i, ref docs[i].Content, 20000, new Vector2(-1, -34), ImGuiInputTextFlags.AllowTabInput)) { docs[i].HasUnsaved = true; } ImGuiHelpers.ScaledDummy(3); if (ImGui.Button("Compile & Reload")) { docs[i].Status = this.Execution.RenewScratch(docs[i]); } ImGui.SameLine(); if (ImGui.Button("Dispose all")) { this.Execution.DisposeAllScratches(); } ImGui.SameLine(); if (ImGui.Button("Dump processed code")) { try { var code = this.Execution.MacroProcessor.Process(docs[i].Content); Log.Information(code); ImGui.SetClipboardText(code); } catch (Exception ex) { Log.Error(ex, "Could not process macros"); } } ImGui.SameLine(); if (ImGui.Button("Toggle Log")) { this.dalamud.DalamudUi.ToggleLog(); } ImGui.SameLine(); ImGui.Checkbox("Use Macros", ref docs[i].IsMacro); ImGui.SameLine(); switch (docs[i].Status) { case ScratchLoadStatus.Unknown: ImGui.TextColored(ImGuiColors.DalamudGrey, "Compile scratch to see status"); break; case ScratchLoadStatus.FailureCompile: ImGui.TextColored(ImGuiColors.DalamudRed, "Error during compilation"); break; case ScratchLoadStatus.FailureInit: ImGui.TextColored(ImGuiColors.DalamudRed, "Error during init"); break; case ScratchLoadStatus.Success: ImGui.TextColored(ImGuiColors.HealerGreen, "OK!"); break; default: throw new ArgumentOutOfRangeException(); } ImGui.SameLine(); ImGui.TextColored(ImGuiColors.DalamudGrey, docs[i].Id.ToString()); ImGui.EndTabItem(); } } ImGui.EndTabBar(); } }
/// <inheritdoc/> public override void Draw() { ImGui.Text($"Dalamud has been updated to version D{this.assemblyVersion}."); ImGuiHelpers.ScaledDummy(10); ImGui.Text("The following changes were introduced:"); ImGui.SameLine(); ImGuiHelpers.ScaledDummy(0); var imgCursor = ImGui.GetCursorPos(); ImGui.TextWrapped(ChangeLog); /* * ImGuiHelpers.ScaledDummy(5); * * ImGui.TextColored(ImGuiColors.DalamudRed, " !!! ATTENTION !!!"); * * ImGui.TextWrapped(UpdatePluginsInfo); */ ImGuiHelpers.ScaledDummy(10); ImGui.Text("Thank you for using our tools!"); ImGuiHelpers.ScaledDummy(10); ImGui.PushFont(UiBuilder.IconFont); if (ImGui.Button(FontAwesomeIcon.Download.ToIconString())) { Service <DalamudInterface> .Get().OpenPluginInstaller(); } if (ImGui.IsItemHovered()) { ImGui.PopFont(); ImGui.SetTooltip("Open Plugin Installer"); ImGui.PushFont(UiBuilder.IconFont); } ImGui.SameLine(); if (ImGui.Button(FontAwesomeIcon.LaughBeam.ToIconString())) { Util.OpenLink("https://discord.gg/3NMcUV5"); } if (ImGui.IsItemHovered()) { ImGui.PopFont(); ImGui.SetTooltip("Join our Discord server"); ImGui.PushFont(UiBuilder.IconFont); } ImGui.SameLine(); if (ImGui.Button(FontAwesomeIcon.Globe.ToIconString())) { Util.OpenLink("https://goatcorp.github.io/faq/"); } if (ImGui.IsItemHovered()) { ImGui.PopFont(); ImGui.SetTooltip("See the FAQ"); ImGui.PushFont(UiBuilder.IconFont); } ImGui.SameLine(); if (ImGui.Button(FontAwesomeIcon.Heart.ToIconString())) { Util.OpenLink("https://goatcorp.github.io/faq/support"); } if (ImGui.IsItemHovered()) { ImGui.PopFont(); ImGui.SetTooltip("Support what we care about"); ImGui.PushFont(UiBuilder.IconFont); } ImGui.PopFont(); ImGui.SameLine(); ImGuiHelpers.ScaledDummy(20, 0); ImGui.SameLine(); if (ImGui.Button("Close")) { this.IsOpen = false; } imgCursor.X += 750; imgCursor.Y -= 30; ImGui.SetCursorPos(imgCursor); ImGui.Image(this.logoTexture.ImGuiHandle, new Vector2(100)); }
private void PlayerDisplay() { if (this.SelectedPlayer == null) { return; } const float sameLineOffset = 150f; // category ImGui.Text(Loc.Localize("PlayerCategory", "Category")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset); var categoryNames = this.plugin.CategoryService.GetCategoryNames().ToArray(); var categoryIds = this.plugin.CategoryService.GetCategoryIds().ToArray(); var currentCategory = this.plugin.CategoryService.GetCategory(this.SelectedPlayer.CategoryId); var categoryIndex = Array.IndexOf(categoryNames, currentCategory.Name); ImGui.SetNextItemWidth(150f * ImGuiHelpers.GlobalScale); if (ImGui.Combo( "###PlayerTrack_PlayerCategory_Combo", ref categoryIndex, categoryNames, categoryNames.Length)) { this.SelectedPlayer.CategoryId = categoryIds[categoryIndex]; this.plugin.PlayerService.UpdatePlayerCategory(this.SelectedPlayer); this.plugin.NamePlateManager.ForceRedraw(); } ImGuiHelpers.ScaledDummy(0.5f); ImGui.Separator(); // override warning ImGui.TextColored(ImGuiColors.DalamudYellow, Loc.Localize( "OverrideNote", "These config will override category config.")); ImGuiHelpers.ScaledDummy(1f); // title ImGui.Text(Loc.Localize("Title", "Title")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset); var title = this.SelectedPlayer.Title; ImGui.SetNextItemWidth(150f * ImGuiHelpers.GlobalScale); if (ImGui.InputText("###PlayerTrack_PlayerTitle_Input", ref title, 30)) { this.SelectedPlayer.Title = title; this.plugin.PlayerService.UpdatePlayerTitle(this.SelectedPlayer); } ImGui.Spacing(); // icon ImGui.Text(Loc.Localize("Icon", "Icon")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset); ImGui.SetNextItemWidth(150f * ImGuiHelpers.GlobalScale); var iconIndex = this.plugin.IconListIndex(this.SelectedPlayer !.Icon); if (ImGui.Combo( "###PlayerTrack_PlayerIcon_Combo", ref iconIndex, this.plugin.IconListNames(), this.plugin.IconListNames().Length)) { this.SelectedPlayer.Icon = this.plugin.IconListCodes()[iconIndex]; this.plugin.PlayerService.UpdatePlayerIcon(this.SelectedPlayer); } ImGui.SameLine(); ImGui.PushFont(UiBuilder.IconFont); ImGui.TextColored( ImGuiColors.DalamudWhite, ((FontAwesomeIcon)this.SelectedPlayer.Icon).ToIconString()); ImGui.PopFont(); ImGui.Spacing(); // visibility ImGui.Text(Loc.Localize("VisibilityType", "Visibility")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset); ImGui.SetNextItemWidth(150f * ImGuiHelpers.GlobalScale); var visibilityType = (int)this.SelectedPlayer.VisibilityType; if (ImGui.Combo( "###PlayerTrack_VisibilityType_Combo", ref visibilityType, Enum.GetNames(typeof(VisibilityType)), Enum.GetNames(typeof(VisibilityType)).Length)) { this.SelectedPlayer.VisibilityType = (VisibilityType)visibilityType; this.plugin.PlayerService.UpdatePlayerVisibilityType(this.SelectedPlayer); } ImGui.Spacing(); // list color ImGui.Text(Loc.Localize("List", "List")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset); var listColor = this.SelectedPlayer.EffectiveListColor(); if (ImGui.ColorButton("List Color###PlayerTrack_PlayerListColor_Button", listColor)) { ImGui.OpenPopup("###PlayerTrack_PlayerListColor_Popup"); } if (ImGui.BeginPopup("###PlayerTrack_PlayerListColor_Popup")) { if (ImGui.ColorPicker4("List Color###PlayerTrack_PlayerListColor_ColorPicker", ref listColor)) { this.SelectedPlayer.ListColor = listColor; if (this.plugin.Configuration.DefaultNamePlateColorToListColor) { this.SelectedPlayer.NamePlateColor = listColor; } this.plugin.PlayerService.UpdatePlayerListColor(this.SelectedPlayer); } this.PlayerOverride_ListColorSwatchRow(0, 8); this.PlayerOverride_ListColorSwatchRow(8, 16); this.PlayerOverride_ListColorSwatchRow(16, 24); this.PlayerOverride_ListColorSwatchRow(24, 32); ImGui.EndPopup(); } // nameplate color ImGui.Spacing(); ImGui.Text(Loc.Localize("Nameplate", "Nameplate")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset); var namePlateColor = this.SelectedPlayer.EffectiveNamePlateColor(); if (ImGui.ColorButton("NamePlate Color###PlayerTrack_PlayerNamePlateColor_Button", namePlateColor)) { ImGui.OpenPopup("###PlayerTrack_PlayerNamePlateColor_Popup"); } if (ImGui.BeginPopup("###PlayerTrack_PlayerNamePlateColor_Popup")) { if (ImGui.ColorPicker4("NamePlate Color###PlayerTrack_PlayerNamePlateColor_ColorPicker", ref namePlateColor)) { this.SelectedPlayer.NamePlateColor = namePlateColor; this.plugin.PlayerService.UpdatePlayerNamePlateColor(this.SelectedPlayer); } this.PlayerOverride_NamePlateColorSwatchRow(0, 8); this.PlayerOverride_NamePlateColorSwatchRow(8, 16); this.PlayerOverride_NamePlateColorSwatchRow(16, 24); this.PlayerOverride_NamePlateColorSwatchRow(24, 32); ImGui.EndPopup(); } // fc name color ImGui.Spacing(); ImGui.Text(Loc.Localize("OverrideFCNameColor", "Override FCNameColor")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset); var overrideFCNameColor = this.SelectedPlayer.OverrideFCNameColor; if (ImGui.Checkbox( "###PlayerTrack_PlayerOverrideFCNameColor_Checkbox", ref overrideFCNameColor)) { this.SelectedPlayer.OverrideFCNameColor = overrideFCNameColor; this.plugin.PlayerService.UpdatePlayerOverrideFCNameColor(this.SelectedPlayer); } // alerts ImGui.Spacing(); ImGui.Text(Loc.Localize("Alerts", "Alerts")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset); var isAlertEnabled = this.SelectedPlayer.IsAlertEnabled; if (ImGui.Checkbox( "###PlayerTrack_PlayerAlerts_Checkbox", ref isAlertEnabled)) { this.SelectedPlayer.IsAlertEnabled = isAlertEnabled; this.plugin.PlayerService.UpdatePlayerAlert(this.SelectedPlayer); } // reset ImGuiHelpers.ScaledDummy(5f); if (ImGui.Button(Loc.Localize("Reset", "Reset") + "###PlayerTrack_PlayerOverrideModalReset_Button")) { this.SelectedPlayer.Reset(); this.plugin.PlayerService.ResetPlayerOverrides(this.SelectedPlayer); } }
/// <inheritdoc /> public override void Draw() { var config = Service <DalamudConfiguration> .Get(); var renameModalTitle = Loc.Localize("RenameStyleModalTitle", "Rename Style"); var workStyle = config.SavedStyles[this.currentSel]; workStyle.BuiltInColors ??= StyleModelV1.DalamudStandard.BuiltInColors; var appliedThisFrame = false; var styleAry = config.SavedStyles.Select(x => x.Name).ToArray(); ImGui.Text(Loc.Localize("StyleEditorChooseStyle", "Choose Style:")); if (ImGui.Combo("###styleChooserCombo", ref this.currentSel, styleAry, styleAry.Length)) { var newStyle = config.SavedStyles[this.currentSel]; newStyle.Apply(); appliedThisFrame = true; } if (ImGui.Button(Loc.Localize("StyleEditorAddNew", "Add new style"))) { this.SaveStyle(); var newStyle = StyleModelV1.DalamudStandard; newStyle.Name = GetRandomName(); config.SavedStyles.Add(newStyle); this.currentSel = config.SavedStyles.Count - 1; newStyle.Apply(); appliedThisFrame = true; config.Save(); } ImGui.SameLine(); if (ImGuiComponents.IconButton(FontAwesomeIcon.Trash) && this.currentSel != 0) { this.currentSel--; var newStyle = config.SavedStyles[this.currentSel]; newStyle.Apply(); appliedThisFrame = true; config.SavedStyles.RemoveAt(this.currentSel + 1); config.Save(); } if (ImGui.IsItemHovered()) { ImGui.SetTooltip(Loc.Localize("StyleEditorDeleteStyle", "Delete current style")); } ImGui.SameLine(); if (ImGuiComponents.IconButton(FontAwesomeIcon.Pen) && this.currentSel != 0) { var newStyle = config.SavedStyles[this.currentSel]; this.renameText = newStyle.Name; this.renameModalDrawing = true; ImGui.OpenPopup(renameModalTitle); } if (ImGui.IsItemHovered()) { ImGui.SetTooltip(Loc.Localize("StyleEditorRenameStyle", "Rename style")); } ImGui.SameLine(); ImGuiHelpers.ScaledDummy(5); ImGui.SameLine(); if (ImGuiComponents.IconButton(FontAwesomeIcon.FileExport)) { var selectedStyle = config.SavedStyles[this.currentSel]; var newStyle = StyleModelV1.Get(); newStyle.Name = selectedStyle.Name; ImGui.SetClipboardText(newStyle.Serialize()); } if (ImGui.IsItemHovered()) { ImGui.SetTooltip(Loc.Localize("StyleEditorCopy", "Copy style to clipboard for sharing")); } ImGui.SameLine(); if (ImGuiComponents.IconButton(FontAwesomeIcon.FileImport)) { this.SaveStyle(); var styleJson = ImGui.GetClipboardText(); try { var newStyle = StyleModel.Deserialize(styleJson); newStyle.Name ??= GetRandomName(); if (config.SavedStyles.Any(x => x.Name == newStyle.Name)) { newStyle.Name = $"{newStyle.Name} ({GetRandomName()} Mix)"; } config.SavedStyles.Add(newStyle); newStyle.Apply(); appliedThisFrame = true; this.currentSel = config.SavedStyles.Count - 1; config.Save(); } catch (Exception ex) { Log.Error(ex, "Could not import style"); } } if (ImGui.IsItemHovered()) { ImGui.SetTooltip(Loc.Localize("StyleEditorImport", "Import style from clipboard")); } ImGui.Separator(); ImGui.PushItemWidth(ImGui.GetWindowWidth() * 0.50f); if (this.currentSel < 2) { ImGui.TextColored(ImGuiColors.DalamudRed, Loc.Localize("StyleEditorNotAllowed", "You cannot edit built-in styles. Please add a new style first.")); } else if (appliedThisFrame) { ImGui.Text(Loc.Localize("StyleEditorApplying", "Applying style...")); } else if (ImGui.BeginTabBar("StyleEditorTabs")) { var style = ImGui.GetStyle(); if (ImGui.BeginTabItem(Loc.Localize("StyleEditorVariables", "Variables"))) { ImGui.BeginChild($"ScrollingVars", ImGuiHelpers.ScaledVector2(0, -32), true, ImGuiWindowFlags.HorizontalScrollbar | ImGuiWindowFlags.NoBackground); ImGui.SetCursorPosY(ImGui.GetCursorPosY() - 5); ImGui.SliderFloat2("WindowPadding", ref style.WindowPadding, 0.0f, 20.0f, "%.0f"); ImGui.SliderFloat2("FramePadding", ref style.FramePadding, 0.0f, 20.0f, "%.0f"); ImGui.SliderFloat2("CellPadding", ref style.CellPadding, 0.0f, 20.0f, "%.0f"); ImGui.SliderFloat2("ItemSpacing", ref style.ItemSpacing, 0.0f, 20.0f, "%.0f"); ImGui.SliderFloat2("ItemInnerSpacing", ref style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f"); ImGui.SliderFloat2("TouchExtraPadding", ref style.TouchExtraPadding, 0.0f, 10.0f, "%.0f"); ImGui.SliderFloat("IndentSpacing", ref style.IndentSpacing, 0.0f, 30.0f, "%.0f"); ImGui.SliderFloat("ScrollbarSize", ref style.ScrollbarSize, 1.0f, 20.0f, "%.0f"); ImGui.SliderFloat("GrabMinSize", ref style.GrabMinSize, 1.0f, 20.0f, "%.0f"); ImGui.Text("Borders"); ImGui.SliderFloat("WindowBorderSize", ref style.WindowBorderSize, 0.0f, 1.0f, "%.0f"); ImGui.SliderFloat("ChildBorderSize", ref style.ChildBorderSize, 0.0f, 1.0f, "%.0f"); ImGui.SliderFloat("PopupBorderSize", ref style.PopupBorderSize, 0.0f, 1.0f, "%.0f"); ImGui.SliderFloat("FrameBorderSize", ref style.FrameBorderSize, 0.0f, 1.0f, "%.0f"); ImGui.SliderFloat("TabBorderSize", ref style.TabBorderSize, 0.0f, 1.0f, "%.0f"); ImGui.Text("Rounding"); ImGui.SliderFloat("WindowRounding", ref style.WindowRounding, 0.0f, 12.0f, "%.0f"); ImGui.SliderFloat("ChildRounding", ref style.ChildRounding, 0.0f, 12.0f, "%.0f"); ImGui.SliderFloat("FrameRounding", ref style.FrameRounding, 0.0f, 12.0f, "%.0f"); ImGui.SliderFloat("PopupRounding", ref style.PopupRounding, 0.0f, 12.0f, "%.0f"); ImGui.SliderFloat("ScrollbarRounding", ref style.ScrollbarRounding, 0.0f, 12.0f, "%.0f"); ImGui.SliderFloat("GrabRounding", ref style.GrabRounding, 0.0f, 12.0f, "%.0f"); ImGui.SliderFloat("LogSliderDeadzone", ref style.LogSliderDeadzone, 0.0f, 12.0f, "%.0f"); ImGui.SliderFloat("TabRounding", ref style.TabRounding, 0.0f, 12.0f, "%.0f"); ImGui.Text("Alignment"); ImGui.SliderFloat2("WindowTitleAlign", ref style.WindowTitleAlign, 0.0f, 1.0f, "%.2f"); var windowMenuButtonPosition = (int)style.WindowMenuButtonPosition + 1; if (ImGui.Combo("WindowMenuButtonPosition", ref windowMenuButtonPosition, "None\0Left\0Right\0")) { style.WindowMenuButtonPosition = (ImGuiDir)(windowMenuButtonPosition - 1); } ImGui.SliderFloat2("ButtonTextAlign", ref style.ButtonTextAlign, 0.0f, 1.0f, "%.2f"); ImGui.SameLine(); ImGuiComponents.HelpMarker("Alignment applies when a button is larger than its text content."); ImGui.SliderFloat2("SelectableTextAlign", ref style.SelectableTextAlign, 0.0f, 1.0f, "%.2f"); ImGui.SameLine(); ImGuiComponents.HelpMarker("Alignment applies when a selectable is larger than its text content."); ImGui.SliderFloat2("DisplaySafeAreaPadding", ref style.DisplaySafeAreaPadding, 0.0f, 30.0f, "%.0f"); ImGui.SameLine(); ImGuiComponents.HelpMarker( "Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured)."); ImGui.EndTabItem(); ImGui.EndChild(); ImGui.EndTabItem(); } if (ImGui.BeginTabItem(Loc.Localize("StyleEditorColors", "Colors"))) { ImGui.BeginChild("ScrollingColors", ImGuiHelpers.ScaledVector2(0, -30), true, ImGuiWindowFlags.HorizontalScrollbar | ImGuiWindowFlags.NoBackground); ImGui.SetCursorPosY(ImGui.GetCursorPosY() - 5); if (ImGui.RadioButton("Opaque", this.alphaFlags == ImGuiColorEditFlags.None)) { this.alphaFlags = ImGuiColorEditFlags.None; } ImGui.SameLine(); if (ImGui.RadioButton("Alpha", this.alphaFlags == ImGuiColorEditFlags.AlphaPreview)) { this.alphaFlags = ImGuiColorEditFlags.AlphaPreview; } ImGui.SameLine(); if (ImGui.RadioButton("Both", this.alphaFlags == ImGuiColorEditFlags.AlphaPreviewHalf)) { this.alphaFlags = ImGuiColorEditFlags.AlphaPreviewHalf; } ImGui.SameLine(); ImGuiComponents.HelpMarker( "In the color list:\n" + "Left-click on color square to open color picker,\n" + "Right-click to open edit options menu."); foreach (var imGuiCol in Enum.GetValues <ImGuiCol>()) { if (imGuiCol == ImGuiCol.COUNT) { continue; } ImGui.PushID(imGuiCol.ToString()); ImGui.ColorEdit4("##color", ref style.Colors[(int)imGuiCol], ImGuiColorEditFlags.AlphaBar | this.alphaFlags); ImGui.SameLine(0.0f, style.ItemInnerSpacing.X); ImGui.TextUnformatted(imGuiCol.ToString()); ImGui.PopID(); } ImGui.Separator(); foreach (var property in typeof(DalamudColors).GetProperties(BindingFlags.Public | BindingFlags.Instance)) { ImGui.PushID(property.Name); var colorVal = property.GetValue(workStyle.BuiltInColors); if (colorVal == null) { colorVal = property.GetValue(StyleModelV1.DalamudStandard.BuiltInColors); property.SetValue(workStyle.BuiltInColors, colorVal); } var color = (Vector4)colorVal; if (ImGui.ColorEdit4("##color", ref color, ImGuiColorEditFlags.AlphaBar | this.alphaFlags)) { property.SetValue(workStyle.BuiltInColors, color); workStyle.BuiltInColors?.Apply(); } ImGui.SameLine(0.0f, style.ItemInnerSpacing.X); ImGui.TextUnformatted(property.Name); ImGui.PopID(); } ImGui.EndChild(); ImGui.EndTabItem(); } ImGui.EndTabBar(); } ImGui.PopItemWidth(); ImGui.Separator(); if (ImGui.Button(Loc.Localize("Close", "Close"))) { this.IsOpen = false; } ImGui.SameLine(); if (ImGui.Button(Loc.Localize("SaveAndClose", "Save and Close"))) { this.SaveStyle(); config.ChosenStyle = config.SavedStyles[this.currentSel].Name; Log.Verbose("ChosenStyle = {ChosenStyle}", config.ChosenStyle); this.didSave = true; this.IsOpen = false; } if (ImGui.BeginPopupModal(renameModalTitle, ref this.renameModalDrawing, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoScrollbar)) { ImGui.Text(Loc.Localize("StyleEditorEnterName", "Please enter the new name for this style.")); ImGui.Spacing(); ImGui.InputText("###renameModalInput", ref this.renameText, 255); const float buttonWidth = 120f; ImGui.SetCursorPosX((ImGui.GetWindowWidth() - buttonWidth) / 2); if (ImGui.Button("OK", new Vector2(buttonWidth, 40))) { config.SavedStyles[this.currentSel].Name = this.renameText; config.Save(); ImGui.CloseCurrentPopup(); } ImGui.EndPopup(); } }
private void PlayerSummary() { if (this.SelectedPlayer == null) { return; } var sameLineOffset1 = 100f; var sameLineOffset2 = 260f; var sameLineOffset3 = 360f; // Override for more spacing string[] overrideLangCodes = { "fr", "it", "es" }; if (overrideLangCodes.Contains(PlayerTrackPlugin.PluginInterface.UiLanguage)) { sameLineOffset1 = 120f; sameLineOffset2 = 280f; sameLineOffset3 = 450f; } ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("PlayerInfo", "Player Info")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset2); ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("PlayerStats", "Player Stats")); ImGui.Text(Loc.Localize("PlayerName", "Name")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset1); if (this.SelectedPlayer.Names.Count > 1) { ImGui.BeginGroup(); ImGui.Text(this.SelectedPlayer.Names.First()); ImGui.SameLine(); ImGui.PushFont(UiBuilder.IconFont); ImGui.TextColored(ImGuiColors.DalamudYellow, FontAwesomeIcon.InfoCircle.ToIconString()); ImGui.PopFont(); ImGui.EndGroup(); if (ImGui.IsItemHovered()) { ImGui.SetTooltip(string.Format( Loc.Localize("PlayerPreviousNames", "Previously known as {0}"), string.Join(", ", this.SelectedPlayer.Names.Skip(1)))); } } else { ImGui.Text(this.SelectedPlayer.Names !.First()); } ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset2); ImGui.Text(Loc.Localize("PlayerFirstSeen", "First Seen")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset3); ImGui.Text(this.SelectedPlayer.SeenCount != 0 ? this.SelectedPlayer.Created.ToTimeSpan() : "N/A"); ImGui.Text(Loc.Localize("PlayerHomeworld", "Homeworld")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset1); if (this.SelectedPlayer.HomeWorlds.Count > 1) { ImGui.BeginGroup(); ImGui.Text(this.SelectedPlayer.HomeWorlds !.First().Value); ImGui.SameLine(); ImGui.PushFont(UiBuilder.IconFont); ImGui.TextColored(ImGuiColors.DalamudYellow, FontAwesomeIcon.InfoCircle.ToIconString()); ImGui.PopFont(); ImGui.EndGroup(); if (ImGui.IsItemHovered()) { ImGui.SetTooltip(string.Format( Loc.Localize("PlayerPreviousWorlds", "Previously on {0}"), string.Join(", ", this.SelectedPlayer.HomeWorlds.Skip(1).Select(kvp => kvp.Value)))); } } else { ImGui.Text(this.SelectedPlayer.HomeWorlds !.First().Value); } ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset2); ImGui.Text(Loc.Localize("PlayerLastSeen", "Last Seen")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset3); ImGui.Text(this.SelectedPlayer.SeenCount != 0 ? this.SelectedPlayer.Updated.ToTimeSpan() : "N/A"); ImGui.Text(Loc.Localize("FreeCompany", "Free Company")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset1); ImGui.Text(this.SelectedPlayer.FreeCompany); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset2); ImGui.Text(Loc.Localize("PlayerLastLocation", "Last Location")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset3); ImGui.Text(this.SelectedPlayer.LastLocationName); ImGui.Text(Loc.Localize("PlayerLodestone", "Lodestone")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset1); if (this.SelectedPlayer.LodestoneStatus != LodestoneStatus.Failed) { ImGui.Text(this.SelectedPlayer.LodestoneStatus.ToString()); } else { ImGui.BeginGroup(); ImGui.Text(this.SelectedPlayer.LodestoneStatus.ToString()); ImGui.SameLine(); ImGui.PushFont(UiBuilder.IconFont); ImGui.TextColored(ImGuiColors.DPSRed, FontAwesomeIcon.Redo.ToIconString()); ImGui.PopFont(); ImGui.EndGroup(); if (ImGui.IsItemClicked()) { this.SelectedPlayer.LodestoneStatus = LodestoneStatus.Unverified; this.SelectedPlayer.LodestoneFailureCount = 0; this.plugin.PlayerService.UpdatePlayerLodestoneState(this.SelectedPlayer); this.plugin.PlayerService.SubmitLodestoneRequest(this.SelectedPlayer); } } ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset2); ImGui.Text(Loc.Localize("PlayerSeenCount", "Seen Count")); ImGuiHelpers.ScaledRelativeSameLine(sameLineOffset3); ImGui.Text(this.SelectedPlayer.SeenCount != 0 ? this.SelectedPlayer.SeenCount + "x" : "N/A"); // add tag if (this.plugin.Configuration.ShowPlayerTags) { ImGui.Spacing(); ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("PlayerTags", "Tags")); ImGui.SetNextItemWidth(150f * ImGuiHelpers.GlobalScale); ImGui.InputText( "###PlayerTrack_PlayerNotes_InputText", ref this.newTag, 20); ImGui.SameLine(); if (ImGui.Button("Add")) { if (!string.IsNullOrEmpty(this.newTag)) { this.SelectedPlayer.Tags.Add(this.newTag); this.plugin.PlayerService.UpdatePlayerTags(this.SelectedPlayer); this.newTag = string.Empty; } } // tags ImGui.Spacing(); for (var i = 0; i < this.SelectedPlayer.Tags.Count; i++) { if (ImGui.SmallButton(this.SelectedPlayer.Tags[i] + " ×")) { this.SelectedPlayer.Tags.RemoveAt(i); this.plugin.PlayerService.UpdatePlayerTags(this.SelectedPlayer); } ImGui.SameLine(); } if (this.SelectedPlayer.Tags.Count > 0) { ImGuiHelpers.ScaledDummy(5f); } } ImGui.Spacing(); ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("PlayerNotes", "Notes")); var notes = this.SelectedPlayer.Notes; if (ImGui.InputTextMultiline( "###PlayerTrack_PlayerNotes_MultiText", ref notes, 2000, new Vector2( x: ImGui.GetWindowSize().X - (5f * ImGuiHelpers.GlobalScale), y: -1 - (5f * ImGuiHelpers.GlobalScale)))) { this.SelectedPlayer.Notes = notes; this.plugin.PlayerService.UpdatePlayerNotes(this.SelectedPlayer); } }