comparison Gui.lua @ 79:7b8fcea357d2

Rolls are active
author John@Yosemite-PC
date Thu, 12 Apr 2012 23:50:56 -0400
parents 5b507f4125d4
children 62805e6b46c5
comparison
equal deleted inserted replaced
78:5b507f4125d4 79:7b8fcea357d2
260 { 260 {
261 widget = nil, 261 widget = nil,
262 ["RollEvent"] = function(self) self:Redraw() end, 262 ["RollEvent"] = function(self) self:Redraw() end,
263 ["Release"] = function(self) self.widget = nil end, 263 ["Release"] = function(self) self.widget = nil end,
264 ["Redraw"] = function(self) 264 ["Redraw"] = function(self)
265 self.widget:SetList(statebids) 265 local list = {}
266 for i,v in pairs(statebids) do
267 table.insert(list,v)
268 end
269 for i,v in pairs(staterolls) do
270 local roll
271 for r,s in pairs(staterollvalues) do
272 if s.value == v.value then
273 roll = r
274 break
275 end
276 end
277 print("Inserting a roll ", v.value, roll)
278
279 local c = copy(v)
280 c.disabled = false
281 c.text = c.text .. " (roll "..roll..")"
282 table.insert(list,c)
283 end
284 self.widget:SetList(list)
266 RListEventDispatch:Event("Redraw") 285 RListEventDispatch:Event("Redraw")
267 end, 286 end,
268 ["SetWidget"] = function(self,w) 287 ["SetWidget"] = function(self,w)
269 if type(w) ~= "table" or type(w.SetList) ~= "function" then 288 if type(w) ~= "table" or type(w.SetList) ~= "function" then
270 _G.error("Bad SetWidget") 289 _G.error("Bad SetWidget")
277 -- if dummydata[2] then dummydata[2].text = dummydata[2].text .. " (roll 73)" end 296 -- if dummydata[2] then dummydata[2].text = dummydata[2].text .. " (roll 73)" end
278 -- self.data = dummydata 297 -- self.data = dummydata
279 --end 298 --end
280 self:Redraw() 299 self:Redraw()
281 end, 300 end,
282 ["Force"] = function(self,who) 301 ["Force"] = function(self,who) -- todo: remove this and the horse it rode in on
283 local new = self.Convert(who,72) 302 local new = self.Convert(who,72)
284 InitiateBid(new) 303 InitiateBid(new)
285 --self:Redraw() 304 --self:Redraw()
286 end, 305 end,
287 ["Retract"] = function(self,who) 306 ["Retract"] = function(self,who) -- todo: remove this and the horse it rode in on
288 -- todo 307 -- todo
289 --for i,v in pairs(self.data) do 308 --for i,v in pairs(self.data) do
290 -- if who.value == v.value then 309 -- if who.value == v.value then
291 -- table.remove(self.data,i) 310 -- table.remove(self.data,i)
292 -- end 311 -- end
348 bidRetractButton:SetCallback("OnClick", function(widget) InitiateBid(SListPopulator:GetMe()) end) 367 bidRetractButton:SetCallback("OnClick", function(widget) InitiateBid(SListPopulator:GetMe()) end)
349 368
350 local rollButton = AceGUI:Create("Button") 369 local rollButton = AceGUI:Create("Button")
351 rollButton:SetText("Offset Roll") 370 rollButton:SetText("Offset Roll")
352 rollButton:SetWidth(100) 371 rollButton:SetWidth(100)
353 -- todo: callback 372 rollButton:SetCallback("OnClick", function(widget) InitiateRollRequest(SListPopulator:GetMe()) end) -- todo: wrong behavior. GetMe will nil if the person isn't on the currently selected loot list. this could easily happen. return a new thingy instead
373 local retractButton = AceGUI:Create("Button")
374 retractButton:SetText("Retract")
375 retractButton:SetWidth(100)
376 retractButton:SetCallback("OnClick", function(widget) InitiateRetract(SListPopulator:GetMe()) end)
354 377
355 RListEventDispatch:SetTarget(b1) 378 RListEventDispatch:SetTarget(b1)
356 RListPopulator:SetWidget(b1) 379 RListPopulator:SetWidget(b1)
357 380
358 local g1 381 local g1
405 adminRetract:SetDisabled(true) 428 adminRetract:SetDisabled(true)
406 429
407 g1:AddChildren(adminForce,adminRetract) 430 g1:AddChildren(adminForce,adminRetract)
408 end 431 end
409 432
410 self.group:AddChildren(spacer,label,biddingOn,bidRetractButton,rollButton,spacer2,bidTitle,b1) 433 self.group:AddChildren(spacer,label,biddingOn,bidRetractButton,rollButton,retractButton,spacer2,bidTitle,b1)
411 if admin then self.group:AddChildren(g1) end 434 if admin then self.group:AddChildren(g1) end
412 435
413 else 436 else
414 437
415 438