I propose a change to ingame/hud/hudinfamymeter.lua to make it use templates like how the other HUD meters do.
This will allow addons to manipulate the layout easier.
In function ZO_HUDInfamyMeter.Initialize
Lua Code:
-- from line 65 change >
-- Set up platform styles
self.keyboardStyle =
{
template = "ZO_HUDInfamyMeter_KeyboardTemplate" ,
currencyOptions =
{
showTooltips = true,
customTooltip = SI_STATS_BOUNTY_LABEL,
isGamepad = false,
font = "ZoFontGameLargeBold",
iconSide = RIGHT,,
overrideTexture = nil
},
}
self.gamepadStyle =
{
template = "ZO_HUDInfamyMeter_GamepadTemplate",
currencyOptions =
{
showTooltips = false,
customTooltip = SI_STATS_BOUNTY_LABEL,
isGamepad = true,
font = "ZoFontGamepadHeaderDataValue",
iconSide = RIGHT,
overrideTexture = ZO_Currency_GetGamepadCurrencyIcon(CURT_MONEY)
},
}
self.currencyOptions = self.isInGamepadMode and self.gamepadStyle or self.keyboardStyle
--< end change 73
In function ZO_HUDInfamyMeter.OnInfamyUpdated
Lua Code:
if oldInfamy ~= self.infamyMeterState.infamy or updateType == UPDATE_TYPE_EVENT or gamepadModeSwitchUpdate then
-- Update frame and bars if we're switching between PC and console mode
if IsInGamepadPreferredMode() and not self.isInGamepadMode then
-- from line 159 change >
self.currencyOptions = self.gamepadStyle
self.isInGamepadMode = true
elseif not IsInGamepadPreferredMode() and self.isInGamepadMode then
self.currencyOptions = self.keyboardStyle
self.isInGamepadMode = false
--< end change 168
end
The above was written during initial lookup and taking notes in preparation of implementation into addon.
After beginning work on adding into the addon, I realized I missed an important detail for the telvar meter.
Proposed change to ingame/hud/hudtelvarmeter.lua
Due to not storing the object returned by ZO_PlatformStyle:New, one would need to replace or hook HUD_TELVAR_METER:UpdatePlatformStyle(styleTable)
Lua Code:
self.platformStyle = ZO_PlatformStyle:New(function(...) self:UpdatePlatformStyle(...) end, self.keyboardStyle, self.gamepadStyle)
-- line 59 ^
Examples
Current method:
Lua Code:
-- initialize
-- used outside of UpdatePlatformStyle
HUD_TELVAR_METER.gamepadStyle = customGamepadStyle
HUD_TELVAR_METER.keyboardStyle = customKeyboardStyle
function HUD_TELVAR_METER:UpdatePlatformStyle(styleTable)
styleTable = self.styleTable
ApplyTemplateToControl(self.control, styleTable.template)
ZO_CurrencyControl_SetSimpleCurrency(self.telvarDisplayControl, CURT_TELVAR_STONES, GetCurrencyAmount(CURT_TELVAR_STONES, CURRENCY_LOCATION_CHARACTER), styleTable.currencyOptions, CURRENCY_SHOW_ALL)
local isMaxThreshold = IsMaxTelvarStoneMultiplierThreshold(self.telvarStoneThreshold)
self.meterBarControl:SetHidden(isMaxThreshold)
self.meterOverlayControl:SetAlpha(isMaxThreshold and 1 or 0)
end
-- on platform style change
HUD_TELVAR_METER.styleTable = isGamepadMode and HUD_TELVAR_METER.gamepadStyle or HUD_TELVAR_METER.keyboardStyle
HUD_TELVAR_METER:UpdatePlatformStyle()
Proposed method:
Lua Code:
-- initialize
-- used outside of UpdatePlatformStyle
HUD_TELVAR_METER.gamepadStyle = customGamepadStyle
HUD_TELVAR_METER.keyboardStyle = customKeyboardStyle
-- used in UpdatePlatformStyle
HUD_TELVAR_METER.platformStyle.gamepadStyle = customGamepadStyle
HUD_TELVAR_METER.platformStyle.keyboardStyle = customKeyboardStyle
HUD_TELVAR_METER.platformStyle:Apply()