[Orxonox-commit 6767] r11395 - in code/branches/HUD_HS16: data/levels src/modules src/modules/dialogue src/modules/pickup
patricwi at orxonox.net
patricwi at orxonox.net
Thu Apr 6 16:18:21 CEST 2017
Author: patricwi
Date: 2017-04-06 16:18:21 +0200 (Thu, 06 Apr 2017)
New Revision: 11395
Added:
code/branches/HUD_HS16/src/modules/dialogue/
code/branches/HUD_HS16/src/modules/dialogue/CMakeLists.txt
code/branches/HUD_HS16/src/modules/dialogue/Dialogue.layout
code/branches/HUD_HS16/src/modules/dialogue/Dialogue.lua
code/branches/HUD_HS16/src/modules/dialogue/DialogueManager.cc
code/branches/HUD_HS16/src/modules/dialogue/DialogueManager.h
code/branches/HUD_HS16/src/modules/dialogue/DialoguePrereqs.h
code/branches/HUD_HS16/src/modules/dialogue/NextQuestion.cc
code/branches/HUD_HS16/src/modules/dialogue/NextQuestion.h
Modified:
code/branches/HUD_HS16/data/levels/events.oxw
code/branches/HUD_HS16/src/modules/CMakeLists.txt
code/branches/HUD_HS16/src/modules/pickup/DDDialogue.cc
Log:
dialogue classes added
Modified: code/branches/HUD_HS16/data/levels/events.oxw
===================================================================
--- code/branches/HUD_HS16/data/levels/events.oxw 2017-04-06 14:17:58 UTC (rev 11394)
+++ code/branches/HUD_HS16/data/levels/events.oxw 2017-04-06 14:18:21 UTC (rev 11395)
@@ -76,14 +76,15 @@
<!-- HELLO THERE ................................................................ ITS ME -->
<DistanceTrigger name="test" position="0,0,0" target="Pawn" distance=25 stayActive="true"/>
<Backlight position="0,0,0" visible=true frequency=0.6 amplitude=3 material="Flares/lensflare" colour="1,0,0"/>
- <DDDialogue string="Hello World3" >
+ <DialogueManager question="Hello World3">
<events>
<execute>
<EventListener event="test" />
</execute>
</events>
- </DDDialogue>
+ </DialogueManager>
+
<!-- orange -->
<!--
EventListener:
Modified: code/branches/HUD_HS16/src/modules/CMakeLists.txt
===================================================================
--- code/branches/HUD_HS16/src/modules/CMakeLists.txt 2017-04-06 14:17:58 UTC (rev 11394)
+++ code/branches/HUD_HS16/src/modules/CMakeLists.txt 2017-04-06 14:18:21 UTC (rev 11395)
@@ -26,6 +26,7 @@
################ Sub Directories ################
ADD_SUBDIRECTORY(designtools)
+ADD_SUBDIRECTORY(dialogue)
ADD_SUBDIRECTORY(gametypes)
ADD_SUBDIRECTORY(notifications)
ADD_SUBDIRECTORY(objects)
Added: code/branches/HUD_HS16/src/modules/dialogue/CMakeLists.txt
===================================================================
--- code/branches/HUD_HS16/src/modules/dialogue/CMakeLists.txt (rev 0)
+++ code/branches/HUD_HS16/src/modules/dialogue/CMakeLists.txt 2017-04-06 14:18:21 UTC (rev 11395)
@@ -0,0 +1,12 @@
+SET_SOURCE_FILES(DIALOGUE_SRC_FILES
+ DialogueManager.cc
+
+)
+
+ORXONOX_ADD_LIBRARY(dialogue
+ MODULE
+ FIND_HEADER_FILES
+ LINK_LIBRARIES
+ orxonox
+ SOURCE_FILES ${DIALOGUE_SRC_FILES}
+)
Added: code/branches/HUD_HS16/src/modules/dialogue/Dialogue.layout
===================================================================
--- code/branches/HUD_HS16/src/modules/dialogue/Dialogue.layout (rev 0)
+++ code/branches/HUD_HS16/src/modules/dialogue/Dialogue.layout 2017-04-06 14:18:21 UTC (rev 11395)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<GUILayout >
+ <Window Type="DefaultWindow" Name="orxonox/PickupInventory/Background" >
+ <Property Name="InheritsAlpha" Value="False" />
+ <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+ <Window Type="MenuWidgets/StaticText" Name="orxonox/PickupInventory/PickupInventory" >
+ <Property Name="Text" Value="Pickup Inventory" />
+ <Property Name="Alpha" Value="0.8" />
+ <Property Name="InheritsAlpha" Value="False" />
+ <Property Name="HorzFormatting" Value="HorzCentred" />
+ <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+ <Property Name="VertFormatting" Value="TopAligned" />
+ <Property Name="UnifiedAreaRect" Value="{{0.15,0},{0.15,0},{0.85,0},{0.8,0}}" />
+ <Window Type="MenuWidgets/StaticText" Name="orxonox/PickupInventory/Wrapper" >
+ <Property Name="TextColours" Value="FF4444FF" />
+ <Property Name="InheritsAlpha" Value="False" />
+ <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+ <Property Name="HorzFormatting" Value="HorzCentred" />
+ <Property Name="VertFormatting" Value="TopAligned" />
+ <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.92,0}}" />
+ </Window>
+ </Window>
+ </Window>
+</GUILayout>
\ No newline at end of file
Added: code/branches/HUD_HS16/src/modules/dialogue/Dialogue.lua
===================================================================
--- code/branches/HUD_HS16/src/modules/dialogue/Dialogue.lua (rev 0)
+++ code/branches/HUD_HS16/src/modules/dialogue/Dialogue.lua 2017-04-06 14:18:21 UTC (rev 11395)
@@ -0,0 +1,31 @@
+local P = createMenuSheet("Dialogue Window")
+
+function P.onLoad()
+ P.createWindow()
+end
+
+
+
+
+
+function P.createWindow()
+
+ local question = orxonox.DialogueManager:getInstance():getquestion()
+ local default = (winMgr:createWindow("DefaultWindow"))
+ default:setText(question)
+ default:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}")
+ default:setProperty("UnifiedAreaRect", "{{0,0},{0,0},{1,0},{1,0}}")
+
+
+
+
+
+end
+--[[local numOptions = DialogueManager:getnumOptions()
+ local counter = 1
+ local offset = 0
+ --create and name buttons while there are still options
+ while counter <= numOptions do
+
+
+ end]]
Added: code/branches/HUD_HS16/src/modules/dialogue/DialogueManager.cc
===================================================================
--- code/branches/HUD_HS16/src/modules/dialogue/DialogueManager.cc (rev 0)
+++ code/branches/HUD_HS16/src/modules/dialogue/DialogueManager.cc 2017-04-06 14:18:21 UTC (rev 11395)
@@ -0,0 +1,89 @@
+#include "core/CoreIncludes.h"
+#include "core/LuaState.h"
+#include "core/GUIManager.h"
+#include "core/class/Identifier.h"
+#include "core/singleton/ScopedSingletonIncludes.h"
+#include "network/Host.h"
+#include "network/NetworkFunctionIncludes.h"
+#include "DialogueManager.h"
+#include "DialoguePrereqs.h"
+#include <vector>
+#include <string>
+#include "core/XMLPort.h"
+
+
+namespace orxonox {
+ //ManageScopedSingleton(DialogueManager, ScopeID::ROOT, false);
+ RegisterAbstractClass(DialogueManager).inheritsFrom<Configurable>();
+
+
+
+ DialogueManager* DialogueManager::singletonPtr_s =nullptr;
+
+ DialogueManager::DialogueManager(Context* context): BaseObject(context){
+ RegisterObject(DialogueManager);
+ this->setConfigValues();
+
+
+ }
+
+
+ /**
+ * @brief set the config values in the orxonox.ini file
+ */
+
+
+ void DialogueManager::setquestion(std::string question){
+ question=question;
+ }
+
+ std::string DialogueManager::getquestion(void){
+ return question;
+ }
+ void DialogueManager::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(DialogueManager, XMLPort, xmlelement, mode);
+
+ XMLPortParam(DialogueManager, "question", setquestion, getquestion, xmlelement, mode);
+ }
+
+ bool DialogueManager::execute(bool bTriggered, BaseObject* trigger)
+ {
+ //if(!bTriggered) return false;
+
+
+
+ orxout() << "bTriggered is " << bTriggered;
+ //orxout() << " 1 " << mystring << endl;
+ return false;
+ }
+
+ void DialogueManager::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(DialogueManager, XMLEventPort, xmlelement, mode);
+
+ XMLPortEventSink(DialogueManager, BaseObject, "execute", execute, xmlelement, mode);
+ }
+
+ /*std::string DialogueManager::setnpc(std::string npc){
+ return npc;
+ }
+
+
+
+ void DialogueManager::setanswers(std::string option1, std::string option2, std::string option3){
+ options.at(0)=option1;
+ options.at(1)=option2;
+ options.at(2)=option3;
+ }
+
+ vector<std::string> DialogueManager::getanswers(void){
+ return options;
+ }
+
+ int DialogueManager::getnumOptions(){
+ return options.size();
+ }
+
+ */
+}
\ No newline at end of file
Added: code/branches/HUD_HS16/src/modules/dialogue/DialogueManager.h
===================================================================
--- code/branches/HUD_HS16/src/modules/dialogue/DialogueManager.h (rev 0)
+++ code/branches/HUD_HS16/src/modules/dialogue/DialogueManager.h 2017-04-06 14:18:21 UTC (rev 11395)
@@ -0,0 +1,61 @@
+#include "core/CoreIncludes.h"
+#include "core/LuaState.h"
+#include "core/GUIManager.h"
+#include "core/class/Identifier.h"
+#include "core/singleton/ScopedSingletonIncludes.h"
+#include "network/Host.h"
+#include "network/NetworkFunctionIncludes.h"
+#include "DialoguePrereqs.h"
+#include "util/Singleton.h"
+#include <string>
+#include <vector>
+#include "OrxonoxPrereqs.h"
+#include "core/config/Configurable.h"
+#include "core/XMLPort.h"
+#include "core/EventIncludes.h"
+
+//tolua_begin
+namespace orxonox
+//tolua_end
+{//toluaexport
+ class _OrxonoxExport DialogueManager : public Singleton<DialogueManager>, public BaseObject
+ {
+ friend class Singleton<DialogueManager>;
+ //tolua_begin
+ public:
+
+ DialogueManager(Context* context); // tolua_export
+
+
+ static DialogueManager& getInstance() { return Singleton<DialogueManager>::getInstance(); }
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ void setquestion(std::string question);
+ std::string getquestion(void);
+
+
+ virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
+ bool execute(bool bTriggered, BaseObject* trigger);
+
+
+
+ /*std::string setnpc(std::string npc);
+
+ void setanswers(std::string option1, std::string option2, std::string option3);
+ std::vector <std::string> getanswers(void);
+
+ int getnumOptions();
+
+
+
+ std::string npc;
+ std::vector<std::string> options;
+ //tolua_end
+*/
+private:
+ std::string question;
+ static DialogueManager* singletonPtr_s;
+
+ };//toluaexport
+}
Added: code/branches/HUD_HS16/src/modules/dialogue/DialoguePrereqs.h
===================================================================
--- code/branches/HUD_HS16/src/modules/dialogue/DialoguePrereqs.h (rev 0)
+++ code/branches/HUD_HS16/src/modules/dialogue/DialoguePrereqs.h 2017-04-06 14:18:21 UTC (rev 11395)
@@ -0,0 +1,75 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ at file
+ at brief
+ Shared library macros, enums, constants and forward declarations for the questsystem module
+*/
+
+#ifndef _DialoguePrereqs_H__
+#define _DialoguePrereqs_H__
+
+#include "OrxonoxConfig.h"
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(Dialogue_STATIC_BUILD)
+# ifdef Dialogue_SHARED_BUILD
+# define _DialogueExport __declspec(dllexport)
+# else
+# if defined( __MINGW32__ )
+# define _DialogueExport
+# else
+# define _DialogueExport __declspec(dllimport)
+# endif
+# endif
+# define _DialoguePrivate
+#elif defined (ORXONOX_GCC_VISIBILITY)
+# define _DialogueExport __attribute__ ((visibility("default")))
+# define _DialoguePrivate __attribute__ ((visibility("hidden")))
+#else
+# define _DialogueExport
+# define _DialoguePrivate
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+
+ class DialogueManager;
+
+}
+
+#endif /* _DialoguePrereqs_H__ */
Added: code/branches/HUD_HS16/src/modules/dialogue/NextQuestion.cc
===================================================================
--- code/branches/HUD_HS16/src/modules/dialogue/NextQuestion.cc (rev 0)
+++ code/branches/HUD_HS16/src/modules/dialogue/NextQuestion.cc 2017-04-06 14:18:21 UTC (rev 11395)
@@ -0,0 +1,27 @@
+#include <vector>
+#include <string>
+
+#include "NextQuestion.h"
+#include "core/XMLPort.h"
+
+namespace orxonox{
+
+ RegisterClass(NextQuestion);
+
+ vector<NextQuestion> nextquestion;
+
+ void NextQuestion::setanswers(std::string option1, std::string option2, std::string option3){
+ options.at(0)=option1;
+ options.at(1)=option2;
+ options.at(2)=option3;
+ }
+
+ vector<std::string> NextQuestion::getanswers(void){
+ return options;
+ }
+
+ int NextQuestion::getnumOptions(){
+ return options.size();
+ }
+
+}
\ No newline at end of file
Added: code/branches/HUD_HS16/src/modules/dialogue/NextQuestion.h
===================================================================
--- code/branches/HUD_HS16/src/modules/dialogue/NextQuestion.h (rev 0)
+++ code/branches/HUD_HS16/src/modules/dialogue/NextQuestion.h 2017-04-06 14:18:21 UTC (rev 11395)
@@ -0,0 +1,12 @@
+#include <vector>
+#include <string>
+
+#include "core/XMLPort.h"
+
+namespace orxonox{
+ void setanswers(std::string option1, std::string option2, std::string option3);
+ std::vector <std::string> getanswers(void);
+
+ int getnumOptions();
+ std::vector<std::string> options;
+}
\ No newline at end of file
Modified: code/branches/HUD_HS16/src/modules/pickup/DDDialogue.cc
===================================================================
--- code/branches/HUD_HS16/src/modules/pickup/DDDialogue.cc 2017-04-06 14:17:58 UTC (rev 11394)
+++ code/branches/HUD_HS16/src/modules/pickup/DDDialogue.cc 2017-04-06 14:18:21 UTC (rev 11395)
@@ -8,6 +8,7 @@
RegisterClass(DDDialogue);
+
/**
@brief
Constructor. Registers and initializes the object.
@@ -17,11 +18,14 @@
RegisterObject(DDDialogue);
}
+ //getResponses
bool DDDialogue::execute(bool bTriggered, BaseObject* trigger)
{
if(!bTriggered) return false;
+
+
orxout() << "bTriggered is " << bTriggered;
orxout() << " 1 " << mystring << endl;
return false;
@@ -44,4 +48,6 @@
XMLPortEventSink(DDDialogue, BaseObject, "execute", execute, xmlelement, mode);
}
+
+
}
\ No newline at end of file
More information about the Orxonox-commit
mailing list