From 2d9598e1902966ac03cf0e2f0be938e3823014c7 Mon Sep 17 00:00:00 2001 From: Raenore <172234435+Raenore@users.noreply.github.com> Date: Sun, 21 Jul 2024 00:41:13 +0200 Subject: [PATCH] All dropdowns get consistent + Some delete relation stuff (#1050) * All dropdowns get consistent Dropdowns will generally be: Change nothing > Do not show > Change something > Change all (the bigger/more permissive the change, the lower in the list. Where applicable!). * Make "Delete Relations" option red as it is destructive Deleting relations can also hurt your feelings maybe. :( * Relation in use means greyed out Mind you, due to how the menu list works.. If you disable an option it has no "hover" state so the tooltip doesn't actually trigger. * Don't lose the element data reference before setting tooltips --------- Co-authored-by: Daniel Yates --- totalRP3/Locales/enUS.lua | 1 + totalRP3/Modules/Dashboard/StatusPanel.lua | 26 +++++++++---------- .../Register/Characters/RegisterMisc.lua | 24 ++++++++--------- .../Register/Characters/RegisterRelations.lua | 8 ++++-- 4 files changed, 32 insertions(+), 27 deletions(-) diff --git a/totalRP3/Locales/enUS.lua b/totalRP3/Locales/enUS.lua index 507df19f2..c5233d69e 100644 --- a/totalRP3/Locales/enUS.lua +++ b/totalRP3/Locales/enUS.lua @@ -509,6 +509,7 @@ Class: 50 characters|r]], CO_RELATIONS_NEW_COLOR_TT = "This will determine the relation color.", CO_RELATIONS_MENU_EDIT = "Edit relation", CO_RELATIONS_MENU_DELETE = "Delete relation", + CO_RELATIONS_MENU_DELETE_DISABLED_TT = "You cannot delete relations that are currently associated with a profile.", CO_CURSOR_TITLE = "Cursor interactions", CO_CURSOR_RIGHT_CLICK = "Right-click to open profile", CO_CURSOR_RIGHT_CLICK_TT = [[Right-click on a player in the 3D world to open their profile, if they have one. diff --git a/totalRP3/Modules/Dashboard/StatusPanel.lua b/totalRP3/Modules/Dashboard/StatusPanel.lua index 5b85efe48..aacd50ad8 100644 --- a/totalRP3/Modules/Dashboard/StatusPanel.lua +++ b/totalRP3/Modules/Dashboard/StatusPanel.lua @@ -76,34 +76,34 @@ local function SetWalkup(walkup) end local function GenerateRPStatusMenu(_, rootDescription) - do -- In character - local status = AddOn_TotalRP3.Enums.ROLEPLAY_STATUS.IN_CHARACTER; - local elementDescription = rootDescription:CreateRadio(L.DB_STATUS_RP_IC, IsRoleplayStatus, SetRoleplayStatus, status); - TRP3_MenuUtil.AttachTexture(elementDescription, [[Interface\COMMON\Indicator-Green]]); - TRP3_MenuUtil.SetElementTooltip(elementDescription, L.DB_STATUS_RP_IC_TT); - end - do -- Out of character local status = AddOn_TotalRP3.Enums.ROLEPLAY_STATUS.OUT_OF_CHARACTER; local elementDescription = rootDescription:CreateRadio(L.DB_STATUS_RP_OOC, IsRoleplayStatus, SetRoleplayStatus, status); TRP3_MenuUtil.AttachTexture(elementDescription, [[Interface\COMMON\Indicator-Red]]); TRP3_MenuUtil.SetElementTooltip(elementDescription, L.DB_STATUS_RP_OOC_TT); end + + do -- In character + local status = AddOn_TotalRP3.Enums.ROLEPLAY_STATUS.IN_CHARACTER; + local elementDescription = rootDescription:CreateRadio(L.DB_STATUS_RP_IC, IsRoleplayStatus, SetRoleplayStatus, status); + TRP3_MenuUtil.AttachTexture(elementDescription, [[Interface\COMMON\Indicator-Green]]); + TRP3_MenuUtil.SetElementTooltip(elementDescription, L.DB_STATUS_RP_IC_TT); + end end local function GenerateWalkupMenu(_, rootDescription) + do -- Walkup No + local walkup = AddOn_TotalRP3.Enums.WALKUP.NO; + local elementDescription = rootDescription:CreateRadio(L.CM_DO_NOT_SHOW, IsWalkupFriendly, SetWalkup, walkup); + TRP3_MenuUtil.AttachTexture(elementDescription); + end + do -- Walkup Yes local walkup = AddOn_TotalRP3.Enums.WALKUP.YES; local elementDescription = rootDescription:CreateRadio(L.CM_YES, IsWalkupFriendly, SetWalkup, walkup); TRP3_MenuUtil.AttachTexture(elementDescription, [[Interface\AddOns\totalRP3\Resources\UI\ui-icon-walkup.tga]]); TRP3_MenuUtil.SetElementTooltip(elementDescription, L.DB_STATUS_WU_YES_TT); end - - do -- Walkup No - local walkup = AddOn_TotalRP3.Enums.WALKUP.NO; - local elementDescription = rootDescription:CreateRadio(L.CM_DO_NOT_SHOW, IsWalkupFriendly, SetWalkup, walkup); - TRP3_MenuUtil.AttachTexture(elementDescription); - end end local function GenerateXPStatusMenu(_, rootDescription) diff --git a/totalRP3/Modules/Register/Characters/RegisterMisc.lua b/totalRP3/Modules/Register/Characters/RegisterMisc.lua index 8bb834dc7..d704ceed4 100644 --- a/totalRP3/Modules/Register/Characters/RegisterMisc.lua +++ b/totalRP3/Modules/Register/Characters/RegisterMisc.lua @@ -36,10 +36,10 @@ local function buildStyleStructure() name = loc.REG_PLAYER_STYLE_INJURY, tooltipText = loc.REG_PLAYER_STYLE_INJURY_TT, values = { - {YES, 1}, + {loc.CM_DO_NOT_SHOW, 0}, {NO, 2}, {loc.REG_PLAYER_STYLE_PERMI, 3}, - {loc.CM_DO_NOT_SHOW, 0}, + {YES, 1}, } }, { @@ -47,10 +47,10 @@ local function buildStyleStructure() name = loc.REG_PLAYER_STYLE_DEATH, tooltipText = loc.REG_PLAYER_STYLE_DEATH_TT, values = { - {YES, 1}, + {loc.CM_DO_NOT_SHOW, 0}, {NO, 2}, {loc.REG_PLAYER_STYLE_PERMI, 3}, - {loc.CM_DO_NOT_SHOW, 0}, + {YES, 1}, } }, { @@ -58,10 +58,10 @@ local function buildStyleStructure() name = loc.REG_PLAYER_STYLE_ROMANCE, tooltipText = loc.REG_PLAYER_STYLE_ROMANCE_TT, values = { - {YES, 1}, + {loc.CM_DO_NOT_SHOW, 0}, {NO, 2}, {loc.REG_PLAYER_STYLE_PERMI, 3}, - {loc.CM_DO_NOT_SHOW, 0}, + {YES, 1}, } }, { @@ -69,10 +69,10 @@ local function buildStyleStructure() name = loc.REG_PLAYER_STYLE_CRIME, tooltipText = loc.REG_PLAYER_STYLE_CRIME_TT, values = { - {YES, 1}, + {loc.CM_DO_NOT_SHOW, 0}, {NO, 2}, {loc.REG_PLAYER_STYLE_PERMI, 3}, - {loc.CM_DO_NOT_SHOW, 0}, + {YES, 1}, } }, { @@ -80,10 +80,10 @@ local function buildStyleStructure() name = loc.REG_PLAYER_STYLE_LOSSOFCONTROL, tooltipText = loc.REG_PLAYER_STYLE_LOSSOFCONTROL_TT, values = { - {YES, 1}, + {loc.CM_DO_NOT_SHOW, 0}, {NO, 2}, {loc.REG_PLAYER_STYLE_PERMI, 3}, - {loc.CM_DO_NOT_SHOW, 0}, + {YES, 1}, } }, { @@ -91,9 +91,9 @@ local function buildStyleStructure() name = loc.REG_PLAYER_STYLE_GUILD, tooltipText = loc.REG_PLAYER_STYLE_GUILD_TT, values = { - {loc.REG_PLAYER_STYLE_GUILD_IC, 1}, - {loc.REG_PLAYER_STYLE_GUILD_OOC, 2}, {loc.CM_DO_NOT_SHOW, 0}, + {loc.REG_PLAYER_STYLE_GUILD_OOC, 2}, + {loc.REG_PLAYER_STYLE_GUILD_IC, 1}, } }, }; diff --git a/totalRP3/Modules/Register/Characters/RegisterRelations.lua b/totalRP3/Modules/Register/Characters/RegisterRelations.lua index 0fe1e14da..4fa44cb4a 100644 --- a/totalRP3/Modules/Register/Characters/RegisterRelations.lua +++ b/totalRP3/Modules/Register/Characters/RegisterRelations.lua @@ -272,8 +272,12 @@ function updateRelationsList() TRP3_MenuUtil.CreateContextMenu(button, function(_, description) description:CreateButton(loc.CO_RELATIONS_MENU_EDIT, onActionSelected, ACTIONS.EDIT..relation.id); checkRelationUse(); - if not relation.inUse then - description:CreateButton(loc.CO_RELATIONS_MENU_DELETE, onActionSelected, ACTIONS.DELETE..relation.id); + if relation.inUse then + local deleteOption = description:CreateButton(loc.CO_RELATIONS_MENU_DELETE); + deleteOption:SetEnabled(false); + TRP3_MenuUtil.SetElementTooltip(deleteOption, loc.CO_RELATIONS_MENU_DELETE_DISABLED_TT); + else + description:CreateButton("|cnRED_FONT_COLOR:" ..loc.CO_RELATIONS_MENU_DELETE.. "|r", onActionSelected, ACTIONS.DELETE..relation.id); end end); end);