Mercurial > wow > reaction
comparison classes/ActionButton.lua @ 159:799c6ea9da7b
added vehicle exit floater
some fixes for vehicle exit button on main bars
still some lingering settexcoords issues on the vehicle exit icon
| author | Flick <flickerstreak@gmail.com> |
|---|---|
| date | Mon, 29 Jun 2009 17:43:16 +0000 |
| parents | 806a61b331a0 |
| children | d0a41fc7b0d7 |
comparison
equal
deleted
inserted
replaced
| 158:d2f289c3bae6 | 159:799c6ea9da7b |
|---|---|
| 257 end | 257 end |
| 258 | 258 |
| 259 function Action:InstallVehicle() | 259 function Action:InstallVehicle() |
| 260 local f = self:GetFrame() | 260 local f = self:GetFrame() |
| 261 if self.idx == 7 and self:GetBarConfig().vehicle then | 261 if self.idx == 7 and self:GetBarConfig().vehicle then |
| 262 -- install vehicle-exit button on 7th button (only) | 262 if not self.vehicleInstalled then |
| 263 f:SetAttribute("_childupdate-vehicle", _childupdate_vehicleExit) | 263 self.vehicleInstalled = true |
| 264 f:SetAttribute("macrotext","/run VehicleExit()") | 264 -- install vehicle-exit button on 7th button (only) |
| 265 self:GetBar():GetFrame().ShowVehicleExit = function(bar,show) | 265 f:SetAttribute("_childupdate-vehicle", _childupdate_vehicleExit) |
| 266 self:ShowVehicleExit(show) | 266 f:SetAttribute("macrotext","/run VehicleExit()") |
| 267 end | 267 self:GetBar():GetFrame().ShowVehicleExit = function(bar,show) |
| 268 else | 268 self:ShowVehicleExit(show) |
| 269 end | |
| 270 end | |
| 271 -- setscale blows away tex coords | |
| 272 self:UpdateIcon() | |
| 273 elseif self.vehicleInstalled then | |
| 274 self.vehicleInstalled = false | |
| 269 f:SetAttribute("_childupdate-vehicle",nil) | 275 f:SetAttribute("_childupdate-vehicle",nil) |
| 270 f:SetAttribute("macrotext",nil) | 276 f:SetAttribute("macrotext",nil) |
| 271 end | 277 end |
| 272 end | 278 end |
| 273 | 279 |
| 373 local f = self:GetFrame() | 379 local f = self:GetFrame() |
| 374 | 380 |
| 375 if self.vehicleExitMode then | 381 if self.vehicleExitMode then |
| 376 texture = "Interface\\Vehicles\\UI-Vehicles-Button-Exit-Up" | 382 texture = "Interface\\Vehicles\\UI-Vehicles-Button-Exit-Up" |
| 377 icon:SetTexCoord(0.140625, 0.859375, 0.140625, 0.859375) | 383 icon:SetTexCoord(0.140625, 0.859375, 0.140625, 0.859375) |
| 378 icon:SetVertexColor(1,0,0) | 384 icon:SetVertexColor(1,1,1) |
| 379 else | 385 else |
| 380 icon:SetTexCoord(0,1,0,1) | 386 icon:SetTexCoord(0,1,0,1) |
| 381 end | 387 end |
| 382 | 388 |
| 383 if texture then | 389 if texture then |
| 387 f:SetNormalTexture("Interface\\Buttons\\UI-Quickslot2") | 393 f:SetNormalTexture("Interface\\Buttons\\UI-Quickslot2") |
| 388 else | 394 else |
| 389 icon:Hide() | 395 icon:Hide() |
| 390 self.frames.cooldown:Hide() | 396 self.frames.cooldown:Hide() |
| 391 self.rangeTimer = nil | 397 self.rangeTimer = nil |
| 392 if self.vehicleExitMode then | 398 f:SetNormalTexture("Interface\\Buttons\\UI-Quickslot") |
| 393 f:SetNormalTexture("Interface\\Buttons\\UI-Quickslot2") | |
| 394 else | |
| 395 f:SetNormalTexture("Interface\\Buttons\\UI-Quickslot") | |
| 396 end | |
| 397 end | 399 end |
| 398 end | 400 end |
| 399 | 401 |
| 400 function Action:UpdateBorder() | 402 function Action:UpdateBorder() |
| 401 local action = self.actionID | 403 local action = self.actionID |
| 453 end | 455 end |
| 454 end | 456 end |
| 455 | 457 |
| 456 function Action:UpdateUsable() | 458 function Action:UpdateUsable() |
| 457 local isUsable, notEnoughMana = IsUsableAction(self.actionID) | 459 local isUsable, notEnoughMana = IsUsableAction(self.actionID) |
| 458 if isUsable or self.vehicleExitMode then | 460 local noRange = IsActionInRange(self.actionID) == 0 |
| 459 self.frames.icon:SetVertexColor(1.0, 1.0, 1.0) | 461 |
| 460 self.frames.normalTexture:SetVertexColor(1.0, 1.0, 1.0) | 462 isUsable = self.vehicleExitMode or (isUsable and not noRange) |
| 463 | |
| 464 if isUsable then | |
| 465 if self.usableStatus ~= "usable" then | |
| 466 self.frames.icon:SetVertexColor(1.0, 1.0, 1.0) | |
| 467 self.frames.normalTexture:SetVertexColor(1.0, 1.0, 1.0) | |
| 468 self.usableStatus = "usable" | |
| 469 end | |
| 470 elseif noRange then | |
| 471 if self.usableStatus ~= "norange" then | |
| 472 self.frames.icon:SetVertexColor(1.0,0.1,0.1) | |
| 473 self.frames.normalTexture:SetVertexColor(1.0, 1.0, 1.0) | |
| 474 self.usableStatus = "norange" | |
| 475 end | |
| 461 elseif notEnoughMana then | 476 elseif notEnoughMana then |
| 462 self.frames.icon:SetVertexColor(0.5, 0.5, 1.0) | 477 if self.usableStatus ~= "oom" then |
| 463 self.frames.normalTexture:SetVertexColor(0.5, 0.5, 1.0) | 478 self.frames.icon:SetVertexColor(0.5, 0.5, 1.0) |
| 464 else | 479 self.frames.normalTexture:SetVertexColor(0.5, 0.5, 1.0) |
| 465 self.frames.icon:SetVertexColor(0.4, 0.4, 0.4) | 480 self.usableStatus = "oom" |
| 466 self.frames.normalTexture:SetVertexColor(1.0, 1.0, 1.0) | 481 end |
| 482 else | |
| 483 if self.usableStatus ~= "unusable" then | |
| 484 self.frames.icon:SetVertexColor(0.4, 0.4, 0.4) | |
| 485 self.frames.normalTexture:SetVertexColor(1.0, 1.0, 1.0) | |
| 486 self.usableStatus = "unusable" | |
| 487 end | |
| 467 end | 488 end |
| 468 end | 489 end |
| 469 | 490 |
| 470 function Action:UpdateCooldown() | 491 function Action:UpdateCooldown() |
| 471 CooldownFrame_SetTimer(self.frames.cooldown, GetActionCooldown(self.actionID)) | 492 CooldownFrame_SetTimer(self.frames.cooldown, GetActionCooldown(self.actionID)) |
| 511 local rangeTimer = self.rangeTimer | 532 local rangeTimer = self.rangeTimer |
| 512 if rangeTimer then | 533 if rangeTimer then |
| 513 rangeTimer = rangeTimer - elapsed | 534 rangeTimer = rangeTimer - elapsed |
| 514 self.rangeTimer = rangeTimer | 535 self.rangeTimer = rangeTimer |
| 515 if rangeTimer <= 0 then | 536 if rangeTimer <= 0 then |
| 516 if self.vehicleExitMode then | 537 self:UpdateUsable() |
| 517 self.frames.icon:SetVertexColor(1,1,1) | |
| 518 elseif IsActionInRange(self.actionID) == 0 then | |
| 519 self.frames.icon:SetVertexColor(1.0,0.1,0.1) | |
| 520 else | |
| 521 self:UpdateUsable() | |
| 522 end | |
| 523 self.rangeTimer = TOOLTIP_UPDATE_TIME | 538 self.rangeTimer = TOOLTIP_UPDATE_TIME |
| 524 end | 539 end |
| 525 end | 540 end |
| 526 end | 541 end |
| 527 | 542 |
