示例#1
0
        public frmEndGame(Team winner,frmGameStart f)
        {
            creator = f;
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            this.txtWinner.Text ="the winner is " + winner.teamName;
            this.lblTank1.Text = winner.tanks[0].name;
            this.lblTank2.Text = winner.tanks[1].name;
            this.lblTank3.Text = winner.tanks[2].name;
            this.lblTank4.Text = winner.tanks[3].name;

            this.label1.Text = "remaining health : " + winner.tanks[0].health.ToString();
            this.label2.Text = "remaining health : " + winner.tanks[1].health.ToString();
            this.label3.Text = "remaining health : " + winner.tanks[2].health.ToString();
            this.label4.Text = "remaining health : " + winner.tanks[3].health.ToString();

            this.progressBar1.Value = winner.tanks[0].health;
            this.progressBar2.Value = winner.tanks[1].health;
            this.progressBar3.Value = winner.tanks[2].health;
            this.progressBar4.Value = winner.tanks[3].health;

            //horisontalBarGraph1 = new horisontalBarGraph();
            //horisontalBarGraph1.setByValue(winner.tanks[0].health);
        }
示例#2
0
        public Game(frmGameStart s,Team[] t,string l)
        {
            // Start Menu The menu that Spawned this
            startMenu = s;
            // Game Teams The Teams that are playing this game
            gameTeams = t;
            // This initalises the formes neaded to producec the game screen
            weaponsMenu = new   frmWeaponsMenu(this);
            myTimer     = new   frmGameTimer(this);
            // This initalises the mdi container form for the game screen
            inGame      = new   frmGameContainer(this);
            //this initalises game level wich contains details on the level
            myGameScreen= new   frmGameScreen(this,l);
            //this sets the mdiParent the forms composing the game screen
            //to the inGame container form
            weaponsMenu.MdiParent  =      inGame;
            myGameScreen.MdiParent =      inGame;
            myTimer.MdiParent      =      inGame;
            top.MdiParent          =      inGame;
            //this tells the forms to show
            myGameScreen.Show();
            myTimer.Show();
            inGame.Show();
            top.Show();
            // this sets up the displays needed to show details
            for(int teamOn = 0; teamOn <= gameTeams.Length-1; teamOn++)
            {
                inGame.displays[teamOn].setTeamName(gameTeams[teamOn].teamName);
                this.gameTeams[teamOn].setCreator(this);
            }
            //this gives the myGameScreen object focus
            myGameScreen.Activate();
            nextTurn();
            nextTurn();
            //***************** ~~  NETWORKING ATTEMPT  ~~ ************************************************
            /*for(int t = this.gameTeams.Length-1;t >=0 ;t--)
            {
                if(!gameTeams[t].myClient.isLocal)
                    myServers[t] = new gameServer(this,gameTeams[t].myClient.mySocket,t);
            }
            if(myServer == null)
            {
                this.iAmClient = false;
            }
            else
            {
                iAmClient = true;
                this.ServerNetStream = myServer.GetStream();
                this.toServerWriter = new StreamWriter(ServerNetStream);
                this.fromServerReader = new StreamReader(ServerNetStream);

            }*/
            //*********************************************************************************************
            updateDisplay();
        }
 private void cmdPlayGame_Click(object sender, System.EventArgs e)
 {
     frmGameStart preGameScreen = new frmGameStart();
     this.Hide();
     preGameScreen.Show();
 }
示例#4
0
        //******************** ~~ This Contructor is only used for Networks ~~ ************************
        public Game(frmGameStart s,Team[] t,System.Net.Sockets.NetworkStream sns,string l)
        {
            /*//this is for a server or local game;
            //level = l;
            startMenu = s;
            for(int i = t.Length-1;i>=0;i--)
            {
                gameTeams[i] = t[i];
            }

            // This initalises the formes neaded to producec the game screen
            weaponsMenu = new frmWeaponsMenu(this);

            myTimer = new frmGameTimer(this);
            // This initalises the mdi container form for the game screen
            inGame = new frmGameContainer(this);
            //this initalises game level wich contains details on the level
            gameLevel = new Level();
            //this code initalises and populates the gameTeams array
            //which contains team objects
            //gameTeams = new Team[2];
            myGameScreen = new frmGameScreen(this,l);

            //this sets the mdiParent the forms composing the game screen
            //to the inGame container form
            weaponsMenu.MdiParent = inGame;
            myGameScreen.MdiParent = inGame;
            myTimer.MdiParent = inGame;
            //this tells the forms to show
            myGameScreen.Show();
            myTimer.Show();
            inGame.Show();
            for(int teamOn = 0; teamOn <= 1; teamOn++)
            {
                inGame.displays[teamOn].setTeamName(gameTeams[teamOn].teamName);
                this.gameTeams[teamOn].setCreator(this);
            }
            //this gives the myGameScreen object focus
            //myViewer.Show();
            top.MdiParent = inGame;
            top.Show();
            myGameScreen.Activate();
            nextTurn();
            nextTurn();
            */
            /*for(int t = this.gameTeams.Length-1;t >=0 ;t--)
            {
                if(!gameTeams[t].myClient.isLocal)
                    myServers[t] = new gameServer(this,gameTeams[t].myClient.mySocket,t);
            }
            */
            /*if(myServer == null)
            {
                this.iAmClient = false;
            }
            else
            {
                iAmClient = true;
                this.ServerNetStream = myServer.GetStream();
                this.toServerWriter = new StreamWriter(ServerNetStream);
                this.fromServerReader = new StreamReader(ServerNetStream);

            }
            */
            updateDisplay();
            //initViewControls();
            myServer = new Server(sns,this);
            startMenu = s;
            gameTeams = t;
            //gameTeams[1] = gameTeam2;
            // This initalises the formes neaded to producec the game screen
            weaponsMenu = new frmWeaponsMenu(this);
            myTimer = new frmGameTimer(this);
            // This initalises the mdi container form for the game screen
            inGame = new frmGameContainer(this);
            //this initalises game level wich contains details on the level
            //gameLevel = new Level();
            //this code initalises and populates the gameTeams array
            //which contains team objects
            //gameTeams = new Team[2];
            myGameScreen = new frmGameScreen(this,l);
            //this sets the mdiParent the forms composing the game screen
            //to the inGame container form
            weaponsMenu.MdiParent = inGame;
            myGameScreen.MdiParent = inGame;
            myTimer.MdiParent = inGame;
            //this tells the forms to show
            inGame.Show();
            myGameScreen.Show();
            myTimer.Show();
            inGame.Show();
            for(int teamOn = 0; teamOn <= 1; teamOn++)
            {
                inGame.displays[teamOn].setTeamName(gameTeams[teamOn].teamName);
                this.gameTeams[teamOn].setCreator(this);
            }
            //this gives the myGameScreen object focus
            //myViewer.Show();
            top.MdiParent = inGame;
            top.Show();
            myGameScreen.Activate();
            nextTurn();
            nextTurn();
            //myThreadStart = new ThreadStart(this.serverComm);
            //System.IAsyncResult m = null;
            //m = myThreadStart.BeginInvoke(new AsyncCallback(caller),null);
            this.gameTeams = t;
            iAmClient = true;
        }