From a02c62ad670f563fcb7ace9d6b17152785682bac Mon Sep 17 00:00:00 2001 From: Pisti01 Date: Sun, 24 Apr 2016 15:37:38 +0200 Subject: [PATCH] Options and UI tweaks +Option to fill bars from right to left +Option to hide thread per second +Color mode select now use radio buttons +Slightly reorganized settings window +Small tweaks to default class colors --- Forms/Settings.xml | 40 ++++++++++++++++++++++++++-------------- Modules/Main.lua | 19 +++++++++++++++---- Modules/Settings.lua | 26 ++++++++++++++++++++++++++ Threat.lua | 16 +++++++++------- 4 files changed, 76 insertions(+), 25 deletions(-) diff --git a/Forms/Settings.xml b/Forms/Settings.xml index 88d572f..3c460d3 100644 --- a/Forms/Settings.xml +++ b/Forms/Settings.xml @@ -1,6 +1,6 @@ -
+ @@ -14,30 +14,42 @@ - - - - - - - - - + - + - + + + + + - + + + + + + + + + + + + + + + + + @@ -56,7 +68,7 @@ -
+ diff --git a/Modules/Main.lua b/Modules/Main.lua index f2cafaa..9a97a57 100644 --- a/Modules/Main.lua +++ b/Modules/Main.lua @@ -191,17 +191,28 @@ function Main:CreateBar(wndParent, tEntry, bFirst) wndBar:FindChild("Name"):SetText(tEntry.sName) -- Print threat per second as a floating point number with a precision of 1. (Ex. 7572.2) - wndBar:FindChild("ThreatPerSecond"):SetText(string.format("%.1f", nPerSecond)) + if Threat.tOptions.profile.bShowThreatPerSec then + wndBar:FindChild("ThreatPerSecond"):SetText(string.format("%.1f", nPerSecond)) + else + wndBar:FindChild("ThreatPerSecond"):SetText("") + end -- Print the total as a string with the formatted number and percentage of total. (Ex. 300k 42%) wndBar:FindChild("Total"):SetText(string.format("%s %d%s", sValue, nPercent, "%")) wndBar:FindChild("Total"):SetData(tEntry.nValue) -- Update the progress bar with the new values and set the bar color. + local wndBarBackground = wndBar:FindChild("Background") local nR, nG, nB, nA = self:GetColorForEntry(tEntry, bFirst) - local nLeft, nTop, _, nBottom = wndBar:FindChild("Background"):GetAnchorPoints() - wndBar:FindChild("Background"):SetAnchorPoints(nLeft, nTop, nPercent / 100, nBottom) - wndBar:FindChild("Background"):SetBGColor(ApolloColor.new(nR, nG, nB, nA)) + local nLeft, nTop, _, nBottom = wndBarBackground:GetAnchorPoints() + + if Threat.tOptions.profile.bRightToLeftBars then + wndBarBackground:SetAnchorPoints(nLeft + (1 - nPercent / 100), nTop, 1, nBottom) + else + wndBarBackground:SetAnchorPoints(nLeft, nTop, nPercent / 100, nBottom) + end + + wndBarBackground:SetBGColor(ApolloColor.new(nR, nG, nB, nA)) end function Main:GetColorForEntry(tEntry, bFirst) diff --git a/Modules/Settings.lua b/Modules/Settings.lua index 3cfd6c7..34da857 100644 --- a/Modules/Settings.lua +++ b/Modules/Settings.lua @@ -43,6 +43,15 @@ function Settings:OnBtnLock(wndHandler, wndControl) Threat:GetModule("Main"):UpdateLockStatus() end +-- Color Select + +function Settings:OnBtnSimpleColors(wndHandler, wndControl) + if wndControl:IsChecked() then + Threat.tOptions.profile.bUseClassColors = false + Threat.tOptions.profile.bUseRoleColors = false + end +end + function Settings:OnBtnClassColors(wndHandler, wndControl) Threat.tOptions.profile.bUseClassColors = wndControl:IsChecked() if wndControl:IsChecked() then @@ -57,6 +66,8 @@ function Settings:OnBtnRoleColors(wndHandler, wndControl) end end +-- Show Options + function Settings:OnBtnShowSolo(wndHandler, wndControl) Threat.tOptions.profile.bShowSolo = wndControl:IsChecked() end @@ -65,6 +76,12 @@ function Settings:OnBtnShowDifferences(wndHandler, wndControl) Threat.tOptions.profile.bShowDifferences = wndControl:IsChecked() end +function Settings:OnBtnShowTPS(wndHandler, wndControl) + Threat.tOptions.profile.bShowThreatPerSec = wndControl:IsChecked() +end + +-- Other Options + function Settings:OnBtnAlwaysUseSelf(wndHandler, wndControl) Threat.tOptions.profile.bUseSelfColor = wndControl:IsChecked() end @@ -73,6 +90,12 @@ function Settings:OnBtnShowSelfWarning(wndHandler, wndControl) Threat.tOptions.profile.bShowSelfWarning = wndControl:IsChecked() end +function Settings:OnBtnRightToLeftBars(wndHandler, wndControl) + Threat.tOptions.profile.bRightToLeftBars = wndControl:IsChecked() +end + +-- Buttons + function Settings:OnBtnReset(wndHandler, wndControl) Threat.tOptions:ResetProfile() end @@ -121,12 +144,15 @@ end function Settings:ApplyCurrent() self.wndMain:FindChild("BtnEnable"):SetCheck(Threat.tOptions.profile.bEnabled) self.wndMain:FindChild("BtnLock"):SetCheck(Threat.tOptions.profile.bLock) + self.wndMain:FindChild("BtnSimpleColors"):SetCheck(not (Threat.tOptions.profile.bUseRoleColors or Threat.tOptions.profile.bUseClassColors)) self.wndMain:FindChild("BtnClassColors"):SetCheck(Threat.tOptions.profile.bUseClassColors) self.wndMain:FindChild("BtnRoleColors"):SetCheck(Threat.tOptions.profile.bUseRoleColors) self.wndMain:FindChild("BtnShowSolo"):SetCheck(Threat.tOptions.profile.bShowSolo) self.wndMain:FindChild("BtnShowDifferences"):SetCheck(Threat.tOptions.profile.bShowDifferences) + self.wndMain:FindChild("BtnShowThreatPerSec"):SetCheck(Threat.tOptions.profile.bShowThreatPerSec) self.wndMain:FindChild("BtnAlwaysUseSelf"):SetCheck(Threat.tOptions.profile.bUseSelfColor) self.wndMain:FindChild("BtnShowSelfWarning"):SetCheck(Threat.tOptions.profile.bShowSelfWarning) + self.wndMain:FindChild("BtnRightToLeftBars"):SetCheck(Threat.tOptions.profile.bRightToLeftBars) self:CreateColors() end diff --git a/Threat.lua b/Threat.lua index 57cc58e..0a0b57b 100644 --- a/Threat.lua +++ b/Threat.lua @@ -6,7 +6,7 @@ local Threat = Apollo.GetPackage("Gemini:Addon-1.1").tPackage:NewAddon("Threat", Threat.tVersion = { nMajor = 1, nMinor = 0, - nBuild = 2 + nBuild = 3 } local tDefaults = { @@ -14,8 +14,10 @@ local tDefaults = { bEnabled = true, bShowSolo = false, bShowDifferences = false, + bShowThreatPerSec = true, bUseSelfColor = false, bShowSelfWarning = false, + bRightToLeftBars = false, bLock = false, tPosition = { nX = 100, @@ -36,12 +38,12 @@ local tDefaults = { tTank = { nR = 154, nG = 25, nB = 230, nA = 255 }, tHealer = { nR = 87, nG = 156, nB = 12, nA = 255 }, tDamage = { nR = 235, nG = 27, nB = 27, nA = 255 }, - [GameLib.CodeEnumClass.Warrior] = { nR = 245, nG = 79, nB = 79, nA = 255 }, - [GameLib.CodeEnumClass.Engineer] = { nR = 255, nG = 231, nB = 87, nA = 255 }, - [GameLib.CodeEnumClass.Esper] = { nR = 21, nG = 145, nB = 219, nA = 255 }, - [GameLib.CodeEnumClass.Medic] = { nR = 84, nG = 207, nB = 23, nA = 255 }, - [GameLib.CodeEnumClass.Spellslinger] = { nR = 240, nG = 164, nB = 53, nA = 255 }, - [GameLib.CodeEnumClass.Stalker] = { nR = 210, nG = 62, nB = 244, nA = 255 } + [GameLib.CodeEnumClass.Warrior] = { nR = 204, nG = 26, nB = 26, nA = 255 }, + [GameLib.CodeEnumClass.Engineer] = { nR = 204, nG = 204, nB = 0, nA = 255 }, + [GameLib.CodeEnumClass.Esper] = { nR = 26, nG = 128, nB = 179, nA = 255 }, + [GameLib.CodeEnumClass.Medic] = { nR = 51, nG = 153, nB = 26, nA = 255 }, + [GameLib.CodeEnumClass.Spellslinger] = { nR = 230, nG = 102, nB = 0, nA = 255 }, + [GameLib.CodeEnumClass.Stalker] = { nR = 128, nG = 26, nB = 204, nA = 255 } } } }