Skip to content

Commit

Permalink
Finished rewrite on the arena real time dps
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed May 17, 2021
1 parent 324598d commit 5417132
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Libs/DF/split_bar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ function DF:NewSplitBar (parent, container, name, member, w, h)
SplitBarObject.currentValue = 0.5

--> create widgets
SplitBarObject.statusbar = CreateFrame ("statusbar", name, parent)
SplitBarObject.statusbar = CreateFrame ("statusbar", name, parent, "BackdropTemplate")
build_statusbar (SplitBarObject.statusbar)
SplitBarObject.spark = SplitBarObject.statusbar.spark
SplitBarObject.widget = SplitBarObject.statusbar
Expand Down
80 changes: 66 additions & 14 deletions frames/window_currentdps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ local Details = _G.Details
local libwindow = LibStub("LibWindow-1.1")
local DF = DetailsFramework

local green_team_color
local yellow_team_color

function Details:OpenCurrentRealDPSOptions(from_options_panel)

if (not DetailsCurrentRealDPSOptions) then

green_team_color = Details.class_colors.ARENA_GREEN --{.5, 1, .5, 1}
yellow_team_color = Details.class_colors.ARENA_YELLOW --{1, 1, .5, 1}

local DF = _detalhes.gump

local f = DF:CreateSimplePanel (UIParent, 700, 400, "Details! The Current Real DPS Options", "DetailsCurrentRealDPSOptions")
Expand Down Expand Up @@ -54,6 +60,19 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel)
Details:UpdateTheRealCurrentDPSFrame(testUsing)
end

local lockCallback = function()
local f = _G.DetailsCurrentDpsMeter
if (Details.current_dps_meter.frame.locked) then
f.movemeLabel:Hide()
f.lockButton:Hide()
f:SetBackdropColor(.2, .2, .2, 0)
else
f.movemeLabel:Show()
f.lockButton:Show()
f:SetBackdropColor(.2, .2, .2, 0.5)
end
end

--> options table
local options = {

Expand All @@ -77,6 +96,7 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel)
set = function (self, fixedparam, value)
Details.current_dps_meter.frame.locked = not Details.current_dps_meter.frame.locked
Details:UpdateTheRealCurrentDPSFrame(testUsing)
lockCallback()
end,
desc = "Locked",
name = "Locked",
Expand Down Expand Up @@ -237,6 +257,8 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel)
end)
end
end)

C_Timer.After(1, lockCallback)
end

--> check if the frame was been created
Expand All @@ -259,11 +281,12 @@ function Details:CreateCurrentDpsFrame(parent, name)
local DF = _detalhes.gump
local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")

green_team_color = Details.class_colors.ARENA_GREEN --{.5, 1, .5, 1}
yellow_team_color = Details.class_colors.ARENA_YELLOW --{1, 1, .5, 1}

--> 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")
Expand All @@ -276,13 +299,44 @@ function Details:CreateCurrentDpsFrame(parent, name)
f:SetMovable (true)
f:SetClampedToScreen (true)

f.movemeLabel = f:CreateFontString(nil, "overlay", "GameFontNormal")
f.movemeLabel:SetPoint("center", f, "center", 0, 20)
f.movemeLabel:SetText("Move-Me")

f.lockButton = DetailsFramework:CreateButton(f, function()
Details.current_dps_meter.frame.locked = not Details.current_dps_meter.frame.locked
Details:UpdateTheRealCurrentDPSFrame()
f.movemeLabel:Hide()
f.lockButton:Hide()
end, 80, 20)
f.lockButton:SetPoint("center", f, "center", 0, -20)
f.lockButton.text = "Lock"

if (Details.current_dps_meter.frame.locked) then
f.movemeLabel:Hide()
f.lockButton:Hide()
end

f.PlayerTeam = 0

local LibWindow = LibStub ("LibWindow-1.1")
LibWindow.RegisterConfig (f, _detalhes.current_dps_meter.frame)
LibWindow.MakeDraggable (f)
LibWindow.RestorePosition (f)

local lockCallback = function()
local f = _G.DetailsCurrentDpsMeter
if (Details.current_dps_meter.frame.locked) then
f.movemeLabel:Hide()
f.lockButton:Hide()
f:SetBackdropColor(.2, .2, .2, 0)
else
f.movemeLabel:Show()
f.lockButton:Show()
f:SetBackdropColor(.2, .2, .2, 0.5)
end
end

--> arena dps bars
--code for the dps bars shown in arenas

Expand All @@ -291,8 +345,8 @@ function Details:CreateCurrentDpsFrame(parent, name)
local barFrame = CreateFrame("frame", "DetailsArenaDpsBars", f)
f.dpsBarFrame = barFrame
barFrame:SetSize(400, 80)
barFrame:SetPoint("center", f, "center", 0, 50)
barFrame:SetPoint("center", f, "center", 0, 0)

barFrame.splitBar = DF:CreateSplitBar(barFrame, 400, 20)
barFrame.splitBar:SetSize(400, 20)
barFrame.splitBar:SetPoint("center", barFrame, "center", 0, 0)
Expand All @@ -317,7 +371,7 @@ function Details:CreateCurrentDpsFrame(parent, name)
labelPlayerTeam_DPS:SetText ("0")
labelYellowTeam_DPS:SetText ("0")
labelPlayerTeam_DPS:SetPoint ("left", barFrame.splitBar.widget, "left", 4, 0)
labelYellowTeam_DPS:SetPoint ("right", barFrame.splitBar.widget, "right", 4, 0)
labelYellowTeam_DPS:SetPoint ("right", barFrame.splitBar.widget, "right", -4, 0)

function f.SwapArenaTeamColors()
if (f.PlayerTeam == 0) then
Expand Down Expand Up @@ -578,6 +632,12 @@ function Details:CreateCurrentDpsFrame(parent, name)
dpsBarFrame:SetRightColor(unpack (green_team_color))
end

if (Details.current_dps_meter.frame.locked) then
f.movemeLabel:Hide()
f.lockButton:Hide()
f:SetBackdropColor(.2, .2, .2, 0)
end

if (self.NextScreenUpdate <= 0) then
if (f.PlayerTeam == 0) then
labelPlayerTeam_DPS:SetText (_detalhes:ToK2 (self.PlayerTeamDamage / self.SampleSize))
Expand Down Expand Up @@ -705,16 +765,10 @@ function Details:CreateCurrentDpsFrame(parent, name)

_detalhes.Broadcaster_CurrentDpsLoaded = true
_detalhes.Broadcaster_CurrentDpsFrame = f
C_Timer.After(1, lockCallback)
f:Hide()
end

--initialize frames
function Details:InitializeCurrentDpsFrames()
Details:CreateCurrentDpsFrame(UIParent, "DetailsCurrentDpsMeter")
end



function DetailsTestSplitBar()

--> create the frame
Expand All @@ -738,8 +792,6 @@ function DetailsTestSplitBar()
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))

Expand Down

0 comments on commit 5417132

Please sign in to comment.