Skip to content

Commit f2a4d8b

Browse files
committed
auto select highest completed key in besttime overview
1 parent 63cdeb0 commit f2a4d8b

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

BestTimes.lua

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,6 @@ function MPT:ShowSeasonFrames() -- Showing Frame & Season Buttons
490490
btn.BG = btn:CreateTexture(nil, "BACKGROUND")
491491
btn.BG:SetAllPoints()
492492
btn.BG:SetColorTexture(0.3, 0.3, 0.3, 0.9)
493-
btn:SetNormalTexture("")
494-
btn:SetHighlightTexture("")
495-
btn:SetPushedTexture("")
496493
btn.Border = btn:CreateTexture(nil, "OVERLAY")
497494
btn.Border:SetAllPoints()
498495
btn.Border:SetColorTexture(0.2, 0.6, 1, 0.5)
@@ -508,7 +505,6 @@ function MPT:ShowSeasonFrames() -- Showing Frame & Season Buttons
508505
btn.Text:SetText(self.SeasonName[i])
509506
btn:Show()
510507
btn:SetScript("OnClick", function()
511-
self:ShowDungeonFrames(i)
512508
if self.SelectedSeasonButton then
513509
self.SelectedSeasonButton.Border:Hide()
514510
end
@@ -520,14 +516,15 @@ function MPT:ShowSeasonFrames() -- Showing Frame & Season Buttons
520516
end
521517
if F.PBDataText then F.PBDataText:Hide() end
522518
if F.DeleteButton then F.DeleteButton:Hide() end
523-
btn.Border:Show()
524519
for k, v in pairs(F.LevelButtons or {}) do
525520
v:Hide()
526521
end
527522
self.SelectedSeasonButton = btn
528523
self.SelectedSeason = i
529524
self.SelectedDungeon = nil
530525
self.SelectedLevel = nil
526+
self:ShowDungeonFrames(i)
527+
btn.Border:Show()
531528
end)
532529
if self.SelectedSeasonButton ~= btn then
533530
btn.Border:Hide()
@@ -568,9 +565,6 @@ function MPT:ShowDungeonFrames(seasonID) -- Showing Dungeon Buttons
568565
btn.BG = btn:CreateTexture(nil, "BACKGROUND")
569566
btn.BG:SetAllPoints()
570567
btn.BG:SetColorTexture(0.3, 0.3, 0.3, 0.9)
571-
btn:SetNormalTexture("")
572-
btn:SetHighlightTexture("")
573-
btn:SetPushedTexture("")
574568
btn.Border = btn:CreateTexture(nil, "OVERLAY")
575569
btn.Border:SetAllPoints()
576570
btn.Border:SetColorTexture(0.2, 0.6, 1, 0.5)
@@ -583,7 +577,6 @@ function MPT:ShowDungeonFrames(seasonID) -- Showing Dungeon Buttons
583577
end
584578
btn:SetPoint("TOP", parent, "TOP", 0, num == 1 and -10 or -50)
585579
btn:SetScript("OnClick", function()
586-
self:ShowLevelFrames(cmap, seasonID)
587580
if self.SelectedDungeonButton then
588581
self.SelectedDungeonButton.Border:Hide()
589582
end
@@ -592,10 +585,11 @@ function MPT:ShowDungeonFrames(seasonID) -- Showing Dungeon Buttons
592585
end
593586
if F.PBDataText then F.PBDataText:Hide() end
594587
if F.DeleteButton then F.DeleteButton:Hide() end
595-
btn.Border:Show()
596588
self.SelectedDungeonButton = btn
597589
self.SelectedDungeon = cmap
598590
self.SelectedLevel = nil
591+
self:ShowLevelFrames(cmap, seasonID)
592+
btn.Border:Show()
599593
end)
600594
if self.SelectedDungeonButton ~= btn then
601595
btn.Border:Hide()
@@ -620,6 +614,7 @@ function MPT:ShowLevelFrames(cmap, seasonID) -- Showing Level Buttons
620614
if self.SelectedLevelButton then
621615
self.SelectedLevelButton.Border:Hide()
622616
end
617+
local first = true
623618
for level = 100, 1, -1 do
624619
if MPTSV.BestTime[seasonID][cmap][level] then
625620
if not F.LevelButtons[num] then
@@ -628,9 +623,6 @@ function MPT:ShowLevelFrames(cmap, seasonID) -- Showing Level Buttons
628623
btn.BG = btn:CreateTexture(nil, "BACKGROUND")
629624
btn.BG:SetAllPoints()
630625
btn.BG:SetColorTexture(0.3, 0.3, 0.3, 0.9)
631-
btn:SetNormalTexture("")
632-
btn:SetHighlightTexture("")
633-
btn:SetPushedTexture("")
634626
btn.Border = btn:CreateTexture(nil, "OVERLAY")
635627
btn.Border:SetAllPoints()
636628
btn.Border:SetColorTexture(0.2, 0.6, 1, 0.5)
@@ -645,14 +637,24 @@ function MPT:ShowLevelFrames(cmap, seasonID) -- Showing Level Buttons
645637
--btn:SetPoint("TOPLEFT", F.LevelContent, "TOPLEFT", 10, num == 1 and -5 or ((num-1)*-45)-5)
646638
btn:SetPoint("TOP", F.LevelContent, "TOP", 0, num == 1 and -5 or ((num-1)*-45)-5)
647639
btn:SetScript("OnClick", function()
648-
self:ShowPBDataFrame(cmap, level, seasonID)
649640
if self.SelectedLevelButton then
650641
self.SelectedLevelButton.Border:Hide()
651642
end
652-
btn.Border:Show()
653643
self.SelectedLevelButton = btn
654644
self.SelectedLevel = level
645+
self:ShowPBDataFrame(seasonID, cmap, level)
646+
btn.Border:Show()
655647
end)
648+
if first then
649+
first = false
650+
if self.SelectedLevelButton then
651+
self.SelectedLevelButton.Border:Hide()
652+
end
653+
self.SelectedLevelButton = btn
654+
self.SelectedLevel = level
655+
self:ShowPBDataFrame(seasonID, cmap, level)
656+
btn.Border:Show()
657+
end
656658
btn.Text:SetText(level)
657659
btn:Show()
658660
num = num+1
@@ -661,7 +663,7 @@ function MPT:ShowLevelFrames(cmap, seasonID) -- Showing Level Buttons
661663
F.LevelContent:SetHeight(num*50)
662664
end
663665

664-
function MPT:ShowPBDataFrame(cmap, level, seasonID) -- Showing PB Data
666+
function MPT:ShowPBDataFrame(seasonID, cmap, level) -- Showing PB Data
665667
local F = self.BestTimeFrame
666668
if not F then return end
667669
if F.PBDataFrame then

0 commit comments

Comments
 (0)