public void Update() { playButton.Update(OnClickAction: () => Game1.ChangeToScene(WK.Scene.GameScene) ); }
public void Initialize(Vector2?playerPosition = null) { UIs = new List <IUI>() { new Button( rectangle: new Rectangle(360, 10, 100, 50), text: "Hello World", defaultTexture: WK.Texture.Green, mouseOverTexture: WK.Texture.Red, spriteFont: WK.Font.font_7, tag: "", OnClickAction: () => Console.WriteLine("User click button!") ), // Left new Label(new Rectangle(10, 10, 100, 30), WK.Font.font_7, "My Text", Label.TextAlignment.Top_Left, tag: "", WK.Texture.Green), new Label(new Rectangle(10, 50, 100, 30), WK.Font.font_7, "My Text", Label.TextAlignment.Midle_Left, tag: "", WK.Texture.Green), new Label(new Rectangle(10, 90, 100, 30), WK.Font.font_7, "My Text", Label.TextAlignment.Down_Left, tag: "", WK.Texture.Green), // Center new Label(new Rectangle(120, 10, 100, 30), WK.Font.font_7, "My Text", Label.TextAlignment.Top_Center, tag: "", WK.Texture.Green), new Label(new Rectangle(120, 50, 100, 30), WK.Font.font_7, "My Text", Label.TextAlignment.Midle_Center, tag: "", WK.Texture.Green), new Label(new Rectangle(120, 90, 100, 30), WK.Font.font_7, "My Text", Label.TextAlignment.Down_Center, tag: "", WK.Texture.Green), // Right new Label(new Rectangle(230, 10, 100, 30), WK.Font.font_7, "My Text", Label.TextAlignment.Top_Right, tag: "", WK.Texture.Green), new Label(new Rectangle(230, 50, 100, 30), WK.Font.font_7, "My Text", Label.TextAlignment.Midle_Right, tag: "", WK.Texture.Green), new Label(new Rectangle(230, 90, 100, 30), WK.Font.font_7, "My Text", Label.TextAlignment.Down_Right, tag: "", WK.Texture.Green), new HealthBar(Tools.Texture.CreateColorTexture(Color.Green), Tools.Texture.CreateColorTexture(Color.Red), new Rectangle(10, 130, 50, 10), HealthBar.Direction.Right), new HealthBar(Tools.Texture.CreateColorTexture(Color.Green), Tools.Texture.CreateColorTexture(Color.Red), new Rectangle(10, 150, 50, 10), HealthBar.Direction.Left), new HealthBar(Tools.Texture.CreateColorTexture(Color.Green), Tools.Texture.CreateColorTexture(Color.Red), new Rectangle(10, 175, 10, 50), HealthBar.Direction.Up), new HealthBar(Tools.Texture.CreateColorTexture(Color.Green), Tools.Texture.CreateColorTexture(Color.Red), new Rectangle(30, 175, 10, 50), HealthBar.Direction.Down), new Label( rectangle: new Rectangle(100, 150, 100, 30), spriteFont: WK.Font.font_7, text: textOfChars, textAlignment: Label.TextAlignment.Top_Left, tag: "", lineSpacing: 7 + 2 ), new Label( rectangle: new Rectangle(50, 350, 450, 60), spriteFont: WK.Font.font_7, text: textOfChars, textAlignment: Label.TextAlignment.Top_Left, tag: "", lineSpacing: 14 + 2 ), new Button( rectangle: new Rectangle(360, 100, 100, 50), text: "Play sound", defaultTexture: Tools.Texture.CreateColorTexture(Color.Green), mouseOverTexture: Tools.Texture.CreateColorTexture(Color.Red), spriteFont: WK.Font.font_7, tag: "SoundButton", OnClickAction: () => soundEffects.First().Play() ), new Button( rectangle: new Rectangle(0, 470, 230, 30), text: "<- Menu", defaultTexture: WK.Texture.LightGray, mouseOverTexture: WK.Texture.Gray, spriteFont: WK.Font.font_7, tag: "goToMenu", OnClickAction: () => Game1.ChangeToScene(WK.Scene.Menu) ) }; this.soundEffects = new List <SoundEffect>() { Tools.Sound.GetSoundEffect(Path.Combine("Sounds", "EatingSound_WAV")) }; this.dxUpdateSystem = (InputState lastInputState, InputState inputState) => Update(lastInputState, inputState); }