//Create widgets for the end screen public void CreateEndScreenWidgets() { //Create widget object endScreen = new Widget(this); //Add background image, with default setting (full screen) endScreen.AddWidgetImage(endScreenContent.LeaderBoardTexture); //Add high scores for (int i = 0; i < scoreManager.LeaderBoard.Scores.Count; i++) { string score = scoreManager.LeaderBoard.Scores[i].ToString(); WidgetText highScore = endScreen.AddWidgetText(score, new Vector2(SCREEN_WIDTH / 2, 475 + i * 85), new Vector2(0.75f)); } }
//Create HUD for the level public void CreateLevelWidgets() { //create widget object levelHUD = new Widget(this); //create widget text object WidgetText score = levelHUD.AddWidgetText("Score", new Vector2(SCREEN_WIDTH / 2, 50), new Vector2(0.75f)); //bind the text value to player score score.BindText += BindPlayerScore; //create widget text object WidgetText special = levelHUD.AddWidgetText("SpecialAttack", new Vector2(SCREEN_WIDTH - 150, 50), new Vector2(0.75f)); //bind the text value to the number of remaining special attack special.BindText += BindPlayerSpecialAttack; }
//Bind the number of player special attack to a widget text object public void BindPlayerSpecialAttack(WidgetText text) { text.Text = player.Special.ToString(); }
//Bind score to a widget text object public void BindPlayerScore(WidgetText text) { text.Text = scoreManager.Score.ToString(); }
public WidgetText AddWidgetText(String text, Vector2 position, Vector2 scale) { this.text = new WidgetText(text, position, scale); texts.Add(this.text); return(this.text); }
public WidgetText AddWidgetText(String text) { this.text = new WidgetText(text); texts.Add(this.text); return(this.text); }
public WidgetText AddWidgetText() { this.text = new WidgetText(); texts.Add(this.text); return(this.text); }