|
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 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 |
return objectend self.unownedLoop = ANIMATION_MANAGER:CreateTimelineFromVirtual("ZO_ScryingGoal_UnownedFlipbook", self.control) self.ownedLoop = ANIMATION_MANAGER:CreateTimelineFromVirtual("ZO_ScryingGoal_OwnedFlipbook", self.control) self.activateAnim = ANIMATION_MANAGER:CreateTimelineFromVirtual("ZO_ScryingGoal_ActivateFlipbook", self.control) end) if completedPlaying then end end)endZO_SCRYING_GOAL_TEXTURE_WIDTH = 512ZO_SCRYING_GOAL_TEXTURE_HEIGHT = 512 local goalWidth = hexWidth * (ZO_SCRYING_GOAL_TEXTURE_WIDTH / ZO_SCRYING_HEX_TEXTURE_WIDTH) local goalHeight = hexHeight * (ZO_SCRYING_GOAL_TEXTURE_HEIGHT / ZO_SCRYING_HEX_TEXTURE_HEIGHT)endZO_SCRYING_GOAL_STATE_NONE = 0ZO_SCRYING_GOAL_STATE_UNOWNED = 1ZO_SCRYING_GOAL_STATE_PREVIOUSLY_OWNED = 2ZO_SCRYING_GOAL_STATE_OWNING = 3ZO_SCRYING_GOAL_STATE_OWNED = 4 end if state == ZO_SCRYING_GOAL_STATE_NONE then elseif state == ZO_SCRYING_GOAL_STATE_UNOWNED or state == ZO_SCRYING_GOAL_STATE_PREVIOUSLY_OWNED then elseif state == ZO_SCRYING_GOAL_STATE_OWNING then elseif state == ZO_SCRYING_GOAL_STATE_OWNED then end endendend--[[ A Scrying island represents a contiguous block of hexes.]]-- return objectendendenddo -- Angle indexes go from 0-5 inclusive, to make the math operations they're used in simpler local CLOCKWISE_NEIGHBORS = { [0] = {-2, 0}, {-1, 1}, {1, 1}, {2, 0}, {1, -1}, {-1, -1}, } local EDGE_POINT_ANGLE_FOR_NEIGHBOR = { [0] = 240, 300, 0, 60, 120, 180, } return (angleIndex - 3) % 6 end return angleIndex % 6 end end return EDGE_POINT_ANGLE_FOR_NEIGHBOR[angleIndex % 6] end for angleIndex = startAngleIndex + 2, startAngleIndex + 6 do local lastRow, lastColumn = startRow + lastOffsetRow, startColumn + lastOffsetColumn local testRow, testColumn = startRow + testOffsetRow, startColumn + testOffsetColumn -- Edge found: report out the node it connects to and its angle from the current node end end -- if we are here we found no edge continuations (probably island with only one tile) return nil, nil end -- step one, get point for angle -- step two, scale/offset to position relative to board local boardPositionX, boardPositionY = self.board:ConvertHexCoordinateToOffset(hex:GetCoordinates()) boardPositionX = boardPositionX + (normalizedX - 0.5) * hexWidth boardPositionY = boardPositionY + (normalizedY - 0.5) * hexHeight -- step three, normalize to boardsize local normalizedBoardX, normalizedBoardY = boardPositionX / boardWidth, boardPositionY / boardHeight -- step four, reanchor to bottom center of board normalizedBoardX = normalizedBoardX + 0.5 normalizedBoardY = normalizedBoardY + 1.0 end end -- initial angle index, so we always test the tile just above us first -- For this to generate an outer edge, the initial tile should _always_ be at the top of our given island. -- We can also set our initial tile to just below an interior hole to generate an inner edge around the hole: not currently used, but interesting local START_ANGLE = 2 --[[ Store the first edge so we can detect cycles. This must be an edge and not just the tile we started on to handle the situation where the same tile provides multiple edges. Imagine a blob that looks like so _ _ _/ \_/ \_ / \_/X\_/ \ \_/ \_/ \_/ \_/ \_/ the only thing connecting left and right halves is the one tile bridge marked with X. To complete the loop, this tile would need to be traversed twice: once to provide an edge going right, and once to provide an edge going left. We can only say the loop is repeating when we try to go right on the tile twice, or left on that tile twice. ]]-- local firstEdgeHex, firstAngleIndex = hex, angleIndex if hex == nil then -- we are an island of a single tile for pointAngleIndex = 0, 5 do end return end local iterations = 0 -- repeat until we've looped around to where we started repeat local lastHex, lastAngleIndex = hex, angleIndex return end -- go clockwise from: -- the point where lastHex and the hex before it met -- The point where lastHex and currentHex meet local endAngleIndex = angleIndex if endAngleIndex <= startAngleIndex then -- denormalize, The start angle must before the angle to ensure a clockwise order startAngleIndex = startAngleIndex - 6 end for pointAngleIndex = startAngleIndex + 2, endAngleIndex do end iterations = iterations + 1 if iterations > 1000 then return end until hex == firstEdgeHex and angleIndex == firstAngleIndex end endend--[[ Utility object for constructing outlines around affected/selected hexes]]--end local board = internalassert(SCRYING:GetScryingBoard(), "Missing scrying board object: maybe initializing an island too early?") endend-- OverrideendZO_AFFECTED_HEX_BORDER_PIXELS = "10px"ZO_TARGETED_HEX_BORDER_PIXELS = "4px"ZO_NOT_SELECTED_HEX_BORDER_PIXELS = "2px" if borderType == ZO_SCRYING_HEX_BORDER_AFFECTED then elseif borderType == ZO_SCRYING_HEX_BORDER_TARGETED then endendend--[[ A global singleton object used for holding scrying visual resources]]-- return objectendendend return timeline, timelineKeyendZO_SCROLLING_BACKGROUND_TEXTURE_WIDTH = 512ZO_SCROLLING_BACKGROUND_TEXTURE_HEIGHT = 512-- NOTE: to loop correctly, texture deltas should be whole numbers. This means that each parameter should be read as "this texture will scroll N times over this period"local HEX_IDLE_ANIMATIONS ={ -- TODO: fill this out [SCRYING_HEX_TYPE_ONE] = { slideDeltas = {{5, 0}, {5, 2}}, periodMS = 500000 }, [SCRYING_HEX_TYPE_TWO] = { slideDeltas = {{0, -5}, {-5, -2}}, periodMS = 500000 }, [SCRYING_HEX_TYPE_THREE] = { slideDeltas = {{-5, 0}, {-5, -2}}, periodMS = 500000 }, [SCRYING_HEX_TYPE_FOUR] = { slideDeltas = {{-5, 0}, {5, -2}}, periodMS = 500000 }, [SCRYING_HEX_TYPE_FIVE] = { slideDeltas = {{5, 0}, {-5, 2}}, periodMS = 500000 }, [SCRYING_HEX_TYPE_SIX] = { slideDeltas = {{-5, 0}, {-5, 2}}, periodMS = 500000 }, [SCRYING_HEX_TYPE_SEVEN] = { slideDeltas = {{0, 5}, {5, -2}}, periodMS = 500000 }, [SCRYING_HEX_TYPE_EIGHT] = { slideDeltas = {{0, 5}, {5, 2}}, periodMS = 500000 }, [SCRYING_HEX_TYPE_OWNED] = { slideDeltas = {{0, -5}, {-5, -2}}, periodMS = 500000 }, [SCRYING_HEX_TYPE_GOAL] = { slideDeltas = {{0, -5}, {-5, 2}}, periodMS = 500000 },} left = left / ZO_SCROLLING_BACKGROUND_TEXTURE_WIDTH right = right / ZO_SCROLLING_BACKGROUND_TEXTURE_WIDTH top = top / ZO_SCROLLING_BACKGROUND_TEXTURE_HEIGHT bottom = bottom / ZO_SCROLLING_BACKGROUND_TEXTURE_HEIGHT -- apply some texture offset so there's never a point where the two textures have the same coordinates local offsetU, offsetV = (animationIndex - 1) * .3, (animationIndex - 1) * .2 endend end) -- Play all animations in sequence, with delay local timelineDuration = initialDelayMS timelineDuration = timelineDuration + animationDuration endendendendendend -- delay end to give the idle animation a bit of time to play local DELAY_MS = 500 end, DELAY_MS)endend endend |