- Timestamp:
- May 9, 2019, 3:29:29 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxScore.cc
r12266 r12359 35 35 36 36 #include "core/CoreIncludes.h" 37 #include "core/XMLPort.h"38 37 #include "util/Convert.h" 39 38 … … 41 40 42 41 #include "OrxoBlox.h" 43 #include "sound/WorldSound.h" /////////////////////////////44 42 45 43 namespace orxonox … … 56 54 57 55 this->owner_ = nullptr; 58 59 this->bShowName_ = true; 60 this->bShowScore_ = true; 61 this->bShowPlayer_ = true; 62 } 56 this->player_ = nullptr; 63 57 64 58 /** … … 70 64 } 71 65 72 /** 73 @brief 74 Method to create a OrxoBloxScore through XML. 75 */ 76 void OrxoBloxScore::XMLPort(Element& xmlelement, XMLPort::Mode mode) 77 { 78 SUPER(OrxoBloxScore, XMLPort, xmlelement, mode); 79 80 XMLPortParam(OrxoBloxScore, "showname", setShowName, getShowName, xmlelement, mode).defaultValues(false); 81 XMLPortParam(OrxoBloxScore, "showscore", setShowScore, getShowScore, xmlelement, mode).defaultValues(false); 82 XMLPortParam(OrxoBloxScore, "showplayer", setShowPlayer, getShowPlayer, xmlelement, mode).defaultValues(false); 83 } 84 66 85 67 /** 86 68 @brief … … 97 79 if (this->owner_ != nullptr) 98 80 { 99 if (!this->owner_->hasEnded()) 81 std::string score("0"); 82 if(!this->owner_->hasEnded()) 100 83 { 101 // Get the player. 102 //Fehlermeldung 103 //player1_ = this->owner_->getPlayer(); 84 //get the player 85 player_ = this->owner_->getPlayer(); 104 86 } 105 87 106 std::string name1; 107 108 std::string score1("0"); 109 110 // Save the name and score of each player as a string. 111 if (player1_ != nullptr) 88 if(this->owner_->hasStarted()) 112 89 { 113 name1 = player1_->getName(); 114 score1 = multi_cast<std::string>(this->owner_->getScore(player1_)); 90 // Save the name and score of each player as a string. 91 if (player_ != nullptr) 92 score = multi_cast<std::string>(this->owner_->getScore(player_)); 115 93 } 116 117 // Assemble the strings, depending on what should all be displayed. 118 std::string output1; 119 if (this->bShowPlayer_) 120 { 121 if (this->bShowName_ && this->bShowScore_ && player1_ != nullptr) 122 output1 = name1 + " - " + score1; 123 else if (this->bShowScore_) 124 output1 = score1; 125 else if (this->bShowName_) 126 output1 = name1; 127 } 128 129 std::string output("OrxoBlox"); 130 /* Keine Ahnung wofuer das gut ist. 131 132 if (this->bShowName_ || this->bShowScore_) 133 { 134 if (this->bShowLeftPlayer_ && this->bShowRightPlayer_) 135 output = output1 + ':' + output2; 136 else if (this->bShowLeftPlayer_ || this->bShowRightPlayer_) 137 output = output1 + output2; 138 }*/ 139 140 this->setCaption(output); 94 this->setCaption(score); 141 95 } 142 96 }
Note: See TracChangeset
for help on using the changeset viewer.