Changeset 8700
- Timestamp:
- Jun 6, 2011, 8:15:38 AM (13 years ago)
- Location:
- code/branches/presentation
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/data/gui/layouts/DockingDialog.layout
r8643 r8700 2 2 3 3 <GUILayout > 4 <Window Type="MenuWidgets/StaticImage" Name="orxonox/Docking Background" >4 <Window Type="MenuWidgets/StaticImage" Name="orxonox/Docking/Background" > 5 5 <Property Name="FrameEnabled" Value="False" /> 6 6 <Property Name="InheritsAlpha" Value="False" /> … … 8 8 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" /> 9 9 <Property Name="BackgroundEnabled" Value="False" /> 10 <Window Type="MenuWidgets/StaticText" Name="orxonox/Docking Title" >10 <Window Type="MenuWidgets/StaticText" Name="orxonox/Docking/Title" > 11 11 <Property Name="Text" Value="Docking" /> 12 12 <Property Name="Alpha" Value="0.8" /> … … 16 16 <Property Name="VertFormatting" Value="TopAligned" /> 17 17 <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.2875,0},{0.75,0},{0.7,0}}" /> 18 <Window Type="MenuWidgets/Listbox" Name="orxonox/Docking Docks" >18 <Window Type="MenuWidgets/Listbox" Name="orxonox/Docking/Docks" > 19 19 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 20 20 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.85,0}}" /> 21 21 </Window> 22 22 </Window> 23 <Window Type="MenuWidgets/Button" Name="orxonox/Docking DockButton" >23 <Window Type="MenuWidgets/Button" Name="orxonox/Docking/DockButton" > 24 24 <Property Name="Text" Value="Dock" /> 25 25 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> … … 27 27 <Event Name="Clicked" Function="DockingDialog.dockButton_clicked"/> 28 28 </Window> 29 <Window Type="MenuWidgets/Button" Name="orxonox/Docking CancelButton" >29 <Window Type="MenuWidgets/Button" Name="orxonox/Docking/CancelButton" > 30 30 <Property Name="Text" Value="Cancel" /> 31 31 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> -
code/branches/presentation/data/gui/scripts/DockingDialog.lua
r8643 r8700 9 9 --button are arranged in a 1x2 matrix 10 10 P:setButton(1, 1, { 11 ["button"] = winMgr:getWindow("orxonox/Docking DockButton"),11 ["button"] = winMgr:getWindow("orxonox/Docking/DockButton"), 12 12 ["callback"] = P.dockButton_clicked 13 13 }) 14 14 15 15 P:setButton(1, 2, { 16 ["button"] = winMgr:getWindow("orxonox/Docking CancelButton"),16 ["button"] = winMgr:getWindow("orxonox/Docking/CancelButton"), 17 17 ["callback"] = P.cancelButton_clicked 18 18 }) … … 37 37 end 38 38 39 local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/Docking Docks"))39 local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/Docking/Docks")) 40 40 listbox:resetList() 41 41 … … 51 51 52 52 function P.dockButton_clicked(e) 53 local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/Docking Docks"))53 local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/Docking/Docks")) 54 54 local choice = listbox:getFirstSelectedItem() 55 55 if choice ~= nil then -
code/branches/presentation/data/levels/presentationFS11.oxw
r8684 r8700 139 139 <!-- PARTICLE EFFECT --> 140 140 141 <ParticleSpawner position="-50,50,-125" source="Orxonox/RingExp" autostart="false" lifetime=500 loop=1 startdelay= 7.5>141 <ParticleSpawner position="-50,50,-125" source="Orxonox/RingExp" autostart="false" lifetime=500 loop=1 startdelay=2.5> 142 142 <events> 143 143 <spawn> 144 <EventListener event=spawn trigger/>144 <EventListener event=spawndelaytrigger1 /> 145 145 </spawn> 146 146 </events> 147 147 </ParticleSpawner> 148 <ParticleSpawner position="-50,50,-125" source="Orxonox/RingExp2" autostart="false" lifetime=500 loop=1 startdelay= 7>148 <ParticleSpawner position="-50,50,-125" source="Orxonox/RingExp2" autostart="false" lifetime=500 loop=1 startdelay=2> 149 149 <events> 150 150 <spawn> 151 <EventListener event=spawn trigger/>151 <EventListener event=spawndelaytrigger1 /> 152 152 </spawn> 153 153 </events> 154 154 </ParticleSpawner> 155 <ParticleSpawner position="-50,50,-125" source="Orxonox/RingExp3" autostart="false" lifetime=500 loop=1 startdelay= 7>155 <ParticleSpawner position="-50,50,-125" source="Orxonox/RingExp3" autostart="false" lifetime=500 loop=1 startdelay=2> 156 156 <events> 157 157 <spawn> 158 <EventListener event=spawn trigger/>158 <EventListener event=spawndelaytrigger1 /> 159 159 </spawn> 160 160 </events> -
code/branches/presentation/src/modules/docking/Dock.cc
r8667 r8700 63 63 } 64 64 65 66 65 void Dock::XMLPort(Element& xmlelement, XMLPort::Mode mode) 67 66 { … … 79 78 XMLPortEventSink(Dock, BaseObject, "execute", execute, xmlelement, mode); 80 79 } 81 82 80 83 81 bool Dock::execute(bool bTriggered, BaseObject* trigger) … … 109 107 { 110 108 // Add player to this Docks candidates 111 candidates .insert(player);109 candidates_.insert(player); 112 110 113 111 // Show docking dialog … … 117 115 { 118 116 // Remove player from candidates list 119 candidates.erase(player); 120 } 121 122 return true; 123 } 124 117 candidates_.erase(player); 118 } 119 120 return true; 121 } 125 122 126 123 void Dock::cmdDock() … … 144 141 } 145 142 146 147 143 bool Dock::dock(PlayerInfo* player) 148 144 { 149 145 // Check if player is a candidate 150 if(candidates .find(player) == candidates.end())146 if(candidates_.find(player) == candidates_.end()) 151 147 { 152 148 COUT(2) << "Dock::dock Player is not a candidate!" << std::endl; … … 154 150 } 155 151 156 candidates .erase(player);157 docked .insert(player);158 159 if (animations .empty())152 candidates_.erase(player); 153 docked_.insert(player); 154 155 if (animations_.empty()) 160 156 return dockingAnimationFinished(player); 161 157 else 162 DockingAnimation::invokeAnimation(true, player, animations );158 DockingAnimation::invokeAnimation(true, player, animations_); 163 159 164 160 return true; … … 167 163 bool Dock::dockingAnimationFinished(PlayerInfo* player) 168 164 { 169 if(docked .find(player) == docked.end())165 if(docked_.find(player) == docked_.end()) 170 166 { 171 167 COUT(2) << "Dock::dockingAnimationFinished Player is not currently docked." << std::endl; … … 173 169 } 174 170 175 DockingEffect::invokeEffect(true, player, effects );171 DockingEffect::invokeEffect(true, player, effects_); 176 172 return true; 177 173 } … … 180 176 { 181 177 // Check if player is docked to this Dock 182 if(docked .find(player) == docked.end())178 if(docked_.find(player) == docked_.end()) 183 179 { 184 180 COUT(2) << "Dock::undock Player is not docked to this Dock." << std::endl; … … 186 182 } 187 183 188 docked .erase(player);189 candidates .insert(player);190 191 DockingEffect::invokeEffect(false, player, effects );192 193 if (animations .empty())184 docked_.erase(player); 185 candidates_.insert(player); 186 187 DockingEffect::invokeEffect(false, player, effects_); 188 189 if (animations_.empty()) 194 190 return undockingAnimationFinished(player); 195 191 else 196 DockingAnimation::invokeAnimation(false, player, animations );192 DockingAnimation::invokeAnimation(false, player, animations_); 197 193 198 194 return true; … … 204 200 } 205 201 206 207 202 unsigned int Dock::getNumberOfActiveDocks() 208 203 { … … 211 206 for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it) 212 207 { 213 if(it->candidates .find(player) != it->candidates.end())208 if(it->candidates_.find(player) != it->candidates_.end()) 214 209 i++; 215 210 } … … 222 217 for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it) 223 218 { 224 if(it->candidates .find(player) != it->candidates.end())219 if(it->candidates_.find(player) != it->candidates_.end()) 225 220 { 226 221 if(index == 0) … … 232 227 } 233 228 234 235 229 bool Dock::addEffect(DockingEffect* effect) 236 230 { 237 231 assert(effect); 238 effects .push_back(effect);232 effects_.push_back(effect); 239 233 return true; 240 234 } … … 242 236 const DockingEffect* Dock::getEffect(unsigned int i) const 243 237 { 244 for (std::list<DockingEffect*>::const_iterator effect = this->effects .begin(); effect != this->effects.end(); ++effect)238 for (std::list<DockingEffect*>::const_iterator effect = this->effects_.begin(); effect != this->effects_.end(); ++effect) 245 239 { 246 240 if(i == 0) … … 255 249 assert(animation); 256 250 animation->setParent(this); 257 animations .push_back(animation);251 animations_.push_back(animation); 258 252 return true; 259 253 } … … 261 255 const DockingAnimation* Dock::getAnimation(unsigned int i) const 262 256 { 263 for (std::list<DockingAnimation*>::const_iterator animation = this->animations .begin(); animation != this->animations.end(); ++animation)257 for (std::list<DockingAnimation*>::const_iterator animation = this->animations_.begin(); animation != this->animations_.end(); ++animation) 264 258 { 265 259 if(i == 0) … … 270 264 } 271 265 } 272 -
code/branches/presentation/src/modules/docking/Dock.h
r8645 r8700 55 55 : public StaticEntity 56 56 { // tolua_export 57 public:58 Dock(BaseObject* creator);59 virtual ~Dock();57 public: 58 Dock(BaseObject* creator); 59 virtual ~Dock(); 60 60 61 // Trigger interface62 bool execute(bool bTriggered, BaseObject* trigger);61 // Trigger interface 62 bool execute(bool bTriggered, BaseObject* trigger); 63 63 64 // XML interface65 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);66 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);64 // XML interface 65 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 66 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode); 67 67 68 // XML functions69 bool addEffect(DockingEffect* effect); //!< Add a DockingEffect to the Dock.70 const DockingEffect* getEffect(unsigned int index) const; //!< Get the DockingEffect at a given index.71 bool addAnimation(DockingAnimation* animation); //!< Add a DockingAnimation to the Dock.72 const DockingAnimation* getAnimation(unsigned int index) const; //!< Get the DockingAnimation at a given index.68 // XML functions 69 bool addEffect(DockingEffect* effect); //!< Add a DockingEffect to the Dock. 70 const DockingEffect* getEffect(unsigned int index) const; //!< Get the DockingEffect at a given index. 71 bool addAnimation(DockingAnimation* animation); //!< Add a DockingAnimation to the Dock. 72 const DockingAnimation* getAnimation(unsigned int index) const; //!< Get the DockingAnimation at a given index. 73 73 74 // Docking/undocking logic, checks conditions and invokes the DockingAnimations75 bool dock(PlayerInfo* player); //!< Returns true if given player docked successfully (player must be a candidate)76 bool undock(PlayerInfo* player); //!< Undocks a player (player must be docked)74 // Docking/undocking logic, checks conditions and invokes the DockingAnimations 75 bool dock(PlayerInfo* player); //!< Returns true if given player docked successfully (player must be a candidate) 76 bool undock(PlayerInfo* player); //!< Undocks a player (player must be docked) 77 77 78 // Animation logic79 bool dockingAnimationFinished(PlayerInfo* player); //!< Called when a docking animation finished80 bool undockingAnimationFinished(PlayerInfo* player); //!< Called when a undocking animation finished78 // Animation logic 79 bool dockingAnimationFinished(PlayerInfo* player); //!< Called when a docking animation finished 80 bool undockingAnimationFinished(PlayerInfo* player); //!< Called when a undocking animation finished 81 81 82 // LUA interface 83 void dock() { this->dock(HumanController::getLocalControllerSingleton()->getPlayer()); } // tolua_export 84 static unsigned int getNumberOfActiveDocks(); // tolua_export 85 static Dock* getActiveDockAtIndex(unsigned int index); // tolua_export 82 // LUA interface 83 // tolua_begin 84 void dock() 85 { this->dock(HumanController::getLocalControllerSingleton()->getPlayer()); } 86 static unsigned int getNumberOfActiveDocks(); 87 static Dock* getActiveDockAtIndex(unsigned int index); 88 // tolua_end 86 89 87 // Console commands88 static void cmdDock();89 static void cmdUndock();90 // Console commands 91 static void cmdDock(); 92 static void cmdUndock(); 90 93 91 private:92 std::set<PlayerInfo*> candidates; //!< A set of all players which are allowed to dock using the console command.93 std::set<PlayerInfo*> docked; //!< A set of all docked players94 private: 95 std::set<PlayerInfo*> candidates_; //!< A set of all players which are allowed to dock using the console command. 96 std::set<PlayerInfo*> docked_; //!< A set of all docked players 94 97 95 std::list<DockingEffect*> effects; //!< The list of DockingEffects to be executed when a player docks.96 std::list<DockingAnimation*> animations; //!< The list of DockingAnimations to be executed before a player docks98 std::list<DockingEffect*> effects_; //!< The list of DockingEffects to be executed when a player docks. 99 std::list<DockingAnimation*> animations_; //!< The list of DockingAnimations to be executed before a player docks 97 100 }; // tolua_export 98 101 } // tolua_export -
code/branches/presentation/src/modules/docking/DockingTarget.cc
r8645 r8700 49 49 } 50 50 51 52 51 void DockingTarget::XMLPort(Element& xmlelement, XMLPort::Mode mode) 53 52 { 54 53 SUPER(DockingTarget, XMLPort, xmlelement, mode); 55 XMLPortParam(DockingTarget, "name", setName, getName, xmlelement, mode);56 54 57 55 COUT(4) << "DockingTarget with name '" << this->getName() << "' created.." << std::endl; 58 56 } 59 57 60 61 void DockingTarget::setName(const std::string& str) {62 this->name_ = str;63 }64 65 const std::string& DockingTarget::getName() const {66 return this->name_;67 }68 58 } 69 59 -
code/branches/presentation/src/modules/docking/DockingTarget.h
r8645 r8700 54 54 class _DockingExport DockingTarget : public StaticEntity 55 55 { 56 private:57 std::string name_;58 59 56 public: 60 57 DockingTarget(BaseObject* creator); … … 63 60 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 64 61 65 virtual void setName(const std::string& str);66 virtual const std::string& getName() const;67 62 }; 68 63
Note: See TracChangeset
for help on using the changeset viewer.