Changeset 6996 for code/branches/presentation3/data/gui/scripts
- Timestamp:
- May 27, 2010, 10:44:10 PM (14 years ago)
- Location:
- code/branches/presentation3/data/gui/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/data/gui/scripts/KeyBindMenu.lua
r6748 r6996 28 28 table.insert(commandList, "OverlayGroup toggleVisibility Debug") 29 29 table.insert(commandList, "OverlayGroup toggleVisibility Stats") 30 table.insert(commandList, "OrxonoxOverlay toggleVisibility QuestGUI") 31 table.insert(commandList, "OrxonoxOverlay toggleVisibility PickupInventory") 32 table.insert(commandList, "startchat") 33 table.insert(commandList, "startchat_small") 30 34 table.insert(commandList, "mouseLook") 31 35 table.insert(commandList, "pause") … … 53 57 table.insert(nameList, "Show Debug") 54 58 table.insert(nameList, "Show Stats") 59 table.insert(nameList, "Show Quests") 60 table.insert(nameList, "Show Pickups") 61 table.insert(nameList, "Show Chat") 62 table.insert(nameList, "Show small Chat") 55 63 table.insert(nameList, "Look Around") 56 64 table.insert(nameList, "Pause") -
code/branches/presentation3/data/gui/scripts/PickupInventory.lua
r6965 r6996 3 3 local P = createMenuSheet("PickupInventory") 4 4 5 P.carrierList = {}6 5 P.wrapper = nil 7 6 P.detailsWindows = {} 7 P.detailPickups = {} 8 8 P.pickupsList = {} 9 9 … … 17 17 18 18 function P.onLoad() 19 carrierList = {} 19 P.wrapper = nil 20 P.detailsWindows = {} 21 P.detailPickups = {} 22 P.pickupsList = {} 20 23 end 21 24 … … 27 30 function P.onHide() 28 31 P.showing = false 29 P.cleanup( )32 P.cleanup(true) 30 33 end 31 34 … … 34 37 return 35 38 end 36 37 P.cleanup() 38 39 40 -- Update opened detail windows. 41 for k,v in pairs(P.detailsWindows) do 42 if v ~= nil then 43 local pickup = P.detailPickups[k] 44 if pickup ~= nil and pickup ~= 0 then 45 local useButton = winMgr:getWindow("orxonox/PickupInventory/Details" .. k .. "/UseButton") 46 local dropButton = winMgr:getWindow("orxonox/PickupInventory/Details" .. k .. "/DropButton") 47 if orxonox.PickupManager:getInstance():isValidPickup(pickup) == false then 48 useButton:setEnabled(false) 49 dropButton:setEnabled(false) 50 P.detailPickups[k] = nil 51 else 52 useButton:setEnabled(true) 53 if pickup:isUsed() == true then 54 useButton:setText("unuse") 55 orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUseDetailButton_clicked") 56 else 57 useButton:setText("use") 58 orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUnuseDetailButton_clicked") 59 end 60 61 if pickup:isPickedUp() == false then 62 useButton:setEnabled(false) 63 dropButton:setEnabled(false) 64 P.detailPickups[k] = nil 65 end 66 end 67 end 68 end 69 end 70 71 -- Update main inventory. 72 P.cleanup(false) 39 73 P.createInventory() 74 -- TODO: Recover scrolling position 75 40 76 end 41 77 … … 83 119 local title = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Title") 84 120 title:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.imageHeight+5), CEGUI.UDim(0, (P.imageHeight-P.textHeight)/2))) 85 title:setSize(CEGUI.UVector2(CEGUI.UDim(0. 4, 0), CEGUI.UDim(0, P.textHeight)))121 title:setSize(CEGUI.UVector2(CEGUI.UDim(0.3, 0), CEGUI.UDim(0, P.textHeight))) 86 122 title:setText(representation:getPickupName()) 87 123 title:setProperty("FrameEnabled", "set:False") … … 89 125 90 126 local useButton = winMgr:createWindow("MenuWidgets/Button", name .. "/UseButton") 91 useButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0. 4, P.imageHeight+10),CEGUI.UDim(0, (P.imageHeight-P.textHeight)/2)))127 useButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.3, P.imageHeight+10),CEGUI.UDim(0, (P.imageHeight-P.textHeight)/2))) 92 128 useButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.buttonWidth), CEGUI.UDim(0, P.textHeight))) 93 129 if pickup:isUsed() == false then … … 101 137 102 138 local dropButton = winMgr:createWindow("MenuWidgets/Button", name .. "/DropButton") 103 dropButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0. 4, P.imageHeight+15+P.buttonWidth),CEGUI.UDim(0, (P.imageHeight-P.textHeight)/2)))139 dropButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.3, P.imageHeight+15+P.buttonWidth),CEGUI.UDim(0, (P.imageHeight-P.textHeight)/2))) 104 140 dropButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.buttonWidth), CEGUI.UDim(0, P.textHeight))) 105 141 dropButton:setText("drop") … … 108 144 109 145 local detailsButton = winMgr:createWindow("MenuWidgets/Button", name .. "/DetailsButton") 110 detailsButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0. 4, P.imageHeight+20+2*P.buttonWidth),CEGUI.UDim(0, (P.imageHeight-P.textHeight)/2)))146 detailsButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.3, P.imageHeight+20+2*P.buttonWidth),CEGUI.UDim(0, (P.imageHeight-P.textHeight)/2))) 111 147 detailsButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.buttonWidth), CEGUI.UDim(0, P.textHeight))) 112 148 detailsButton:setText("details") … … 117 153 end 118 154 119 function P.cleanup( )155 function P.cleanup(destroyDetails) 120 156 if P.wrapper ~= nil then 121 157 winMgr:destroyWindow(P.wrapper) … … 123 159 124 160 --Destroy details windows. 161 if destroyDetails == false then 162 return 163 end 125 164 for k,v in pairs(P.detailsWindows) do 126 165 if v ~= nil then … … 143 182 local pickup = P.pickupsList[pickupIndex] 144 183 local representation = orxonox.PickupManager:getInstance():getPickupRepresentation(pickup) 145 146 local headerOffset = 35 147 --Design parameters 148 local imageSize = 100 149 150 local name = "orxonox/PickupInventory/Pickup" .. pickupIndex .. "/Details" .. P.getNewDetailNumber() 184 185 local index = P.getNewDetailNumber() 186 local name = "orxonox/PickupInventory/Details" .. index 151 187 152 188 local window = winMgr:createWindow("MenuWidgets/FrameWindow", name) … … 192 228 if pickup:isUsed() == false then 193 229 useButton:setText("use") 194 orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUse Button_clicked")230 orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUseDetailButton_clicked") 195 231 else 196 232 useButton:setText("unuse") 197 orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUnuse Button_clicked")233 orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUnuseDetailButton_clicked") 198 234 end 199 235 wrapper:addChildWindow(useButton) … … 203 239 dropButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.buttonWidth), CEGUI.UDim(0, P.textHeight))) 204 240 dropButton:setText("drop") 205 orxonox.GUIManager:subscribeEventHelper(dropButton, "Clicked", P.name .. ".InventoryDrop Button_clicked")241 orxonox.GUIManager:subscribeEventHelper(dropButton, "Clicked", P.name .. ".InventoryDropDetailButton_clicked") 206 242 wrapper:addChildWindow(dropButton) 207 208 table.insert(P.detailsWindows, window) 209 210 end 211 243 244 P.detailsWindows[index] = window 245 P.detailPickups[index] = pickup 246 247 end 248 249 -- TODO: Smarter 212 250 function P.getNewDetailNumber() 213 251 local number = table.getn(P.detailsWindows) … … 217 255 end 218 256 end 219 return number 257 return number+1 220 258 end 221 259 … … 238 276 local pickupIndex = P.windowToPickupHelper(e) 239 277 P.createDetailsWindow(pickupIndex) 278 end 279 280 function P.InventoryUseDetailButton_clicked(e) 281 local pickupIndex = P.windowToPickupHelper(e) 282 orxonox.PickupManager:getInstance():usePickup(P.detailPickups[pickupIndex], true) 283 end 284 285 function P.InventoryUnuseDetailButton_clicked(e) 286 local pickupIndex = P.windowToPickupHelper(e) 287 orxonox.PickupManager:getInstance():usePickup(P.detailPickups[pickupIndex], false) 288 end 289 290 function P.InventoryDropDetailButton_clicked(e) 291 local pickupIndex = P.windowToPickupHelper(e) 292 orxonox.PickupManager:getInstance():dropPickup(P.detailPickups[pickupIndex]) 240 293 end 241 294 … … 245 298 local name = we.window:getName() 246 299 local match = string.gmatch(name, "%d+") 247 local pickupNr = tonumber(match())248 300 local detailNr = tonumber(match()) 249 301 250 local window = P.detailsWindows[detailNr +1]302 local window = P.detailsWindows[detailNr] 251 303 winMgr:destroyWindow(window) 252 P.detailsWindows[detailNr+1] = nil 304 P.detailsWindows[detailNr] = nil 305 P.detailPickups[detailNr] = nil 253 306 end 254 307
Note: See TracChangeset
for help on using the changeset viewer.