[Orxonox-commit 3690] r8371 - in code/branches/tutoriallevel2: . data/gui/layouts data/gui/scripts data/levels src/libraries/core src/modules/notifications src/modules/objects/triggers src/modules/questsystem src/orxonox
dafrick at orxonox.net
dafrick at orxonox.net
Sun May 1 14:43:33 CEST 2011
Author: dafrick
Date: 2011-05-01 14:43:33 +0200 (Sun, 01 May 2011)
New Revision: 8371
Added:
code/branches/tutoriallevel2/data/levels/quests.oxw
Modified:
code/branches/tutoriallevel2/
code/branches/tutoriallevel2/data/gui/layouts/QuestGUI.layout
code/branches/tutoriallevel2/data/gui/scripts/NotificationLayer.lua
code/branches/tutoriallevel2/data/gui/scripts/QuestGUI.lua
code/branches/tutoriallevel2/data/gui/scripts/SingleplayerMenu.lua
code/branches/tutoriallevel2/src/libraries/core/GUIManager.cc
code/branches/tutoriallevel2/src/libraries/core/GUIManager.h
code/branches/tutoriallevel2/src/modules/notifications/NotificationManager.cc
code/branches/tutoriallevel2/src/modules/notifications/NotificationManager.h
code/branches/tutoriallevel2/src/modules/notifications/NotificationQueue.cc
code/branches/tutoriallevel2/src/modules/notifications/NotificationQueue.h
code/branches/tutoriallevel2/src/modules/objects/triggers/MultiTrigger.cc
code/branches/tutoriallevel2/src/modules/objects/triggers/TriggerBase.h
code/branches/tutoriallevel2/src/modules/questsystem/QuestManager.cc
code/branches/tutoriallevel2/src/modules/questsystem/QuestManager.h
code/branches/tutoriallevel2/src/orxonox/LevelManager.cc
Log:
Merging tutoriallevel branch into tutoriallevel2 branch.
Property changes on: code/branches/tutoriallevel2
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/ai:6592-7033
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dynamicmatch:6584-7030
/code/branches/fps:6591-7072
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation3:6913-7162
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/tetris:8100-8107
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890
+ /code/branches/ai:6592-7033
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dynamicmatch:6584-7030
/code/branches/fps:6591-7072
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation3:6913-7162
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/tetris:8100-8107
/code/branches/tutoriallevel:7827-8370
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890
Modified: code/branches/tutoriallevel2/data/gui/layouts/QuestGUI.layout
===================================================================
--- code/branches/tutoriallevel2/data/gui/layouts/QuestGUI.layout 2011-05-01 12:16:43 UTC (rev 8370)
+++ code/branches/tutoriallevel2/data/gui/layouts/QuestGUI.layout 2011-05-01 12:43:33 UTC (rev 8371)
@@ -1,23 +1,78 @@
<?xml version="1.0" ?>
<GUILayout>
- <Window Type="MenuWidgets/StaticImage" Name="orxonox/QuestGUI/Background">
- <Property Name="UnifiedSize" Value="{{1.0,0},{1.0,0}}"/>
- <Property Name="Image" Value="set:MainMenuBackground image:Background"/>
- <Property Name="FrameEnabled" Value="set:true"/>
- <Property Name="BackgroundEnabled" Value="set:false"/>
- <Property Name="InheritsAlpha" Value="False" />
+ <Window Type="DefaultWindow" Name="orxonox/QuestGUI/Background">
+ <Property Name="InheritsAlpha" Value="False" />
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
- <Window Type="MenuWidgets/Titlebar" Name="orxonox/QuestGUI/Title">
- <Property Name="UnifiedPosition" Value="{{0.05,0},{0.05,0}}"/>
- <Property Name="UnifiedSize" Value="{{0.9,0},{0.05,0}}"/>
- <Property Name="Text" Value="Your Quests"/>
- </Window>
+ <Window Type="DefaultWindow" Name="orxonox/QuestGUI/MainWindow">
+ <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.1,0},{0.9,0},{0.9,0}}" />
- <Window Type="MenuWidgets/Listbox" Name="orxonox/QuestGUI/QuestsList">
- <Property Name="UnifiedPosition" Value="{{0.07,0},{0.18,0}}" />
- <Property Name="UnifiedSize" Value="{{0.86,0},{0.8,0}}" />
- <Property Name="Alpha" Value="0.8" />
+ <Window Type="MenuWidgets/Titlebar" Name="orxonox/QuestGUI/Title">
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{0,30}}" />
+ <Property Name="Text" Value="Your Quests"/>
+ </Window>
+
+ <Window Type="MenuWidgets/StaticText" Name="orxonox/QuestGUI/MainWindow/LeftPanel">
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,30},{0.5,0},{1,0}}" />
+
+ <Window Type="MenuWidgets/TabButton" Name="orxonox/QuestGUI/ActiveQuestsButton">
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0.5,0},{0,30}}" />
+ <Property Name="Text" Value="active quests"/>
+ <Event Name="Clicked" Function="QuestGUI.showActiveQuestsButton_clicked"/>
+ </Window>
+ <Window Type="MenuWidgets/TabButton" Name="orxonox/QuestGUI/FinishedQuestsButton">
+ <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0,0},{1,0},{0,30}}" />
+ <Property Name="Text" Value="finished quests"/>
+ <Event Name="Clicked" Function="QuestGUI.showFinishedQuestsButton_clicked"/>
+ </Window>
+
+ <Window Type="MenuWidgets/Listbox" Name="orxonox/QuestGUI/QuestsList">
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,30},{1,0},{1,0}}" />
+ <Event Name="ItemSelectionChanged" Function="QuestGUI.changeQuest_clicked"/>
+ </Window>
+ </Window>
+
+ <Window Type="MenuWidgets/StaticText" Name="orxonox/QuestGUI/MainWindow/RightPanel">
+ <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0,30},{1,0},{1,0}}" />
+
+ <Window Type="MenuWidgets/StaticText" Name="orxonox/QuestGUI/Quest/Title">
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{0,30}}" />
+ <Property Name="Text" Value="Quest Title"/>
+ </Window>
+
+ <Window Type="MenuWidgets/ScrollablePane" Name="orxonox/QuestGUI/Quest/ScrollWrapper">
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,30},{1,-4},{1,-4}}" />
+
+ <Window Type="MenuWidgets/StaticText" Name="orxonox/QuestGUI/Quest/Wrapper">
+ <Property Name="UnifiedAreaRect" Value="{{0,5},{0,5},{1,-5},{0,0}}" />
+ <Property Name="FrameEnabled" Value="false" />
+ <Property Name="Alpha" Value="0" />
+
+ <Window Type="MenuWidgets/StaticText" Name="orxonox/QuestGUI/Quest/Description">
+ <Property Name="UnifiedAreaRect" Value="{{0,5},{0,0},{1,-5},{0,0}}" />
+ <Property Name="InheritsAlpha" Value="False" />
+ <Property Name="HorzFormatting" Value="WordWrapLeftAligned" />
+ <Property Name="VertFormatting" Value="TopAligned" />
+ <Property Name="FrameEnabled" Value="false" />
+ <Property Name="Text" Value="Quest Description"/>
+ </Window>
+
+ <Window Type="MenuWidgets/Listbox" Name="orxonox/QuestGUI/Quest/SubquestsList">
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+ <Property Name="InheritsAlpha" Value="False" />
+ <Event Name="ItemSelectionChanged" Function="QuestGUI.changeToSubquest_clicked"/>
+ </Window>
+
+ <Window Type="MenuWidgets/StaticText" Name="orxonox/QuestGUI/Quest/Hints">
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{0,0}}" />
+ <Property Name="InheritsAlpha" Value="False" />
+ <Property Name="VertFormatting" Value="TopAligned" />
+ <Property Name="FrameEnabled" Value="false" />
+ <Property Name="Text" Value="Hints:" />
+ </Window>
+ </Window>
+ </Window>
+ </Window>
</Window>
-
</Window>
</GUILayout>
Modified: code/branches/tutoriallevel2/data/gui/scripts/NotificationLayer.lua
===================================================================
--- code/branches/tutoriallevel2/data/gui/scripts/NotificationLayer.lua 2011-05-01 12:16:43 UTC (rev 8370)
+++ code/branches/tutoriallevel2/data/gui/scripts/NotificationLayer.lua 2011-05-01 12:43:33 UTC (rev 8371)
@@ -16,20 +16,28 @@
-- Creates a queue in the GUI.
function P.createQueue(name, size)
local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
- local queue = winMgr:createWindow("MenuWidgets/Listbox", "orxonox/NotificationLayer/Root/Queue/" .. name)
- queue:setProperty("BackgroundColor", "00FFFFFF") -- Set background to be fully transparent.
+ --local queue = winMgr:createWindow("MenuWidgets/Listbox", "orxonox/NotificationLayer/Root/Queue/" .. name)
+ --queue:setProperty("BackgroundColor", "00FFFFFF") -- Set background to be fully transparent.
+ local queue = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/NotificationLayer/Root/Queue/" .. name)
+ queue:setProperty("Alpha", 0.0)
+ --queue:setProperty("FrameEnabled", "false")
root:addChildWindow(queue)
- queue:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, 0)))
- queue:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, 0), CEGUI.UDim(0, P.queueHeightHelper(queue, size))))
-
local queueTuple =
{
- ["window"] = queue,
- ["name"] = name,
- ["edit"] = nil,
- ["visible"] = false
+ ["window"] = queue,
+ ["name"] = name,
+ ["edit"] = nil,
+ ["visible"] = false,
+ ["fontSize"] = 12,
+ ["fontColor"] = "#FFFFFFFF",
+ ["items"] = {},
+ ["first"] = 1,
+ ["last"] = 1
}
+
+ queue:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, 0)))
+ queue:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, 0), CEGUI.UDim(0, P.queueHeightHelper(queueTuple, size))))
P.queueList[name] = queueTuple -- name access
P.setVisible(queueTuple, false) -- Set the queue to invisible as long as there are no notifications in it.
@@ -51,14 +59,27 @@
if queue == nil then
return
end
- item = CEGUI.createListboxTextItem(notification)
- local listbox = CEGUI.toListbox(queue.window)
- -- Add the item to the top of the listbox.
- if listbox:getItemCount() == 0 then
- listbox:addItem(item)
- else
- listbox:insertItem(item, listbox:getListboxItemFromIndex(0))
+
+ local item = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/Queue/" .. queueName .. "/" .. queue.last)
+ item:setText(notification)
+ P.setItemFontHelper(item, queue, true)
+ -- Add the item to the top of the queue.
+ local itemHeight = P.itemHeightHelper(queue)
+ if queue.last-queue.first > 0 then -- If the queue is not empty move all items down
+ for i=queue.first,queue.last-1 do
+ local item = queue.items[i]
+ item:setYPosition(CEGUI.UDim(0, itemHeight*(queue.last-i)))
+ end
end
+ queue.window:addChildWindow(item)
+ item:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0), CEGUI.UDim(0, itemHeight)))
+ item:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, 0)))
+ item:setProperty("Alpha", 1.0)
+ item:setProperty("InheritsAlpha", "false")
+ item:setProperty("BackgroundEnabled", "false")
+ item:setProperty("FrameEnabled", "false")
+ queue.items[queue.last] = item
+ queue.last = queue.last+1
-- If the queue has been invisible, set it to visible.
if queue.visible == false then
@@ -72,28 +93,53 @@
if queue == nil then
return
end
- local listbox = CEGUI.toListbox(queue.window)
- -- Removes the item from the bottom of the listbox.
- listbox:removeItem(listbox:getListboxItemFromIndex(listbox:getItemCount()-1))
+ local item = queue.items[queue.first]
+ -- Removes the item from the bottom of the queue.
+ queue.window:removeChildWindow(item)
+ winMgr:destroyWindow(item)
+ queue.first = queue.first+1
-- Sets the queue to invisible if there are no more notifications in it.
- if listbox:getItemCount() == 0 then
+ if queue.last-queue.first == 0 then
P.setVisible(queue, false)
end
end
--- Removes a notification at a given index from the queue.
+-- Removes a notification at a given index from the queue. Where the 0th item is the newest and the nth the (n+1)th newest.
function P.removeNotification(queueName, index)
local queue = P.queueList[queueName]
if queue == nil then
return
end
- local listbox = CEGUI.toListbox(queue.window)
+
+ index = queue.last-tonumber(index)-1
+ --if index == queue.first then -- If we want to remove the oldest notification, we can just use pop.
+ -- P.popNotification(queueName)
+ -- return
+ --end
+
-- Removes the item.
- listbox:removeItem(listbox:getListboxItemFromIndex(tonumber(index)))
+ local item = queue.items[index]
+ queue.window:removeChildWindow(item)
+ winMgr:destroyWindow(item)
+ queue.items[index] = nil
+ -- Move the items below, up.
+ local itemHeight = P.itemHeightHelper(queue)
+ local moved = false
+ if index > queue.first then -- Move all older notifications up in the list.
+ for i=index-1,-1,queue.first do
+ cout(0, i)
+ item = queue.items[i]
+ item:setYposition(CEGUI.UDim(0, itemHeight*(queue.last-i-1)))
+ queue.items[i+1] = item
+ end
+ end
+ queue.items[queue.first] = nil
+ queue.first = queue.first+1
+
-- Sets the queue to invisible if there are no more notifications in it.
- if listbox:getItemCount() == 0 then
+ if queue.last-queue.first == 0 then
P.setVisible(queue, false)
end
end
@@ -104,8 +150,14 @@
if queue == nil then
return
end
- local listbox = CEGUI.toListbox(queue.window)
- CEGUI.toListbox(queue.window):resetList()
+ for i=queue.first,queue.last-1 do
+ local item = queue.items[i]
+ queue.window:removeChildWindow(item)
+ winMgr:destroyWindow(item)
+ end
+ queue.items = {}
+ queue.first = 1
+ queue.last = 1
-- Sets the queue to invisible.
P.setVisible(queue, false)
@@ -120,6 +172,64 @@
queue.visible = visible
end
+-- Change the position of the queue.
+-- The parameters are (in order) 'name of the queue', 'relative x-position', 'absolute x-position in pixel', 'relative y-position', 'absolute y-position in pixel'.
+function P.moveQueue(queueName, relativeXPos, absoluteXPos, relativeYpos, absoluteYPos)
+ local queueWindow = P.queueList[queueName].window
+ queueWindow:setPosition(CEGUI.UVector2(CEGUI.UDim(relativeXPos, absoluteXPos), CEGUI.UDim(relativeYpos, absoluteYPos)))
+end
+
+-- Change the size of the queue.
+-- The parameters are (in order) 'name of the queue', 'relative width', 'absolute width in pixel', 'relative height', 'absolute heigth in pixel'.
+-- Additionally the last parameter can be ommitted and relativeHeight can be set to the size (i.e. the maximal number of notifications displayed) of the queue, which leads to the height being set such that all notifications can be displayed.
+function P.resizeQueue(queueName, relativeWidth, absoluteWidth, relativeHeight, absoluteHeigth)
+ local queueWindow = P.queueList[queueName].window
+ if queueWindow == nil then
+ return
+ end
+ if absoluteHeigth == nil then
+ absoluteHeigth = P.queueHeightHelper(P.queueList[queueName], relativeHeight)
+ relativeHeight = 0
+ end
+ queueWindow:setSize(CEGUI.UVector2(CEGUI.UDim(relativeWidth, absoluteWidth), CEGUI.UDim(relativeHeight, absoluteHeigth)))
+end
+
+-- Change the font size and font color of all notifications in a queueHeightHelper
+-- The parameters are (in order) 'name of the queue', 'font size', 'RGBA of the font color in hex notation'.
+function P.changeQueueFont(queueName, size, color)
+ local queue = P.queueList[queueName]
+ local queueWindow = queue.window
+ if queueWindow == nil then
+ return
+ end
+
+ queue.fontSize = size
+ local changeColor = false
+ if color ~= nil then
+ queue.fontColor = color
+ changeColor = true
+ end
+ for i=queue.first,queue.last-1 do
+ P.setItemFontHelper(queue.items[i], queue, changeColor)
+ end
+end
+
+-- Helper function to set the font size and color of a item of a queue.
+-- The parameters are (in order) 'the ListboxItem', 'the queue table', 'whether color should be changed as well'
+function P.setItemFontHelper(item, queue, changeColor)
+ --local item = tolua.cast(item, "CEGUI::ListboxTextItem")
+ local fontMgr = CEGUI.FontManager:getSingleton()
+ if fontMgr:isFontPresent("BlueHighway-" .. queue.fontSize) then
+ item:setFont("BlueHighway-" .. queue.fontSize)
+ else
+ orxonox.GUIManager:addFontHelper("BlueHighway-" .. queue.fontSize, queue.fontSize, "bluehigh.ttf")
+ item:setFont("BlueHighway-" .. queue.fontSize)
+ end
+ if changeColor then
+ --item:setProperty("TextColours", "tl:[" .. queue.fontColor .. "] tr:[" .. queue.fontColor .. "] bl:[" .. queue.fontColor .. "] br:[" .. queue.fontColor .. "]")
+ end
+end
+
-- Enter the edit mode of the notification layer.
function P.enterEditMode()
P.editMode = true
@@ -332,7 +442,7 @@
end
-- Is called after the sheet has been hidden.
-function P.onQuit()
+function P.afterHide()
-- If we leave the edit mode we show the sheet again.
if P.editMode then
P.leaveEditMode()
@@ -341,7 +451,7 @@
end
-- If the button to save the targets of a queue has been clicked.
-function P. saveTargets_clicked(e)
+function P.saveTargets_clicked(e)
local we = CEGUI.toWindowEventArgs(e)
local name = we.window:getName()
@@ -368,7 +478,7 @@
end
-- If the button to save the size if a queue has been clicked.
-function P. saveSize_clicked(e)
+function P.saveSize_clicked(e)
local we = CEGUI.toWindowEventArgs(e)
local name = we.window:getName()
@@ -395,7 +505,7 @@
end
-- If the button to save the display time if a queue has been clicked.
-function P. saveDisplayTime_clicked(e)
+function P.saveDisplayTime_clicked(e)
local we = CEGUI.toWindowEventArgs(e)
local name = we.window:getName()
@@ -477,15 +587,31 @@
-- Helper function. Returns height a queue needs to have to display 'size' items.
function P.queueHeightHelper(queue, size)
- local listbox = CEGUI.toListbox(queue)
- local item = CEGUI.createListboxTextItem("Text")
- listbox:addItem(item)
- local singleItemHeight = listbox:getTotalItemsHeight()
- local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(queue:getLookNFeel())
- local formattedArea = lookAndFeel:getNamedArea("ItemRenderingArea"):getArea():getPixelRect(queue)
- local frameHeight = queue:getUnclippedOuterRect():getHeight() - formattedArea:getHeight()
- listbox:removeItem(item)
- return frameHeight + singleItemHeight*size
+ --local listbox = CEGUI.toListbox(queue.window)
+ --local item = CEGUI.createListboxTextItem("Text")
+ --P.setItemFontHelper(item, queue, false)
+ --listbox:addItem(item)
+ --local singleItemHeight = listbox:getTotalItemsHeight()
+ local singleItemHeight = P.itemHeightHelper(queue)
+ --local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(queue.window:getLookNFeel())
+ --local formattedArea = lookAndFeel:getNamedArea("ItemRenderingArea"):getArea():getPixelRect(queue.window)
+ --local frameHeight = queue.window:getUnclippedOuterRect():getHeight() - formattedArea:getHeight()
+ --listbox:removeItem(item)
+ --return frameHeight + singleItemHeight*size
+ return singleItemHeight*size + 1
end
+function P.itemHeightHelper(queue)
+ local item = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/Test/")
+ item:setText("text")
+ P.setItemFontHelper(item, queue, true)
+ queue.window:addChildWindow(item)
+ item:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0), CEGUI.UDim(1, 0)))
+ item:setProperty("FrameEnabled", "false")
+ local height = getStaticTextWindowHeight(item)
+ queue.window:removeChildWindow(item)
+ winMgr:destroyWindow(item)
+ return height
+end
+
return P
Modified: code/branches/tutoriallevel2/data/gui/scripts/QuestGUI.lua
===================================================================
--- code/branches/tutoriallevel2/data/gui/scripts/QuestGUI.lua 2011-05-01 12:16:43 UTC (rev 8370)
+++ code/branches/tutoriallevel2/data/gui/scripts/QuestGUI.lua 2011-05-01 12:43:33 UTC (rev 8371)
@@ -2,33 +2,323 @@
local P = createMenuSheet("QuestGUI")
-P.rootWindow = nil
-P.detailsWindows = {}
+P.questManager = nil -- The QuestManager.
+P.showActive = true -- Whether the active or finished quest list is displayed.
+P.currentQuest = nil -- The quest that is currently displayed.
+P.player = nil -- The player the quests are displayed for.
P.quests = {}
-P.hints = {}
-P.player = nil
+P.subquests = {}
-- design parameters
-P.indentWidth = 20
P.scrollbarWidth = 13
-P.buttonHeight = 30
+P.frameHeigth = 18
+P.borderSize = 5
P.titleHeight = 26
-P.borderWidth = 5
-function P.onShow()
+--TODO:
+-- Highlight whether we are currently looking at active or finished quests
+-- Distinguish completed from failed quests
- local questsList = winMgr:getWindow("orxonox/QuestGUI/QuestsList")
+function P.onLoad()
+ P.questManager = orxonox.QuestManager:getInstance() -- Store the pointer to the QuestManager as an internal variable to allow for faster access,
+end
+function P.onShow()
+ -- Get the player.
P.player = orxonox.GUIManager:getInstance():getPlayer(P.name)
- P.rootWindow = P.createQuestGUI()
- questsList:addChildWindow(P.rootWindow)
+ -- Load the list of quests to be displayed.
+ P.loadQuestsList(P.currentQuest)
end
-function P.onHide()
- P.cleanup()
+-- Loads the list of quests, depending on P.showActive, either the active (P.showActive == true) or the finished, i.e. inactive quests are loaded.
+-- selectQuest is a pointer to a quest that should be selected, if it is nil the first quest is selected.
+function P.loadQuestsList(selectQuest)
+ local list = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/QuestsList"))
+ P.clearQuestList()
+
+ local selectQuestId = nil
+ if selectQuest ~= nil then
+ selectQuestId = P.questManager:getId(selectQuest)
+ end
+
+ -- Iterate through all root-quests.
+ local numRootQuests = P.questManager:getNumRootQuests(P.player)
+ if numRootQuests > 0 then
+ local i = 0
+ while i <= numRootQuests-1 do
+ local quest = P.questManager:getRootQuest(P.player, i)
+ -- Insert the current quest into the list.
+ local item = P.insertQuest(list, quest)
+ -- If the quest was inserted in the list and is has the same id as the selectQuest (thus it is the same quest) it is selected.
+ if selectQuestId ~= nil and item ~= nil and selectQuestId == P.questManager:getId(quest) then
+ list:setItemSelectState(item, true)
+ end
+ -- Insert all subquests of this rootquest.
+ P.insertSubQuests(list, quest, selectQuestId)
+ i = i+1
+ end
+ -- If there were quests added to the list but there was no selectQuest specified (i.e. selectQuest was nil), the first item is selected.
+ if list:getItemCount() > 0 then
+ if selectQuestId == nil then
+ list:setItemSelectState(list:getListboxItemFromIndex(0), true) -- Select first quest.
+ end
+ -- If there werent any quests added the standard "no quests" message is loaded.
+ else
+ P.loadQuest()
+ end
+ end
end
+-- Helper function, recursively inserts all the (active or inactive, depending on P.showActive) subquests of the input quest.
+-- list is the list into which the subquests should be insterted.
+-- quest is the quest, whose subquests should be inserted.
+-- selectQuestId is the id of the quest that should be selected.
+function P.insertSubQuests(list, quest, selectQuestId)
+ -- Iterate through all sub-quests.
+ local numQuests = P.questManager:getNumSubQuests(quest, P.player)
+ if numQuests > 0 then
+ local i = 0
+ while i <= numQuests-1 do
+ local subquest = P.questManager:getSubQuest(quest, P.player, i)
+ -- Insert the current quest into the list.
+ local item = P.insertQuest(list, subquest)
+ -- If the quest was inserted in the list and is has the same id as the selectQuest (thus it is the same quest) it is selected.
+ if selectQuestId ~= nil and item ~= nil and selectQuestId == P.questManager:getId(subquest) then
+ list:setItemSelectState(item, true)
+ end
+ i = i+1
+ end
+ end
+end
+
+-- Helper function, inserts a quest into the list (depending whether active or inactive quests are being shown). Returns nil if the quest was not inserted.
+-- list is the list into which the quets should be inserted.
+-- quest is the quest to be inserted.
+function P.insertQuest(list, quest)
+ if P.showActive == quest:isActive(P.player) then
+ local item = CEGUI.createListboxTextItem(P.questManager:getDescription(quest):getTitle())
+ item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
+ list:addItem(item)
+ table.insert(P.quests, quest)
+ return item
+ end
+ return nil
+end
+
+-- Loads the input quest.
+-- quest the quest to be loaded.
+function P.loadQuest(quest)
+
+ P.clearQuest() -- Clear the old quest.
+ if quest == nil then -- If quets is nil there is nothing to display.
+ return
+ else
+ local offset = 0
+
+ -- Load title and description
+ local description = P.questManager:getDescription(quest)
+ local titleWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Title")
+ titleWindow:setText(description:getTitle())
+ local descriptionWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Description")
+ descriptionWindow:setText(description:getDescription())
+ descriptionWindow:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(1, 0)))
+ descriptionWindow:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderSize), CEGUI.UDim(0, P.borderSize)))
+ local height = getStaticTextWindowHeight(descriptionWindow)
+ descriptionWindow:setHeight(CEGUI.UDim(0, height))
+ offset = offset + height
+
+ -- Load subquests
+ local list = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/Quest/SubquestsList"))
+ local numQuests = P.questManager:getNumSubQuests(quest, P.player)
+ local i = 0
+ while i <= numQuests-1 do
+ local quest = P.questManager:getSubQuest(quest, P.player, i)
+ local item = CEGUI.createListboxTextItem(P.questManager:getDescription(quest):getTitle())
+ item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
+ list:addItem(item)
+ table.insert(P.subquests, quest)
+ i = i+1
+ end
+ height = list:getTotalItemsHeight()
+ if height > 0 then
+ height = height+P.frameHeigth
+ end
+ list:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(0, height)))
+ list:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderSize), CEGUI.UDim(0, offset)))
+ offset = offset + height + P.borderSize
+
+ -- Load hints
+ local hintsWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Hints")
+ hintsWindow:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderSize), CEGUI.UDim(0, offset)))
+ hintsWindow:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(0, 0)))
+ height = P.titleHeight
+ local numHints = P.questManager:getNumHints(quest, P.player)
+ local i = 0
+ while i <= numHints-1 do
+ local hint = P.questManager:getHints(quest, P.player, i)
+ height = height + P.insertHint(hintsWindow, hint, i, height)
+ i = i+1
+ end
+ if numHints == 0 then
+ height = 0
+ end
+ hintsWindow:setHeight(CEGUI.UDim(0, height))
+ offset = offset + height
+
+ -- Set the size of the wrapper
+ local window = winMgr:getWindow("orxonox/QuestGUI/Quest/Wrapper")
+ window:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.borderSize-P.scrollbarWidth), CEGUI.UDim(0,offset+P.borderSize)))
+ end
+
+ P.currentQuest = quest
+end
+
+-- Clear the currently displayed quest.
+function P.clearQuest()
+ -- clear title
+ local titleWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Title")
+ titleWindow:setText("no Quests")
+
+ -- clear description
+ local descriptionWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Description")
+ descriptionWindow:setText("There is currently no quest that can be displayed.")
+
+ -- clear list fo subquests
+ local list = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/Quest/SubquestsList"))
+ list:resetList()
+ list:setHeight(CEGUI.UDim(0, 0))
+ P.subquests = {}
+
+ -- clear hints
+ local hints = winMgr:getWindow("orxonox/QuestGUI/Quest/Hints")
+ local numChildren = hints:getChildCount()-2 -- TODO: HACK
+ local i = 0
+ while i < numChildren do
+ local hint = hints:getChild("orxonox/QuestGUI/Quest/Hints/" .. i)
+ if hint ~= nil then
+ hints:removeChildWindow(hint)
+ winMgr:destroyWindow(hint)
+ end
+ i = i+1
+ end
+ hints:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.scrollbarWidth-P.borderSize), CEGUI.UDim(0, 0)))
+
+ P.currentQuest = nil
+end
+
+-- Clear the quests list
+function P.clearQuestList()
+ local list = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/QuestsList"))
+ list:resetList()
+ P.quests = {}
+end
+
+-- Select an input quest in the input list.
+-- list is the list in which the input quest is to be selected.
+-- quest is the quest to be selected.
+function P.selectQuest(list, quest)
+ if quest == nil then -- If the input quest is nil, there is nothing to be selected, an error is output and the first quest is selected instead.
+ cout(1, "Error in QuestGUI: selectQuest(), input quest is nil. Selecting first.")
+ list:setItemSelectState(list:getListboxItemFromIndex(0), true) -- Select first
+ return
+ end
+
+ local questId = P.questManager:getId(quest)
+ local found = false
+ local index = 0
+ -- Iterate over all quests currently in the list.
+ for k,v in pairs(P.quests) do
+ -- If the id's are the same we have found the quest.
+ if P.questManager:getId(v) == questId then
+ found = true
+ index = k-1
+ end
+ end
+
+ if found then -- If the quest was found it is selected.
+ list:setItemSelectState(list:getListboxItemFromIndex(index), true)
+ else -- If the quest isn't found an error is output and the first quest is selected instead.
+ cout(1, "Error in QuestGUI: selectQuest(), input quest is not in list. Selecting first.")
+ list:setItemSelectState(list:getListboxItemFromIndex(0), true) -- Select first
+ end
+end
+
+-- Helper function, insert the input hint into the input hintsWindow. Returns the height of the newly inserted hint.
+-- hintsWindow is the window in which the hint is to be inserted.
+-- hint is the hint to be inserted.
+-- index is the index of the hint.
+-- offset is the current offset in the hintsWindow.
+function P.insertHint(hintsWindow, hint, index, offset)
+ -- Create the window for the hint.
+ local window = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/QuestGUI/Quest/Hints/" .. index)
+ window:setProperty("HorzFormatting", "WordWrapLeftAligned")
+ window:setProperty("VertFormatting", "TopAligned")
+ window:setProperty("FrameEnabled", "false")
+ window:setID(index)
+ hintsWindow:addChildWindow(window)
+ local description = P.questManager:getDescription(hint)
+ window:setText(description:getDescription())
+ window:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(1, 0)))
+ local height = getStaticTextWindowHeight(window)
+ window:setHeight(CEGUI.UDim(0, height))
+ window:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderSize), CEGUI.UDim(0, offset)))
+ return height
+end
+
+-- Show the currently active quests in the quests list.
+function P.showActiveQuestsButton_clicked(e)
+ if P.showActive == false then
+ P.showActive = true
+ P.loadQuestsList()
+ end
+end
+
+-- Show the finished (i.e. inactive) quests in the quests list.
+function P.showFinishedQuestsButton_clicked(e)
+ if P.showActive == true then
+ P.showActive = false
+ P.loadQuestsList()
+ end
+end
+
+-- Change to a new quest.
+function P.changeQuest_clicked(e)
+ local list = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/QuestsList"))
+ local choice = list:getFirstSelectedItem()
+ if choice ~= nil then
+ local index = list:getItemIndex(choice)
+ local quest = P.quests[index+1]
+ if quest ~= nil then
+ P.loadQuest(quest)
+ end
+ end
+end
+
+-- Change to a new subquest.
+function P.changeToSubquest_clicked(e)
+ local list = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/Quest/SubquestsList"))
+ local questsList = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/QuestsList"))
+ local choice = list:getFirstSelectedItem()
+ if choice ~= nil then
+ local index = list:getItemIndex(choice)
+ local quest = P.subquests[index+1]
+ if quest ~= nil then
+ -- If the P.showActive must be changed to display the quest the quests list also has to be regenerated.
+ if quest:isActive(P.player) == P.showActive then
+ P.selectQuest(questsList, quest)
+ else
+ P.showActive = quest:isActive(P.player)
+ P.loadQuestsList(quest)
+ end
+ else
+ cout(1, "Error in QuestGUI: changeToSubquest(), quest was nil. Ignoring...")
+ end
+ end
+end
+
+-- old:
+--[[
function P.createQuestGUI()
local questManager = orxonox.QuestManager:getInstance()
@@ -282,7 +572,7 @@
winMgr:destroyWindow(P.detailsWindows[detailsNr])
P.detailsWindows[detailsNr] = nil
-end
+end --]]
return P
Modified: code/branches/tutoriallevel2/data/gui/scripts/SingleplayerMenu.lua
===================================================================
--- code/branches/tutoriallevel2/data/gui/scripts/SingleplayerMenu.lua 2011-05-01 12:16:43 UTC (rev 8370)
+++ code/branches/tutoriallevel2/data/gui/scripts/SingleplayerMenu.lua 2011-05-01 12:43:33 UTC (rev 8371)
@@ -53,6 +53,7 @@
end
index = index + 1
end
+
for k,v in pairs(P.levelList) do
local item = CEGUI.createListboxTextItem(v:getName())
item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
Copied: code/branches/tutoriallevel2/data/levels/quests.oxw (from rev 8370, code/branches/tutoriallevel/data/levels/quests.oxw)
===================================================================
--- code/branches/tutoriallevel2/data/levels/quests.oxw (rev 0)
+++ code/branches/tutoriallevel2/data/levels/quests.oxw 2011-05-01 12:43:33 UTC (rev 8371)
@@ -0,0 +1,231 @@
+<LevelInfo
+ name = "Quests showcase"
+ description = "Level to test and showcase quests."
+ tags = "test, showcase"
+/>
+
+<?lua
+ include("HUDTemplates3.oxo")
+ include("stats.oxo")
+ include("templates/spaceshipAssff.oxt")
+ include("templates/lodInformation.oxt")
+?>
+
+<Level
+ name = "Questsystem"
+ description = "Just a few tests"
+>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+
+ <Scene
+ ambientlight = "0.5, 0.5, 0.5"
+ skybox = "Orxonox/Starbox"
+ >
+
+ <Script code="showGUI NotificationLayer false true" needsGraphics="true" />
+
+ <GlobalQuest id="quest0">
+ <QuestDescription title="Quest 0" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor. Donec posuere scelerisque purus, et porttitor ipsum dictum ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed non turpis non eros porttitor dignissim. Phasellus at elit vel diam gravida malesuada ut a lorem. Etiam vel lacus massa. In arcu neque, ultrices at placerat in, facilisis a metus. Curabitur erat nunc, molestie sed pretium ac, ullamcorper eget tellus. Vivamus tortor magna, mollis ut vulputate vel, lacinia nec neque. Integer a nisl odio, in iaculis tortor. Nam erat erat, commodo quis tincidunt et, congue at quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+
+ Ut consequat leo ut quam congue semper et eget nibh. Nunc sit amet velit eu lorem pretium adipiscing eu ut ante. Nulla facilisi. Pellentesque interdum, neque nec consectetur vulputate, mauris risus feugiat nunc, ac sollicitudin neque quam ut tellus. Morbi elit velit, tincidunt et hendrerit eget, rutrum at erat. Duis eros nulla, faucibus vitae blandit vitae, pharetra sollicitudin justo." failMessage="Fail message 0" completeMessage="Complete message 0" />
+ </GlobalQuest>
+ <GlobalQuest id="quest1">
+ <QuestDescription title="Quest 1" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor." failMessage="Fail message 1" completeMessage="Complete message 1" />
+ <hints>
+ <QuestHint id="quest1hint1">
+ <QuestDescription title="The super Hint." description="Be proud of yourself." />
+ </QuestHint>
+ <QuestHint id="quest1hint2">
+ <QuestDescription title="The super Hint2." description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor." />
+ </QuestHint>
+ <QuestHint id="quest1hint3">
+ <QuestDescription title="The super Hint3." description="Donec posuere scelerisque purus, et porttitor ipsum dictum ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed non turpis non eros porttitor dignissim. Phasellus at elit vel diam gravida malesuada ut a lorem. Etiam vel lacus massa. In arcu neque, ultrices at placerat in, facilisis a metus." />
+ </QuestHint>
+ </hints>
+ <subquests>
+ <GlobalQuest id="quest1.1">
+ <QuestDescription title="Quest 1: Subquest 1" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor. Donec posuere scelerisque purus, et porttitor ipsum dictum ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed non turpis non eros porttitor dignissim. Phasellus at elit vel diam gravida malesuada ut a lorem. Etiam vel lacus massa. In arcu neque, ultrices at placerat in, facilisis a metus. Curabitur erat nunc, molestie sed pretium ac, ullamcorper eget tellus. Vivamus tortor magna, mollis ut vulputate vel, lacinia nec neque. Integer a nisl odio, in iaculis tortor. Nam erat erat, commodo quis tincidunt et, congue at quam." failMessage="Fail message 2" completeMessage="Complete message 2" />
+ </GlobalQuest>
+ <GlobalQuest id="quest1.2">
+ <QuestDescription title="Quest 1: Subquest 2" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor." failMessage="Fail message 2" completeMessage="Complete message 2" />
+ </GlobalQuest>
+ <GlobalQuest id="quest1.3">
+ <QuestDescription title="Quest 1: Subquest 3" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor. Donec posuere scelerisque purus, et porttitor ipsum dictum ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas." failMessage="Fail message 2" completeMessage="Complete message 2" />
+ </GlobalQuest>
+ <GlobalQuest id="quest1.4">
+ <QuestDescription title="Quest 1: Subquest 4" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor. Donec posuere scelerisque purus, et porttitor ipsum dictum ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed non turpis non eros porttitor dignissim. Phasellus at elit vel diam gravida malesuada ut a lorem. Etiam vel lacus massa. In arcu neque, ultrices at placerat in, facilisis a metus. Curabitur erat nunc, molestie sed pretium ac, ullamcorper eget tellus. Vivamus tortor magna, mollis ut vulputate vel, lacinia nec neque. Integer a nisl odio, in iaculis tortor. Nam erat erat, commodo quis tincidunt et, congue at quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit." failMessage="Fail message 2" completeMessage="Complete message 2" />
+ </GlobalQuest>
+ <GlobalQuest id="quest1.5">
+ <QuestDescription title="Quest 1: Subquest 5" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor. Donec posuere scelerisque purus, et porttitor ipsum dictum ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed non turpis non eros porttitor dignissim. Phasellus at elit vel diam gravida malesuada ut a lorem. Etiam vel lacus massa. In arcu neque, ultrices at placerat in, facilisis a metus. Curabitur erat nunc, molestie sed pretium ac, ullamcorper eget tellus. Vivamus tortor magna, mollis ut vulputate vel, lacinia nec neque. Integer a nisl odio, in iaculis tortor. Nam erat erat, commodo quis tincidunt et, congue at quam." failMessage="Fail message 2" completeMessage="Complete message 2" />
+ </GlobalQuest>
+ </subquests>
+ </GlobalQuest>
+ <GlobalQuest id="quest2">
+ <QuestDescription title="Quest 2" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor. Donec posuere scelerisque purus, et porttitor ipsum dictum ac." failMessage="Fail message 2" completeMessage="Complete message 2" />
+ </GlobalQuest>
+ <GlobalQuest id="quest3">
+ <QuestDescription title="Quest 3" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor. Donec posuere scelerisque purus, et porttitor ipsum dictum ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed non turpis non eros porttitor dignissim. Phasellus at elit vel diam gravida malesuada ut a lorem. Etiam vel lacus massa. In arcu neque, ultrices at placerat in, facilisis a metus. Curabitur erat nunc, molestie sed pretium ac, ullamcorper eget tellus. Vivamus tortor magna, mollis ut vulputate vel, lacinia nec neque. Integer a nisl odio, in iaculis tortor. Nam erat erat, commodo quis tincidunt et, congue at quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit." failMessage="Fail message 1" completeMessage="Complete message 1" />
+ </GlobalQuest>
+ <GlobalQuest id="quest4">
+ <QuestDescription title="Quest 4" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor. Donec posuere scelerisque purus, et porttitor ipsum dictum ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed non turpis non eros porttitor dignissim. Phasellus at elit vel diam gravida malesuada ut a lorem. Etiam vel lacus massa. In arcu neque, ultrices at placerat in, facilisis a metus. Curabitur erat nunc, molestie sed pretium ac, ullamcorper eget tellus. Vivamus tortor magna, mollis ut vulputate vel, lacinia nec neque. Integer a nisl odio, in iaculis tortor. Nam erat erat, commodo quis tincidunt et, congue at quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+
+ Ut consequat leo ut quam congue semper et eget nibh. Nunc sit amet velit eu lorem pretium adipiscing eu ut ante. Nulla facilisi. Pellentesque interdum, neque nec consectetur vulputate, mauris risus feugiat nunc, ac sollicitudin neque quam ut tellus. Morbi elit velit, tincidunt et hendrerit eget, rutrum at erat. Duis eros nulla, faucibus vitae blandit vitae, pharetra sollicitudin justo. Donec luctus est a tortor auctor feugiat." failMessage="Fail message 1" completeMessage="Complete message 1" />
+ </GlobalQuest>
+ <GlobalQuest id="quest5">
+ <QuestDescription title="Quest 5" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa." failMessage="Fail message 1" completeMessage="Complete message 1" />
+ </GlobalQuest>
+ <GlobalQuest id="quest6">
+ <QuestDescription title="Quest 6" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor. Donec posuere scelerisque purus, et porttitor ipsum dictum ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed non turpis non eros porttitor dignissim. Phasellus at elit vel diam gravida malesuada ut a lorem. Etiam vel lacus massa. In arcu neque, ultrices at placerat in, facilisis a metus. Curabitur erat nunc, molestie sed pretium ac, ullamcorper eget tellus. Vivamus tortor magna, mollis ut vulputate vel, lacinia nec neque. " failMessage="Fail message 1" completeMessage="Complete message 1" />
+ </GlobalQuest>
+
+ <EventMultiTrigger name=spawntrigger>
+ <events>
+ <trigger>
+ <SpawnPoint position="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+ </trigger>
+ </events>
+ </EventMultiTrigger>
+
+ <QuestEffectBeacon times=1>
+ <effects>
+ <AddQuest questId="quest0" />
+ <AddQuest questId="quest1" />
+ <AddQuest questId="quest1.1" />
+ <AddQuest questId="quest1.2" />
+ <AddQuest questId="quest1.3" />
+ <AddQuest questId="quest1.4" />
+ <AddQuest questId="quest1.5" />
+ <AddQuest questId="quest2" />
+ <AddQuest questId="quest3" />
+ <AddQuest questId="quest4" />
+ <AddQuest questId="quest5" />
+ <AddQuest questId="quest6" />
+ <AddQuestHint hintId ="quest1hint1" />
+ <AddQuestHint hintId ="quest1hint2" />
+ <AddQuestHint hintId ="quest1hint3" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event=spawntrigger />
+ </execute>
+ </events>
+ </QuestEffectBeacon>
+
+ <QuestEffectBeacon position="-100,0,0" times=1>
+ <effects>
+ <FailQuest questId="quest1.1" />
+ <FailQuest questId="quest1.2" />
+ <FailQuest questId="quest1.3" />
+ <FailQuest questId="quest1.4" />
+ <FailQuest questId="quest1.5" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event=dtrigger1 />
+ </execute>
+ </events>
+ <attached>
+ <Billboard position="0,0,0" colour="1.0,0,0" material="Examples/Flare" />
+ <DistanceTrigger name=dtrigger1 position="0,0,0" distance=10 target="Pawn" />
+ </attached>
+ </QuestEffectBeacon>
+
+ <QuestEffectBeacon position="100,0,0" times=-1>
+ <effects>
+ <CompleteQuest questId="quest0" />
+ <CompleteQuest questId="quest1" />
+ <CompleteQuest questId="quest1.1" />
+ <CompleteQuest questId="quest1.2" />
+ <CompleteQuest questId="quest1.3" />
+ <CompleteQuest questId="quest1.4" />
+ <CompleteQuest questId="quest1.5" />
+ <CompleteQuest questId="quest2" />
+ <CompleteQuest questId="quest3" />
+ <CompleteQuest questId="quest4" />
+ <CompleteQuest questId="quest5" />
+ <CompleteQuest questId="quest6" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event=dtrigger2 />
+ </execute>
+ </events>
+ <attached>
+ <Billboard position="0,0,0" colour="0,1.0,0" material="Examples/Flare" />
+ <DistanceTrigger name=dtrigger2 position="0,0,0" distance=10 target="Pawn" />
+ </attached>
+ </QuestEffectBeacon>
+
+ <!--QuestEffectBeacon position="0,0,100" times=-1>
+ <effects>
+ <AddQuest questId="b80c2c60-e62c-4637-80f8-5aa18dc93b34" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event=qebdt1 />
+ </execute>
+ </events>
+ <attached>
+ <Billboard position="0,0,0" colour="1.0,1.0,1.0" material="Examples/Flare" />
+ <DistanceTrigger name=qebdt1 position="0,0,0" distance=10 target="ControllableEntity" />
+ </attached>
+ </QuestEffectBeacon>
+
+ <QuestEffectBeacon position="-100,0,0" times=-1>
+ <effects>
+ <FailQuest questId="b80c2c60-e62c-4637-80f8-5aa18dc93b34" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event=qebdt2 />
+ </execute>
+ </events>
+ <attached>
+ <Billboard position="0,0,0" colour="1.0,0,0" material="Examples/Flare" />
+ <DistanceTrigger name=qebdt2 position="0,0,0" distance=10 target="ControllableEntity" />
+ </attached>
+ </QuestEffectBeacon>
+
+ <QuestEffectBeacon position="100,0,0" times=-1>
+ <effects>
+ <CompleteQuest questId="b80c2c60-e62c-4637-80f8-5aa18dc93b34" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event=qebdt3 />
+ </execute>
+ </events>
+ <attached>
+ <Billboard position="0,0,0" colour="0,1.0,0" material="Examples/Flare" />
+ <DistanceTrigger name=qebdt3 position="0,0,0" distance=10 target="ControllableEntity" />
+ </attached>
+ </QuestEffectBeacon>
+
+ <QuestEffectBeacon position="0,100,0" times=-1>
+ <effects>
+ <AddQuestHint hintId="022a859d-08dd-4eac-a085-c28c29c06d48" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event=qebdt4 />
+ </execute>
+ </events>
+ <attached>
+ <Billboard position="0,0,0" colour="0,0,1.0" material="Examples/Flare" />
+ <DistanceTrigger name=qebdt4 position="0,0,0" distance=10 target="ControllableEntity" />
+ </attached>
+ </QuestEffectBeacon>
+
+ <ParticleEmitter name=firecenter position="0,0,0" source="Orxonox/fire3" active=false>
+ <events>
+ <activity>
+ <QuestListener questId="b80c2c60-e62c-4637-80f8-5aa18dc93b34" mode="complete" />
+ </activity>
+ </events>
+ </ParticleEmitter-->
+
+ </Scene>
+</Level>
+
Modified: code/branches/tutoriallevel2/src/libraries/core/GUIManager.cc
===================================================================
--- code/branches/tutoriallevel2/src/libraries/core/GUIManager.cc 2011-05-01 12:16:43 UTC (rev 8370)
+++ code/branches/tutoriallevel2/src/libraries/core/GUIManager.cc 2011-05-01 12:43:33 UTC (rev 8371)
@@ -36,12 +36,14 @@
#include <CEGUIDefaultLogger.h>
#include <CEGUIExceptions.h>
+#include <CEGUIFontManager.h>
#include <CEGUIInputEvent.h>
#include <CEGUIMouseCursor.h>
#include <CEGUIResourceProvider.h>
#include <CEGUISystem.h>
#include <CEGUIWindow.h>
#include <CEGUIWindowManager.h>
+#include <CEGUIXMLAttributes.h>
#include <elements/CEGUIListbox.h>
#include <elements/CEGUIListboxItem.h>
@@ -648,4 +650,39 @@
this->mouseLeft();
}
+ /**
+ @brief
+ Adds a new freetype font to the CEGUI system.
+ @param name
+ The name of the new font.
+ @param size
+ The font size of the new font in pixels.
+ @param fontName
+ The filename of the font.
+ */
+ /*static*/ void GUIManager::addFontHelper(const std::string& name, int size, const std::string& fontName)
+ {
+ if(CEGUI::FontManager::getSingleton().isFontPresent(name)) // If a font with that name already exists.
+ return;
+
+ CEGUI::Font* font = NULL;
+ CEGUI::XMLAttributes xmlAttributes;
+
+ // Attributes specified within CEGUIFont
+ xmlAttributes.add("Name", name);
+ xmlAttributes.add("Filename", fontName);
+ xmlAttributes.add("ResourceGroup", "");
+ xmlAttributes.add("AutoScaled", "true");
+ xmlAttributes.add("NativeHorzRes", "800");
+ xmlAttributes.add("NativeVertRes", "600");
+
+ // Attributes specified within CEGUIXMLAttributes
+ xmlAttributes.add("Size", multi_cast<std::string>(size));
+ xmlAttributes.add("AntiAlias", "true");
+
+ font = CEGUI::FontManager::getSingleton().createFont("FreeType", xmlAttributes);
+ if(font != NULL)
+ font->load();
+ }
+
}
Modified: code/branches/tutoriallevel2/src/libraries/core/GUIManager.h
===================================================================
--- code/branches/tutoriallevel2/src/libraries/core/GUIManager.h 2011-05-01 12:16:43 UTC (rev 8370)
+++ code/branches/tutoriallevel2/src/libraries/core/GUIManager.h 2011-05-01 12:43:33 UTC (rev 8371)
@@ -124,9 +124,10 @@
inline orxonox::PlayerInfo* getPlayer(const std::string& guiname) const { std::map<std::string, PlayerInfo*>::const_iterator it = this->players_.find(guiname); return (it != this->players_.end()) ? it->second : 0; } // tolua_export
// TODO: Temporary hack because the tolua exported CEGUI method does not seem to work
- static void subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function); //tolua_export
- static void setTooltipTextHelper(CEGUI::ListboxItem* item, const std::string& toooltip); //tolua_export
- static void setItemTooltipsEnabledHelper(CEGUI::Listbox* listbox, bool enabled); //tolua_export
+ static void subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function); // tolua_export
+ static void setTooltipTextHelper(CEGUI::ListboxItem* item, const std::string& toooltip); // tolua_export
+ static void setItemTooltipsEnabledHelper(CEGUI::Listbox* listbox, bool enabled); // tolua_export
+ static void addFontHelper(const std::string& name, int size, const std::string& fontName); // tolua_export
static GUIManager& getInstance() { return Singleton<GUIManager>::getInstance(); } // tolua_export
Modified: code/branches/tutoriallevel2/src/modules/notifications/NotificationManager.cc
===================================================================
--- code/branches/tutoriallevel2/src/modules/notifications/NotificationManager.cc 2011-05-01 12:16:43 UTC (rev 8370)
+++ code/branches/tutoriallevel2/src/modules/notifications/NotificationManager.cc 2011-05-01 12:43:33 UTC (rev 8371)
@@ -39,6 +39,7 @@
#include "core/LuaState.h"
#include "network/Host.h"
#include "network/NetworkFunction.h"
+#include "util/Convert.h"
#include "util/ScopedSingletonManager.h"
#include "interfaces/NotificationListener.h"
@@ -341,6 +342,38 @@
/**
@brief
+ Fetches the newest Notifications for a specific NotificationListener and stores them in the input map.
+ @param listener
+ The NotificationListener the Notifications are fetched for.
+ @param map
+ A pointer to a multimap, in which the notifications are stored. The map needs to have been allocated.
+ @param numberOfNotifications
+ The number of newest Notifications to be got.
+ @return
+ Returns true if successful.
+ */
+ void NotificationManager::getNewestNotifications(NotificationListener* listener, std::multimap<std::time_t, Notification*>* map, int numberOfNotifications)
+ {
+ assert(listener);
+ assert(map);
+
+ std::multimap<std::time_t, Notification*>* notifications = this->notificationLists_[this->listenerList_[listener]]; // All the Notifications for the input NotificationListener.
+
+ if(!notifications->empty()) // If the list of Notifications is not empty.
+ {
+ std::multimap<std::time_t,Notification*>::iterator it = notifications->end();
+ for(int i = 0; i < numberOfNotifications; i++) // Iterate through the Notifications from the newest until we have the specified number of notifications.
+ {
+ it--;
+ map->insert(std::pair<std::time_t, Notification*>(it->first, it->second)); // Add the found Notifications to the map.
+ if(it == notifications->begin())
+ break;
+ }
+ }
+ }
+
+ /**
+ @brief
Enters the edit mode of the NotificationLayer.
*/
void NotificationManager::enterEditMode(void)
@@ -386,7 +419,14 @@
*/
void NotificationManager::loadQueues(void)
{
- new NotificationQueue("all");
+ NotificationQueue* allQueue = new NotificationQueue("all");
+ GUIManager::getInstance().getLuaState()->doString("NotificationLayer.resizeQueue(\"all\", 0.5, 0, " + multi_cast<std::string>(allQueue->getMaxSize()) + ")");
+ GUIManager::getInstance().getLuaState()->doString("NotificationLayer.moveQueue(\"all\", 0, 10, 0.3, 0)");
+
+ NotificationQueue* infoQueue = new NotificationQueue("info", NotificationManager::ALL, 1, -1);
+ GUIManager::getInstance().getLuaState()->doString("NotificationLayer.changeQueueFont(\"info\", 24, \"FFFFFF00\")");
+ GUIManager::getInstance().getLuaState()->doString("NotificationLayer.resizeQueue(\"info\", 0.6, 0, " + multi_cast<std::string>(infoQueue->getMaxSize()) + ")");
+ GUIManager::getInstance().getLuaState()->doString("NotificationLayer.moveQueue(\"info\", 0.2, 0, 0.8, 0)");
}
/**
Modified: code/branches/tutoriallevel2/src/modules/notifications/NotificationManager.h
===================================================================
--- code/branches/tutoriallevel2/src/modules/notifications/NotificationManager.h 2011-05-01 12:16:43 UTC (rev 8370)
+++ code/branches/tutoriallevel2/src/modules/notifications/NotificationManager.h 2011-05-01 12:43:33 UTC (rev 8371)
@@ -97,6 +97,8 @@
void getNotifications(NotificationListener* listener, std::multimap<std::time_t, Notification*>* map, int timeDelay)
{ this->getNotifications(listener, map, std::time(0)-timeDelay, std::time(0)); }
+ void getNewestNotifications(NotificationListener* listener, std::multimap<std::time_t, Notification*>* map, int numberOfNotifications); //!< Fetches the newest Notifications for a specific NotificationListener and stores them in the input map.
+
void enterEditMode(void); //!< Enters the edit mode of the NotificationLayer.
bool registerQueue(NotificationQueue* queue); //!< Registers a NotificationQueue.
Modified: code/branches/tutoriallevel2/src/modules/notifications/NotificationQueue.cc
===================================================================
--- code/branches/tutoriallevel2/src/modules/notifications/NotificationQueue.cc 2011-05-01 12:16:43 UTC (rev 8370)
+++ code/branches/tutoriallevel2/src/modules/notifications/NotificationQueue.cc 2011-05-01 12:43:33 UTC (rev 8371)
@@ -160,7 +160,7 @@
void NotificationQueue::tick(float dt)
{
this->tickTime_ += dt; // Add the time interval that has passed to the time counter.
- if(this->tickTime_ >= 1.0) // If the time counter is greater than 1s all Notifications that have expired are removed, if it is smaller we wait to the next tick.
+ if(this->displayTime_ != INF && this->tickTime_ >= 1.0) // If the time counter is greater than 1s all Notifications that have expired are removed, if it is smaller we wait to the next tick.
{
this->timeLimit_.time = std::time(0)-this->displayTime_; // Container containig the current time.
@@ -187,7 +187,10 @@
std::multimap<std::time_t, Notification*>* notifications = new std::multimap<std::time_t, Notification*>;
// Get the Notifications sent in the interval from now to now minus the display time.
- NotificationManager::getInstance().getNotifications(this, notifications, this->displayTime_);
+ if(this->displayTime_ == INF)
+ NotificationManager::getInstance().getNewestNotifications(this, notifications, this->getMaxSize());
+ else
+ NotificationManager::getInstance().getNotifications(this, notifications, this->displayTime_);
if(!notifications->empty())
{
@@ -363,11 +366,9 @@
@brief
Sets the maximum number of seconds a Notification is displayed.
@param time
- The number of seconds the Notifications is displayed.
- @return
- Returns true if successful.
+ The number of seconds a Notification is displayed.
*/
- void NotificationQueue::setDisplayTime(unsigned int time)
+ void NotificationQueue::setDisplayTime(int time)
{
if(this->displayTime_ == time)
return;
Modified: code/branches/tutoriallevel2/src/modules/notifications/NotificationQueue.h
===================================================================
--- code/branches/tutoriallevel2/src/modules/notifications/NotificationQueue.h 2011-05-01 12:16:43 UTC (rev 8370)
+++ code/branches/tutoriallevel2/src/modules/notifications/NotificationQueue.h 2011-05-01 12:43:33 UTC (rev 8371)
@@ -120,12 +120,12 @@
inline unsigned int getMaxSize() const
{ return this->maxSize_; }
- void setDisplayTime(unsigned int time); //!< Sets the maximum number of seconds a Notification is displayed.
+ void setDisplayTime(int time); //!< Sets the maximum number of seconds a Notification is displayed.
/**
@brief Returns the time interval the Notification is displayed.
@return Returns the display time.
*/
- inline unsigned int getDisplayTime() const
+ inline int getDisplayTime() const
{ return this->displayTime_; }
// tolua_end
@@ -151,12 +151,13 @@
private:
static const unsigned int DEFAULT_SIZE = 5; //!< The default maximum number of Notifications displayed.
static const unsigned int DEFAULT_DISPLAY_TIME = 30; //!< The default display time.
+ static const int INF = -1; //!< Constant denoting infinity.
std::string name_; //!< The name of the NotificationQueue.
unsigned int maxSize_; //!< The maximal number of Notifications displayed.
unsigned int size_; //!< The number of Notifications displayed.
- unsigned int displayTime_; //!< The time a Notification is displayed.
+ int displayTime_; //!< The time a Notification is displayed.
bool registered_; //!< Helper variable to remember whether the NotificationQueue is registered already.
Modified: code/branches/tutoriallevel2/src/modules/objects/triggers/MultiTrigger.cc
===================================================================
--- code/branches/tutoriallevel2/src/modules/objects/triggers/MultiTrigger.cc 2011-05-01 12:16:43 UTC (rev 8370)
+++ code/branches/tutoriallevel2/src/modules/objects/triggers/MultiTrigger.cc 2011-05-01 12:43:33 UTC (rev 8371)
@@ -197,7 +197,6 @@
// If the activity is different from what it is now, change it and fire an Event.
if(bActive ^ this->isActive(state->originator))
{
-
bool bFire = true;
// Add the originator to the objects activating this MultiTrigger.
Modified: code/branches/tutoriallevel2/src/modules/objects/triggers/TriggerBase.h
===================================================================
--- code/branches/tutoriallevel2/src/modules/objects/triggers/TriggerBase.h 2011-05-01 12:16:43 UTC (rev 8370)
+++ code/branches/tutoriallevel2/src/modules/objects/triggers/TriggerBase.h 2011-05-01 12:43:33 UTC (rev 8371)
@@ -132,6 +132,12 @@
*/
inline int getActivations(void) const
{ return this->remainingActivations_; }
+ /**
+ @brief Check whether the trigger has still at least one remaining activation.
+ @return Returns true if the trigger has remaining activations (i.e. the number of remaining activations is not zero).
+ */
+ inline bool hasRemainingActivations(void) const
+ { return this->remainingActivations_ > 0 || this->remainingActivations_ == INF_s; }
/**
@brief Set the invert-mode of triggerhe trigger.
Modified: code/branches/tutoriallevel2/src/modules/questsystem/QuestManager.cc
===================================================================
--- code/branches/tutoriallevel2/src/modules/questsystem/QuestManager.cc 2011-05-01 12:16:43 UTC (rev 8370)
+++ code/branches/tutoriallevel2/src/modules/questsystem/QuestManager.cc 2011-05-01 12:43:33 UTC (rev 8371)
@@ -273,6 +273,9 @@
*/
int QuestManager::getNumSubQuests(Quest* quest, PlayerInfo* player)
{
+ if(quest == NULL)
+ return this->getNumRootQuests(player);
+
std::list<Quest*> quests = quest->getSubQuestList();
int numQuests = 0;
for(std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)
@@ -295,6 +298,9 @@
*/
Quest* QuestManager::getSubQuest(Quest* quest, PlayerInfo* player, int index)
{
+ if(quest == NULL)
+ return this->getRootQuest(player, index);
+
std::list<Quest*> quests = quest->getSubQuestList();
for(std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)
{
@@ -348,6 +354,19 @@
/**
@brief
+ Get the parent-quest of the input Quest for the input player.
+ @param quest
+ The Quest to get the parent-quest of.
+ @param player
+ The player.
+ */
+ Quest* QuestManager::getParentQuest(Quest* quest)
+ {
+ return quest->getParentQuest();
+ }
+
+ /**
+ @brief
Get the QuestDescription of the input Quest.
@param item
The Quest to get the QuestDescription of.
@@ -374,6 +393,32 @@
/**
@brief
+ Get the id of the input Quest.
+ @param item
+ The Quest to get the id of.
+ @return
+ Returns the id of the input Quest.
+ */
+ const std::string QuestManager::getId(Quest* item) const
+ {
+ return item->getId();
+ }
+
+ /**
+ @brief
+ Get the id of the input QuestHint.
+ @param item
+ The QuestHint to get the id of.
+ @return
+ Returns the id of the input QuestHint.
+ */
+ const std::string QuestManager::getId(QuestHint* item) const
+ {
+ return item->getId();
+ }
+
+ /**
+ @brief
Retrieve the player for a certain GUI.
@param guiName
The name of the GUI the player is retrieved for.
Modified: code/branches/tutoriallevel2/src/modules/questsystem/QuestManager.h
===================================================================
--- code/branches/tutoriallevel2/src/modules/questsystem/QuestManager.h 2011-05-01 12:16:43 UTC (rev 8370)
+++ code/branches/tutoriallevel2/src/modules/questsystem/QuestManager.h 2011-05-01 12:43:33 UTC (rev 8371)
@@ -80,8 +80,13 @@
int getNumHints(Quest* quest, orxonox::PlayerInfo* player); //!< Get the number of QuestHints of the input Quest for the input player.
QuestHint* getHints(Quest* quest, orxonox::PlayerInfo* player, int index); //!< Get the index-th QuestHint of the input Quest for the input player.
- QuestDescription* getDescription(Quest* item);
- QuestDescription* getDescription(QuestHint* item);
+ Quest* getParentQuest(Quest* quest); //!< Get the parent-quest of the input Quest.
+
+ QuestDescription* getDescription(Quest* item); //!< Get the QuestDescription of the input Quest.
+ QuestDescription* getDescription(QuestHint* item); //!< Get the QuestDescription of the input QuestHint.
+
+ const std::string getId(Quest* item) const; //!< Get the id of the input Quest.
+ const std::string getId(QuestHint* item) const; //!< Get the id of the input QuestHint.
// tolua_end
bool registerQuest(Quest* quest); //!< Registers a Quest in the QuestManager.
Modified: code/branches/tutoriallevel2/src/orxonox/LevelManager.cc
===================================================================
--- code/branches/tutoriallevel2/src/orxonox/LevelManager.cc 2011-05-01 12:16:43 UTC (rev 8370)
+++ code/branches/tutoriallevel2/src/orxonox/LevelManager.cc 2011-05-01 12:43:33 UTC (rev 8371)
@@ -221,6 +221,7 @@
this->nextIndex_ = 0;
this->nextLevel_ = this->availableLevels_.begin();
}
+
while(this->nextIndex_ != index)
{
this->nextIndex_++;
More information about the Orxonox-commit
mailing list