public aboutmenu(Game1 game) { this.game = game; back = new button(0, game); }
public settingsmenu(Game1 game) { this.game = game; back = new button(0, game); }
public void checkbuttons() { if(button==null){ button = new button[6]; button[0] = new button(1, game); button[1] = new button(2, game); button[2] = new button(3, game); button[3] = new button(4, game); button[4] = new button(5, game); button[5] = new button(6, game); } if (button[0].ispressed(game.touch) == true) { game.statemenager.changestate(Game); } if (button[1].ispressed(game.touch) == true) { game.currentgame = new GAME(game); game.statemenager.currentstate = 10; } if (button[2].ispressed(game.touch) == true) { game.statemenager.changestate(Settings); } if (button[3].ispressed(game.touch) == true) { game.statemenager.changestate(Hiscores); } if (button[4].ispressed(game.touch) == true) { game.statemenager.changestate(About); } if (button[5].ispressed(game.touch) == true) { game.Exit(); } }
public void drawbuttons() { if (button == null) { button = new button[6]; button[0] = new button(1, game); button[1] = new button(2, game); button[2] = new button(3, game); button[3] = new button(4, game); button[4] = new button(5, game); button[5] = new button(6, game); } foreach(button b in button){ b.draw(); } }
public hiscoremenu(Game1 game) { scores = new int[5]; this.game = game; back = new button(0, game); string datafolder = "Data"; string filename = "scores.txt"; bool freshfolder = false; using(IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication()) { string filepath = System.IO.Path.Combine(datafolder, filename); if (file.FileExists(filepath)==false) { file.CreateDirectory(datafolder); freshfolder = true; } if (freshfolder==true) { using (IsolatedStorageFileStream s = file.CreateFile(filepath)) { StreamWriter writer = new StreamWriter(s); writer.WriteLine("0"); writer.WriteLine("0"); writer.WriteLine("0"); writer.WriteLine("0"); writer.WriteLine("0"); writer.Close(); } } using (IsolatedStorageFileStream s2 = file.OpenFile(filepath, System.IO.FileMode.Open)) { StreamReader reader = new StreamReader(s2); scores[0] = Convert.ToInt32(reader.ReadLine()); scores[1] = Convert.ToInt32(reader.ReadLine()); scores[2] = Convert.ToInt32(reader.ReadLine()); scores[3] = Convert.ToInt32(reader.ReadLine()); scores[4] = Convert.ToInt32(reader.ReadLine()); reader.Close(); } } }