# HG changeset patch
# User Nenue
# Date 1477087415 14400
# Node ID 74e714637d6a3e3ec9eed182d9783ce5a82235d3
# Parent b107b4df7eb6ab5861189461dfba96713753d20c
WorldStateProgress fade-in is called for all visibility check falses
diff -r b107b4df7eb6 -r 74e714637d6a Modules/PaperDoll.lua
--- a/Modules/PaperDoll.lua Thu Oct 20 04:08:11 2016 -0400
+++ b/Modules/PaperDoll.lua Fri Oct 21 18:03:35 2016 -0400
@@ -66,7 +66,9 @@
end
local numRelicSlots = C_ArtifactUI.GetNumRelicSlots() or 0;
+ for i = 1, numRelicSlots do
+ end
local pointsAvailable = 0
local nextRankCost = GetCostForPointAtRank(pointsSpent + pointsAvailable) or 0
diff -r b107b4df7eb6 -r 74e714637d6a Modules/WorldState.lua
--- a/Modules/WorldState.lua Thu Oct 20 04:08:11 2016 -0400
+++ b/Modules/WorldState.lua Fri Oct 21 18:03:35 2016 -0400
@@ -11,7 +11,7 @@
VeneerWorldStateCurrencyMixin = {
}
VeneerWorldStateProgressMixin = {
- keepOpen = true
+ keepOpen = true,
}
VeneerWorldStateMixin = {
maxHeight = 0,
@@ -107,10 +107,18 @@
function VeneerWorldStateMixin:Reanchor(isUpdate)
print(' |cFF0088FF'..self:GetName()..':Reanchor()|r', #self.modules, 'blocks')
self.maxHeight = 0
+ local lastFrame
for i, frame in ipairs(self.modules) do
print(' '..frame:GetName()..':',frame:IsShown(), frame:IsVisible(), frame:GetHeight())
if frame:IsShown() then
- self.maxHeight = max(self.maxHeight, frame:GetHeight())
+ if lastFrame then
+ frame:SetPoint('TOP', lastFrame, 'BOTTOM')
+ else
+ frame:SetPoint('TOP', self, 'TOP')
+ end
+
+ self.maxHeight = self.maxHeight + frame:GetHeight()
+ lastFrame = frame
end
end
if self.maxHeight == 0 then
@@ -179,14 +187,12 @@
end
function VeneerWorldStateCurrencyMixin:OnLoad ()
-
self:RegisterEvent("PLAYER_ENTERING_WORLD");
self:RegisterEvent("ZONE_CHANGED");
self:RegisterEvent("ZONE_CHANGED_INDOORS");
self:RegisterEvent("ZONE_CHANGED_NEW_AREA");
self:RegisterEvent('CURRENCY_DISPLAY_UPDATE')
self:RegisterEvent('CHAT_MSG_CURRENCY')
-
end
function VeneerWorldStateCurrencyMixin:OnEvent (event, arg)
@@ -204,7 +210,6 @@
self.Label:SetFormattedText("%d / %d", earned, totalMax)
self:Show()
self:SetWidth(self.Icon:GetWidth() + self.Label:GetStringWidth() + 6)
- self:SetSize(200,16)
else
self:Hide()
end
@@ -292,28 +297,10 @@
local GetEquippedArtifactInfo = _G.C_ArtifactUI.GetEquippedArtifactInfo
local GetCostForPointAtRank = _G.C_ArtifactUI.GetCostForPointAtRank
-function VeneerWorldStateProgressMixin:AnimateProgress(progressChange)
- local progressWidth = self:GetWidth() * progressChange
-
- print(' Render change:', progressChange, progressWidth)
- self.ProgressAdded:Show()
- self.ProgressAdded:ClearAllPoints()
- self.ProgressAdded:SetPoint('TOPRIGHT', self.ProgressBar, 'TOPRIGHT', 0, 0)
- self.ProgressAdded:SetPoint('BOTTOMLEFT', self.ProgressBar, 'BOTTOMRIGHT', - (progressWidth), 0)
-
-
- self.ProgressFlash.translation:SetOffset(progressWidth, 0)
- self.ProgressFlash:Play()
-end
-
-function VeneerWorldStateProgressMixin:Update(isBatchUpdate)
- local hasNewInfo = false
- local progressChange = false
- print(' current mode:', self.mode)
-
-
- if self.mode == 'xp' then
+local progressHandlers = {
+ xp = function(self)
+ local hasNewInfo, showChange = false, false
local xp = UnitXP('player')
local xpMax = UnitXPMax('player')
local bonusXP = GetXPExhaustion()
@@ -322,27 +309,29 @@
end
self.progressText = '|cFFFFCC00' .. UnitLevel('player') .. '|r ' .. xp .. '/' .. xpMax
if bonusXP then
- self.ProgressBar:SetColorTexture(0, 0.5,1)
- self.OverflowBar:Show()
- self.OverflowBar:ClearAllPoints()
- self.OverflowBar:SetPoint('BOTTOMLEFT', self.ProgressBar, 'BOTTOMRIGHT', 0, 0)
+ self.progressOverflow = min(1,(bonusXP / xpMax))
+ self.OverflowBar:SetColorTexture(0.5, 0.5,0.5, 0.25)
+ self.OverflowBar:SetPoint('LEFT', self.ProgressBar, 'LEFT')
else
- self.ProgressBar:SetColorTexture(0.5,0,1)
+ self.progressOverflow = nil
end
- hasNewInfo = (self.progressAmount ~= xp)
- progressChange = (hasNewInfo and not self.modeChanged) and ((xp - self.progressAmount) / xpMax)
- self.progressOverflow = bonusXP or 0
+ self.ProgressBar:SetColorTexture(0, 0.5,1,1)
+ self.OverflowAnchor = self.ProgressBar
+ self.hasNewInfo = (self.progressAmount ~= xp)
+ showChange = (hasNewInfo and not self.modeChanged) and ((xp - self.progressAmount) / xpMax)
+
self.progressAmount = xp
self.progressMax = xpMax
-
- elseif self.mode == 'artifact' then
+ return hasNewInfo, showChange
+ end,
+ artifact = function(self)
+ local hasNewInfo, showChange = false, false
local itemID, altItemID, name, icon, totalXP, pointsSpent = GetEquippedArtifactInfo()
-
if itemID then
local nextRankCost = GetCostForPointAtRank(pointsSpent) or 0
print(' API:', itemID, name, 'XP:', totalXP, 'Points:', pointsSpent, 'Next:', nextRankCost)
hasNewInfo = (self.progressAmount ~= totalXP)
- progressChange = (hasNewInfo and not self.modeChanged) and (((totalXP - self.progressAmount) / nextRankCost))
+ showChange = (hasNewInfo and not self.modeChanged) and (((totalXP - self.progressAmount) / nextRankCost))
if totalXP > nextRankCost then
self.progressPercent = 1
@@ -355,66 +344,103 @@
self.ProgressBar:SetColorTexture(1,0.5,0,1)
self.OverflowBar:Hide()
- self.progressOverflow = 0
+ if totalXP > nextRankCost then
+ self.progressText = self.progressText .. ' Level Up!'
+ self.progressOverflow = (totalXP - nextRankCost) / nextRankCost
+ self.OverflowBar:SetPoint('LEFT', self.ProgressBG, 'LEFT')
+ self.OverflowAnchor = self.OverflawBar
+ else
+ self.progressOverflow = nil
+ self.OverflowAnchor = self.ProgressBar
+ end
+
self.progressAmount = totalXP
self.progressMax = nextRankCost
else
- self.progressOverflow = 0
+ self.progressOverflow = nil
self.progressAmount = 0
self.progressMax = 1
self.progressText = ''
end
+ return hasNewInfo, showChange
+ end
+}
+
+function VeneerWorldStateProgressMixin:Update(isBatchUpdate)
+
+ local progressChange = false
+ print(' current mode:', self.mode)
+ if (not self.mode) or (not progressHandlers[self.mode]) then
+ self:HidePanel()
+ return
end
- if self.mode then
- self:SetSize(600,16)
- if hasNewInfo then
- self.timeOut = nil
- self.timeLived = 0
- if self.TransitionFadeOut:IsPlaying() then
- self.TransitionFadeOut:Stop()
- self:SetAlpha(1)
- end
- if not self:IsVisible() then
- self.TransitionFadeIn:Play()
- else
- self:ShowPanel()
- end
+ local hasNewInfo, showProgress = progressHandlers[self.mode](self)
+ self:SetSize(600,16)
+ if hasNewInfo then
+ self.timeOut = nil
+ self.timeLived = 0
+ end
+ if not self:IsVisible() then
+ self.TransitionFadeIn:Play()
+ else
+ self:ShowPanel()
+ end
+
+ print(' Percent:', floor(self.progressPercent*100)/100, 'BarLength:', floor(self:GetWidth()* self.progressPercent), 'new:', hasNewInfo, 'shown:', self:IsShown())
+ print(' Metrics:', self:IsVisible(), self:GetWidth(), self.ProgressBG:GetWidth())
+ if self.progressPercent > 0 then
+ self.ProgressBar:Show()
+ self.ProgressBar:SetPoint('TOPRIGHT', self.ProgressBG, 'TOPLEFT', self:GetWidth()* self.progressPercent , 0)
+ self.Label:SetText(self.progressText)
+
+ self.ProgressSpark:ClearAllPoints()
+ if self.progressOverflow then
+ print(' Overflow:', self.progressOverflow)
+ self.OverflowBar:Show()
+ self.OverflowBar:SetWidth(self.progressOverflow * self:GetWidth(), 0)
+ else
+ self.OverflowBar:Hide()
end
+ self.ProgressSpark:SetPoint('CENTER', self.OverflowAnchor, 'RIGHT', 0, 0)
+ else
+ self.ProgressBar:Hide()
+ end
- print(' Percent:', floor(self.progressPercent*100)/100, 'BarLength:', floor(self:GetWidth()* self.progressPercent), 'new:', hasNewInfo, 'shown:', self:IsShown())
- print(' Metrics:', self:IsVisible(), self:GetWidth(), self.ProgressBG:GetWidth())
+ if self.progressOverflow and (self.progressOverflow >= self.progressPercent) then
+ self.OverflowBar:SetDrawLayer('ARTWORK', 1)
+ self.ProgressBar:SetDrawLayer('ARTWORK', 2)
+ else
+ self.OverflowBar:SetDrawLayer('ARTWORK', 2)
+ self.ProgressBar:SetDrawLayer('ARTWORK', 1)
+ end
if progressChange then
- self:AnimateProgress(progressChange)
- end
-
-
- if self.progressPercent > 0 then
- self.ProgressBar:Show()
- self.ProgressBar:SetPoint('TOPRIGHT', self.ProgressBG, 'TOPLEFT', self:GetWidth()* self.progressPercent , 0)
- self.Label:SetText(self.progressText)
-
- self.progressLeft = self.progressMax - self.progressAmount
- if self.progressOverflow >= self.progressLeft then
-
- self.OverflowBar:SetPoint('TOPRIGHT', self.ProgressBG, 'TOPRIGHT', 0, 0)
- else
- self.OverflowBar:SetPoint('TOPRIGHT', self.ProgressBar, 'TOPRIGHT', (self.progressOverflow / self.progressMax) * self:GetWidth(), 0)
- end
-
- else
- self.ProgressBar:Hide()
- end
- else
- self:HidePanel()
+ self:AnimateProgress(progressChange)
end
self.modeChanged = nil
end
+
+function VeneerWorldStateProgressMixin:AnimateProgress(progressChange)
+
+
+ local changeAnchor = (self.progressOverflow and self.OverflowBar) or self.ProgressBar
+ local progressWidth = self:GetWidth() * min(progressChange, changeAnchor:GetWidth())
+
+ self.ProgressAdded:Show()
+ self.ProgressAdded:ClearAllPoints()
+ self.ProgressAdded:SetPoint('TOPRIGHT', changeAnchor, 'TOPRIGHT', 0, 0)
+ self.ProgressAdded:SetPoint('BOTTOMLEFT', changeAnchor, 'BOTTOMRIGHT', - (progressWidth), 0)
+
+ print(' Render change:', progressWidth, changeAnchor)
+ self.ProgressFlash.translation:SetOffset(progressWidth, 0)
+ self.ProgressFlash:Play()
+end
+
function VeneerWorldStateProgressMixin:OnMouseDown(button)
if button == 'RightButton' then
if self.keepOpen then
@@ -425,6 +451,7 @@
end
print('keepOpen =', self.keepOpen)
else
+
if self.mode == 'xp' then
self.mode = 'artifact'
else
@@ -433,6 +460,9 @@
end
self.mode = 'xp'
end
+ print('|cFFFF4400Change mode:', self.mode)
+
+
self:AnimateMode()
end
diff -r b107b4df7eb6 -r 74e714637d6a Modules/WorldState.xml
--- a/Modules/WorldState.xml Thu Oct 20 04:08:11 2016 -0400
+++ b/Modules/WorldState.xml Fri Oct 21 18:03:35 2016 -0400
@@ -9,7 +9,7 @@
-
+
@@ -19,8 +19,14 @@
--print('VnWorldState','fade out')
+ self:GetParent().faded = true
+
+ print('VnWorldState', '|cFF44FF00stopped fadeout')
+ self:GetParent():Update()
+
+ print('VnWorldState', '|cFFFFFF00end of fadeout')
self:GetParent():Hide()
self:GetParent():Update()
@@ -34,21 +40,19 @@
self:GetParent().timeLived = 0
--print('VnWorldState', 'fade in')
+
+ self:GetParent():Update()
+
+ print('VnWorldState', '|cFFFFFF00end of fade IN')
+ self:GetParent().faded = nil
self:GetParent().timeLived = 0
-
-
-
- --print('VnWorldState','fade out')
-
-
- self:GetParent():HidePanel()
-
-
+
+
@@ -57,6 +61,9 @@
+
+
+
@@ -75,13 +82,24 @@
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -91,11 +109,15 @@
+
+
+
-
+
+
-
+
@@ -109,6 +131,10 @@
+
+
+
+
@@ -118,18 +144,18 @@
-
+
+
-
+
-
+
-
diff -r b107b4df7eb6 -r 74e714637d6a Veneer.lua
--- a/Veneer.lua Thu Oct 20 04:08:11 2016 -0400
+++ b/Veneer.lua Fri Oct 21 18:03:35 2016 -0400
@@ -125,7 +125,6 @@
self:StartMoving()
end
-
function VeneerCore:OnDragStop()
self:StopMovingOrSizing()
end
@@ -164,8 +163,6 @@
if not insertPosition then
insertPosition = #clusterTable + 1
end
-
-
return primaryAnchor, clusterTable, insertPosition
end
@@ -181,7 +178,6 @@
tinsert(clusterTable, clusterIndex, handler)
print('cluster', anchorGroup, 'table', clusterTable, 'position', clusterIndex)
-
handler.anchorCluster = clusterTable
handler.anchorIndex = clusterIndex
for k,v in pairs(VeneerHandlerMixin) do
@@ -197,7 +193,6 @@
handler.initialized = true
end
self:InternalReanchor(handler)
-
end
end
@@ -227,8 +222,6 @@
print(' |cFF00FF00'..index, frame:GetName(), frame:IsVisible())
if frame:IsVisible() then
anchorPoint = frame.anchorPoint
-
-
frame:ClearAllPoints()
if lastFrame then
frame:SetPoint(anchorPoint, lastFrame, ANCHOR_OFFSET_POINT[anchorPoint], 0, 0)
@@ -250,7 +243,6 @@
local subPoint, subTo
local nextFrame
for index, frame in ipairs(handler.anchorCluster) do
-
print(' |cFF00FF00'..index, frame:GetName(), frame:IsVisible())
if frame:IsVisible() then
if frame ~= handler then
@@ -288,44 +280,19 @@
end
function VeneerCore:SlideBlock(frame, ...)
+ local aX, aY = frame:GetLeft(), frame:GetTop()
- local anchorPoint, parent, anchorTo, pX,pY = ...
- print(' |cFF0088FFSlide:|r', frame, 'to', parent, pX,pY)
- local qX, qY = pX, pY
- local bX, bY
- local dX, dY = 0, 0
- local aX, aY = frame:GetLeft(), frame:GetTop()
- local str = ''
- if not aX then
- dY = ((anchorPoint == 'TOP') and frame:GetHeight()) or (((anchorPoint == 'BOTTOM') and -frame:GetHeight()) or 0)
- dX = ((anchorPoint == 'LEFT') and -frame:GetWidth()) or (((anchorPoint == 'RIGHT') and frame:GetWidth()) or 0)
- qX = pX + dX
- qY = pY + dY
- aX, aY = qX, qY
- bX, bY = pX, pY
- str = '|cFFFFFF00relative|r'
- else
- frame:ClearAllPoints()
+ frame:SetPoint('TOPLEFT', frame, 'BOTTOMLEFT', aX, aY)
+ frame.animation = frame.animation or {}
+ frame.animation.startX = aX
+ frame.animation.startY = aY
- bX, bY = frame:GetLeft(), frame:GetTop()
- dX, dY = (bX-aX), (bY-aY)
+ local targetPoint, targetParent, targetAnchor, offsetX, offsetY = ...
+ frame.BlockSlide:SetScript('OnFinished', function()
+ frame:SetPoint(targetPoint, targetParent, targetAnchor, offsetX, offsetY)
+ VeneerAnimationMixin.OnFinished(frame)
+ end)
- str = '|cFFFFFF00existing|r'
- end
-
- if ((dX ~= 0) or (dY ~= 0)) and frame.BlockSlide then
- print(' |cFF00FF88Slide result:|r',str, dX, dY)
-
- frame:ClearAllPoints()
- frame:SetPoint(anchorPoint, parent, anchorTo, qX, qY)
- frame.BlockSlide.dX = dX
- frame.BlockSlide.dY = dY
- frame.BlockSlide.sourcePoint = {anchorPoint, parent, anchorTo, qX, qY}
- frame.BlockSlide.destPoint = {anchorPoint, parent, anchorTo, pX,pY}
- frame.BlockSlide.translation:SetOffset(dX, dY)
- frame.BlockSlide:Play()
- return
- end
end
@@ -500,14 +467,16 @@
function VeneerAnimationMixin:OnPlay()
PlaySoundKitID(229)
+ self.animating = true
print('|cFF00FF00Anim:OnPlay|r @', unpack(self.sourcePoint))
end
function VeneerAnimationMixin:OnStop()
PlaySoundKitID(229)
+ self.animating = nil
+ print('|cFF00FF00Anim:OnFinish|r @', unpack(self.destPoint))
end
function VeneerAnimationMixin:OnFinished()
PlaySoundKitID(229)
+ self.animating = nil
print('|cFF00FF00Anim:OnFinish|r @', unpack(self.destPoint))
- self:GetParent():ClearAllPoints()
- self:GetParent():SetPoint(unpack(self.destPoint))
end
\ No newline at end of file