[Orxonox-commit 6688] r11317 - in code/branches/Dialog_HS16: data/levels data/overlays src/modules/notifications src/modules/notifications/dispatchers src/modules/overlays/hud
dmoritz at orxonox.net
dmoritz at orxonox.net
Mon Dec 5 15:59:28 CET 2016
Author: dmoritz
Date: 2016-12-05 15:59:27 +0100 (Mon, 05 Dec 2016)
New Revision: 11317
Modified:
code/branches/Dialog_HS16/data/levels/missionOne.oxw
code/branches/Dialog_HS16/data/overlays/HUDTemplates3.oxo
code/branches/Dialog_HS16/src/modules/notifications/CMakeLists.txt
code/branches/Dialog_HS16/src/modules/notifications/dispatchers/CMakeLists.txt
code/branches/Dialog_HS16/src/modules/notifications/dispatchers/Dialogue.cc
code/branches/Dialog_HS16/src/modules/notifications/dispatchers/Dialogue.h
code/branches/Dialog_HS16/src/modules/overlays/hud/HUDDialogue.cc
code/branches/Dialog_HS16/src/modules/overlays/hud/HUDDialogue.h
Log:
Picture added
Modified: code/branches/Dialog_HS16/data/levels/missionOne.oxw
===================================================================
--- code/branches/Dialog_HS16/data/levels/missionOne.oxw 2016-12-05 14:57:07 UTC (rev 11316)
+++ code/branches/Dialog_HS16/data/levels/missionOne.oxw 2016-12-05 14:59:27 UTC (rev 11317)
@@ -34,7 +34,7 @@
size=3
displayTime=3.9
position="0.2, 0, 0.1, 0"
- fontSize="23"
+ fontSize="19"
fontColor="0.3, 1, 0.2, 0.8"
alignment="HorzCentred"
displaySize="0.6, 0, 0, 0"
@@ -370,7 +370,7 @@
<DistanceTrigger name="spawndelaytrigger0" position="800,700,600" target="Pawn" distance=10 stayActive="true" delay=2/>
- <Dialogue speaker="ABC: " message=" Press (F3) to see your mission briefing.">
+ <Dialogue speaker="Speaker" message=" Press (F3) to see your mission briefing." portrait="Orxonox/DialogueHUD_Person">
<events>
<trigger>
<EventListener event="spawndelaytrigger0" />
@@ -409,22 +409,22 @@
<!-------------------------------------- PART ZERO: How to fly --------------------------------------->
<DistanceTrigger name="flying1" position="800,700,600" target="Pawn" distance=10 stayActive="true" delay=6/>
- <SimpleNotification message="Let's fly to the blinking light.">
+ <Dialogue speaker="Speaker" message="Let's fly to the blinking light." portrait="Orxonox/DialogueHUD_Person">
<events>
<trigger>
<EventListener event="flying1" />
</trigger>
</events>
- </SimpleNotification>
+ </Dialogue>
<DistanceTrigger name="flying2" position="800,700,600" target="Pawn" distance=10 stayActive="true" delay=10/>
- <SimpleNotification message="Use (W) to accelerate and the mouse to steer.">
+ <Dialogue speaker="Speaker" message="Use (W) to accelerate and the mouse to steer." portrait="Orxonox/DialogueHUD_Person">
<events>
<trigger>
<EventListener event="flying2" />
</trigger>
</events>
- </SimpleNotification>
+ </Dialogue>
<!-- QUEST-Trigger && Message Trigger: navigationend is activated after flying4 was triggered -->
<DistanceTrigger name="navigationend" position="0,0,0" distance=950 target="SpaceShip" stayActive="false" delay=1.1>
@@ -432,7 +432,7 @@
</DistanceTrigger>
- <Dialogue message="Three arrows just appeared.">
+ <Dialogue speaker="Speaker2" message="Three arrows just appeared." portrait="Orxonox/DialogueHUD_Person2">
<events>
<trigger>
<EventListener event="flying4" />
@@ -441,13 +441,13 @@
</Dialogue>
<DistanceTrigger name="flying5" position="-900,640,600" target="Pawn" distance=60 stayActive="true" delay=5/>
- <SimpleNotification message="Follow those arrows.">
+ <Dialogue speaker="Speaker2" message="Follow those arrows." portrait="Orxonox/DialogueHUD_Person2">
<events>
<trigger>
<EventListener event="flying5" />
</trigger>
</events>
- </SimpleNotification>
+ </Dialogue>
<!-------------------------------------- PART ONE : Destroy boxes --------------------------------------->
<!-- @ triggers: spawndelaytriggerX: textoutput only if no box was destroyed -->
@@ -485,15 +485,15 @@
</Trigger>
<!-- @Text: How to shoot-->
- <SimpleNotification message="Destroy the four boxes." broadcast="true">
+ <Dialogue speaker="Speaker" message="Destroy the four boxes." portrait="Orxonox/DialogueHUD_Person" broadcast="true">
<events>
<trigger>
<EventListener event="spawndelaytrigger1" />
</trigger>
</events>
- </SimpleNotification>
+ </Dialogue>
- <SimpleNotification message=" 1. Aim the a red cycle." broadcast="true">
+ <SimpleNotification message=" 1. Aim at the red cycle." broadcast="true">
<events>
<trigger>
<EventListener event="spawndelaytrigger2" />
Modified: code/branches/Dialog_HS16/data/overlays/HUDTemplates3.oxo
===================================================================
--- code/branches/Dialog_HS16/data/overlays/HUDTemplates3.oxo 2016-12-05 14:57:07 UTC (rev 11316)
+++ code/branches/Dialog_HS16/data/overlays/HUDTemplates3.oxo 2016-12-05 14:59:27 UTC (rev 11317)
@@ -187,7 +187,9 @@
<HUDDialogue
name = "Dialogue"
position = "0.5, 0.85"
+ pickpoint = "0.5, 0.5"
font = "VeraMono"
+ size = "0.2, 0.2"
textsize = 0.1
colour = "1.0, 1.0, 0.0, 0.8"
align = "center"
Modified: code/branches/Dialog_HS16/src/modules/notifications/CMakeLists.txt
===================================================================
--- code/branches/Dialog_HS16/src/modules/notifications/CMakeLists.txt 2016-12-05 14:57:07 UTC (rev 11316)
+++ code/branches/Dialog_HS16/src/modules/notifications/CMakeLists.txt 2016-12-05 14:59:27 UTC (rev 11317)
@@ -16,6 +16,7 @@
PCH_FILE
NotificationsPrecompiledHeaders.h
LINK_LIBRARIES
+ overlays
orxonox
SOURCE_FILES ${NOTIFICATIONS_SRC_FILES}
)
Modified: code/branches/Dialog_HS16/src/modules/notifications/dispatchers/CMakeLists.txt
===================================================================
--- code/branches/Dialog_HS16/src/modules/notifications/dispatchers/CMakeLists.txt 2016-12-05 14:57:07 UTC (rev 11316)
+++ code/branches/Dialog_HS16/src/modules/notifications/dispatchers/CMakeLists.txt 2016-12-05 14:59:27 UTC (rev 11317)
@@ -2,5 +2,4 @@
CommandNotification.cc
SimpleNotification.cc
Dialogue.cc
- DialogueManager.cc
)
Modified: code/branches/Dialog_HS16/src/modules/notifications/dispatchers/Dialogue.cc
===================================================================
--- code/branches/Dialog_HS16/src/modules/notifications/dispatchers/Dialogue.cc 2016-12-05 14:57:07 UTC (rev 11316)
+++ code/branches/Dialog_HS16/src/modules/notifications/dispatchers/Dialogue.cc 2016-12-05 14:59:27 UTC (rev 11317)
@@ -1,10 +1,15 @@
+
#include "Dialogue.h"
#include "core/CoreIncludes.h"
#include "core/EventIncludes.h"
#include "core/XMLPort.h"
+#include "overlays/hud/HUDDialogue.h"
+
+#include "NotificationDispatcher.h"
+
namespace orxonox{
RegisterClass(Dialogue);
@@ -27,11 +32,19 @@
XMLPortParam(Dialogue, "speaker", setSpeaker, getSpeaker, xmlelement, mode);
XMLPortParam(Dialogue, "message", setMessage, getMessage, xmlelement, mode);
+ XMLPortParam(Dialogue, "portrait", setPortrait, getPortrait, xmlelement, mode);
}
+ void Dialogue::update()
+ {
+ for(HUDDialogue* huddialogue : ObjectList<HUDDialogue>())
+ huddialogue->updateTarget(portrait_);
+ }
+
const std::string& Dialogue::createNotificationMessage(void)
{
- dialogue_ = speaker_ + message_;
+ dialogue_ = speaker_ + ": " + message_;
+ this->update();
return this->dialogue_ ;
}
}
\ No newline at end of file
Modified: code/branches/Dialog_HS16/src/modules/notifications/dispatchers/Dialogue.h
===================================================================
--- code/branches/Dialog_HS16/src/modules/notifications/dispatchers/Dialogue.h 2016-12-05 14:57:07 UTC (rev 11316)
+++ code/branches/Dialog_HS16/src/modules/notifications/dispatchers/Dialogue.h 2016-12-05 14:59:27 UTC (rev 11317)
@@ -19,24 +19,29 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
const std::string& getMessage(void)
- { return this->message_; }
+ { return this->message_; }
const std::string& getSpeaker(void)
{return this->speaker_;}
+ const std::string& getPortrait(void)
+ { return this->portrait_;}
+
protected:
virtual const std::string& createNotificationMessage(void);
-
+ virtual void update(void);
private:
std::string message_;
std::string speaker_;
std::string dialogue_;
+ std::string portrait_;
void setSpeaker(const std::string& speaker)
{ this->speaker_ = speaker;}
void setMessage(const std::string& message)
{ this->message_ = message; }
+ void setPortrait(const std::string& portrait)
+ { this->portrait_ = portrait;}
} ;
-
}
#endif
\ No newline at end of file
Modified: code/branches/Dialog_HS16/src/modules/overlays/hud/HUDDialogue.cc
===================================================================
--- code/branches/Dialog_HS16/src/modules/overlays/hud/HUDDialogue.cc 2016-12-05 14:57:07 UTC (rev 11316)
+++ code/branches/Dialog_HS16/src/modules/overlays/hud/HUDDialogue.cc 2016-12-05 14:59:27 UTC (rev 11317)
@@ -1,8 +1,5 @@
-
-
-
#include "HUDDialogue.h"
#include "core/XMLPort.h"
@@ -12,6 +9,7 @@
#include <OgreOverlayManager.h>
#include <OgreTextAreaOverlayElement.h>
#include <OgrePanelOverlayElement.h>
+#include "core/CoreIncludes.h"
namespace orxonox
{
@@ -22,32 +20,26 @@
OrxonoxOverlay(context)
{
RegisterObject(HUDDialogue);
-
- overlayElementIcon_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "Dialogue" + getUniqueNumberString()));
+ }
+ void HUDDialogue::updateTarget(std::string portrait)
+ {
+ overlayElementIcon_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "Dialogue" + getUniqueNumberString()));
overlayElementIcon_->setPosition(0.0f,0.0f);
overlayElementIcon_->setDimensions(1.0f,1.0f);
- this->background_->addChild(overlayElementIcon_);
+ this->background_->addChild(overlayElementIcon_);
- overlayElementIcon_->setMaterialName("Orxonox/DialogueHUD_Person");
-
- }
-
- void HUDDialogue::tick(float dt)
+ overlayElementIcon_->setMaterialName(portrait);
+ this->setVisible(true);
+ portraitTimer.setTimer(2.9f,false,createExecutor(createFunctor(&HUDDialogue::invisible, this)));
+ }
+ void HUDDialogue::invisible()
{
- SUPER(HUDDialogue, tick, dt);
-
-
+ this->setVisible(false);
+ Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->overlayElementIcon_);
}
-
HUDDialogue::~HUDDialogue()
{
}
-
- void HUDDialogue::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(HUDDialogue, XMLPort, xmlelement, mode);
- }
-
}
\ No newline at end of file
Modified: code/branches/Dialog_HS16/src/modules/overlays/hud/HUDDialogue.h
===================================================================
--- code/branches/Dialog_HS16/src/modules/overlays/hud/HUDDialogue.h 2016-12-05 14:57:07 UTC (rev 11316)
+++ code/branches/Dialog_HS16/src/modules/overlays/hud/HUDDialogue.h 2016-12-05 14:59:27 UTC (rev 11317)
@@ -1,8 +1,5 @@
-
-
-
#ifndef _HUDDialogue_H__
#define _HUDDialogue_H__
@@ -12,26 +9,25 @@
#include <string>
#include "util/OgreForwardRefs.h"
-#include "tools/interfaces/Tickable.h"
#include "overlays/OrxonoxOverlay.h"
+#include "tools/Timer.h"
namespace orxonox
{
- class _OverlaysExport HUDDialogue : public OrxonoxOverlay, public Tickable
+ class _OverlaysExport HUDDialogue : public OrxonoxOverlay
{
public:
HUDDialogue(Context* context);
virtual ~HUDDialogue();
- virtual void tick(float dt) override;
+ virtual void updateTarget(std::string portrait);
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+ virtual void invisible();
-
-
private:
Ogre::PanelOverlayElement* overlayElementIcon_;
+
+ Timer portraitTimer;
};
}
-
#endif
\ No newline at end of file
More information about the Orxonox-commit
mailing list