Mercurial > wow > breuesk
comparison Gui.lua @ 72:9e5b0a2368ad
Big progress towards GUI usefulness and communication between clients
| author | John@Yosemite-PC |
|---|---|
| date | Sat, 07 Apr 2012 13:35:57 -0400 |
| parents | d5e2dfe0c269 |
| children | 7eb2963eea7d |
comparison
equal
deleted
inserted
replaced
| 71:d5e2dfe0c269 | 72:9e5b0a2368ad |
|---|---|
| 47 end | 47 end |
| 48 end | 48 end |
| 49 pulldown:SetWidth(175) | 49 pulldown:SetWidth(175) |
| 50 pulldown:SetList(pull) | 50 pulldown:SetList(pull) |
| 51 SListPopulator:SetSwidget(pulldown) | 51 SListPopulator:SetSwidget(pulldown) |
| 52 pulldown:SetCallback("OnValueChanged", function(_,_,value) SListPopulator:SelectList(value) end) | 52 pulldown:SetCallback("OnValueChanged", function(_,_,value) SListPopulator:PulldownEvent(value) end) |
| 53 if ltemp > 0 then SListPopulator:SelectList(ltemp) end -- default value | 53 if ltemp > 0 then SListPopulator:PulldownEvent(ltemp) end -- default value |
| 54 return pulldown | 54 return pulldown |
| 55 end | 55 end |
| 56 | 56 |
| 57 local f, right | 57 local f, right -- important gui elements |
| 58 local escapeButton = | 58 local escapeButton = |
| 59 { | 59 { |
| 60 shown = false, | 60 shown = false, |
| 61 ["IsShown"] = function(self) return self.shown end, | 61 ["IsShown"] = function(self) return self.shown end, |
| 62 ["Hide"] = function(self) if f then AceGUI:Release(f); self.shown=false end end | 62 ["Hide"] = function(self) if f then AceGUI:Release(f); self.shown=false end end |
| 152 end, | 152 end, |
| 153 ["SetFiltered"] = function(self,value) | 153 ["SetFiltered"] = function(self,value) |
| 154 self.filtered = value | 154 self.filtered = value |
| 155 self:Redraw() | 155 self:Redraw() |
| 156 end, | 156 end, |
| 157 ["SelectList"] = function(self,value) | 157 ["SelectList"] = function(self,value,nocomm) |
| 158 self.swidget:SetValue(value) | 158 self.swidget:SetValue(value) |
| 159 self.lref = LootLists:Select(value) | 159 local l = LootLists:Select(value) |
| 160 self:Redraw() | 160 if l ~= self.lref then |
| 161 Comm:ActivateList(value) | 161 self.lref = l |
| 162 self:Redraw() | |
| 163 end | |
| 164 if nocomm then InitiateActiveList(value) end | |
| 165 end, | |
| 166 | |
| 167 | |
| 168 ["PulldownEvent"] = function(self,value) | |
| 169 self:SelectList(value) | |
| 170 if admin and state == "looting" then | |
| 171 InitiateActivateList(value) | |
| 172 end | |
| 162 end, | 173 end, |
| 163 ["DataEvent"] = function(self) | 174 ["DataEvent"] = function(self) |
| 164 self:Redraw() | 175 self:Redraw() |
| 165 end, | 176 end, |
| 177 ["StateEvent"] = function(self) | |
| 178 if state == "bidding" or (state == "looting" and not admin) then | |
| 179 self.swidget:SetDisabled(true) | |
| 180 self:SelectList(stateactivelist) | |
| 181 elseif state == "looting" and admin then | |
| 182 self.swidget:SetDisabled(false) | |
| 183 else | |
| 184 self.swidget:SetDisabled(false) | |
| 185 end | |
| 186 -- if bidding then disable pulldown | |
| 187 -- if looting and not admin then disable pulldown | |
| 188 -- if looting and admin then enable pulldown | |
| 189 -- otherwise enable pulldown | |
| 190 end, | |
| 191 ["ActiveListEvent"] = function(self) | |
| 192 self:SelectList(stateactivelist) | |
| 193 end, | |
| 194 | |
| 195 | |
| 196 | |
| 166 ["GetMe"] = function(self) | 197 ["GetMe"] = function(self) |
| 167 local me = _G.UnitName("player") | 198 local me = _G.UnitName("player") |
| 168 for i,v in pairs(self.data) do | 199 for i,v in pairs(self.data) do |
| 169 if v.textPlain == me then | 200 if v.textPlain == me then |
| 170 return v | 201 return v |
| 289 } | 320 } |
| 290 | 321 |
| 291 function OnInitializeSetStaticData() | 322 function OnInitializeSetStaticData() |
| 292 SetChangeListener(DataEventDispatch) | 323 SetChangeListener(DataEventDispatch) |
| 293 DataEventDispatch:RegisterListener(SListPopulator) | 324 DataEventDispatch:RegisterListener(SListPopulator) |
| 325 RegisterListenerActiveListChanged(SListPopulator) | |
| 326 RegisterListenerStateChange(SListPopulator) | |
| 294 RegisterListenerRolls(RListPopulator) | 327 RegisterListenerRolls(RListPopulator) |
| 295 end | 328 end |
| 296 | 329 |
| 297 function CreateGUI() | 330 function CreateGUI() |
| 298 -- special registration procedure to be closable with the escape button | 331 -- special registration procedure to be closable with the escape button |
| 299 --escapeButton.shown = true | 332 --escapeButton.shown = true |
| 300 --_G["BSK_ESCAPEBUTTON"] = escapeButton | 333 --_G["BSK_ESCAPEBUTTON"] = escapeButton |
| 301 --table.insert(_G.UISpecialFrames, "BSK_ESCAPEBUTTON") | 334 --table.insert(_G.UISpecialFrames, "BSK_ESCAPEBUTTON") |
| 302 | 335 |
| 303 if f then return end -- no second gui please | 336 if f then return end -- no second gui please |
| 304 local admin = admin or true | |
| 305 f = AceGUI:Create("Frame") | 337 f = AceGUI:Create("Frame") |
| 306 | 338 |
| 307 f:SetCallback("OnClose",function(widget) escapeButton.shown = false; AceGUI:Release(widget); f=nil; right=nil; SListEventDispatch:Release(); LListEventDispatch:Release(); SListPopulator:Release(); RListEventDispatch:Release(); LListPopulator:Release(); RListPopulator:Release() end) | 339 f:SetCallback("OnClose",function(widget) escapeButton.shown = false; AceGUI:Release(widget); f=nil; right=nil; SListEventDispatch:Release(); LListEventDispatch:Release(); SListPopulator:Release(); RListEventDispatch:Release(); LListPopulator:Release(); RListPopulator:Release() end) |
| 308 f:SetTitle("BSK") | 340 f:SetTitle("BSK") |
| 309 f:SetLayout("Flow") | 341 f:SetLayout("Flow") |
