WoWInterface SVN RuneWatch

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 19 to Rev 20
    Reverse comparison

Rev 19 → Rev 20

trunk/Options.lua
17,6 → 17,7
config = {
type = "execute",
name = "Configure",
order = 0,
desc = "Open the Configuration Dialog",
func = function() RuneWatch:ShowConfig() end,
guiHidden = true
24,11 → 25,20
frame = {
type = "group",
name = "Frame",
order = 1,
desc = "UI-Frame Options",
args = {
dsc = {
type = "description",
order = 0,
cmdHidden = true,
dropdownHidden = true,
name = "This section of the configuration allows you to change the appearance/location of the main ui-frame."
},
locked = {
type = "toggle",
name = "Locked",
width = "full",
desc = "Toggles the ui's locked state, preventing it from being moved.",
get = function(info) return RuneWatch.db.locked end,
set = function(info, v) RuneWatch.db.locked = v; RuneWatch:GuiUpdate(); end
49,16 → 59,26
type = "group",
name = "Behaviour",
desc = "Mod-Behaviour Options",
order = 2,
args = {
dsc = {
type = "description",
order = 0,
cmdHidden = true,
dropdownHidden = true,
name = "This section of the configuration deals with behavioural changes to RuneWatch. The options in this section govern how RuneWatch acts and responds to various events."
},
fadeout = {
type = "group",
order = 1,
name = "Fade-Out",
desc = "Out of combat Fade-Out",
args = {
dsc = {
type = "description",
order = 0,
guiHidden = true,
cmdHidden = true,
dropdownHidden = true,
name = "The Fade-Out behavior allows the RuneWatch Gui to fade-out after combat has ended, this allows the user to have an un-obstructed view when they aren't in combat since RuneWatch is primarily an in-combat mod."
},
enabled = {
trunk/RuneWatch.lua
1,5 → 1,6
local AceAddon = LibStub("AceAddon-3.0")
local AceDB = LibStub("AceDB-3.0")
local AceTimer = LibStub("AceTimer-3.0")
 
RuneWatch = AceAddon:NewAddon("RuneWatch", "AceConsole-3.0", "AceEvent-3.0", "AceHook-3.0")
 
16,12 → 17,13
 
local barWidth = 300;
 
local rpBarCol = { r = 0.2, g = 0.2, b = 0.6 }
local rpBarColMax = { r = 0.4, g = 0.4, b = 0.9 }
local rpBarCol = { r = 0.1, g = 0.1, b = 0.3 }
local rpBarColMax = { r = 0.2, g = 0.2, b = 0.6 }
 
local artTextures = {
Frame = "Interface\\AddOns\\RuneWatch\\Artwork\\UI-RuneWatch-Frame",
Bar = "Interface\\AddOns\\RuneWatch\\Artwork\\UI-RuneWatch-Bar"
Bar = "Interface\\AddOns\\RuneWatch\\Artwork\\UI-RuneWatch-Bar",
Border = "Interface\\AddOns\\RuneWatch\\Artwork\\UI-RuneWatch-BarBorder"
};
 
function RuneWatch:OnInitialize()
50,10 → 52,24
self:RegisterEvent("RUNE_TYPE_UPDATE")
self:RegisterEvent("UNIT_RUNIC_POWER")
 
-- In/Out of Combat Events
self:RegisterEvent("PLAYER_REGEN_DISABLED");
self:RegisterEvent("PLAYER_REGEN_ENABLED");
 
self:GuiUpdate();
--end
 
self.LastUpdate = 0;
 
-- Self-States
 
self.State = {
LastUpdate = 0,
FadeOut = {
active = false,
elapsed = 0
}
}
end
 
function RuneWatch:OnEnable()
82,16 → 98,49
end
 
function RuneWatch:OnUpdate(self, elapsed)
RuneWatch.LastUpdate = RuneWatch.LastUpdate + elapsed;
local State = RuneWatch.State;
 
State.LastUpdate = State.LastUpdate + elapsed;
 
if (RuneWatch.LastUpdate > 0.5) then
RuneWatch.LastUpdate = 0;
if (State.FadeOut.active == true) then
local tarOpacity = RuneWatch.db.behaviour.fadeout.opacity;
 
State.FadeOut.elapsed = State.FadeOut.elapsed + elapsed;
 
if (State.FadeOut.elapsed >= RuneWatch.db.behaviour.fadeout.length) then
State.FadeOut.active = false;
RuneWatch.Gui.Anchor:SetAlpha(tarOpacity);
else
local perc = 1 - (State.FadeOut.elapsed / RuneWatch.db.behaviour.fadeout.length);
local curOpacity = ((1-tarOpacity) * perc) + tarOpacity;
RuneWatch.Gui.Anchor:SetAlpha(curOpacity);
end
end
 
-- Update the Runic Power Every 1/2 second.
if (State.LastUpdate > 0.5) then
State.LastUpdate = 0;
 
-- Update the GUI
RuneWatch:UNIT_RUNIC_POWER("UNIT_RUNIC_POWER", "player");
end
end
 
-- Occurs when player enters 'combat'
function RuneWatch:PLAYER_REGEN_DISABLED(event, ...)
-- Always make sure our opacity is at full when we enter combat.
self.Gui.Anchor:SetAlpha(1);
end
 
-- Occurs when player exits 'combat'
function RuneWatch:PLAYER_REGEN_ENABLED(event, ...)
-- If Fade-Out Is Turned on
if (self.db.behaviour.fadeout.enabled == true) then
-- Schedule a timer
AceTimer:ScheduleTimer(function() self.State.FadeOut.elapsed = 0; self.State.FadeOut.active = true; end, self.db.behaviour.fadeout.wait);
end
end
 
function RuneWatch:RUNE_POWER_UPDATE(event, ...)
local rune, usable = ...;
if not usable then
271,7 → 320,15
bar:SetHeight(150);
bar:Show();
 
local bord = frame:CreateTexture("$parent_BarBorder", "ARTWORK");
bord:SetTexture(artTextures.Border);
bar:SetPoint("LEFT", self.Gui.Art.Base, "LEFT", 0, 0);
bar:SetWidth(300);
bar:SetHeight(150);
bar:Show();
 
self.Gui.Art.Bar = bar;
self.Gui.Art.BarBorder = bord;
end
 
function RuneWatch:InitBackBlocks()