- Timestamp:
- Feb 24, 2018, 3:09:05 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cegui0.8_ogre1.9/data/gui/scripts/QuestGUI.lua
r11795 r11806 40 40 -- selectQuest is a pointer to a quest that should be selected, if it is nil the first quest is selected. 41 41 function P.loadQuestsList(selectQuest) 42 local list = CEGUI.toListbox( winMgr:getWindow("orxonox/QuestGUI/QuestsList"))42 local list = CEGUI.toListbox(P.window:getChild("MainWindow/LeftPanel/QuestsList")) 43 43 P.clearQuestList() 44 44 … … 124 124 -- Load title and description 125 125 local description = P.questManager:getDescription(quest) 126 local titleWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Title")126 local titleWindow = P.window:getChild("MainWindow/Title") 127 127 titleWindow:setText(description:getTitle()) 128 local descriptionWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Description")128 local descriptionWindow = P.window:getChild("MainWindow/RightPanel/ScrollWrapper/Wrapper/Description") 129 129 descriptionWindow:setText(description:getDescription()) 130 descriptionWindow:setSize(CEGUI.U Vector2(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(1, 0)))130 descriptionWindow:setSize(CEGUI.USize(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(1, 0))) 131 131 descriptionWindow:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderSize), CEGUI.UDim(0, P.borderSize))) 132 132 local height = getStaticTextWindowHeight(descriptionWindow) … … 135 135 136 136 -- Load subquests 137 local list = CEGUI.toListbox( winMgr:getWindow("orxonox/QuestGUI/Quest/SubquestsList"))137 local list = CEGUI.toListbox(P.window:getChild("MainWindow/RightPanel/ScrollWrapper/Wrapper/SubquestsList")) 138 138 local numQuests = P.questManager:getNumSubQuests(quest, P.player) 139 139 local i = 0 … … 150 150 height = height+P.frameHeigth 151 151 end 152 list:setSize(CEGUI.U Vector2(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(0, height)))152 list:setSize(CEGUI.USize(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(0, height))) 153 153 list:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderSize), CEGUI.UDim(0, offset))) 154 154 offset = offset + height + P.borderSize 155 155 156 156 -- Load hints 157 local hintsWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Hints")157 local hintsWindow = P.window:getChild("MainWindow/RightPanel/ScrollWrapper/Wrapper/Hints") 158 158 hintsWindow:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderSize), CEGUI.UDim(0, offset))) 159 hintsWindow:setSize(CEGUI.U Vector2(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(0, 0)))159 hintsWindow:setSize(CEGUI.USize(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(0, 0))) 160 160 height = P.titleHeight 161 161 local numHints = P.questManager:getNumHints(quest, P.player) … … 173 173 174 174 -- Set the size of the wrapper 175 local window = winMgr:getWindow("orxonox/QuestGUI/Quest/Wrapper")176 window:setSize(CEGUI.U Vector2(CEGUI.UDim(1, -P.borderSize-P.scrollbarWidth), CEGUI.UDim(0,offset+P.borderSize)))175 local window = P.window:getChild("MainWindow/RightPanel/ScrollWrapper/Wrapper") 176 window:setSize(CEGUI.USize(CEGUI.UDim(1, -P.borderSize-P.scrollbarWidth), CEGUI.UDim(0,offset+P.borderSize))) 177 177 end 178 178 end … … 181 181 function P.clearQuest() 182 182 -- clear title 183 local titleWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Title")183 local titleWindow = P.window:getChild("MainWindow/Title") 184 184 titleWindow:setText("no Quests") 185 185 186 186 -- clear description 187 local descriptionWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Description")187 local descriptionWindow = P.window:getChild("MainWindow/RightPanel/ScrollWrapper/Wrapper/Description") 188 188 descriptionWindow:setText("There is currently no quest that can be displayed.") 189 189 190 190 -- clear list fo subquests 191 local list = CEGUI.toListbox( winMgr:getWindow("orxonox/QuestGUI/Quest/SubquestsList"))191 local list = CEGUI.toListbox(P.window:getChild("MainWindow/RightPanel/ScrollWrapper/Wrapper/SubquestsList")) 192 192 list:resetList() 193 193 list:setHeight(CEGUI.UDim(0, 0)) … … 195 195 196 196 -- clear hints 197 local hints = winMgr:getWindow("orxonox/QuestGUI/Quest/Hints")197 local hints = P.window:getChild("MainWindow/RightPanel/ScrollWrapper/Wrapper/Hints") 198 198 local numChildren = hints:getChildCount()-2 -- TODO: HACK 199 199 local i = 0 200 200 while i < numChildren do 201 local hint = hints:getChild(" orxonox/QuestGUI/Quest/Hints/" .. i)201 local hint = hints:getChild("" .. i) 202 202 if hint ~= nil then 203 hints:removeChild Window(hint)203 hints:removeChild(hint) 204 204 winMgr:destroyWindow(hint) 205 205 end 206 206 i = i+1 207 207 end 208 hints:setSize(CEGUI.U Vector2(CEGUI.UDim(1, -P.scrollbarWidth-P.borderSize), CEGUI.UDim(0, 0)))208 hints:setSize(CEGUI.USize(CEGUI.UDim(1, -P.scrollbarWidth-P.borderSize), CEGUI.UDim(0, 0))) 209 209 end 210 210 211 211 -- Clear the quests list 212 212 function P.clearQuestList() 213 local list = CEGUI.toListbox( winMgr:getWindow("orxonox/QuestGUI/QuestsList"))213 local list = CEGUI.toListbox(P.window:getChild("MainWindow/LeftPanel/QuestsList")) 214 214 list:resetList() 215 215 P.quests = {} … … 253 253 function P.insertHint(hintsWindow, hint, index, offset) 254 254 -- Create the window for the hint. 255 local window = winMgr:createWindow("MenuWidgets/StaticText", " orxonox/QuestGUI/Quest/Hints/" .. index)255 local window = winMgr:createWindow("MenuWidgets/StaticText", "" .. index) 256 256 window:setProperty("HorzFormatting", "WordWrapLeftAligned") 257 257 window:setProperty("VertFormatting", "TopAligned") 258 258 window:setProperty("FrameEnabled", "false") 259 259 window:setID(index) 260 hintsWindow:addChild Window(window)260 hintsWindow:addChild(window) 261 261 local description = P.questManager:getDescription(hint) 262 262 window:setText(description:getDescription()) 263 window:setSize(CEGUI.U Vector2(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(1, 0)))263 window:setSize(CEGUI.USize(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(1, 0))) 264 264 local height = getStaticTextWindowHeight(window) 265 265 window:setHeight(CEGUI.UDim(0, height)) … … 286 286 -- Change to a new quest. 287 287 function P.changeQuest_clicked(e) 288 local list = CEGUI.toListbox( winMgr:getWindow("orxonox/QuestGUI/QuestsList"))288 local list = CEGUI.toListbox(P.window:getChild("MainWindow/LeftPanel/QuestsList")) 289 289 local choice = list:getFirstSelectedItem() 290 290 if choice ~= nil then … … 299 299 -- Change to a new subquest. 300 300 function P.changeToSubquest_clicked(e) 301 local list = CEGUI.toListbox( winMgr:getWindow("orxonox/QuestGUI/Quest/SubquestsList"))302 local questsList = CEGUI.toListbox( winMgr:getWindow("orxonox/QuestGUI/QuestsList"))301 local list = CEGUI.toListbox(P.window:getChild("MainWindow/RightPanel/ScrollWrapper/Wrapper/SubquestsList")) 302 local questsList = CEGUI.toListbox(P.window:getChild("MainWindow/LeftPanel/QuestsList")) 303 303 local choice = list:getFirstSelectedItem() 304 304 if choice ~= nil then … … 328 328 329 329 local questWindow = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/QuestGUI/Quests") 330 questWindow:setSize(CEGUI.U Vector2(CEGUI.UDim(1, 0),CEGUI.UDim(1, 0)))330 questWindow:setSize(CEGUI.USize(CEGUI.UDim(1, 0),CEGUI.UDim(1, 0))) 331 331 332 332 -- Iterate through all root-quests. … … 348 348 node:setText(orxonox.QuestManager:getInstance():getDescription(parent):getTitle()) 349 349 node:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.indentWidth*depth), CEGUI.UDim(0, P.buttonHeight*index))) 350 node:setSize(CEGUI.U Vector2(CEGUI.UDim(1, -P.indentWidth*depth-P.scrollbarWidth), CEGUI.UDim(0, P.buttonHeight)))350 node:setSize(CEGUI.USize(CEGUI.UDim(1, -P.indentWidth*depth-P.scrollbarWidth), CEGUI.UDim(0, P.buttonHeight))) 351 351 orxonox.GUIManager:subscribeEventHelper(node, "Clicked", P.name .. ".openDetails_clicked") 352 root:addChild Window(node)352 root:addChild(node) 353 353 354 354 table.insert(P.quests, parent) … … 389 389 --Get some numbers from the window 390 390 local we = CEGUI.toWindowEventArgs(e) 391 local name = we.window:getName ()391 local name = we.window:getNamePath() 392 392 local match = string.gmatch(name, "%d+") 393 393 local questNr = tonumber(match()) … … 397 397 398 398 local details = winMgr:createWindow("MenuWidgets/FrameWindow", name) 399 details:setSize(CEGUI.U Vector2(CEGUI.UDim(0.7, 0), CEGUI.UDim(0.7, 0)))399 details:setSize(CEGUI.USize(CEGUI.UDim(0.7, 0), CEGUI.UDim(0.7, 0))) 400 400 details:setPosition(CEGUI.UVector2(CEGUI.UDim(0.1, 0), CEGUI.UDim(0.1, 0))) 401 401 details:setText(orxonox.QuestManager:getInstance():getDescription(quest):getTitle()) … … 408 408 name = name .. "/Scrollable" 409 409 local window = winMgr:createWindow("MenuWidgets/ScrollablePane", name) 410 window:setSize(CEGUI.U Vector2(CEGUI.UDim(1.0, -2*P.borderWidth),CEGUI.UDim(1.0, -P.titleHeight)))410 window:setSize(CEGUI.USize(CEGUI.UDim(1.0, -2*P.borderWidth),CEGUI.UDim(1.0, -P.titleHeight))) 411 411 window:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderWidth), CEGUI.UDim(0, P.titleHeight))) 412 details:addChild Window(window)412 details:addChild(window) 413 413 414 414 local offset = 0 415 415 416 416 local status = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Status") 417 window:addChild Window(status)417 window:addChild(status) 418 418 status:setProperty("HorzFormatting", "WordWrapLeftAligned") 419 419 status:setProperty("VertFormatting", "TopAligned") … … 426 426 end 427 427 status:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset))) 428 status:setSize(CEGUI.U Vector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))428 status:setSize(CEGUI.USize(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0))) 429 429 local height = getStaticTextWindowHeight(status) 430 430 status:setHeight(CEGUI.UDim(0, height)) … … 432 432 433 433 local descriptionTitle = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Description/Title") 434 window:addChild Window(descriptionTitle)435 descriptionTitle:setProperty("HorzFormatting", " HorzCentred")434 window:addChild(descriptionTitle) 435 descriptionTitle:setProperty("HorzFormatting", "CentreAligned") 436 436 descriptionTitle:setProperty("VertFormatting", "TopAligned") 437 437 descriptionTitle:setText("Description:") 438 438 descriptionTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset))) 439 descriptionTitle:setSize(CEGUI.U Vector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))439 descriptionTitle:setSize(CEGUI.USize(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0))) 440 440 height = getStaticTextWindowHeight(descriptionTitle) 441 441 descriptionTitle:setHeight(CEGUI.UDim(0, height)) … … 443 443 444 444 local description = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Description") 445 window:addChild Window(description)445 window:addChild(description) 446 446 description:setProperty("HorzFormatting", "WordWrapLeftAligned") 447 447 description:setProperty("VertFormatting", "TopAligned") 448 448 description:setText(orxonox.QuestManager:getInstance():getDescription(quest):getDescription()) 449 449 description:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset))) 450 description:setSize(CEGUI.U Vector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))450 description:setSize(CEGUI.USize(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0))) 451 451 height = getStaticTextWindowHeight(description) 452 452 description:setHeight(CEGUI.UDim(0, height)) … … 457 457 if numHints > 0 then 458 458 local hintsTitle = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Hints/Title") 459 window:addChild Window(hintsTitle)460 hintsTitle:setProperty("HorzFormatting", " HorzCentred")459 window:addChild(hintsTitle) 460 hintsTitle:setProperty("HorzFormatting", "CentreAligned") 461 461 hintsTitle:setProperty("VertFormatting", "TopAligned") 462 462 hintsTitle:setText("Hints:") 463 463 hintsTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset))) 464 hintsTitle:setSize(CEGUI.U Vector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))464 hintsTitle:setSize(CEGUI.USize(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0))) 465 465 height = getStaticTextWindowHeight(hintsTitle) 466 466 hintsTitle:setHeight(CEGUI.UDim(0, height)) … … 475 475 node:setText(orxonox.QuestManager:getInstance():getDescription(hint):getTitle()) 476 476 node:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset))) 477 node:setSize(CEGUI.U Vector2(CEGUI.UDim(1, -P.scrollbarWidth), CEGUI.UDim(0, P.buttonHeight)))478 window:addChild Window(node)477 node:setSize(CEGUI.USize(CEGUI.UDim(1, -P.scrollbarWidth), CEGUI.UDim(0, P.buttonHeight))) 478 window:addChild(node) 479 479 offset = offset + P.buttonHeight 480 480 … … 483 483 end 484 484 485 local window = winMgr:getWindow("orxonox/QuestGUI/Background")486 window:addChild Window(details)485 local window = P.window:getChild("orxonox/QuestGUI/Background") 486 window:addChild(details) 487 487 end 488 488 … … 499 499 function P.closeDetails_clicked(e) 500 500 local we = CEGUI.toWindowEventArgs(e) 501 local name = we.window:getName ()501 local name = we.window:getNamePath() 502 502 local match = string.gmatch(name, "%d+") 503 503 match() … … 511 511 --Get some numbers from the window 512 512 local we = CEGUI.toWindowEventArgs(e) 513 local name = we.window:getName ()513 local name = we.window:getNamePath() 514 514 local match = string.gmatch(name, "%d+") 515 515 match() … … 521 521 522 522 local details = winMgr:createWindow("MenuWidgets/FrameWindow", name) 523 details:setSize(CEGUI.U Vector2(CEGUI.UDim(0.7, 0), CEGUI.UDim(0.7, 0)))523 details:setSize(CEGUI.USize(CEGUI.UDim(0.7, 0), CEGUI.UDim(0.7, 0))) 524 524 details:setPosition(CEGUI.UVector2(CEGUI.UDim(0.1, 0), CEGUI.UDim(0.1, 0))) 525 525 details:setText(orxonox.QuestManager:getInstance():getDescription(hint):getTitle()) … … 532 532 name = name .. "/Scrollable" 533 533 local window = winMgr:createWindow("MenuWidgets/ScrollablePane", name) 534 window:setSize(CEGUI.U Vector2(CEGUI.UDim(1.0, -2*P.borderWidth),CEGUI.UDim(1.0, -P.titleHeight)))534 window:setSize(CEGUI.USize(CEGUI.UDim(1.0, -2*P.borderWidth),CEGUI.UDim(1.0, -P.titleHeight))) 535 535 window:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderWidth), CEGUI.UDim(0, P.titleHeight))) 536 details:addChild Window(window)536 details:addChild(window) 537 537 538 538 local offset = 0 539 539 540 540 local descriptionTitle = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Description/Title") 541 window:addChild Window(descriptionTitle)542 descriptionTitle:setProperty("HorzFormatting", " HorzCentred")541 window:addChild(descriptionTitle) 542 descriptionTitle:setProperty("HorzFormatting", "CentreAligned") 543 543 descriptionTitle:setProperty("VertFormatting", "TopAligned") 544 544 descriptionTitle:setText("Description:") 545 545 descriptionTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset))) 546 descriptionTitle:setSize(CEGUI.U Vector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))546 descriptionTitle:setSize(CEGUI.USize(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0))) 547 547 height = getStaticTextWindowHeight(descriptionTitle) 548 548 descriptionTitle:setHeight(CEGUI.UDim(0, height)) … … 550 550 551 551 local description = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Description") 552 window:addChild Window(description)552 window:addChild(description) 553 553 description:setProperty("HorzFormatting", "WordWrapLeftAligned") 554 554 description:setProperty("VertFormatting", "TopAligned") 555 555 description:setText(orxonox.QuestManager:getInstance():getDescription(hint):getDescription()) 556 556 description:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset))) 557 description:setSize(CEGUI.U Vector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))557 description:setSize(CEGUI.USize(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0))) 558 558 height = getStaticTextWindowHeight(description) 559 559 description:setHeight(CEGUI.UDim(0, height)) 560 560 561 local window = winMgr:getWindow("orxonox/QuestGUI/Background")562 window:addChild Window(details)561 local window = P.window:getChild("orxonox/QuestGUI/Background") 562 window:addChild(details) 563 563 end 564 564 565 565 function P.closeHintDetails_clicked(e) 566 566 local we = CEGUI.toWindowEventArgs(e) 567 local name = we.window:getName ()567 local name = we.window:getNamePath() 568 568 local match = string.gmatch(name, "%d+") 569 569 match()
Note: See TracChangeset
for help on using the changeset viewer.