Changeset 7163 for code/trunk/data/gui
- Timestamp:
- Aug 11, 2010, 8:55:13 AM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 14 edited
- 8 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/data/gui/layouts/MultiplayerMenu.layout
r6746 r7163 16 16 <Property Name="VertFormatting" Value="TopAligned" /> 17 17 <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.2875,0},{0.75,0},{0.6375,0}}" /> 18 <Window Type="MenuWidgets/Listbox" Name="orxonox/MultiplayerL evelListbox" >18 <Window Type="MenuWidgets/Listbox" Name="orxonox/MultiplayerListbox" > 19 19 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 20 20 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.8,0}}" /> -
code/trunk/data/gui/layouts/SettingsMenu.layout
r6746 r7163 2 2 3 3 <GUILayout > 4 <Window Type="MenuWidgets/StaticImage" Name="orxonox/Settings Background" >4 <Window Type="MenuWidgets/StaticImage" Name="orxonox/SettingsMenu/Background" > 5 5 <Property Name="InheritsAlpha" Value="False" /> 6 6 <Property Name="FrameEnabled" Value="False" /> … … 8 8 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" /> 9 9 <Property Name="BackgroundEnabled" Value="False" /> 10 <Window Type="MenuWidgets/StaticText" Name="orxonox/Settings Window" >10 <Window Type="MenuWidgets/StaticText" Name="orxonox/SettingsMenu/SettingsWindow" > 11 11 <Property Name="Text" Value="Settings" /> 12 12 <Property Name="Alpha" Value="0.8" /> … … 16 16 <Property Name="VertFormatting" Value="TopAligned" /> 17 17 <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.3625,0},{0.75,0},{0.6375,0}}" /> 18 <Window Type="MenuWidgets/Button" Name="orxonox/ GameplayButton" >18 <Window Type="MenuWidgets/Button" Name="orxonox/SettingsMenu/GameplayButton" > 19 19 <Property Name="Text" Value="Gameplay" /> 20 20 <Property Name="Disabled" Value="True" /> … … 23 23 <Event Name="Clicked" Function="SettingsMenu.SettingsGameplayButton_clicked"/> 24 24 </Window> 25 <Window Type="MenuWidgets/Button" Name="orxonox/ MultiplayerOptionsButton" >25 <Window Type="MenuWidgets/Button" Name="orxonox/SettingsMenu/MultiplayerOptionsButton" > 26 26 <Property Name="Text" Value="Multiplayer options" /> 27 27 <Property Name="Disabled" Value="True" /> … … 30 30 <Event Name="Clicked" Function="SettingsMenu.SettingsMultiplayerOptionsButton_clicked"/> 31 31 </Window> 32 <Window Type="MenuWidgets/Button" Name="orxonox/ ControlsButton" >32 <Window Type="MenuWidgets/Button" Name="orxonox/SettingsMenu/ControlsButton" > 33 33 <Property Name="Text" Value="Controls" /> 34 34 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> … … 36 36 <Event Name="Clicked" Function="SettingsMenu.SettingsControlsButton_clicked"/> 37 37 </Window> 38 <Window Type="MenuWidgets/Button" Name="orxonox/ GraphicsButton" >38 <Window Type="MenuWidgets/Button" Name="orxonox/SettingsMenu/GraphicsButton" > 39 39 <Property Name="Text" Value="Graphics" /> 40 40 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> … … 42 42 <Event Name="Clicked" Function="SettingsMenu.SettingsGraphicsButton_clicked"/> 43 43 </Window> 44 <Window Type="MenuWidgets/Button" Name="orxonox/ AudioButton" >44 <Window Type="MenuWidgets/Button" Name="orxonox/SettingsMenu/AudioButton" > 45 45 <Property Name="Text" Value="Audio" /> 46 46 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> … … 48 48 <Event Name="Clicked" Function="SettingsMenu.SettingsAudioButton_clicked"/> 49 49 </Window> 50 <Window Type="MenuWidgets/Button" Name="orxonox/ResetSettingsButton" > 51 <Property Name="Text" Value="Reset settings" /> 52 <Property Name="Disabled" Value="True" /> 50 <Window Type="MenuWidgets/Button" Name="orxonox/SettingsMenu/MiscellaneousButton" > 51 <Property Name="Text" Value="Miscellaneous" /> 53 52 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 54 53 <Property Name="UnifiedAreaRect" Value="{{0.55,0},{0.727272,0},{0.95,0},{0.909090,0}}" /> 55 <Event Name="Clicked" Function="SettingsMenu.Settings ResetSettingsButton_clicked"/>54 <Event Name="Clicked" Function="SettingsMenu.SettingsMiscellaneousButton_clicked"/> 56 55 </Window> 57 56 </Window> 58 <Window Type="MenuWidgets/Button" Name="orxonox/Settings BackButton" >57 <Window Type="MenuWidgets/Button" Name="orxonox/SettingsMenu/SettingsBackButton" > 59 58 <Property Name="Text" Value="Back" /> 60 59 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> -
code/trunk/data/gui/schemes/OrxonoxGUIScheme.scheme
r6746 r7163 6 6 <Font Name="BlueHighway-10" Filename="bluehighway-10.font" /> 7 7 <Font Name="BlueHighway-8" Filename="bluehighway-8.font" /> 8 <Font Name="Monofur-10" Filename="Monofur-10.font" /> 8 9 </GUIScheme> -
code/trunk/data/gui/scripts/GUITools.lua
r6746 r7163 45 45 return 0.008*ratio/0.3204 46 46 end 47 48 function getStaticTextWindowHeight(window) 49 local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel()) 50 local formattedArea = lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window) 51 local frameHeight = window:getUnclippedPixelRect():getHeight() - formattedArea:getHeight() 52 local lines = window:getFont():getFormattedLineCount(window:getText(), formattedArea, CEGUI.WordWrapLeftAligned) 53 local height = lines * window:getFont():getLineSpacing() + frameHeight 54 return height 55 end -
code/trunk/data/gui/scripts/HUDSheet.lua
- Property svn:eol-style set to native
-
code/trunk/data/gui/scripts/KeyBindMenu.lua
r6748 r7163 10 10 table.insert(commandList, "fire 1 | unfire") 11 11 table.insert(commandList, "onpress fire 2") 12 table.insert(commandList, "onpress fire 3") 12 13 table.insert(commandList, "scale 1 moveFrontBack") 13 14 table.insert(commandList, "scale -1 moveFrontBack") … … 28 29 table.insert(commandList, "OverlayGroup toggleVisibility Debug") 29 30 table.insert(commandList, "OverlayGroup toggleVisibility Stats") 31 table.insert(commandList, "OrxonoxOverlay toggleVisibility QuestGUI") 32 table.insert(commandList, "OrxonoxOverlay toggleVisibility PickupInventory") 33 table.insert(commandList, "startchat") 34 table.insert(commandList, "startchat_small") 30 35 table.insert(commandList, "mouseLook") 31 36 table.insert(commandList, "pause") … … 35 40 table.insert(nameList, "Secondary Fire") 36 41 table.insert(nameList, "Fire Rocket") 42 table.insert(nameList, "Fire Alternative Rocket") 37 43 table.insert(nameList, "Accelerate") 38 44 table.insert(nameList, "Break") … … 53 59 table.insert(nameList, "Show Debug") 54 60 table.insert(nameList, "Show Stats") 61 table.insert(nameList, "Show Quests") 62 table.insert(nameList, "Show Pickups") 63 table.insert(nameList, "Show Chat") 64 table.insert(nameList, "Show small Chat") 55 65 table.insert(nameList, "Look Around") 56 66 table.insert(nameList, "Pause") … … 170 180 end 171 181 172 pane = tolua.cast(window, "CEGUI::ScrollablePane")182 local pane = tolua.cast(window, "CEGUI::ScrollablePane") 173 183 pane:setVerticalStepSize(getScrollingStepSize(window)) 174 184 end -
code/trunk/data/gui/scripts/MainMenu.lua
r6748 r7163 6 6 -- events for MainMenu 7 7 function P.QuickGameTestButton_clicked(e) 8 hideAllMenuSheets() 8 9 orxonox.execute("startGame") 9 10 end -
code/trunk/data/gui/scripts/MenuSheet.lua
- Property svn:eol-style set to native
-
code/trunk/data/gui/scripts/MultiplayerMenu.lua
r6746 r7163 4 4 5 5 function P.onLoad() 6 listbox = winMgr:getWindow("orxonox/MultiplayerLevelListbox") 7 preselect = orxonox.LevelManager:getInstance():getDefaultLevel() 6 P.multiplayerMode = "startClient" 7 end 8 9 function P.onShow() 10 if P.multiplayerMode == "startClient" then 11 local window = winMgr:getWindow("orxonox/MultiplayerJoinButton") 12 local button = tolua.cast(window,"CEGUI::RadioButton") 13 button:setSelected(true) 14 P.showServerList() 15 end 16 if P.multiplayerMode == "startServer" then 17 local window = winMgr:getWindow("orxonox/MultiplayerHostButton") 18 local button = tolua.cast(window,"CEGUI::RadioButton") 19 button:setSelected(true) 20 P.showLevelList() 21 end 22 if P.multiplayerMode == "startDedicated" then 23 local window = winMgr:getWindow("orxonox/MultiplayerDedicatedButton") 24 local button = tolua.cast(window,"CEGUI::RadioButton") 25 button:setSelected(true) 26 P.showLevelList() 27 end 28 end 29 30 function P.MultiplayerJoinButton_clicked(e) 31 P.multiplayerMode = "startClient" 32 P.showServerList() 33 end 34 35 function P.MultiplayerHostButton_clicked(e) 36 P.multiplayerMode = "startServer" 37 P.showLevelList() 38 end 39 40 function P.MultiplayerDedicatedButton_clicked(e) 41 P.multiplayerMode = "startDedicated" 42 P.showLevelList() 43 end 44 45 function P.MultiplayerStartButton_clicked(e) 46 local choice = winMgr:getWindow("orxonox/MultiplayerListbox"):getFirstSelectedItem() 47 if P.multiplayerMode == "startClient" then 48 if choice then 49 local client = orxonox.Client:getInstance() 50 local index = tolua.cast(choice, "CEGUI::ListboxItem"):getID() 51 client:setDestination( P.serverList[index][2], 55556 ) 52 else 53 return 54 end 55 else 56 if choice then 57 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") 58 else 59 return 60 end 61 end 62 orxonox.execute(P.multiplayerMode) 63 hideAllMenuSheets() 64 end 65 66 function P.MultiplayerBackButton_clicked(e) 67 hideMenuSheet(P.name) 68 end 69 70 function P.showLevelList() 71 local listbox = winMgr:getWindow("orxonox/MultiplayerListbox") 72 CEGUI.toListbox(listbox):resetList() 73 local preselect = orxonox.LevelManager:getInstance():getDefaultLevel() 8 74 orxonox.LevelManager:getInstance():compileAvailableLevelList() 9 75 local levelList = {} … … 19 85 end 20 86 table.sort(levelList) 87 index = 1 21 88 for k,v in pairs(levelList) do 22 item = CEGUI.createListboxTextItem(v)89 local item = CEGUI.createListboxTextItem(v) 23 90 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 91 item:setID(index) 92 index = index + 1 24 93 CEGUI.toListbox(listbox):addItem(item) 25 94 if v .. ".oxw" == preselect then … … 27 96 end 28 97 end 29 local multiplayerMode = "startClient"30 if multiplayerMode == "startClient" then31 window = winMgr:getWindow("orxonox/MultiplayerJoinButton")32 button = tolua.cast(window,"CEGUI::RadioButton")33 button:setSelected(true)34 98 end 35 if multiplayerMode == "startServer" then 36 window = winMgr:getWindow("orxonox/MultiplayerHostButton") 37 button = tolua.cast(window,"CEGUI::RadioButton") 38 button:setSelected(true) 99 100 function P.showServerList() 101 local listbox = winMgr:getWindow("orxonox/MultiplayerListbox") 102 CEGUI.toListbox(listbox):resetList() 103 local discovery = orxonox.LANDiscovery:getInstance() 104 discovery:discover() 105 P.serverList = {} 106 local index = 0 107 local servername = "" 108 local serverip = "" 109 while true do 110 servername = discovery:getServerListItemName(index) 111 if servername == "" then 112 break 113 end 114 serverip = discovery:getServerListItemIP(index) 115 if serverip == "" then 116 break 117 end 118 table.insert(P.serverList, {servername, serverip}) 119 index = index + 1 39 120 end 40 if multiplayerMode == "startDedicated" then 41 window = winMgr:getWindow("orxonox/MultiplayerDedicatedButton") 42 button = tolua.cast(window,"CEGUI::RadioButton") 43 button:setSelected(true) 121 index = 1 122 for k,v in pairs(P.serverList) do 123 local item = CEGUI.createListboxTextItem( v[1] .. ": " .. v[2] ) 124 item:setID(index) 125 index = index + 1 126 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 127 CEGUI.toListbox(listbox):addItem(item) 44 128 end 45 end46 47 function P.MultiplayerJoinButton_clicked(e)48 multiplayerMode = "startClient"49 end50 51 function P.MultiplayerHostButton_clicked(e)52 multiplayerMode = "startServer"53 end54 55 function P.MultiplayerDedicatedButton_clicked(e)56 multiplayerMode = "startDedicated"57 end58 59 function P.MultiplayerStartButton_clicked(e)60 local choice = winMgr:getWindow("orxonox/MultiplayerLevelListbox"):getFirstSelectedItem()61 if choice then62 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")63 orxonox.execute(multiplayerMode)64 hideAllMenuSheets()65 end66 end67 68 function P.MultiplayerBackButton_clicked(e)69 hideMenuSheet(P.name)70 129 end 71 130 -
code/trunk/data/gui/scripts/PickupInventory.lua
r6906 r7163 3 3 local P = createMenuSheet("PickupInventory") 4 4 5 P.carrierList = {}6 5 P.wrapper = nil 7 6 P.detailsWindows = {} 7 P.detailPickups = {} 8 P.pickupsList = {} 9 10 P.showing = false 11 12 -- Design parameters 13 P.imageHeight = 50 14 P.detailImageSize = 100 15 P.textHeight = 30 16 P.buttonWidth = 85 8 17 9 18 function P.onLoad() 10 carrierList = {} 19 P.wrapper = nil 20 P.detailsWindows = {} 21 P.detailPickups = {} 22 P.pickupsList = {} 11 23 end 12 24 13 25 function P.onShow() 14 26 P.createInventory() 27 P.showing = true 15 28 end 16 29 17 30 function P.onHide() 18 P.cleanup() 31 P.showing = false 32 P.cleanup(true) 19 33 end 20 34 21 35 function P.update() 22 P.cleanup() 23 36 if P.showing == false then 37 return 38 end 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 if pickup:isUsable() == false then 57 useButton:setEnabled(false) 58 end 59 else 60 useButton:setText("use") 61 orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUnuseDetailButton_clicked") 62 if pickup:isUnusable() == false then 63 useButton:setEnabled(false) 64 end 65 end 66 67 if pickup:isPickedUp() == false then 68 useButton:setEnabled(false) 69 dropButton:setEnabled(false) 70 P.detailPickups[k] = nil 71 end 72 end 73 end 74 end 75 end 76 77 -- Update main inventory. 78 P.cleanup(false) 24 79 P.createInventory() 80 -- TODO: Recover scrolling position 81 25 82 end 26 83 27 84 function P.createInventory() 28 85 local pickupManager = orxonox.PickupManager:getInstance() 29 local carrier = pickupManager:getPawn()30 86 31 87 local root = winMgr:getWindow("orxonox/PickupInventory/Inventory") … … 34 90 root:addChildWindow(P.wrapper) 35 91 36 P.carrierList = {} 37 38 --Design parameters: 39 local space = 15 40 41 P.getCarrierList(carrier) 92 P.pickupsList = {} 93 94 local numPickups = pickupManager:getNumPickups() 95 local counter = 1 42 96 local offset = 0 43 for k,v in pairs(P.carrierList) do 44 local window = P.createCarrierBox(v,k) 97 while counter <= numPickups do 98 local pickup = pickupManager:popPickup() 99 table.insert(P.pickupsList, pickup) 100 local window = P.createPickupEntry(counter, pickup) 45 101 window:setYPosition(CEGUI.UDim(0,offset)) 46 offset = offset + window:getHeight():asAbsolute(1) + space102 offset = offset + window:getHeight():asAbsolute(1) 47 103 P.wrapper:addChildWindow(window) 48 end 49 end 50 51 function P.getCarrierList(carrier) 52 53 -- TODO: Test for nil or 0? 54 if carrier == nil then 55 return 56 end 57 58 table.insert(P.carrierList, carrier) 59 60 local numCarriers = orxonox.PickupManager:getInstance():getNumCarrierChildren(carrier) 61 if numCarriers == 0 then 62 return 63 end 64 65 for i=0,numCarriers-1,1 do 66 local child = orxonox.PickupManager:getInstance():getCarrierChild(i, carrier) 67 if child ~= nil then 68 P.getCarrierList(child) 69 end 70 end 71 end 72 73 function P.createCarrierBox(carrier, index) 74 75 local name = "orxonox/PickupInventory/Carrier" .. index 76 77 --Design parameters: 78 local imageHeight = 50 79 local textHeight = 30 80 local horizontalOffset = 20 81 local buttonWidth = 85 82 83 local offset = 0 84 85 local box = winMgr:createWindow("MenuWidgets/ScrollablePane", name .. "/Box") 86 box:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horizontalOffset), CEGUI.UDim(0, 0))) 87 box:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -horizontalOffset), CEGUI.UDim(1, 0))) 88 89 local numPickups = orxonox.PickupManager:getInstance():getNumPickups(carrier) 90 for i=0,numPickups-1,1 do 91 local pickup = orxonox.PickupManager:getInstance():getPickupRepresentation(i, carrier) 92 93 local item = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Box/Pickup" .. i) 94 item:setSize(CEGUI.UVector2(CEGUI.UDim(1, -horizontalOffset), CEGUI.UDim(0, imageHeight))) 95 item:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horizontalOffset), CEGUI.UDim(0, offset))) 96 box:addChildWindow(item) 97 offset = offset + imageHeight+5 98 99 local image = winMgr:createWindow("MenuWidgets/StaticImage", name .. "/Box/Pickup" .. i .. "/Image") 100 image:setProperty("Image", "set:PickupInventory image:" .. pickup:getInventoryRepresentation()) 101 image:setProperty("BackgroundEnabled", "set:False") 102 image:setProperty("FrameEnabled", "set:True") 103 image:setSize(CEGUI.UVector2(CEGUI.UDim(0, imageHeight), CEGUI.UDim(0, imageHeight))) 104 item:addChildWindow(image) 105 106 local title = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Box/Pickup" .. i .. "/Title") 107 title:setPosition(CEGUI.UVector2(CEGUI.UDim(0, imageHeight+5), CEGUI.UDim(0, (imageHeight-textHeight)/2))) 108 title:setSize(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0, textHeight))) 109 title:setText(pickup:getPickupName()) 110 title:setProperty("FrameEnabled", "set:False") 111 item:addChildWindow(title) 112 113 local useButton = winMgr:createWindow("MenuWidgets/Button", name .. "/Box/Pickup" .. i .. "/UseButton") 114 useButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, imageHeight+10),CEGUI.UDim(0, (imageHeight-textHeight)/2))) 115 useButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0, textHeight))) 104 counter = counter + 1 105 end 106 107 end 108 109 function P.createPickupEntry(index, pickup) 110 local representation = orxonox.PickupManager:getInstance():getPickupRepresentation(pickup) 111 112 local name = "orxonox/PickupInventory/Box/Pickup" .. index 113 114 local item = winMgr:createWindow("MenuWidgets/StaticText", name) 115 item:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0), CEGUI.UDim(0, P.imageHeight))) 116 item:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, 0))) 117 118 local image = winMgr:createWindow("MenuWidgets/StaticImage", name .. "/Image") 119 image:setProperty("Image", "set:PickupInventory image:" .. representation:getInventoryRepresentation()) 120 image:setProperty("BackgroundEnabled", "set:False") 121 image:setProperty("FrameEnabled", "set:True") 122 image:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.imageHeight), CEGUI.UDim(0, P.imageHeight))) 123 item:addChildWindow(image) 124 125 local title = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Title") 126 title:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.imageHeight+5), CEGUI.UDim(0, (P.imageHeight-P.textHeight)/2))) 127 title:setSize(CEGUI.UVector2(CEGUI.UDim(0.3, 0), CEGUI.UDim(0, P.textHeight))) 128 title:setText(representation:getPickupName()) 129 title:setProperty("FrameEnabled", "set:False") 130 item:addChildWindow(title) 131 132 local useButton = winMgr:createWindow("MenuWidgets/Button", name .. "/UseButton") 133 useButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.3, P.imageHeight+10),CEGUI.UDim(0, (P.imageHeight-P.textHeight)/2))) 134 useButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.buttonWidth), CEGUI.UDim(0, P.textHeight))) 135 if pickup:isUsed() == false then 116 136 useButton:setText("use") 117 137 orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUseButton_clicked") 118 item:addChildWindow(useButton) 119 120 local dropButton = winMgr:createWindow("MenuWidgets/Button", name .. "/Box/Pickup" .. i .. "/DropButton") 121 dropButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, imageHeight+15+buttonWidth),CEGUI.UDim(0, (imageHeight-textHeight)/2))) 122 dropButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0, textHeight))) 123 dropButton:setText("drop") 124 orxonox.GUIManager:subscribeEventHelper(dropButton, "Clicked", P.name .. ".InventoryDropButton_clicked") 125 item:addChildWindow(dropButton) 126 127 local detailsButton = winMgr:createWindow("MenuWidgets/Button", name .. "/Box/Pickup" .. i .. "/DetailsButton") 128 detailsButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, imageHeight+20+2*buttonWidth),CEGUI.UDim(0, (imageHeight-textHeight)/2))) 129 detailsButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0, textHeight))) 130 detailsButton:setText("details") 131 orxonox.GUIManager:subscribeEventHelper(detailsButton, "Clicked", P.name .. ".InventoryDetailsButton_clicked") 132 item:addChildWindow(detailsButton) 133 end 134 135 box:setHeight(CEGUI.UDim(0,offset)) 136 137 return box 138 end 139 140 function P.cleanup() 138 if pickup:isUsable() == false then 139 useButton:setEnabled(false) 140 end 141 else 142 useButton:setText("unuse") 143 orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUnuseButton_clicked") 144 if pickup:isUnusable() == false then 145 useButton:setEnabled(false) 146 end 147 end 148 item:addChildWindow(useButton) 149 150 local dropButton = winMgr:createWindow("MenuWidgets/Button", name .. "/DropButton") 151 dropButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.3, P.imageHeight+15+P.buttonWidth),CEGUI.UDim(0, (P.imageHeight-P.textHeight)/2))) 152 dropButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.buttonWidth), CEGUI.UDim(0, P.textHeight))) 153 dropButton:setText("drop") 154 orxonox.GUIManager:subscribeEventHelper(dropButton, "Clicked", P.name .. ".InventoryDropButton_clicked") 155 item:addChildWindow(dropButton) 156 157 local detailsButton = winMgr:createWindow("MenuWidgets/Button", name .. "/DetailsButton") 158 detailsButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.3, P.imageHeight+20+2*P.buttonWidth),CEGUI.UDim(0, (P.imageHeight-P.textHeight)/2))) 159 detailsButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.buttonWidth), CEGUI.UDim(0, P.textHeight))) 160 detailsButton:setText("details") 161 orxonox.GUIManager:subscribeEventHelper(detailsButton, "Clicked", P.name .. ".InventoryDetailsButton_clicked") 162 item:addChildWindow(detailsButton) 163 164 return item 165 end 166 167 function P.cleanup(destroyDetails) 141 168 if P.wrapper ~= nil then 142 169 winMgr:destroyWindow(P.wrapper) … … 144 171 145 172 --Destroy details windows. 173 if destroyDetails == false then 174 return 175 end 146 176 for k,v in pairs(P.detailsWindows) do 147 177 if v ~= nil then … … 151 181 end 152 182 153 function P.windowTo CarrierHelper(e)183 function P.windowToPickupHelper(e) 154 184 local we = CEGUI.toWindowEventArgs(e) 155 185 local name = we.window:getName() 156 186 157 187 local match = string.gmatch(name, "%d+") 158 local carrierNr = tonumber(match()) 159 local pickupNr = tonumber(match()) 160 161 local arguments = {} 162 arguments[1] = carrierNr 163 arguments[2] = pickupNr 164 return arguments 165 end 166 167 function P.createDetailsWindow(pickupIndex, carrierIndex) 168 local carrier = P.carrierList[carrierIndex] 169 local pickup = orxonox.PickupManager:getInstance():getPickupRepresentation(pickupIndex, carrier) 170 171 local headerOffset = 35 172 --Design parameters 173 local titleHeight = 30 174 local imageSize = 100 175 local buttonWidth = 85 176 177 local name = "orxonox/PickupInventory/Carrier" .. carrierIndex .. "/Pickup" .. pickupIndex .. "/Details" .. P.getNewDetailNumber() 188 local pickupIndex = tonumber(match()) 189 190 return pickupIndex 191 end 192 193 function P.createDetailsWindow(pickupIndex) 194 local pickup = P.pickupsList[pickupIndex] 195 local representation = orxonox.PickupManager:getInstance():getPickupRepresentation(pickup) 196 197 local index = P.getNewDetailNumber() 198 local name = "orxonox/PickupInventory/Details" .. index 178 199 179 200 local window = winMgr:createWindow("MenuWidgets/FrameWindow", name) … … 190 211 191 212 local title = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Title") 192 title:setText( pickup:getPickupName())193 title:setHeight(CEGUI.UDim(0, titleHeight))213 title:setText(representation:getPickupName()) 214 title:setHeight(CEGUI.UDim(0, P.textHeight)) 194 215 title:setProperty("FrameEnabled", "set:False") 195 216 title:setProperty("BackgroundEnabled", "set:False") … … 197 218 198 219 local image = winMgr:createWindow("MenuWidgets/StaticImage", name .. "/Image") 199 image:setProperty("Image", "set:PickupInventory image:" .. pickup:getInventoryRepresentation())220 image:setProperty("Image", "set:PickupInventory image:" .. representation:getInventoryRepresentation()) 200 221 image:setProperty("BackgroundEnabled", "set:False") 201 222 image:setProperty("FrameEnabled", "set:True") 202 image:setSize(CEGUI.UVector2(CEGUI.UDim(0, imageSize), CEGUI.UDim(0, imageSize)))203 image:setYPosition(CEGUI.UDim(0, titleHeight + 5))223 image:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.detailImageSize), CEGUI.UDim(0, P.detailImageSize))) 224 image:setYPosition(CEGUI.UDim(0, P.textHeight + 5)) 204 225 wrapper:addChildWindow(image) 205 226 206 227 local box = winMgr:createWindow("MenuWidgets/ScrollablePane", name .. "/Description") 207 box:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -1*( imageSize + 10)),CEGUI.UDim(1, -(titleHeight + 5 + titleHeight + 20))))208 box:setPosition(CEGUI.UVector2(CEGUI.UDim(0, imageSize + 10),CEGUI.UDim(0, titleHeight + 5)))209 local description = winMgr:createWindow(" TaharezLook/StaticText", name .. "/Description/Text")210 description:setText( pickup:getPickupDescription())228 box:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -1*(P.detailImageSize + 10)),CEGUI.UDim(1, -(P.textHeight + 5 + P.textHeight + 20)))) 229 box:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.detailImageSize + 10),CEGUI.UDim(0, P.textHeight + 5))) 230 local description = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Description/Text") 231 description:setText(representation:getPickupDescription()) 211 232 description:setProperty("HorzFormatting", "WordWrapLeftAligned") 212 233 description:setProperty("VertFormatting", "TopAligned") 213 234 box:addChildWindow(description) 214 235 wrapper:addChildWindow(box) 215 236 216 237 local useButton = winMgr:createWindow("MenuWidgets/Button", name .. "/UseButton") 217 useButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0, imageSize+10),CEGUI.UDim(1, -40))) 218 useButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0, titleHeight))) 219 useButton:setText("use") 220 orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUseButton_clicked") 238 useButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.detailImageSize+10),CEGUI.UDim(1, -40))) 239 useButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.buttonWidth), CEGUI.UDim(0, P.textHeight))) 240 if pickup:isUsed() == false then 241 useButton:setText("use") 242 orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUseDetailButton_clicked") 243 if pickup:isUsable() == false then 244 useButton:setEnabled(false) 245 end 246 else 247 useButton:setText("unuse") 248 orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUnuseDetailButton_clicked") 249 if pickup:isUnusable() == false then 250 useButton:setEnabled(false) 251 end 252 end 221 253 wrapper:addChildWindow(useButton) 222 254 223 255 local dropButton = winMgr:createWindow("MenuWidgets/Button", name .. "/DropButton") 224 dropButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0, imageSize+10+buttonWidth+10),CEGUI.UDim(1, -40)))225 dropButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0, titleHeight)))256 dropButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.detailImageSize+10+P.buttonWidth+10),CEGUI.UDim(1, -40))) 257 dropButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.buttonWidth), CEGUI.UDim(0, P.textHeight))) 226 258 dropButton:setText("drop") 227 orxonox.GUIManager:subscribeEventHelper(dropButton, "Clicked", P.name .. ".InventoryDrop Button_clicked")259 orxonox.GUIManager:subscribeEventHelper(dropButton, "Clicked", P.name .. ".InventoryDropDetailButton_clicked") 228 260 wrapper:addChildWindow(dropButton) 229 230 table.insert(P.detailsWindows, window) 261 262 P.detailsWindows[index] = window 263 P.detailPickups[index] = pickup 231 264 232 265 end … … 239 272 end 240 273 end 241 return number 274 return number+1 242 275 end 243 276 244 277 function P.InventoryUseButton_clicked(e) 245 local arguments = P.windowToCarrierHelper(e) 246 orxonox.PickupManager:getInstance():usePickup(arguments[2], P.carrierList[arguments[1]], true) 278 local pickupIndex = P.windowToPickupHelper(e) 279 orxonox.PickupManager:getInstance():usePickup(P.pickupsList[pickupIndex], true) 280 end 281 282 function P.InventoryUnuseButton_clicked(e) 283 local pickupIndex = P.windowToPickupHelper(e) 284 orxonox.PickupManager:getInstance():usePickup(P.pickupsList[pickupIndex], false) 247 285 end 248 286 249 287 function P.InventoryDropButton_clicked(e) 250 local arguments = P.windowToCarrierHelper(e)251 orxonox.PickupManager:getInstance():dropPickup( arguments[2], P.carrierList[arguments[1]])288 local pickupIndex = P.windowToPickupHelper(e) 289 orxonox.PickupManager:getInstance():dropPickup(P.pickupsList[pickupIndex]) 252 290 end 253 291 254 292 function P.InventoryDetailsButton_clicked(e) 255 local arguments = P.windowToCarrierHelper(e) 256 P.createDetailsWindow(arguments[2], arguments[1]) 293 local pickupIndex = P.windowToPickupHelper(e) 294 P.createDetailsWindow(pickupIndex) 295 end 296 297 function P.InventoryUseDetailButton_clicked(e) 298 local pickupIndex = P.windowToPickupHelper(e) 299 orxonox.PickupManager:getInstance():usePickup(P.detailPickups[pickupIndex], true) 300 end 301 302 function P.InventoryUnuseDetailButton_clicked(e) 303 local pickupIndex = P.windowToPickupHelper(e) 304 orxonox.PickupManager:getInstance():usePickup(P.detailPickups[pickupIndex], false) 305 end 306 307 function P.InventoryDropDetailButton_clicked(e) 308 local pickupIndex = P.windowToPickupHelper(e) 309 orxonox.PickupManager:getInstance():dropPickup(P.detailPickups[pickupIndex]) 257 310 end 258 311 … … 262 315 local name = we.window:getName() 263 316 local match = string.gmatch(name, "%d+") 264 local carrierNr = tonumber(match())265 local pickupNr = tonumber(match())266 317 local detailNr = tonumber(match()) 267 318 268 local window = P.detailsWindows[detailNr +1]319 local window = P.detailsWindows[detailNr] 269 320 winMgr:destroyWindow(window) 270 P.detailsWindows[detailNr+1] = nil 321 P.detailsWindows[detailNr] = nil 322 P.detailPickups[detailNr] = nil 271 323 end 272 324 -
code/trunk/data/gui/scripts/QuestGUI.lua
r6746 r7163 3 3 local P = createMenuSheet("QuestGUI") 4 4 5 function P.show() 6 P.window:show() -- TODO: Do this through parent... 7 P.visible = true 8 5 P.rootWindow = nil 6 P.detailsWindows = {} 7 P.quests = {} 8 P.hints = {} 9 P.player = nil 10 11 -- design parameters 12 P.indentWidth = 20 13 P.scrollbarWidth = 13 14 P.buttonHeight = 30 15 P.titleHeight = 26 16 P.borderWidth = 5 17 18 function P.onShow() 19 20 local questsList = winMgr:getWindow("orxonox/QuestGUI/QuestsList") 21 22 P.player = orxonox.GUIManager:getInstance():getPlayer(P.name) 23 P.rootWindow = P.createQuestGUI(); 24 25 questsList:addChildWindow(P.rootWindow) 26 end 27 28 function P.onHide() 29 P.cleanup() 30 end 31 32 function P.createQuestGUI() 9 33 local questManager = orxonox.QuestManager:getInstance() 10 34 11 local questsList = winMgr:getWindow("orxonox/QuestGUI/QuestsList") 12 13 local window = questManager:getQuestGUI(P.name) 14 15 questsList:addChildWindow(window) 16 35 local depth = 0 36 local index = 0 37 38 local questWindow = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/QuestGUI/Quests") 39 questWindow:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0),CEGUI.UDim(1, 0))) 40 41 -- Iterate through all parent-quests. 42 local numParentQuests = orxonox.QuestManager:getInstance():getNumParentQuests(P.player) 43 local i = 0 44 while i <= numParentQuests-1 do 45 local quest = orxonox.QuestManager:getInstance():getParentQuest(P.player, i) 46 index = P.createQuestNodes(questWindow, quest, depth, index) 47 i = i+1 48 end 49 50 return questWindow 51 end 52 53 function P.createQuestNodes(root, parent, depth, index) 54 local number = table.getn(P.quests)+1 55 local name = "orxonox/QuestGUI/Quests/" .. number 56 local node = winMgr:createWindow("MenuWidgets/TabButton", name) 57 node:setText(orxonox.QuestManager:getInstance():getDescription(parent):getTitle()) 58 node:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.indentWidth*depth), CEGUI.UDim(0, P.buttonHeight*index))) 59 node:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.indentWidth*depth-P.scrollbarWidth), CEGUI.UDim(0, P.buttonHeight))) 60 orxonox.GUIManager:subscribeEventHelper(node, "Clicked", P.name .. ".openDetails_clicked") 61 root:addChildWindow(node) 62 63 table.insert(P.quests, parent) 64 65 index = index+1 66 67 -- Iterate through all sub-quests. 68 local numQuests = orxonox.QuestManager:getInstance():getNumSubQuests(parent, P.player) 69 local i = 0 70 while i <= numQuests-1 do 71 local quest = orxonox.QuestManager:getInstance():getSubQuest(parent, P.player, i) 72 index = P.createQuestNodes(root, quest, depth+1, index) 73 i = i+1 74 end 75 76 return index; 77 end 78 79 function P.cleanup() 80 winMgr:destroyWindow(P.rootWindow) 81 for k,v in pairs(P.detailsWindows) do 82 if v ~= nil then 83 winMgr:destroyWindow(v) 84 P.detailsWindows[k] = nil 85 end 86 end 87 P.detailsWindows = {} 88 89 P.quests = {} 90 P.hints = {} 91 P.player = nil 92 93 winMgr:destroyWindow(P.rootWindow) 94 P.rootWindow = nil 95 end 96 97 function P.openDetails_clicked(e) 98 --Get some numbers from the window 99 local we = CEGUI.toWindowEventArgs(e) 100 local name = we.window:getName() 101 local match = string.gmatch(name, "%d+") 102 local questNr = tonumber(match()) 103 104 name = name .. "/Details" .. P.getNewDetailNumber() 105 quest = P.quests[questNr] 106 107 local details = winMgr:createWindow("MenuWidgets/FrameWindow", name) 108 details:setSize(CEGUI.UVector2(CEGUI.UDim(0.7, 0), CEGUI.UDim(0.7, 0))) 109 details:setPosition(CEGUI.UVector2(CEGUI.UDim(0.1, 0), CEGUI.UDim(0.1, 0))) 110 details:setText(orxonox.QuestManager:getInstance():getDescription(quest):getTitle()) 111 details:setProperty("Alpha", 1.0) 112 details:setProperty("InheritsAlpha", "setFalse") 113 orxonox.GUIManager:subscribeEventHelper(details, "CloseClicked", P.name .. ".closeDetails_clicked") 114 115 table.insert(P.detailsWindows, details) 116 117 name = name .. "/Scrollable" 118 local window = winMgr:createWindow("MenuWidgets/ScrollablePane", name) 119 window:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -2*P.borderWidth),CEGUI.UDim(1.0, -P.titleHeight))) 120 window:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderWidth), CEGUI.UDim(0, P.titleHeight))) 121 details:addChildWindow(window) 122 123 local offset = 0 124 125 local status = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Status") 126 window:addChildWindow(status) 127 status:setProperty("HorzFormatting", "WordWrapLeftAligned") 128 status:setProperty("VertFormatting", "TopAligned") 129 if quest:isActive(P.player) then 130 status:setText("This quest is active.") 131 elseif quest:isCompleted(P.player) then 132 status:setText("This quest was completed.") 133 elseif quest:isFailed(P.player) then 134 status:setText("This quest was failed.") 135 end 136 status:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset))) 137 status:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0))) 138 local height = getStaticTextWindowHeight(status) 139 status:setHeight(CEGUI.UDim(0, height)) 140 offset = offset + height 141 142 local descriptionTitle = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Description/Title"); 143 window:addChildWindow(descriptionTitle) 144 descriptionTitle:setProperty("HorzFormatting", "HorzCentred") 145 descriptionTitle:setProperty("VertFormatting", "TopAligned") 146 descriptionTitle:setText("Description:") 147 descriptionTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset))) 148 descriptionTitle:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0))) 149 height = getStaticTextWindowHeight(descriptionTitle) 150 descriptionTitle:setHeight(CEGUI.UDim(0, height)) 151 offset = offset + height 152 153 local description = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Description"); 154 window:addChildWindow(description) 155 description:setProperty("HorzFormatting", "WordWrapLeftAligned") 156 description:setProperty("VertFormatting", "TopAligned") 157 description:setText(orxonox.QuestManager:getInstance():getDescription(quest):getDescription()) 158 description:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset))) 159 description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0))) 160 height = getStaticTextWindowHeight(description) 161 description:setHeight(CEGUI.UDim(0, height)) 162 offset = offset + height 163 164 -- Display the hints of this quest 165 local numHints = orxonox.QuestManager:getInstance():getNumHints(quest, P.player) 166 if numHints > 0 then 167 local hintsTitle = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Hints/Title"); 168 window:addChildWindow(hintsTitle) 169 hintsTitle:setProperty("HorzFormatting", "HorzCentred") 170 hintsTitle:setProperty("VertFormatting", "TopAligned") 171 hintsTitle:setText("Hints:") 172 hintsTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset))) 173 hintsTitle:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0))) 174 height = getStaticTextWindowHeight(hintsTitle) 175 hintsTitle:setHeight(CEGUI.UDim(0, height)) 176 offset = offset + height 177 end 178 local i = 0 179 while i <= numHints-1 do 180 local hint = orxonox.QuestManager:getInstance():getHints(quest, P.player, i) 181 table.insert(P.hints, hint) 182 local number = table.getn(P.hints) 183 local node = winMgr:createWindow("MenuWidgets/TabButton", name .. "/Hints" .. number) 184 node:setText(orxonox.QuestManager:getInstance():getDescription(hint):getTitle()) 185 node:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset))) 186 node:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.scrollbarWidth), CEGUI.UDim(0, P.buttonHeight))) 187 window:addChildWindow(node) 188 offset = offset + P.buttonHeight 189 190 orxonox.GUIManager:subscribeEventHelper(node, "Clicked", P.name .. ".openHintDetails_clicked") 191 i = i+1 192 end 193 194 local window = winMgr:getWindow("orxonox/QuestGUI/Background") 195 window:addChildWindow(details) 196 end 197 198 function P.getNewDetailNumber() 199 local number = table.getn(P.detailsWindows) 200 for k,v in pairs(P.detailsWindows) do 201 if v == nil then 202 number = k-1 203 end 204 end 205 return number+1 206 end 207 208 function P.closeDetails_clicked(e) 209 local we = CEGUI.toWindowEventArgs(e) 210 local name = we.window:getName() 211 local match = string.gmatch(name, "%d+") 212 match() 213 local detailsNr = tonumber(match()) 214 215 winMgr:destroyWindow(P.detailsWindows[detailsNr]) 216 P.detailsWindows[detailsNr] = nil 217 end 218 219 function P.openHintDetails_clicked(e) 220 --Get some numbers from the window 221 local we = CEGUI.toWindowEventArgs(e) 222 local name = we.window:getName() 223 local match = string.gmatch(name, "%d+") 224 match() 225 match() 226 local hintNr = tonumber(match()) 227 228 name = name .. "/Details" .. P.getNewDetailNumber() 229 hint = P.hints[hintNr] 230 231 local details = winMgr:createWindow("MenuWidgets/FrameWindow", name) 232 details:setSize(CEGUI.UVector2(CEGUI.UDim(0.7, 0), CEGUI.UDim(0.7, 0))) 233 details:setPosition(CEGUI.UVector2(CEGUI.UDim(0.1, 0), CEGUI.UDim(0.1, 0))) 234 details:setText(orxonox.QuestManager:getInstance():getDescription(hint):getTitle()) 235 details:setProperty("Alpha", 1.0) 236 details:setProperty("InheritsAlpha", "setFalse") 237 orxonox.GUIManager:subscribeEventHelper(details, "CloseClicked", P.name .. ".closeHintDetails_clicked") 238 239 table.insert(P.detailsWindows, details) 240 241 name = name .. "/Scrollable" 242 local window = winMgr:createWindow("MenuWidgets/ScrollablePane", name) 243 window:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -2*P.borderWidth),CEGUI.UDim(1.0, -P.titleHeight))) 244 window:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderWidth), CEGUI.UDim(0, P.titleHeight))) 245 details:addChildWindow(window) 246 247 local offset = 0 248 249 local descriptionTitle = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Description/Title"); 250 window:addChildWindow(descriptionTitle) 251 descriptionTitle:setProperty("HorzFormatting", "HorzCentred") 252 descriptionTitle:setProperty("VertFormatting", "TopAligned") 253 descriptionTitle:setText("Description:") 254 descriptionTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset))) 255 descriptionTitle:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0))) 256 height = getStaticTextWindowHeight(descriptionTitle) 257 descriptionTitle:setHeight(CEGUI.UDim(0, height)) 258 offset = offset + height 259 260 local description = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Description"); 261 window:addChildWindow(description) 262 description:setProperty("HorzFormatting", "WordWrapLeftAligned") 263 description:setProperty("VertFormatting", "TopAligned") 264 description:setText(orxonox.QuestManager:getInstance():getDescription(hint):getDescription()) 265 description:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset))) 266 description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0))) 267 height = getStaticTextWindowHeight(description) 268 description:setHeight(CEGUI.UDim(0, height)) 269 270 local window = winMgr:getWindow("orxonox/QuestGUI/Background") 271 window:addChildWindow(details) 272 end 273 274 function P.closeHintDetails_clicked(e) 275 local we = CEGUI.toWindowEventArgs(e) 276 local name = we.window:getName() 277 local match = string.gmatch(name, "%d+") 278 match() 279 match() 280 match() 281 local detailsNr = tonumber(match()) 282 283 winMgr:destroyWindow(P.detailsWindows[detailsNr]) 284 P.detailsWindows[detailsNr] = nil 17 285 end 18 286 -
code/trunk/data/gui/scripts/SettingsMenu.lua
r6748 r7163 24 24 end 25 25 26 function P.SettingsResetSettingsButton_clicked(e) 27 -- reset settings 28 logMessage(0, "event: reset settings") 26 function P.SettingsMiscellaneousButton_clicked(e) 27 showMenuSheet("MiscConfigMenu", true) 29 28 end 30 29 -
code/trunk/data/gui/scripts/SingleplayerMenu.lua
r6754 r7163 27 27 end 28 28 end 29 29 30 end 30 31
Note: See TracChangeset
for help on using the changeset viewer.