Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10157


Ignore:
Timestamp:
Dec 5, 2014, 3:10:42 PM (9 years ago)
Author:
maxima
Message:

Changes of Phillip. He couldn't upload himself. New Campaign Menu added.

Location:
code/branches/storymodeHS14
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/storymodeHS14/data/gui/layouts/SingleplayerMenu.layout

    r9782 r10157  
    5353            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    5454            <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"/>
    5662        </Window>
    5763    </Window>
  • code/branches/storymodeHS14/data/gui/scripts/SingleplayerMenu.lua

    r9348 r10157  
    22
    33local P = createMenuSheet("SingleplayerMenu")
    4 P.loadAlong = {"ShipSelectionMenu"}
     4P.loadAlong = {"ShipSelectionMenu","CampaignMenu"}
    55P.levelList = {}
    66P.activeTabIndexes = {}
     
    1919    P.createFilterTab("Tests", "test")
    2020    P.createFilterTab("Show All", nil)
     21   
    2122
    2223    -- update description and screenshot boxes
    2324    P.SingleplayerSelectionChanged()
    2425
    25     --buttons are arranged in a 1x3 matrix
     26    --buttons are arranged in a 1x4 matrix
    2627    P:setButton(1, 1, {
    2728            ["button"] = winMgr:getWindow("orxonox/SingleplayerStartButton"),
     
    3738            ["button"] = winMgr:getWindow("orxonox/SingleplayerBackButton"),
    3839            ["callback"]  = P.SingleplayerBackButton_clicked
     40    })
     41    P:setButton(1, 4,{
     42                ["button"] = winMgr:getWindow("orxonox/CampaignButton"),
     43                ["callback"] = P.CampaignButton_clicked
    3944    })
    4045end
     
    166171end
    167172
     173function P.CampaignButton_clicked(e)
     174        showMenuSheet("CampaignMenu", true)
     175end
     176
    168177return P
  • code/branches/storymodeHS14/src/orxonox/gametypes/Mission.cc

    r9986 r10157  
    3636#include "network/Host.h"
    3737#include "worldentities/pawns/Pawn.h"
    38 
     38#include <iostream>
     39#include <fstream>
     40#include <string>
     41#include <ios>
    3942
    4043namespace orxonox
     
    7881    void Mission::start()
    7982    {
     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();
    80108        Gametype::start();
    81109        this->setTeams();
     
    84112    }
    85113
     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
    86124    void Mission::end()
    87125    {
    88         if (this->missionAccomplished_ && !this->gtinfo_->hasEnded())
     126
     127        if (this->missionAccomplished_ && !this->gtinfo_->hasEnded()){
    89128            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
    90153        else if (!this->gtinfo_->hasEnded())
    91154            this->gtinfo_->sendAnnounceMessage("Mission failed!");
     
    106169        for (ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it)
    107170        {//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);
    109197            it->end();
    110         }
    111     }
    112    
     198
     199        }
     200    }
     201
    113202    void Mission::setLivesWrapper(unsigned int amount)
    114203    {
Note: See TracChangeset for help on using the changeset viewer.