From bc50723491abdfc2b50f107a405a486e71d26cdf Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Thu, 6 May 2021 19:28:15 -0300 Subject: [PATCH] Finished coding the new arena real time dps bar --- Libs/DF/split_bar.lua | 136 +++++++++--------- boot.lua | 2 +- classes/container_actors.lua | 19 ++- frames/window_currentdps.lua | 220 ++++++++++++++++-------------- images/bar_textures/split_bar.tga | Bin 0 -> 24620 bytes startup.lua | 2 +- 6 files changed, 192 insertions(+), 187 deletions(-) create mode 100644 images/bar_textures/split_bar.tga diff --git a/Libs/DF/split_bar.lua b/Libs/DF/split_bar.lua index 91554f2c..eb598236 100644 --- a/Libs/DF/split_bar.lua +++ b/Libs/DF/split_bar.lua @@ -440,9 +440,6 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]] end -- frame stratas - function SplitBarMetaFunctions:SetFrameStrata() - return self.statusbar:GetFrameStrata() - end function SplitBarMetaFunctions:SetFrameStrata (strata) if (_type (strata) == "table") then self.statusbar:SetFrameStrata (strata:GetFrameStrata()) @@ -452,91 +449,86 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]] end -- animation - - local timeDilatation = 2.615321 - --> animation with acceleration ~animation ~healthbaranimation local animateLeftWithAccel = function(self, deltaTime) - local distance = (self.AnimationStart - self.AnimationEnd) / self.CurrentMaxValue * 100 --scale 1 - 100 - local minTravel = min (distance / 10, 3) -- 10 = trigger distance to max speed 3 = speed scale on max travel - local maxTravel = max (minTravel, 0.45) -- 0.45 = min scale speed on low travel speed - local animationSpeed = (self.CurrentMaxValue * (deltaTime * timeDilatation)) * maxTravel --re-scale back to unit health, scale with delta time and scale with the travel speed - - self.AnimationStart = self.AnimationStart - (animationSpeed) - self:SetValue(self.AnimationStart) - self.currentValue = self.AnimationStart - - if (self.Spark) then - self.Spark:SetPoint("center", self, "left", self.AnimationStart / self.CurrentMaxValue * self:GetWidth(), 0) - self.Spark:Show() - end - - if (self.AnimationStart - 0.01 <= self.AnimationEnd) then - self:SetValue (self.AnimationEnd) - self.currentValue = self.AnimationEnd - self.IsAnimating = false - if (self.Spark) then - self.Spark:Hide() - end + local currentPercent = DetailsFramework:GetRangePercent(self.targetValue, self.startValue, self.currentValue) + currentPercent = abs(currentPercent - 1) + currentPercent = min(0.9, currentPercent) + currentPercent = max(0.5, currentPercent) + + local animationMultiplier = math.sin(currentPercent * math.pi) + local valueChange = self.step * (deltaTime * animationMultiplier) + self.currentValue = self.currentValue - valueChange + + self.statusbar:SetValue(self.currentValue) + + if (self.currentValue - 0.001 <= self.targetValue) then + self:SetValue(self.targetValue) + self.currentValue = self.targetValue + self.spark:Hide() + self.widget:SetScript("OnUpdate", nil) + return end + + self.spark:SetPoint("center", self.widget, "left", self.currentValue * self:GetWidth(), 0) + self.spark:Show() end local animateRightWithAccel = function(self, deltaTime) - local distance = (self.AnimationEnd - self.AnimationStart) / self.CurrentMaxValue * 100 --scale 1 - 100 basis - local minTravel = math.min (distance / 10, 3) -- 10 = trigger distance to max speed 3 = speed scale on max travel - local maxTravel = math.max (minTravel, 0.45) -- 0.45 = min scale speed on low travel speed - local animationSpeed = (self.CurrentMaxValue * (deltaTime * timeDilatation)) * maxTravel --re-scale back to unit health, scale with delta time and scale with the travel speed - - self.AnimationStart = self.AnimationStart + (animationSpeed) - self:SetValue(self.AnimationStart) - self.currentValue = self.AnimationStart - - if (self.AnimationStart + 0.01 >= self.AnimationEnd) then - self:SetValue (self.AnimationEnd) - self.currentValue = self.AnimationEnd - self.IsAnimating = false - if (self.Spark) then - self.Spark:Hide() - end + --get the animation elapsed percent + local currentPercent = DetailsFramework:GetRangePercent(self.startValue, self.targetValue, self.currentValue) + currentPercent = min(0.9, currentPercent) --slow down the animation but avoid very slow + currentPercent = max(0.5, currentPercent) --default: 0.1, using 0.5 makes the animation start fast and go slow + + --get the sine value and scale time with it + local animationMultiplier = math.sin(currentPercent * math.pi) + local valueChange = self.step * (deltaTime * animationMultiplier) + self.currentValue = self.currentValue + valueChange + + self.statusbar:SetValue(self.currentValue) + + if (self.currentValue + 0.001 >= self.targetValue) then + self:SetValue(self.targetValue) + self.currentValue = self.targetValue + self.spark:Hide() + self.widget:SetScript("OnUpdate", nil) + return end + + self.spark:SetPoint("center", self.widget, "left", self.currentValue * self:GetWidth(), 0) + self.spark:Show() end local onUpdate = function(self, deltaTime) - return self.MyObject:DoAnimation(deltaTime) + self = self.MyObject + --select the animation function + --target is always equal to current + if (self.targetValue > self.currentValue) then + animateRightWithAccel(self, deltaTime) + else + animateLeftWithAccel(self, deltaTime) + end end function SplitBarMetaFunctions:EnableAnimations() - self.widget:SetScript("OnUpdate", onUpdate) - self.widget:SetMinMaxValues(0, 1.0) - self.widget:SetValue(0, 0.5) - self.UsingAnimation = true - self.oldValue = self:GetValue() - self.currentValue = self:GetValue() - self.CurrentMaxValue = 100.0 + return end function SplitBarMetaFunctions:DisableAnimations() self.widget:SetScript("OnUpdate", nil) - self.UsingAnimation = nil - self.oldValue = nil - self.currentValue = nil end - function SplitBarMetaFunctions:DoAnimation(deltaTime) - local oldValue = self.oldValue - - self.AnimationStart = oldValue - self.AnimationEnd = self.currentValue - - self:SetValue(oldValue) - - self.IsAnimating = true - - if (self.AnimationEnd > self.AnimationStart) then - self.AnimateFunc = animateRightWithAccel - else - self.AnimateFunc = animateLeftWithAccel + function SplitBarMetaFunctions:SetValueWithAnimation(value) + if (self.widget:GetScript("OnUpdate") == nil) then + self.widget:SetScript("OnUpdate", onUpdate) + self.widget:SetMinMaxValues(0, 1) + self.spark:ClearAllPoints() + self.spark:SetHeight(self:GetHeight() * 1.7) + self.spark:SetAlpha(0.6) end + self.startValue = self.currentValue + self.step = abs(value - self.currentValue) + self.targetValue = value end ------------------------------------------------------------------------------------------------------------ @@ -633,6 +625,7 @@ function DF:CreateSplitBar(parent, width, height, member, name) end local build_statusbar = function (self) + self:SetSize (300, 14) self.background = self:CreateTexture ("$parent_StatusBarBackground", "BACKGROUND") @@ -711,10 +704,12 @@ function DF:NewSplitBar (parent, container, name, member, w, h) --> misc SplitBarObject.locked = false SplitBarObject.container = container + SplitBarObject.currentValue = 0.5 --> create widgets SplitBarObject.statusbar = CreateFrame ("statusbar", name, parent) build_statusbar (SplitBarObject.statusbar) + SplitBarObject.spark = SplitBarObject.statusbar.spark SplitBarObject.widget = SplitBarObject.statusbar if (not APISplitBarFunctions) then @@ -730,8 +725,9 @@ function DF:NewSplitBar (parent, container, name, member, w, h) end end - SplitBarObject.statusbar:SetHeight (h or 200) - SplitBarObject.statusbar:SetWidth (w or 14) + SplitBarObject.statusbar:SetHeight(h or 200) + SplitBarObject.statusbar:SetWidth(w or 14) + SplitBarObject.statusbar:SetValue(0.5) SplitBarObject.statusbar.MyObject = SplitBarObject diff --git a/boot.lua b/boot.lua index 03d5a760..a7e1a559 100644 --- a/boot.lua +++ b/boot.lua @@ -710,7 +710,7 @@ do SharedMedia:Register ("statusbar", "WorldState Score", [[Interface\WorldStateFrame\WORLDSTATEFINALSCORE-HIGHLIGHT]]) SharedMedia:Register ("statusbar", "DGround", [[Interface\AddOns\Details\images\bar_background]]) SharedMedia:Register ("statusbar", "Details Flat", [[Interface\AddOns\Details\images\bar_background]]) - + SharedMedia:Register ("statusbar", "Splitbar", [[Interface\AddOns\Details\images\bar_textures\split_bar]]) SharedMedia:Register ("statusbar", "Details2020", [[Interface\AddOns\Details\images\bar_textures\texture2020]]) --window bg and bar border diff --git a/classes/container_actors.lua b/classes/container_actors.lua index b0e29758..3be999f6 100644 --- a/classes/container_actors.lua +++ b/classes/container_actors.lua @@ -246,10 +246,10 @@ if (_detalhes.all_players_are_group or _detalhes.immersion_enabled) then novo_objeto.grupo = true end - + if ((_bit_band (flag, IS_GROUP_OBJECT) ~= 0 and novo_objeto.classe ~= "UNKNOW" and novo_objeto.classe ~= "UNGROUPPLAYER") or _detalhes:IsInCache (serial)) then novo_objeto.grupo = true - + if (_detalhes:IsATank (serial)) then novo_objeto.isTank = true end @@ -258,7 +258,7 @@ novo_objeto.grupo = true end end - + --> pvp duel if (_detalhes.duel_candidates [serial]) then --> check if is recent @@ -267,25 +267,24 @@ novo_objeto.enemy = true end end - + if (_detalhes.is_in_arena) then - local my_team_color = GetBattlefieldArenaFaction and GetBattlefieldArenaFaction() or 0 - + if (novo_objeto.grupo) then --> is ally novo_objeto.arena_ally = true - novo_objeto.arena_team = my_team_color + novo_objeto.arena_team = 0 --my_team_color | forcing the player team to always be the same color else --> is enemy novo_objeto.enemy = true novo_objeto.arena_enemy = true - novo_objeto.arena_team = 1 - my_team_color + novo_objeto.arena_team = 1 -- - my_team_color end - + local arena_props = _detalhes.arena_table [nome] if (arena_props) then novo_objeto.role = arena_props.role - + if (arena_props.role == "NONE") then local role = UnitGroupRolesAssigned and UnitGroupRolesAssigned(nome) if (role and role ~= "NONE") then diff --git a/frames/window_currentdps.lua b/frames/window_currentdps.lua index c7a6a576..65af1ff9 100644 --- a/frames/window_currentdps.lua +++ b/frames/window_currentdps.lua @@ -30,7 +30,7 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel) --> frame strata options local set_frame_strata = function (_, _, strata) Details.current_dps_meter.frame.strata = strata - Details:UpdateTheRealCurrentDPSFrame (testUsing) + Details:UpdateTheRealCurrentDPSFrame(testUsing) end local strataTable = {} strataTable [1] = {value = "BACKGROUND", label = "BACKGROUND", onclick = set_frame_strata} @@ -42,7 +42,7 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel) --> font options local set_font_shadow= function (_, _, shadow) Details.current_dps_meter.font_shadow = shadow - Details:UpdateTheRealCurrentDPSFrame (testUsing) + Details:UpdateTheRealCurrentDPSFrame(testUsing) end local fontShadowTable = {} fontShadowTable [1] = {value = "NONE", label = "None", onclick = set_font_shadow} @@ -51,7 +51,7 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel) local on_select_text_font = function (self, fixed_value, value) Details.current_dps_meter.font_face = value - Details:UpdateTheRealCurrentDPSFrame (testUsing) + Details:UpdateTheRealCurrentDPSFrame(testUsing) end --> options table @@ -76,7 +76,7 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel) get = function() return Details.current_dps_meter.frame.locked end, set = function (self, fixedparam, value) Details.current_dps_meter.frame.locked = not Details.current_dps_meter.frame.locked - Details:UpdateTheRealCurrentDPSFrame (testUsing) + Details:UpdateTheRealCurrentDPSFrame(testUsing) end, desc = "Locked", name = "Locked", @@ -88,7 +88,7 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel) get = function() return Details.current_dps_meter.frame.show_title end, set = function (self, fixedparam, value) Details.current_dps_meter.frame.show_title = not Details.current_dps_meter.frame.show_title - Details:UpdateTheRealCurrentDPSFrame (testUsing) + Details:UpdateTheRealCurrentDPSFrame(testUsing) end, desc = "Show Title", name = "Show Title", @@ -103,7 +103,7 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel) set = function (self, r, g, b, a) local color = Details.current_dps_meter.frame.backdrop_color color[1], color[2], color[3], color[4] = r, g, b, a - Details:UpdateTheRealCurrentDPSFrame (testUsing) + Details:UpdateTheRealCurrentDPSFrame(testUsing) end, desc = "Backdrop Color", name = "Backdrop Color", @@ -122,7 +122,7 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel) get = function() return Details.current_dps_meter.frame.width end, set = function (self, fixedparam, value) Details.current_dps_meter.frame.width = value - Details:UpdateTheRealCurrentDPSFrame (testUsing) + Details:UpdateTheRealCurrentDPSFrame(testUsing) end, min = 1, max = 300, @@ -136,7 +136,7 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel) get = function() return Details.current_dps_meter.frame.height end, set = function (self, fixedparam, value) Details.current_dps_meter.frame.height = value - Details:UpdateTheRealCurrentDPSFrame (testUsing) + Details:UpdateTheRealCurrentDPSFrame(testUsing) end, min = 1, max = 300, @@ -178,7 +178,7 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel) get = function() return Details.current_dps_meter.font_size end, set = function (self, fixedparam, value) Details.current_dps_meter.font_size = value - Details:UpdateTheRealCurrentDPSFrame (testUsing) + Details:UpdateTheRealCurrentDPSFrame(testUsing) end, min = 4, max = 32, @@ -195,7 +195,7 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel) set = function (self, r, g, b, a) local color = Details.current_dps_meter.font_color color[1], color[2], color[3], color[4] = r, g, b, a - Details:UpdateTheRealCurrentDPSFrame (testUsing) + Details:UpdateTheRealCurrentDPSFrame(testUsing) end, desc = "Font Color", name = "Font Color", @@ -216,8 +216,6 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel) name = "Font Face", text_template = options_text_template, }, - - } DF:BuildMenu (f, options, 7, -30, 500, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template) @@ -231,7 +229,7 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel) DetailsCurrentDpsMeter:Hide() end end - + --> reopen the options panel if (f.FromOptionsPanel) then C_Timer.After (0.2, function() @@ -239,36 +237,34 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel) end) end end) - end --> check if the frame was been created if (not DetailsCurrentDpsMeter) then Details:CreateCurrentDpsFrame(UIParent, "DetailsCurrentDpsMeter") end - + --> show the options DetailsCurrentRealDPSOptions:Show() DetailsCurrentRealDPSOptions:RefreshOptions() DetailsCurrentRealDPSOptions.FromOptionsPanel = from_options_panel - + --> start the frame for viewing while editing the options DetailsCurrentDpsMeter:StartForArenaMatch() - end function Details:CreateCurrentDpsFrame(parent, name) local DF = _detalhes.gump - local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") - + local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0") + --> some constants local header_size = 12 --title bar size local spacing_vertical = -6 --vertical space between the group anchor and the group dps local green_team_color = {.5, 1, .5, 1} local yellow_team_color = {1, 1, .5, 1} - + --> main farame local f = CreateFrame ("frame", name, parent or UIParent,"BackdropTemplate") f:SetPoint ("center", UIParent, "center") @@ -279,9 +275,9 @@ function Details:CreateCurrentDpsFrame(parent, name) f:EnableMouse (true) f:SetMovable (true) f:SetClampedToScreen (true) - + f.PlayerTeam = 0 - + local LibWindow = LibStub ("LibWindow-1.1") LibWindow.RegisterConfig (f, _detalhes.current_dps_meter.frame) LibWindow.MakeDraggable (f) @@ -292,18 +288,16 @@ function Details:CreateCurrentDpsFrame(parent, name) --frame to support the two bars, one for the dps and another for heal --the dps bar is wider and taller, hps is below it and smaller - local barFrame = CreateFrame("frame", "DetailsArenaDpsBars", f, "BackdropTemplate") - f.dpsBarFrame = barFrame - barFrame:SetSize(400, 80) - barFrame:SetPoint("center", f, "center") - - barFrame.splitBar = DF:CreateSplitBar(barFrame, 400, 50) - barFrame.splitBar:SetSize(400, 50) - barFrame.splitBar:SetPoint("center", barFrame, "center", 0, 0) - barFrame.splitBar.fontsize = 10 - barFrame.splitBar:SetMinMaxValues(0, 1.0) - barFrame.splitBar:SetValue(0.5) - barFrame.splitBar:EnableAnimations() + local barFrame = CreateFrame("frame", "DetailsArenaDpsBars", f) + f.dpsBarFrame = barFrame + barFrame:SetSize(400, 80) + barFrame:SetPoint("center", f, "center", 0, 50) + + barFrame.splitBar = DF:CreateSplitBar(barFrame, 400, 20) + barFrame.splitBar:SetSize(400, 20) + barFrame.splitBar:SetPoint("center", barFrame, "center", 0, 0) + barFrame.splitBar.fontsize = 10 + barFrame.splitBar:SetTexture(SharedMedia:Fetch("statusbar", "Splitbar")) --> title bar local TitleString = f:CreateFontString (nil, "overlay", "GameFontNormal") @@ -318,41 +312,12 @@ function Details:CreateCurrentDpsFrame(parent, name) TitleBackground:SetHeight (header_size) --> labels for arena - local labelPlayerTeam = f:CreateFontString (nil, "overlay", "GameFontNormal") - local labelYellowTeam = f:CreateFontString (nil, "overlay", "GameFontNormal") - labelPlayerTeam:SetText ("Player Team") - labelYellowTeam:SetText ("Enemy Team") - DF:SetFontSize (labelPlayerTeam, 14) - DF:SetFontSize (labelYellowTeam, 14) - DF:SetFontOutline (labelPlayerTeam, "NONE") - DF:SetFontOutline (labelYellowTeam, "NONE") - - local labelPlayerTeam_DPS = f:CreateFontString (nil, "overlay", "GameFontNormal") - local labelYellowTeam_DPS = f:CreateFontString (nil, "overlay", "GameFontNormal") + local labelPlayerTeam_DPS = barFrame.splitBar:CreateFontString(nil, "overlay", "GameFontNormal") + local labelYellowTeam_DPS = barFrame.splitBar:CreateFontString(nil, "overlay", "GameFontNormal") labelPlayerTeam_DPS:SetText ("0") labelYellowTeam_DPS:SetText ("0") - - local labelPlayerTeam_DPS_Icon = f:CreateTexture (nil, "overlay") - local labelYellowTeam_DPS_Icon = f:CreateTexture (nil, "overlay") - labelPlayerTeam_DPS_Icon:SetTexture ([[Interface\LFGFRAME\UI-LFG-ICON-ROLES]]) - labelYellowTeam_DPS_Icon:SetTexture ([[Interface\LFGFRAME\UI-LFG-ICON-ROLES]]) - labelPlayerTeam_DPS_Icon:SetTexCoord (72/256, 130/256, 69/256, 127/256) - labelYellowTeam_DPS_Icon:SetTexCoord (72/256, 130/256, 69/256, 127/256) - local icon_size = 16 - labelPlayerTeam_DPS_Icon:SetSize (icon_size, icon_size) - labelYellowTeam_DPS_Icon:SetSize (icon_size, icon_size) - - labelPlayerTeam:SetPoint ("left", f, "left", 5, 10) - labelYellowTeam:SetPoint ("right", f, "right", -5, 10) - - labelPlayerTeam_DPS_Icon:SetPoint ("topleft", labelPlayerTeam, "bottomleft", 0, -4) - labelYellowTeam_DPS_Icon:SetPoint ("topleft", labelYellowTeam, "bottomleft", 0, -4) - - labelPlayerTeam_DPS:SetPoint ("left", labelPlayerTeam_DPS_Icon, "right", 4, 0) - labelYellowTeam_DPS:SetPoint ("left", labelYellowTeam_DPS_Icon, "right", 4, 0) - - labelPlayerTeam:SetTextColor (unpack (green_team_color)) - labelYellowTeam:SetTextColor (unpack (yellow_team_color)) + labelPlayerTeam_DPS:SetPoint ("left", barFrame.splitBar.widget, "left", 4, 0) + labelYellowTeam_DPS:SetPoint ("right", barFrame.splitBar.widget, "right", 4, 0) function f.SwapArenaTeamColors() if (f.PlayerTeam == 0) then @@ -391,102 +356,99 @@ function Details:CreateCurrentDpsFrame(parent, name) f.YellowDamage = 0 f.LastPlayerTeamDamage = 0 f.LastYellowDamage = 0 - + --> mythic dungeon / party group f.GroupBuffer = {} f.GroupTotalDamage = 0 f.LastTickGroupDamage = 0 - + --> general f.SampleSize = _detalhes.current_dps_meter.sample_size f.MaxBufferIndex = 1 f.ShowingArena = false - - function _detalhes:UpdateTheRealCurrentDPSFrame (scenario) + + function _detalhes:UpdateTheRealCurrentDPSFrame(scenario) --> don't run if the featured hasn't loaded if (not f) then return end - + if (not _detalhes.current_dps_meter.enabled) then f:Hide() print("D! debug currentdps.lua > !current_dps_meter.enabled") return end - + if (not _detalhes.current_dps_meter.arena_enabled and not _detalhes.current_dps_meter.mythic_dungeon_enabled) then f:Hide() print("D! debug currentdps.lua > not _detalhes.current_dps_meter.arena_enabled and not _detalhes.current_dps_meter.mythic_dungeon_enabled") return end - + --> where the player are if (scenario == "arena") then labelPlayerTeam_DPS:Show() labelYellowTeam_DPS:Show() - labelPlayerTeam:Show() - labelYellowTeam:Show() - labelPlayerTeam_DPS_Icon:Show() - labelYellowTeam_DPS_Icon:Show() - f.dpsBarFrame:Show() --> update arena labels DF:SetFontColor (labelPlayerTeam_DPS, _detalhes.current_dps_meter.font_color) DF:SetFontFace (labelPlayerTeam_DPS, _detalhes.current_dps_meter.font_face) DF:SetFontSize (labelPlayerTeam_DPS, _detalhes.current_dps_meter.font_size) DF:SetFontOutline (labelPlayerTeam_DPS, _detalhes.current_dps_meter.font_shadow) - + DF:SetFontColor (labelYellowTeam_DPS, _detalhes.current_dps_meter.font_color) DF:SetFontFace (labelYellowTeam_DPS, _detalhes.current_dps_meter.font_face) DF:SetFontSize (labelYellowTeam_DPS, _detalhes.current_dps_meter.font_size) DF:SetFontOutline (labelYellowTeam_DPS, _detalhes.current_dps_meter.font_shadow) - + --> wipe current data for arena wipe (f.PlayerTeamBuffer) wipe (f.YellowTeamBuffer) - + --> reset damage f.PlayerTeamDamage = 0 f.YellowDamage = 0 - + --> reset last tick damage f.LastPlayerTeamDamage = 0 f.LastYellowDamage = 0 - + f:Show() - else - --> isn't arena, hide arena labels - labelPlayerTeam_DPS:Hide() - labelYellowTeam_DPS:Hide() - labelPlayerTeam:Hide() - labelYellowTeam:Hide() - labelPlayerTeam_DPS_Icon:Hide() - labelYellowTeam_DPS_Icon:Hide() - end - - if (scenario == "mythicdungeon") then + DetailsArenaDpsBars:Show() + DetailsArenaDpsBars.splitBar:Show() + barFrame.splitBar:EnableAnimations() + + --hide group widgets + labelGroupDamage:Hide() + labelGroupDamage_DPS:Hide() + f.dpsBarFrame:Hide() + + elseif (scenario == "mythicdungeon") then labelGroupDamage:Show() labelGroupDamage_DPS:Show() - + DF:SetFontColor (labelGroupDamage_DPS, _detalhes.current_dps_meter.font_color) DF:SetFontFace (labelGroupDamage_DPS, _detalhes.current_dps_meter.font_face) DF:SetFontSize (labelGroupDamage_DPS, _detalhes.current_dps_meter.font_size) DF:SetFontOutline (labelGroupDamage_DPS, _detalhes.current_dps_meter.font_shadow) - + --> wipe current data for mythic dungeon f.GroupBuffer = {} - + --> reset damage f.GroupTotalDamage = 0 - + --> reset last tick damage f.LastTickGroupDamage = 0 - + + --show the frame f:Show() - else - labelGroupDamage:Hide() - labelGroupDamage_DPS:Hide() - f.dpsBarFrame:Hide() + + --hide arena widgets + DetailsArenaDpsBars:Hide() + DetailsArenaDpsBars.splitBar:Hide() + labelPlayerTeam_DPS:Hide() + labelYellowTeam_DPS:Hide() end --> frame position @@ -604,7 +566,9 @@ function Details:CreateCurrentDpsFrame(parent, name) local totalDamage = teamGreenDps + teamYellowDps local dpsBarFrame = DetailsArenaDpsBars.splitBar - dpsBarFrame.currentValue = teamGreenDps / totalDamage * 100 + --a percenntagem na barra esta sendo setada corretamente, porem a animação não esta funcrtionando ainda + DetailsArenaDpsBars.splitBar:SetValueWithAnimation(teamGreenDps / totalDamage) + DetailsArenaDpsBars:Show() if (f.PlayerTeam == 0) then dpsBarFrame:SetLeftColor(unpack (green_team_color)) @@ -680,7 +644,10 @@ function Details:CreateCurrentDpsFrame(parent, name) end) function f:StartForArenaMatch() + --seems not to call any show() if (not f.ShowingArena) then + Details:UpdateTheRealCurrentDPSFrame("arena") + f.ShowingArena = true f:SetScript ("OnUpdate", on_tick) end @@ -744,4 +711,47 @@ end --initialize frames function Details:InitializeCurrentDpsFrames() Details:CreateCurrentDpsFrame(UIParent, "DetailsCurrentDpsMeter") +end + + + +function DetailsTestSplitBar() + + --> create the frame + local f = CreateFrame("frame", "DetailsTestSplitBarFrame", UIParent) + f:SetSize(400, 200) + f:SetPoint("center") + local backgroundTexture = f:CreateTexture(nil, "overlay") + backgroundTexture:SetAllPoints() + backgroundTexture:SetColorTexture(.1, .1, .1, .7) + + local barFrame = CreateFrame("frame", "DetailsArenaDpsBars", f, "BackdropTemplate") + f.dpsBarFrame = barFrame + barFrame:SetSize(400, 80) + barFrame:SetPoint("center", f, "center", 0, 50) + DF:ApplyStandardBackdrop(barFrame) + + barFrame.splitBar = DF:CreateSplitBar(barFrame, 400, 50) + barFrame.splitBar:SetSize(400, 50) + barFrame.splitBar:SetPoint("center", barFrame, "center", 0, 0) + barFrame.splitBar.fontsize = 10 + local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0") + barFrame.splitBar:SetTexture(SharedMedia:Fetch("statusbar", "Splitbar")) + + local green_team_color = {.5, 1, .5, 1} + local yellow_team_color = {1, 1, .5, 1} + barFrame.splitBar:SetLeftColor(unpack (green_team_color)) + barFrame.splitBar:SetRightColor(unpack (yellow_team_color)) + + --> test the splitbar + local loopTime = 0.1 + f:SetScript("OnUpdate", function(self, deltaTime) + loopTime = loopTime - deltaTime + if (loopTime <= 0) then + local value = abs(1.0 * math.sin((math.pi*2) * (GetTime() * 0.1))) + local value = math.random() + barFrame.splitBar:SetValueWithAnimation(value) + loopTime = 0.1 + end + end) end \ No newline at end of file diff --git a/images/bar_textures/split_bar.tga b/images/bar_textures/split_bar.tga new file mode 100644 index 0000000000000000000000000000000000000000..cc5eafb4175066740094969c502118ea29605a22 GIT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r&_>JPHaj4;m!Kr_dnDm>OUn4prZd&EUo@;??0FL=QJJ`_5CN8YV|+2W6^PIHXzpj zOZ+VL4z{x|yH>Yw`e&tv`1 zPXnA#|NhPTNB!S%|LZt;VGI9x|HE{cl={ycnXI#xf8yXHfZ!OV)IUT|_@n=UzbZdV zAmk@m=5CwG&A+aKG4GX%Mhk~R9!CN_^rOn;Y)?C3Jj~U`k9N6W{W^X&SR())kv5cyaCt$z@0q`UE7 z-~Yh>`2Iide^%;$78-!)17yhdMsehP$;3p>XPoUs`BOH@8{+IMW zsY$YG1_OT_(rxy|pt2!Cv~&hYJL_TmS*Jocp0NJuc>eA^jx#M&sD7O$zN^4cq$NaH zjUIlYN}N;t;K+Yg0oj3nQ$}m?LmI7V13$S|{1L!S^|R%lC7}M#@~{3&8u~xJ|A&9z zul3Ig|J48TkHdDjz5g8f=dxU!TeRQ57zTrJRI~5@w`SEQ(x%Ed!{tupArQ84j literal 0 HcmV?d00001 diff --git a/startup.lua b/startup.lua index 74538e77..7b4668da 100644 --- a/startup.lua +++ b/startup.lua @@ -532,7 +532,7 @@ function Details:StartMeUp() --I'll never stop! end if (DetailsFramework.IsTimewalkWoW()) then - Details:Msg("TBC Beta Version: 0012") + Details:Msg("TBC Beta Version: 0013") end if (DetailsFramework.IsTBCWow()) then