source:
orxonox.OLD/branches/script_engine/src/lib/script_engine/script_manager.h
@
8173
Last change on this file since 8173 was 8171, checked in by snellen, 18 years ago | |
---|---|
File size: 1.5 KB |
Rev | Line | |
---|---|---|
[8085] | 1 | #ifndef _SCRIPT_MANAGER_H |
[8170] | 2 | #define _SCRIPT_MANAGER_H |
[8085] | 3 | |
[8131] | 4 | #include <list> |
[8085] | 5 | #include <string> |
[8093] | 6 | |
[8131] | 7 | #include "script.h" |
[8085] | 8 | #include "base_object.h" |
9 | #include "luaincl.h" | |
[8093] | 10 | #include "loading/load_param.h" |
[8085] | 11 | |
12 | ||
[8155] | 13 | //!< Contains the name of a lua script file and a list of all objects that the script needs |
14 | struct LuaScript | |
[8131] | 15 | { |
16 | std::string name; | |
[8155] | 17 | std::list<std::string> objectList; |
18 | Script script; | |
[8131] | 19 | }; |
[8085] | 20 | |
[8163] | 21 | class ScriptManager : public BaseObject |
[8085] | 22 | { |
23 | public: | |
[8139] | 24 | ScriptManager(); |
[8136] | 25 | ~ScriptManager(); |
[8085] | 26 | |
[8171] | 27 | inline static ScriptManager* getInstance(){if (!ScriptManager::singletonRef)ScriptManager::singletonRef = new ScriptManager();return ScriptManager::singletonRef;} |
[8138] | 28 | |
[8155] | 29 | virtual void loadParams(const TiXmlElement* root); |
[8163] | 30 | void setWorld(const std::string& world) {currentWorld = world;} |
[8085] | 31 | |
[8137] | 32 | void tick(float timestep); |
[8085] | 33 | |
[8131] | 34 | void initScripts(); // initializes all scripts |
[8171] | 35 | Script* getScriptByFile(std::string& file); |
[8131] | 36 | |
[8085] | 37 | private: |
[8138] | 38 | |
[8155] | 39 | void init(); |
[8157] | 40 | void createScriptList(const TiXmlElement* scripts); |
[8163] | 41 | void setCurrentScriptFile(const std::string& file); |
[8164] | 42 | void addObjectToScript(const std::string object); |
[8085] | 43 | |
[8163] | 44 | bool fileIsInScriptList(const std::string& file); |
45 | bool objectIsInObjectList(const std::string& object, const LuaScript& script); | |
[8085] | 46 | |
[8131] | 47 | |
[8155] | 48 | static ScriptManager* singletonRef; //!< Reference to this class |
49 | std::list<LuaScript> scriptList; //!< The list of all scripts that the current world needs | |
50 | std::string currentWorld; | |
51 | LuaScript currentScript; //!< For temorary use | |
52 | ||
53 | ||
54 | ||
[8085] | 55 | }; |
56 | #endif |
Note: See TracBrowser
for help on using the repository browser.