Changeset 10157 for code/branches/storymodeHS14
- Timestamp:
- Dec 5, 2014, 3:10:42 PM (10 years ago)
- Location:
- code/branches/storymodeHS14
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/storymodeHS14/data/gui/layouts/SingleplayerMenu.layout
r9782 r10157 53 53 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 54 54 <Property Name="UnifiedAreaRect" Value="{{0.6,0},{0.725,0},{0.75,0},{0.775,0}}" /> 55 <Event Name="Clicked" Function="SingleplayerMenu.SingleplayerBackButton_clicked"/> 55 <Event Name="Clicked" Function="SingleplayerMenu.SingleplayerBackButton_clicked"/> 56 </Window> 57 <Window Type="MenuWidgets/Button" Name="orxonox/CampaignButton" > 58 <Property Name="Text" Value="Campaign" /> 59 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 60 <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.8,0},{0.6,0},{0.85,0}}" /> 61 <Event Name="Clicked" Function="SingleplayerMenu.CampaignButton_clicked"/> 56 62 </Window> 57 63 </Window> -
code/branches/storymodeHS14/data/gui/scripts/SingleplayerMenu.lua
r9348 r10157 2 2 3 3 local P = createMenuSheet("SingleplayerMenu") 4 P.loadAlong = {"ShipSelectionMenu" }4 P.loadAlong = {"ShipSelectionMenu","CampaignMenu"} 5 5 P.levelList = {} 6 6 P.activeTabIndexes = {} … … 19 19 P.createFilterTab("Tests", "test") 20 20 P.createFilterTab("Show All", nil) 21 21 22 22 23 -- update description and screenshot boxes 23 24 P.SingleplayerSelectionChanged() 24 25 25 --buttons are arranged in a 1x 3matrix26 --buttons are arranged in a 1x4 matrix 26 27 P:setButton(1, 1, { 27 28 ["button"] = winMgr:getWindow("orxonox/SingleplayerStartButton"), … … 37 38 ["button"] = winMgr:getWindow("orxonox/SingleplayerBackButton"), 38 39 ["callback"] = P.SingleplayerBackButton_clicked 40 }) 41 P:setButton(1, 4,{ 42 ["button"] = winMgr:getWindow("orxonox/CampaignButton"), 43 ["callback"] = P.CampaignButton_clicked 39 44 }) 40 45 end … … 166 171 end 167 172 173 function P.CampaignButton_clicked(e) 174 showMenuSheet("CampaignMenu", true) 175 end 176 168 177 return P -
code/branches/storymodeHS14/src/orxonox/gametypes/Mission.cc
r9986 r10157 36 36 #include "network/Host.h" 37 37 #include "worldentities/pawns/Pawn.h" 38 38 #include <iostream> 39 #include <fstream> 40 #include <string> 41 #include <ios> 39 42 40 43 namespace orxonox … … 78 81 void Mission::start() 79 82 { 83 std::fstream myfile; 84 myfile.open("/home/pmao/pmao-extra-0/orxonox/storymodeHS14/data/gui/scripts/campaign.txt"); 85 std::string line; 86 std::string mission=this->getFilename(); 87 int k=58-mission.length(); 88 std::string helperstring = ""; 89 if(myfile.is_open()){ 90 while (k>1) { 91 helperstring=helperstring+" "; 92 k=k-1; 93 } 94 helperstring=helperstring+"."; 95 while(getline (myfile,line)){ 96 if(line==mission+" 0"+helperstring){ 97 long pos = myfile.tellp(); 98 myfile.seekp (pos-61); 99 myfile << mission+" 1"+helperstring; 100 } 101 }} 102 else{ 103 this->end(); 104 } 105 myfile.flush(); 106 myfile.clear(); 107 myfile.close(); 80 108 Gametype::start(); 81 109 this->setTeams(); … … 84 112 } 85 113 114 std::string GenerateHelperString(int number){ 115 std::string helperstring = ""; 116 while (number>1) { 117 helperstring=helperstring+" "; 118 number=number-1; 119 } 120 helperstring=helperstring+"."; 121 return helperstring; 122 } 123 86 124 void Mission::end() 87 125 { 88 if (this->missionAccomplished_ && !this->gtinfo_->hasEnded()) 126 127 if (this->missionAccomplished_ && !this->gtinfo_->hasEnded()){ 89 128 this->gtinfo_->sendAnnounceMessage("Mission accomplished!"); 129 std::fstream myfile; 130 myfile.open("/home/pmao/pmao-extra-0/orxonox/storymodeHS14/data/gui/scripts/campaign.txt"); 131 std::string line; 132 std::string mission=this->getFilename(); 133 int k=58-mission.length(); 134 std::string helperstring = ""; 135 if(myfile.is_open()){ 136 while (k>1) { 137 helperstring=helperstring+" "; 138 k=k-1; 139 } 140 helperstring=helperstring+"."; 141 while(getline (myfile,line)){ 142 if(line==mission+" 0"+helperstring){ 143 long pos = myfile.tellp(); 144 myfile.seekp (pos-61); 145 myfile << mission+" 1"+helperstring; 146 } 147 }} 148 myfile.flush(); 149 myfile.clear(); 150 myfile.close(); 151 } 152 90 153 else if (!this->gtinfo_->hasEnded()) 91 154 this->gtinfo_->sendAnnounceMessage("Mission failed!"); … … 106 169 for (ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it) 107 170 {//TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would end ALL missions! 108 it->setMissionAccomplished(accomplished); 171 if(accomplished){ 172 std::fstream myfile; 173 myfile.open("/home/pmao/pmao-extra-0/orxonox/storymodeHS14/data/gui/scripts/campaign.txt"); 174 std::string line; 175 std::string mission=it->getFilename(); 176 int k=58-mission.length(); 177 std::string helperstring = ""; 178 if(myfile.is_open()){ 179 while (k>1) { 180 helperstring=helperstring+" "; 181 k=k-1; 182 } 183 helperstring=helperstring+"."; 184 while(getline (myfile,line)){ 185 if(line==mission+" 0"+helperstring){ 186 long pos = myfile.tellp(); 187 myfile.seekp (pos-61); 188 myfile << mission+" 1"+helperstring; 189 } 190 } 191 } 192 myfile.flush(); 193 myfile.clear(); 194 myfile.close(); 195 } 196 it->setMissionAccomplished(accomplished); 109 197 it->end(); 110 } 111 } 112 198 199 } 200 } 201 113 202 void Mission::setLivesWrapper(unsigned int amount) 114 203 {
Note: See TracChangeset
for help on using the changeset viewer.