Beispiel #1
0
        //enables gametimer again when it becomes the main usercontrol (for returning from other screens)
        private void TownScreen_Enter(object sender, EventArgs e)
        {
            gameTimer.Enabled = true;
            Thread.Sleep(400);

            #region set up xml reader
            reader = XmlReader.Create("Resources/Player.xml");

            reader.ReadToFollowing("Save");

            cOutcome = reader.GetAttribute("calum");
            fOutcome = reader.GetAttribute("franky");

            reader.Close();
            #endregion

            #region initializing object recs
            objectRecs.Clear();
            //library (0)
            objectRecs.Add(new Rectangle(objects[0].x + (this.Width / 32) * 9, objects[0].y + buildingHeight, 140, 20));

            //arlos(1)
            objectRecs.Add(new Rectangle(objects[1].x + (this.Width / 32) * 9, objects[1].y, 110, 20));

            //appartments(2-5)
            objectRecs.Add(new Rectangle(objects[2].x + (this.Width / 32) * 2, objects[2].y + buildingHeight, 100, 20));
            objectRecs.Add(new Rectangle(objects[2].x + (this.Width / 8) * 5, objects[2].y + buildingHeight, 100, 20));
            objectRecs.Add(new Rectangle(objects[2].x + (this.Width / 16) * 13, objects[2].y + buildingHeight, 100, 20));
            objectRecs.Add(new Rectangle(objects[2].x + (this.Width / 16) * 22, objects[2].y + buildingHeight, 100, 20));

            //characters (6-8)
            objectRecs.Add(new Rectangle(objects[4].x, objects[4].y, objects[4].width, objects[4].height));
            objectRecs.Add(new Rectangle(objects[5].x, objects[5].y, objects[5].width, objects[5].height));
            objectRecs.Add(new Rectangle(objects[6].x, objects[6].y, objects[6].width, objects[6].height));

            #endregion

            #region coming from battlescreen

            #region Franky

            //if you defeat Franky
            if (fOutcome == "spared" || fOutcome == "killed")
            {
                gameTimer.Enabled = false;

                WinScreen ws   = new WinScreen();
                Form      form = this.FindForm();

                form.Controls.Add(ws);
                form.Controls.Remove(this);
            }

            #endregion

            #region Callum
            //coming out of battlescreen and if you spared callum
            if (noriRec.IntersectsWith(objectRecs[7]) && cOutcome == "spared")
            {
                textNum     = 8;
                displayText = true;
                spaceDown   = false;
            }

            //coming out of battlescreen and if you killed callum
            if (noriRec.IntersectsWith(objectRecs[7]) && cOutcome == "killed")
            {
                textNum     = 9;
                displayText = true;
                spaceDown   = false;

                Thread.Sleep(200);
                objects[5] = new Object(0, 0, 0, 0, Properties.Resources.Calum_WS);
            }
            #endregion
            #endregion
        }