/// <summary> /// Called when New Game is clicked /// </summary> public World(GameForm gf,string mapname) { Player = new Tower_Defense.Player(); Gameform = gf; Map = new Level(mapname); UIElements.Add(new Button("Next Wave", gf.Width - 425, 5,150,50)); UIElements.Add(new Button("Pause Game", gf.Width - 275, 5,150,50)); UIElements.Add(new Button("Exit", gf.Width - 125, 5, 100, 50)); UIElements.Add(new Button("Speed", gf.Width - 575, 5, 150, 50)); BuildMenu = new Tower_Defense.BuildMenu(); BuildMenu.initMenu((int)(gf.Width / 1.31), 75, gf); }
//public static string serverAddress = "localhost"; public static void InitScoreMenu(Player p,int LevelHash) { SubmitScore s = new SubmitScore() { Name = p.Name, Score = p.Score, LevelHashCode = LevelHash }; string name = Microsoft.VisualBasic.Interaction.InputBox("Enter your Name", "Score Entry Dialog"); if (!string.IsNullOrWhiteSpace(name)) s.Name = name; try { TcpClient server = new TcpClient(serverAddress, 2593); Serializer.SerializeWithLengthPrefix<SubmitScore>(server.GetStream(), s, PrefixStyle.Base128); server.GetStream().Flush(); var scores = Serializer.DeserializeWithLengthPrefix<HighScores>(server.GetStream(), PrefixStyle.Base128); strings = new string[scores.TopTen.Count]; int i = 0; bool topten = false; foreach (var str in scores.TopTen) { if (s.Name == str.Name) topten = true; strings[i++] = str.Name + " " + str.Score; } if (!topten) strings[i++] = s.Name + " " + s.Score; server.Close(); } catch { strings = new string[] { "LoadFailed", s.Name + " " + s.Score }; } /*string accesskey = ""; string secretkey = ""; Amazon.SimpleDB.AmazonSimpleDB sdb = AWSClientFactory.CreateAmazonSimpleDBClient(accesskey, secretkey); Amazon.SimpleDB.Model.CreateDomainRequest cdr = new Amazon.SimpleDB.Model.CreateDomainRequest(); cdr.DomainName = "High_SCORE_DOMAIN"; sdb.CreateDomain(cdr);*/ }