From 2964e338e2075d7513359ff9f7ce30f6dfa6f4a2 Mon Sep 17 00:00:00 2001 From: Leonardo Emanuele Date: Sat, 26 Oct 2024 09:38:36 +0200 Subject: [PATCH] Lua: Ensure Custom badges inheritance --- .../Menus/UIMenu/Items/UIMenuCheckboxItem.lua | 14 +++++++++++++- .../Menus/UIMenu/Items/UIMenuDynamicListItem.lua | 14 +++++++++++++- .../src/Menus/UIMenu/Items/UIMenuListItem.lua | 16 +++++++++++++++- .../Menus/UIMenu/Items/UIMenuProgressItem.lua | 14 +++++++++++++- .../Menus/UIMenu/Items/UIMenuSeperatorItem.lua | 9 +++++++++ .../src/Menus/UIMenu/Items/UIMenuSliderItem.lua | 14 +++++++++++++- .../src/Menus/UIMenu/Items/UIMenuStatsItem.lua | 8 ++++++++ 7 files changed, 84 insertions(+), 5 deletions(-) diff --git a/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuCheckboxItem.lua b/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuCheckboxItem.lua index 8ab84053..03d9e123 100644 --- a/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuCheckboxItem.lua +++ b/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuCheckboxItem.lua @@ -186,9 +186,21 @@ function UIMenuCheckboxItem:LeftBadge(Badge) end end +function UIMenuCheckboxItem:CustomLeftBadge(txd,txn) + if txd ~= nil and txd ~= "" and txn ~= nil and txn ~= "" then + self.Base:CustomLeftBadge(txd,txn, self) + else + return self.Base:LeftBadge() + end +end + ---RightBadge function UIMenuCheckboxItem:RightBadge() - error("This item does not support badges") + error("This item does not support right badges") +end + +function UIMenuCheckboxItem:CustomRightBadge() + error("This item does not support right badges") end ---RightLabel diff --git a/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuDynamicListItem.lua b/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuDynamicListItem.lua index 268c54b5..1273753e 100644 --- a/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuDynamicListItem.lua +++ b/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuDynamicListItem.lua @@ -225,9 +225,21 @@ function UIMenuDynamicListItem:LeftBadge(Badge) end end +function UIMenuDynamicListItem:CustomLeftBadge(txd,txn) + if txd ~= nil and txd ~= "" and txn ~= nil and txn ~= "" then + self.Base:CustomLeftBadge(txd,txn, self) + else + return self.Base:LeftBadge() + end +end + ---RightBadge function UIMenuDynamicListItem:RightBadge() - error("This item does not support badges") + error("This item does not support right badges") +end + +function UIMenuDynamicListItem:CustomRightBadge() + error("This item does not support right badges") end ---RightLabel diff --git a/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuListItem.lua b/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuListItem.lua index 67cf521a..5cac90a0 100644 --- a/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuListItem.lua +++ b/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuListItem.lua @@ -277,9 +277,23 @@ function UIMenuListItem:LeftBadge(Badge) end end +--- CustomLeftBadge +function UIMenuListItem:CustomLeftBadge(txd,txn) + if txd ~= nil and txd ~= "" and txn ~= nil and txn ~= "" then + self.Base:CustomLeftBadge(txd,txn, self) + else + return self.Base:LeftBadge() + end +end + + ---RightBadge function UIMenuListItem:RightBadge() - error("This item does not support badges") + error("This item does not support right badges") +end + +function UIMenuListItem:CustomRightBadge() + error("This item does not support right badges") end ---RightLabel diff --git a/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuProgressItem.lua b/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuProgressItem.lua index 8f146306..591b0f0c 100644 --- a/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuProgressItem.lua +++ b/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuProgressItem.lua @@ -241,9 +241,21 @@ function UIMenuProgressItem:LeftBadge(Badge) end end +function UIMenuProgressItem:CustomLeftBadge(txd,txn) + if txd ~= nil and txd ~= "" and txn ~= nil and txn ~= "" then + self.Base:CustomLeftBadge(txd,txn, self) + else + return self.Base:LeftBadge() + end +end + ---RightBadge function UIMenuProgressItem:RightBadge() - error("This item does not support badges") + error("This item does not support right badges") +end + +function UIMenuProgressItem:CustomRightBadge() + error("This item does not support right badges") end ---RightLabel diff --git a/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuSeperatorItem.lua b/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuSeperatorItem.lua index bc6981ac..6cab2431 100644 --- a/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuSeperatorItem.lua +++ b/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuSeperatorItem.lua @@ -166,6 +166,15 @@ function UIMenuSeparatorItem:RightBadge() error("This item does not support badges") end +function UIMenuSeparatorItem:CustomLeftBadge() + error("This item does not support badges") +end + +---RightBadge +function UIMenuSeparatorItem:CustomRightBadge() + error("This item does not support badges") +end + ---RightLabel function UIMenuSeparatorItem:RightLabel() error("This item does not support a right label") diff --git a/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuSliderItem.lua b/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuSliderItem.lua index 63029edf..511bfc59 100644 --- a/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuSliderItem.lua +++ b/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuSliderItem.lua @@ -231,8 +231,20 @@ function UIMenuSliderItem:LeftBadge(Badge) end end +function UIMenuSliderItem:CustomLeftBadge(txd,txn) + if txd ~= nil and txd ~= "" and txn ~= nil and txn ~= "" then + self.Base:CustomLeftBadge(txd,txn, self) + else + return self.Base:LeftBadge() + end +end + function UIMenuSliderItem:RightBadge() - error("This item does not support badges") + error("This item does not support right badges") +end + +function UIMenuSliderItem:CustomRightBadge() + error("This item does not support right badges") end function UIMenuSliderItem:RightLabel() diff --git a/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuStatsItem.lua b/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuStatsItem.lua index a1a7ed08..14ebcd3e 100644 --- a/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuStatsItem.lua +++ b/ScaleformUI_Lua/src/Menus/UIMenu/Items/UIMenuStatsItem.lua @@ -221,6 +221,14 @@ function UIMenuStatsItem:RightBadge() error("This item does not support badges") end +function UIMenuStatsItem:CustomLeftBadge() + error("This item does not support badges") +end + +function UIMenuStatsItem:CustomRightBadge() + error("This item does not support badges") +end + ---RightLabel function UIMenuStatsItem:RightLabel() error("This item does not support a right label")