//Add all text. public ScoreManager(HighScoreClass _highScores, ContentManager content) { places = new List <TextClass>(); scores = new List <TextClass>(); names = new List <TextClass>(); highScores = _highScores; input = new TextClass("Input name: " + name + "|", "Font", Color.White, new Vector2(0, 0)); places.Add(new TextClass("1st", "Font", Color.White, new Vector2(textSpaceX, textSpaceY * 1))); places.Add(new TextClass("2nd", "Font", Color.White, new Vector2(textSpaceX, textSpaceY * 2))); places.Add(new TextClass("3rd", "Font", Color.White, new Vector2(textSpaceX, textSpaceY * 3))); for (int i = 0; i < 10; i++) { if (i > 2) { places.Add(new TextClass((i + 1).ToString() + "th", "Font", Color.White, new Vector2(50, textSpaceY + textSpaceY * i))); } scores.Add(new TextClass("", "Font", Color.White, new Vector2(textSpaceX * 3, textSpaceY + textSpaceY * i))); names.Add(new TextClass("", "Font", Color.White, new Vector2(textSpaceX * 6, textSpaceY + textSpaceY * i))); } //Get the score from the files. GetScore(); }
//The constructor needs to be called multiple times. Hence here is a seperate one. //All needed values and texts are assigned and made. public void Construct() { options.Add(new Button("Play Game", "Button", Vector2.Zero)); options.Add(new Button("Score", "Button", Vector2.Zero)); options.Add(new Button("Quit", "Button", Vector2.Zero)); for (int i = 0; i < options.Count; i++) { options[i].Pos = new Vector2(100, 100 + 60 * i); } foreach (Button option in options) { option.PlaceText(option.textOn.Text); } chosenValues = new List <int>(); chosenValues.Add(chosenJewels); chosenValues.Add(chosenWidth); chosenValues.Add(chosenHeight); chosenValues.Add(chosenDifficulty); chosenValues.Add(chosenTime); chosenMax[0] = 10; chosenMax[1] = 100; chosenMax[2] = 100; chosenMax[3] = 10; chosenMax[4] = 200000; Title = new TextClass("Bejeweled", "Title", Color.White, new Vector2(Position.ScreenWidth - Position.ScreenWidth / 2, Position.ScreenHeight / 2 - Position.ScreenHeight / 4)); }
//Add all text. public ScoreManager(HighScoreClass _highScores, ContentManager content) { places = new List<TextClass>(); scores = new List<TextClass>(); names = new List<TextClass>(); highScores = _highScores; input = new TextClass("Input name: " + name + "|", "Font", Color.White, new Vector2(0, 0)); places.Add(new TextClass("1st", "Font", Color.White, new Vector2(textSpaceX, textSpaceY * 1))); places.Add(new TextClass("2nd", "Font", Color.White, new Vector2(textSpaceX, textSpaceY * 2))); places.Add(new TextClass("3rd", "Font", Color.White, new Vector2(textSpaceX, textSpaceY * 3))); for (int i = 0; i < 10; i++) { if (i > 2) { places.Add(new TextClass((i + 1).ToString() + "th", "Font", Color.White, new Vector2(50, textSpaceY + textSpaceY * i))); } scores.Add(new TextClass("", "Font", Color.White, new Vector2(textSpaceX * 3, textSpaceY + textSpaceY * i))); names.Add(new TextClass("", "Font", Color.White, new Vector2(textSpaceX * 6, textSpaceY + textSpaceY * i))); } //Get the score from the files. GetScore(); }
//Simple function for changing the text on the button. public void PlaceText(string text) { textOn = new TextClass(text, "SegoeUIMono", Color.White, new Vector2(X + 10, Y + 10)); }
//The button has text on it, which is sent in when created. Otherwise texture and position is sent in as other objects. public Button(string text, string _textureName, Vector2 _position) : base(_textureName, _position) { textOn = new TextClass(text, "SegoeUIMono", Color.White, new Vector2(X + 10, Y + 10)); PlaceText(text); }
//The UI is simply only two pieces of text that informs time remaining on the game and current score. public GameUI() { Score = new TextClass("0", "SegoeUIMono", Color.White, new Vector2(10, 10)); Timer = new TextClass("", "Font", Color.White, new Vector2(50, Position.ScreenHeight - 50)); }
//The constructor needs to be called multiple times. Hence here is a seperate one. //All needed values and texts are assigned and made. public void Construct() { options.Add(new Button("Play Game", "Button", Vector2.Zero)); options.Add(new Button("Score", "Button", Vector2.Zero)); options.Add(new Button("Quit", "Button", Vector2.Zero)); for (int i = 0; i < options.Count; i++) { options[i].Pos = new Vector2(100, 100 + 60 * i); } foreach (Button option in options) { option.PlaceText(option.textOn.Text); } chosenValues = new List<int>(); chosenValues.Add(chosenJewels); chosenValues.Add(chosenWidth); chosenValues.Add(chosenHeight); chosenValues.Add(chosenDifficulty); chosenValues.Add(chosenTime); chosenMax[0] = 10; chosenMax[1] = 100; chosenMax[2] = 100; chosenMax[3] = 10; chosenMax[4] = 200000; Title = new TextClass("Bejeweled", "Title", Color.White, new Vector2(Position.ScreenWidth - Position.ScreenWidth / 2, Position.ScreenHeight / 2 - Position.ScreenHeight / 4)); }