public ActionButton(SpaceVillainArcadeBoundUserInterface owner, SharedSpaceVillainArcadeComponent.PlayerAction playerAction) { _owner = owner; _playerAction = playerAction; OnPressed += Clicked; }
public SpaceVillainArcadeMenu(SpaceVillainArcadeBoundUserInterface owner) { Title = "Space Villain"; Owner = owner; GridContainer grid = new GridContainer(); grid.Columns = 1; GridContainer infoGrid = new GridContainer(); infoGrid.Columns = 3; infoGrid.AddChild(new Label { Text = "Player", Align = Label.AlignMode.Center }); infoGrid.AddChild(new Label { Text = "|", Align = Label.AlignMode.Center }); _enemyNameLabel = new Label { Align = Label.AlignMode.Center }; infoGrid.AddChild(_enemyNameLabel); _playerInfoLabel = new Label { Align = Label.AlignMode.Center }; infoGrid.AddChild(_playerInfoLabel); infoGrid.AddChild(new Label { Text = "|", Align = Label.AlignMode.Center }); _enemyInfoLabel = new Label { Align = Label.AlignMode.Center }; infoGrid.AddChild(_enemyInfoLabel); CenterContainer centerContainer = new CenterContainer(); centerContainer.AddChild(infoGrid); grid.AddChild(centerContainer); _playerActionLabel = new Label(); _playerActionLabel.Align = Label.AlignMode.Center; grid.AddChild(_playerActionLabel); _enemyActionLabel = new Label(); _enemyActionLabel.Align = Label.AlignMode.Center; grid.AddChild(_enemyActionLabel); GridContainer buttonGrid = new GridContainer(); buttonGrid.Columns = 3; Button attack = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Attack); attack.Text = "ATTACK"; buttonGrid.AddChild(attack); Button heal = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Heal); heal.Text = "HEAL"; buttonGrid.AddChild(heal); Button recharge = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Recharge); recharge.Text = "RECHARGE"; buttonGrid.AddChild(recharge); centerContainer = new CenterContainer(); centerContainer.AddChild(buttonGrid); grid.AddChild(centerContainer); Button newGame = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.NewGame); newGame.Text = "New Game"; grid.AddChild(newGame); centerContainer = new CenterContainer(); centerContainer.AddChild(grid); Contents.AddChild(centerContainer); }
private readonly Button[] _gameButtons = new Button[3]; //used to disable/enable all game buttons public SpaceVillainArcadeMenu(SpaceVillainArcadeBoundUserInterface owner) { MinSize = SetSize = (400, 200); Title = Loc.GetString("Space Villain"); Owner = owner; var grid = new GridContainer { Columns = 1 }; var infoGrid = new GridContainer { Columns = 3 }; infoGrid.AddChild(new Label { Text = Loc.GetString("Player"), Align = Label.AlignMode.Center }); infoGrid.AddChild(new Label { Text = "|", Align = Label.AlignMode.Center }); _enemyNameLabel = new Label { Align = Label.AlignMode.Center }; infoGrid.AddChild(_enemyNameLabel); _playerInfoLabel = new Label { Align = Label.AlignMode.Center }; infoGrid.AddChild(_playerInfoLabel); infoGrid.AddChild(new Label { Text = "|", Align = Label.AlignMode.Center }); _enemyInfoLabel = new Label { Align = Label.AlignMode.Center }; infoGrid.AddChild(_enemyInfoLabel); var centerContainer = new CenterContainer(); centerContainer.AddChild(infoGrid); grid.AddChild(centerContainer); _playerActionLabel = new Label { Align = Label.AlignMode.Center }; grid.AddChild(_playerActionLabel); _enemyActionLabel = new Label { Align = Label.AlignMode.Center }; grid.AddChild(_enemyActionLabel); var buttonGrid = new GridContainer { Columns = 3 }; _gameButtons[0] = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Attack) { Text = Loc.GetString("ATTACK") }; buttonGrid.AddChild(_gameButtons[0]); _gameButtons[1] = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Heal) { Text = Loc.GetString("HEAL") }; buttonGrid.AddChild(_gameButtons[1]); _gameButtons[2] = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Recharge) { Text = Loc.GetString("RECHARGE") }; buttonGrid.AddChild(_gameButtons[2]); centerContainer = new CenterContainer(); centerContainer.AddChild(buttonGrid); grid.AddChild(centerContainer); var newGame = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.NewGame) { Text = Loc.GetString("New Game") }; grid.AddChild(newGame); centerContainer = new CenterContainer(); centerContainer.AddChild(grid); Contents.AddChild(centerContainer); }