Mercurial > wow > devian
comparison Devian.lua @ 55:1b8c597dba44
added movement fading
todo: sort out dock mouseover hitches
| author | Nenue |
|---|---|
| date | Wed, 06 Jan 2016 07:37:17 -0500 |
| parents | 4c05e55b0433 |
| children | 4b1b301cf8d4 |
comparison
equal
deleted
inserted
replaced
| 54:25725b0c933c | 55:1b8c597dba44 |
|---|---|
| 22 local print = _G.print | 22 local print = _G.print |
| 23 local db | 23 local db |
| 24 local defaults = { | 24 local defaults = { |
| 25 ['global'] = {{}, {}}, | 25 ['global'] = {{}, {}}, |
| 26 ['tags'] = {}, | 26 ['tags'] = {}, |
| 27 ['channels'] = {[1] = {signature = 'Main', index = 1, x = 100, y = 800, height = 500, width = 600, enabled = true}}, | 27 ['channels'] = {[1] = { |
| 28 signature = 'Main', | |
| 29 index = 1, | |
| 30 x = 100, y = 800, | |
| 31 height = 500, width = 600, | |
| 32 enabled = true}}, | |
| 28 ['profiles'] = { | 33 ['profiles'] = { |
| 29 {'Main', false}, | 34 {'Main', false}, |
| 30 {'Devian', true}, | 35 {'Devian', true}, |
| 31 {'Turok', true}, | 36 {'Turok', true}, |
| 32 {'Bam', true} | 37 {'Bam', true} |
| 33 }, | 38 }, |
| 34 primary_channel = 1, -- the channel to which default output is sent | 39 primary_channel = 1, -- the channel to which default output is sent |
| 35 current_channel = 1, -- the front channel | 40 current_channel = 1, -- the front channel |
| 36 max_channel = 1, -- the highest created channel id | 41 max_channel = 1, -- the highest created channel id |
| 37 enable = true, -- allow enabled consoles to appear | 42 enabled = true, -- allow enabled consoles to appear |
| 38 load_message = "Defaults loaded.", -- messages to be displayed after reload | 43 load_message = "Defaults loaded.", -- messages to be displayed after reload |
| 39 font = [[Interface\Addons\Devian\font\SourceCodePro-Regular.ttf]], -- font info | 44 font = [[Interface\Addons\Devian\font\SourceCodePro-Regular.ttf]], -- font info |
| 40 fontsize = 13, | 45 fontsize = 13, |
| 41 fontoutline = 'NONE', | 46 fontoutline = 'NONE', |
| 42 | 47 |
| 47 headeralpha = 1, | 52 headeralpha = 1, |
| 48 headerfontcolor = {1,1,1,1}, | 53 headerfontcolor = {1,1,1,1}, |
| 49 | 54 |
| 50 backdrop = {1,1,1,1}, -- background frame info | 55 backdrop = {1,1,1,1}, -- background frame info |
| 51 backgrad = {'VERTICAL', 0.1, 0.1, 0.1, 1, 0, 0, 0, 1}, | 56 backgrad = {'VERTICAL', 0.1, 0.1, 0.1, 1, 0, 0, 0, 1}, |
| 52 backblend = 'MOD', | 57 backblend = 'BLEND', |
| 53 backalpha = 1, | 58 backalpha = 1, |
| 54 backborder = {.5,.5,.5,1}, | 59 backborder = {.5,.5,.5,1}, |
| 55 backheader = {.25,.25,.25,1}, | 60 backheader = {.25,.25,.25,1}, |
| 56 | 61 |
| 57 frontdrop = {1,1,1,1}, -- foreground frame info | 62 frontdrop = {1,1,1,1}, -- foreground frame info |
| 58 frontgrad = {'VERTICAL', 0.1, 0.1, 0.1, 1, 0, 0, 0, 1}, | 63 frontgrad = {'VERTICAL', 0.1, 0.1, 0.1, 1, 0, 0, 0, 1}, |
| 59 frontblend = 'MOD', | 64 frontblend = 'BLEND', |
| 60 frontalpha = 1, | 65 frontalpha = 1, |
| 61 frontborder = {.07,.47,1,1}, | 66 frontborder = {.07,.47,1,1}, |
| 62 frontheader = {1,1,1,1}, | 67 frontheader = {1,1,1,1}, |
| 63 tagcolor = {}, -- tag color repository | 68 tagcolor = {}, -- tag color repository |
| 64 workspace = 2, -- current profile | 69 workspace = 2, -- current profile |
| 73 dock_fade_in = 0.15, | 78 dock_fade_in = 0.15, |
| 74 dock_fade_out = 0.45, | 79 dock_fade_out = 0.45, |
| 75 dock_button_alpha_on = 1, | 80 dock_button_alpha_on = 1, |
| 76 dock_button_alpha_off = 0.2, | 81 dock_button_alpha_off = 0.2, |
| 77 dock_button_fade_in = 0.075, | 82 dock_button_fade_in = 0.075, |
| 78 dock_button_fade_out = 0.075 | 83 dock_button_fade_out = 0.075, |
| 79 | 84 |
| 85 movement_fade = true, | |
| 86 movement_fade_time = 0.15, | |
| 80 } | 87 } |
| 81 | 88 |
| 82 local function ScanAddOnList(cmd, ...) | 89 local function ScanAddOnList(cmd, ...) |
| 83 local list_state | 90 local list_state |
| 84 | 91 |
| 293 local function Message(prefix, ...) | 300 local function Message(prefix, ...) |
| 294 if db.workspace == 1 then | 301 if db.workspace == 1 then |
| 295 return D.oldprint(prefix, ...) | 302 return D.oldprint(prefix, ...) |
| 296 end | 303 end |
| 297 | 304 |
| 298 if prefix == nil then | 305 if tostring(prefix) == nil then |
| 299 prefix = 1 | 306 prefix = 'nil*' |
| 300 end | 307 end |
| 301 | 308 |
| 302 local sendq = {} | 309 local sendq = {} |
| 303 local tag, id, tagged | 310 local tag, id, tagged |
| 304 local byName = true | 311 local byName = true |
| 331 | 338 |
| 332 db.tagcolor[prefix] = format('%02X%02X%02X', unpack(c)) | 339 db.tagcolor[prefix] = format('%02X%02X%02X', unpack(c)) |
| 333 end | 340 end |
| 334 pcolor = db.tagcolor[prefix] | 341 pcolor = db.tagcolor[prefix] |
| 335 | 342 |
| 336 local buffer = {'|cFF'.. pcolor..prefix ..'|r'} | 343 local buffer = {} |
| 337 for i = 1, select('#',...) do | 344 for i = 1, select('#',...) do |
| 338 local var = select(i, ...) | 345 local var = select(i, ...) |
| 339 | 346 |
| 340 if type(var) == 'table' then | 347 if type(var) == 'table' then |
| 341 if type(var.GetName) == 'function' then | 348 if type(var.GetName) == 'function' then |
| 354 | 361 |
| 355 insert(buffer, var) | 362 insert(buffer, var) |
| 356 end | 363 end |
| 357 local message = concat(buffer, ' ') | 364 local message = concat(buffer, ' ') |
| 358 for id, channel in pairs(sendq) do | 365 for id, channel in pairs(sendq) do |
| 359 channel.out:AddMessage(message) | 366 if channel.width < 250 then |
| 367 prefix = string.sub(prefix, 0,2) | |
| 368 end | |
| 369 channel.out:AddMessage('|cFF'.. pcolor..prefix ..'|r ' .. message) | |
| 360 UIFrameFadeIn(D.dock.buttons[id], db.dock_onshow_fade_time, db.dock_onshow_fade_from, db.dock_onshow_fade_to) | 370 UIFrameFadeIn(D.dock.buttons[id], db.dock_onshow_fade_time, db.dock_onshow_fade_from, db.dock_onshow_fade_to) |
| 361 UIFrameFadeIn(D.dock.buttons[id].caption, db.dock_onshow_fade_time, db.dock_onshow_fade_from, db.dock_onshow_fade_to) | 371 UIFrameFadeIn(D.dock.buttons[id].caption, db.dock_onshow_fade_time, db.dock_onshow_fade_from, db.dock_onshow_fade_to) |
| 362 end | 372 end |
| 363 wipe(buffer) | 373 wipe(buffer) |
| 364 end | 374 end |
| 399 end | 409 end |
| 400 self.modules.Config:ChatCommand(input) | 410 self.modules.Config:ChatCommand(input) |
| 401 end) | 411 end) |
| 402 --@end-debug@ | 412 --@end-debug@ |
| 403 | 413 |
| 414 -- movement fading | |
| 415 if db.movement_fade then | |
| 416 self:RegisterEvent('PLAYER_STARTED_MOVING', function() | |
| 417 for k, v in pairs(self.console) do | |
| 418 if v.enabled then | |
| 419 v.preAlpha = v:GetAlpha() | |
| 420 UIFrameFadeOut(v, db.movement_fade_time, v.preAlpha, 0) | |
| 421 UIFrameFadeOut(v.out, db.movement_fade_time, v.preAlpha, 0) | |
| 422 end | |
| 423 end | |
| 424 end) | |
| 425 self:RegisterEvent('PLAYER_STOPPED_MOVING', function() | |
| 426 for k, v in pairs(self.console) do | |
| 427 if v.enabled then | |
| 428 UIFrameFadeIn(v, db.movement_fade_time, v:GetAlpha(), v.alpha) | |
| 429 UIFrameFadeIn(v.out, db.movement_fade_time, v:GetAlpha(), v.alpha) | |
| 430 end | |
| 431 end | |
| 432 end) | |
| 433 end | |
| 404 end | 434 end |
| 405 | 435 |
| 406 function D:OnInitialize() | 436 function D:OnInitialize() |
| 407 -- commands | 437 -- commands |
| 408 self:RegisterChatCommand("cleandvn", function(args) | 438 self:RegisterChatCommand("cleandvn", function(args) |
