WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   WoD Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=151)
-   -   Cooldown animation not working (https://www.wowinterface.com/forums/showthread.php?t=49560)

galvin 08-02-14 06:59 PM

Cooldown animation not working
 
I know blizzard added new functions for beta. My current addon cooldowns don't work. I made some sample code to test, and I just cant figure out why the cooldown is not playing. I tried messing around with DrawEdge and DrawSwipe. I even tried using blizzards function CooldownFrame_SetTimer function as well. nothing works.

Code:

local F = CreateFrame('Frame', nil, UIParent)
F:SetPoint('RIGHT')
F:SetSize(100, 100)
local CooldownFrame = CreateFrame('Cooldown', nil, F)
local Texture = F:CreateTexture()
Texture:SetTexture([[Interface\PlayerFrame\UI-PlayerFrame-Deathknight-Blood]])
Texture:SetAllPoints(F)

CooldownFrame:Show()
CooldownFrame:SetPoint('CENTER', Texture, 'CENTER', 0, 0)
CooldownFrame:SetSize(100, 100)

CooldownFrame:SetDrawEdge(false)
CooldownFrame:SetDrawSwipe(true)
CooldownFrame:SetCooldown(GetTime(), 10)


zork 08-03-14 02:56 AM

DrawEdge? You mean radial cooldown display is possible?

Sio 08-03-14 09:27 AM

Noticed this too when patching up some addons to get them to work. Basic fix for me was to just inherit from Blizzard's cooldown frame template when creating your cooldown frames.

E.g.
Code:

bar.cooldown = CreateFrame("Cooldown", bname .. "Cooldown", bar.frame, "CooldownFrameTemplate")

Once I did that they started working and I was able to mess around with enabling and disabling the radial edge texture. You can also change the swipe texture if you really want to shake things up:
Code:

Cooldown:SetSwipeTexture("Interface\\Garrison\\Garr_TimerFill-Upgrade")

Haven't really looked if there was a way to change the edge texture or not though.

galvin 08-03-14 11:54 AM

That's weird you have to use the template. Wonder why they made it work that way.
Thanks

Well beta is down, I'll give it a try later.

Yeah cooldown animation has a lot of options now looking at the new functions.
The texture cooldown functions take an r, g, b, a as section parameter.

Sio 08-03-14 12:01 PM

Quote:

Originally Posted by galvin (Post 294666)
That's weird you have to use the template. Wonder why they made it work that way.
Thanks

Yeah I don't know if it's intended or not or just some consequence of how in flux certain parts of the UI systems are right now. It's just the easiest way I found to get it to work right now. And since that's all I was really looking for at the time I didn't dig a whole lot deeper.

galvin 08-03-14 05:04 PM

Have a new problem. I can't change the size of the cooldown. It ignores SetSize()

Fixed it, ClearAllPoints(), forgot the template had that in there.

Duugu 08-09-14 12:28 PM

OT: What is the new SwipeTexture element within the cooldown frame good for?

E: Oh, ok. This is the new cooldown texture itself. :D So, the cooldowns are not longer rendered into the UI by the game engine itself?
Is there any way to reference the texture object?

The point is: I would like to get rid of it ... without removing or hiding the cooldown frame itself. I've used <cooldownframe>:SetAlpha(0) before WoD. But the SwipeTexture child ignores this. :/

E1: Ok. Nevermind. Setting the texture to an empty texture via SetSwipeTexture works. :)

zork 08-09-14 01:59 PM

This is the default ActionButton UpdateCooldown function (Build 18663)
Lua Code:
  1. function ActionButton_UpdateCooldown (self)
  2.         local locStart, locDuration = GetActionLossOfControlCooldown(self.action);
  3.         local start, duration, enable, charges, maxCharges = GetActionCooldown(self.action);
  4.  
  5.         if ( (locStart + locDuration) > (start + duration) ) then
  6.                 if ( self.cooldown.currentCooldownType ~= COOLDOWN_TYPE_LOSS_OF_CONTROL ) then
  7.                         self.cooldown:SetEdgeTexture("Interface\\Cooldown\\edge-LoC");
  8.                         self.cooldown:SetSwipeColor(0.17, 0, 0);
  9.                         self.cooldown:SetHideCountdownNumbers(true);
  10.                         self.cooldown.currentCooldownType = COOLDOWN_TYPE_LOSS_OF_CONTROL;
  11.                 end
  12.                
  13.                 CooldownFrame_SetTimer(self.cooldown, locStart, locDuration, 1, nil, nil, true);
  14.         else
  15.                 if ( self.cooldown.currentCooldownType ~= COOLDOWN_TYPE_NORMAL ) then
  16.                         self.cooldown:SetEdgeTexture("Interface\\Cooldown\\edge");
  17.                         self.cooldown:SetSwipeColor(0, 0, 0);
  18.                         self.cooldown:SetHideCountdownNumbers(false);
  19.                         self.cooldown.currentCooldownType = COOLDOWN_TYPE_NORMAL;
  20.                 end
  21.                
  22.                 CooldownFrame_SetTimer(self.cooldown, start, duration, enable, charges, maxCharges);
  23.         end
  24. end
https://github.com/tekkub/wow-ui-sou...utton.lua#L455


All times are GMT -6. The time now is 10:25 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI