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 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
-- Capture Meter constants
-----------------
local MIN_NUM_PLAYERS_ONE_ARROW = 1
local MIN_NUM_PLAYERS_TWO_ARROWS = 3
local MIN_NUM_PLAYERS_THREE_ARROWS = 5
local CAPTURE_BAR_BEGIN_OFFSET = . 125 -- Begins 12.5% of the way through the circle
local CAPTURE_BAR_LENGTH = . 76 -- Is 75% of a circle long. We add an extra 1% to allow the semitransparent texture to overlap the bar
local ARROW_LENGTH = . 04 -- Arrow's about 4% of the circle long
local ENDCAP_LENGTH = . 02 -- About 2% of the circle long.
local CAPTURE_BAR_ARCLENGTH = CAPTURE_BAR_LENGTH * 2 * math . pi
local ARROW_ARCLENGTH = ARROW_LENGTH * 2 * math . pi
local ENDCAP_ARCLENGTH = ENDCAP_LENGTH * 2 * math . pi
local FADE_DURATION_MS = 150
local FULL_BAR_TIMEOUT_MS = 4000
-- Capture Meter textures
-----------------
local ALLIANCE_BADGE_TEXTURES =
{
"EsoUI/Art/AvA/avaCaptureBar_allianceBadge_aldmeri.dds" ,
"EsoUI/Art/AvA/avaCaptureBar_allianceBadge_ebonheart.dds" ,
"EsoUI/Art/AvA/avaCaptureBar_allianceBadge_daggerfall.dds" ,
}
local ALLIANCE_BAR_TEXTURES =
{
"EsoUI/Art/AvA/avaCaptureBar_fill_aldmeri.dds" ,
"EsoUI/Art/AvA/avaCaptureBar_fill_ebonheart.dds" ,
"EsoUI/Art/AvA/avaCaptureBar_fill_daggerfall.dds" ,
}
local ALLIANCE_POINT_TEXTURES =
{
"EsoUI/Art/AvA/avaCaptureBar_point_aldmeri.dds" ,
"EsoUI/Art/AvA/avaCaptureBar_point_ebonheart.dds" ,
"EsoUI/Art/AvA/avaCaptureBar_point_daggerfall.dds" ,
}
local ALLIANCE_TAIL_TEXTURES =
{
"EsoUI/Art/AvA/avaCaptureBar_point-inverse_aldmeri.dds" ,
"EsoUI/Art/AvA/avaCaptureBar_point-inverse_ebonheart.dds" ,
"EsoUI/Art/AvA/avaCaptureBar_point-inverse_daggerfall.dds" ,
}
-------------------
-- Object functions
-------------------
return object
end
-- Store references to controls
--Set up fade in/out anim
--Register for updates
EVENT_MANAGER : RegisterForEvent ( "GameScore" , EVENT_CAPTURE_AREA_STATUS , function ( ... ) self : ServerUpdate ( ... ) end )
EVENT_MANAGER : RegisterForEvent ( "GameScore" , EVENT_HIDE_OBJECTIVE_STATUS , function ( ... ) self : Hide ( ... ) end )
local KEYBOARD_STYLE = { meter = "ZO_ObjectiveCapture_Keyboard_Template" }
local GAMEPAD_STYLE = { meter = "ZO_ObjectiveCapture_Gamepad_Template" }
ZO_PlatformStyle : New ( function ( style ) self : ApplyPlatformStyle ( style ) end , KEYBOARD_STYLE , GAMEPAD_STYLE )
end
function ZO_ObjectiveCaptureMeter : ServerUpdate ( eventCode , keepId , objectiveId , battlegroundContext , capturePoolValue , capturePoolSize , capturingPlayers , contestingPlayers , owningAlliance )
-- Short-circuit if we're walking in to an already-owned flag.
if ( capturePoolValue / capturePoolSize == 1 and ( self . capturePercentage == nil or self . capturePercentage == 1 ) ) then
return
end
-- Show the bar frame if we're within range
-- Calculate percentage complete
-- Turn on appropriate arrows
self . contestingArrow3 : SetHidden ( contestingPlayers - capturingPlayers < MIN_NUM_PLAYERS_THREE_ARROWS )
-- Determine visibility of UI
if ( owningAlliance ~= 0 ) then
-- Show alliance-specific UI elements
-- Show appropriate endcap and arrows
-- Flag is fully captured, start the timer to fade out this UI
end , FULL_BAR_TIMEOUT_MS )
else
if ( capturingPlayers > contestingPlayers ) then
-- Flag is being captured; make the endcap a point
elseif ( capturingPlayers < contestingPlayers ) then
-- Flag is being contested; make the endcap a tail
else
-- Stalemate
end
end
-- Hide alliance-specific UI elements
else
-- In this case, the capture bar is going from nonzero to zero, which means we need to tween it down to zero and then
-- hide the alliance-specific textures. This is handled in the AnimationTimeline's OnStop event.
end
end
end
local arrowAnchorPointPct -- The percentage of the way around the circle that the arrows should anchor to
-- Goes from 0.0-1.0, where 0.0 is 12.5% around the circle (starting from the top center)
-- and 1.0 is 87.5% of the way around.
if ( visibleArrows > 0 ) then
-- We're displaying capturing arrows
-- Our arrows are longer than our capture bar, anchor to the end
else
-- Our capture bar is longer than our arrows, position arrows to follow capture bar
arrowAnchorPointPct = captureBarFillPercentage
end
elseif ( visibleArrows < 0 ) then
-- We're displaying contesting arrows
if ( ARROW_ARCLENGTH * zo_abs ( visibleArrows ) + ENDCAP_ARCLENGTH > ( 1 - captureBarFillPercentage ) * CAPTURE_BAR_ARCLENGTH ) then
-- Our arrows are longer than our capture bar, anchor to the end
else
-- Our capture bar is longer than our arrows, position arrows to follow capture bar
arrowAnchorPointPct = captureBarFillPercentage
end
else
-- No arrows to display, but keep updating the position for the next time we unhide them
arrowAnchorPointPct = captureBarFillPercentage
end
self . capturingArrow2 : SetTextureRotation ( ( - arrowAnchorPointPct * CAPTURE_BAR_ARCLENGTH ) + ARROW_ARCLENGTH )
self . capturingArrow3 : SetTextureRotation ( ( - arrowAnchorPointPct * CAPTURE_BAR_ARCLENGTH ) + ( 2 * ARROW_ARCLENGTH ) )
self . contestingArrow2 : SetTextureRotation ( ( - arrowAnchorPointPct * CAPTURE_BAR_ARCLENGTH ) - ARROW_ARCLENGTH )
self . contestingArrow3 : SetTextureRotation ( ( - arrowAnchorPointPct * CAPTURE_BAR_ARCLENGTH ) - ( 2 * ARROW_ARCLENGTH ) )
end
local captureBarFillPercentage = ( progress * ( self . capTimeline . endPct - self . capTimeline . startPct ) ) + self . capTimeline . startPct ;
self . progressBar : StartFixedCooldown ( ( captureBarFillPercentage * CAPTURE_BAR_LENGTH ) + CAPTURE_BAR_BEGIN_OFFSET , CD_TYPE_RADIAL , CD_TIME_TYPE_TIME_REMAINING , NO_LEADING_EDGE ) -- CD_TIME_TYPE_TIME_REMAINING causes clockwise scroll
end
-- Hide alliance-specific UI elements
end
end
-- Give the fade-out animation time to play before hiding the control
end , FADE_DURATION_MS )
end
end
-- Param numArrows: A number between -3 and 3, determining which arrows to show and which to hide
-- -3 corresponds to 3 contesting arrows, and
-- +3 corresponds to 3 capturing arrows.
-- If the number is <-3 or >3, 3 arrows will be shown in the corresponding direction
-- Hide and show arrows
end
local numArrows = 0
numArrows = 1
numArrows = 2
numArrows = 3
end
end
numArrows = - 1
numArrows = - 2
numArrows = - 3
end
end
end
return numArrows
end
end
--------------
-- Global XML
--------------
end
end
end |