/******** Variables ********/ /******** Functions ********/ public InfoState(GameStateManager gameStateManager) { this.gameStateManager = gameStateManager; Size formularSize = Program.mainForm.ClientSize; layout = new Layout.Layout(); Layout.Textbox infoBox = new Layout.Textbox("infoBox"); infoBox.anchor = Layout.Anchor.Center; infoBox.boxAdaptive = true; string infoString = "This is just a simple game to test the structure of such a project in C# \n" + "Written by Julian Heinzel \n" + "© 2015"; infoBox.text = infoString; layout.AddBox(infoBox); }
/******** Functions ********/ public HighscoreState(GameStateManager gameStateManager) { this.gameStateManager = gameStateManager; timeRows = new List <string>(); rushRows = new List <string>(); // Creating layout. layout = new Layout.Layout(); // Vertical division. Layout.Box upperBox = new Layout.Box("upperBox"); upperBox.percentageSize = new SizeF(100, 20); upperBox.visible = false; Layout.Box lowerBox = new Layout.Box("lowerBox"); lowerBox.percentageSize = new SizeF(100, 80); lowerBox.location = new Point(0, (int)((float)lowerBox.parent.height / 10 * 2)); lowerBox.visible = false; // Horizontal division. Layout.Box leftBox = new Layout.Box("leftBox"); leftBox.parent = lowerBox; leftBox.percentageSize = new SizeF((float)33.3, 100); leftBox.anchor = Layout.Anchor.Left | Layout.Anchor.Top; leftBox.visible = false; Layout.Box centerBox = new Layout.Box("centerBox"); centerBox.parent = lowerBox; centerBox.percentageSize = new SizeF((float)33.3, 100); centerBox.anchor = Layout.Anchor.CenterX; centerBox.visible = false; Layout.Box rightBox = new Layout.Box("rightBox"); rightBox.parent = lowerBox; rightBox.percentageSize = new SizeF((float)33.3, 100); rightBox.anchor = Layout.Anchor.Right | Layout.Anchor.Top; rightBox.visible = false; // Lists. Layout.Textbox caption = new Layout.Textbox("caption"); caption.borderLine = new Pen(Brushes.Black, 3); caption.font = new Font("ARIAL", 60); caption.text = "Highscore"; caption.parent = upperBox; caption.anchor = Layout.Anchor.Center; Layout.Box leftList = new Layout.Box("leftList"); leftList.parent = leftBox; leftList.y = 100; leftList.width = 300; leftList.height = 400; leftList.anchor = Layout.Anchor.CenterX; Layout.Box centerList = new Layout.Box("centerList"); centerList.parent = centerBox; centerList.y = 100; centerList.width = 300; centerList.height = 400; centerList.anchor = Layout.Anchor.CenterX; // Captions. Layout.Textbox leftCaption = new Layout.Textbox("leftCaption"); leftCaption.parent = leftBox; leftCaption.text = "Time mode:"; leftCaption.x = leftList.x; Layout.Textbox centerCaption = new Layout.Textbox("centerCaption"); centerCaption.parent = centerBox; centerCaption.text = "Rush mode:"; centerCaption.x = centerList.x; // Adding all to layout. layout.AddBox(upperBox); layout.AddBox(lowerBox); layout.AddBox(leftBox); layout.AddBox(centerBox); layout.AddBox(rightBox); layout.AddBox(leftList); layout.AddBox(centerList); layout.AddBox(caption); layout.AddBox(leftCaption); layout.AddBox(centerCaption); }