|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
TELVAR_METER_WIDTH = 256TELVAR_METER_HEIGHT = 128TELVAR_METER_KEYBOARD_BAR_OFFSET_X = 14TELVAR_METER_KEYBOARD_BAR_OFFSET_Y = 18TELVAR_METER_GAMEPAD_BAR_OFFSET_X = -9TELVAR_METER_GAMEPAD_BAR_OFFSET_Y = 15 return objectend -- Initialize state -- Set up controls -- Set up platform styles { template = "ZO_HUDTelvarMeter_KeyboardTemplate" , currencyOptions = { showTooltips = true, isGamepad = false, font = "ZoFontGameLargeBold", iconSide = RIGHT, }, } { template = "ZO_HUDTelvarMeter_GamepadTemplate", currencyOptions = { showTooltips = false, isGamepad = true, font = "ZoFontGamepadHeaderDataValue", iconSide = RIGHT, }, } ZO_PlatformStyle:New(function(...) self:UpdatePlatformStyle(...) end, self.keyboardStyle, self.gamepadStyle) -- Initialize alert border animation self.alertBorder.pulseAnimation = ANIMATION_MANAGER:CreateTimelineFromVirtual("ZO_HUDTelvarAlertBorderAnimation", self.alertBorder) -- Initialize overlay animation self.meterOverlayControl.fadeAnimation = ANIMATION_MANAGER:CreateTimelineFromVirtual("ZO_HUDTelvarMeterOverlayFade", self.meterOverlayControl) -- Initialize label animation self.multiplierContainer.bounceAnimation = ANIMATION_MANAGER:CreateTimelineFromVirtual("ZO_HUDTelvarMeterMultiplierBounce", self.multiplierContainer) -- Initialize bar states and animations self.meterBarControl.easeAnimation = ANIMATION_MANAGER:CreateTimelineFromVirtual("ZO_HUDTelvarMeterEasing") -- Initialize edge animation -- Register for events control:RegisterForEvent(EVENT_TELVAR_STONE_UPDATE, function(...) self:OnTelvarStonesUpdated(...) end) else end end) -- Do our initial updateendend ZO_CurrencyControl_SetSimpleCurrency(self.telvarDisplayControl, CURT_TELVAR_STONES, GetCurrencyAmount(CURT_TELVAR_STONES, CURRENCY_LOCATION_CHARACTER), IsInGamepadPreferredMode() and self.gamepadStyle.currencyOptions or self.keyboardStyle.currencyOptions, CURRENCY_SHOW_ALL) endend else end -- Update bar values -- Start the bar animationend local fractionalPart = zo_round(zo_mod(multiplier, 1.0)*100) -- This strips the fractional part away and formats it as a two-digit whole number. The decimal place is added in the string formatting. self.multiplierFractionalPart:SetText(zo_strformat(SI_TELVAR_HUD_MULTIPLIER_VALUE_FRACTION, string.format("%02d", fractionalPart)))end local fillPercentage = zo_min((progress * (self.meterBarControl.endPercent - self.meterBarControl.startPercent)) + self.meterBarControl.startPercent, 1)end local NO_LEADING_EDGE = false self.meterBarFill:StartFixedCooldown(percentFilled, CD_TYPE_RADIAL, CD_TIME_TYPE_TIME_REMAINING, NO_LEADING_EDGE) -- CD_TIME_TYPE_TIME_REMAINING causes clockwise scroll self.meterBarHighlight:StartFixedCooldown(percentFilled, CD_TYPE_RADIAL, CD_TIME_TYPE_TIME_REMAINING, NO_LEADING_EDGE)end ZO_CurrencyControl_SetSimpleCurrency(self.telvarDisplayControl, CURT_TELVAR_STONES, GetCurrencyAmount(CURT_TELVAR_STONES, CURRENCY_LOCATION_CHARACTER), styleTable.currencyOptions, CURRENCY_SHOW_ALL) end -- Determine whether or not we need to animate again if self.telvarStoneThreshold and newThresholdIndex and self.telvarStoneThreshold ~= newThresholdIndex then -- We've crossed to a higher multiplier threshold. else end -- We've crossed to a lower multiplier threshold. end -- Animate the meter endend return 1 local result = (GetCurrencyAmount(CURT_TELVAR_STONES, CURRENCY_LOCATION_CHARACTER) - currentThresholdAmount) / (nextThresholdAmount - currentThresholdAmount) else return 0 endendend if HUD_TELVAR_METER then endendend |