public Button(string Text, Window window) : base(window) { Selected = new ButtonSelectedEvent(ButtonSelected); Margin = 4; FlowLayout layout = new FlowLayout(true); layout.centered = false; label = new Label(Text, window); label.Color = Color.LightGray; this.AddControl(label); this.Name = "Button"; Color = System.Drawing.Color.White; atlas = new HagsAtlas("window-theme/button/button.png"); atlas["topleft"] = new Rectangle(0, 0, 3, 3); atlas["left"] = new Rectangle(0, 3, 3, 15); atlas["bottomleft"] = new Rectangle(0, 18, 3, 3); atlas["top"] = new Rectangle(3, 0, 34, 3); atlas["middle"] = new Rectangle(3, 3, 34, 15); atlas["bottom"] = new Rectangle(3, 18, 34, 3); atlas["topright"] = new Rectangle(37,0,3,3); atlas["right"] = new Rectangle(37, 3, 3, 15); atlas["bottomright"] = new Rectangle(37, 18, 3, 3); stateOffets.Add(ButtonState.HOVER, new Point(0, 21)); stateOffets.Add(ButtonState.DOWN, new Point(0, 43)); }
private IEnumerator SelectButton() { upAudioSource.Play(); yield return(new WaitForSeconds(.5f)); ButtonSelectedEvent?.Invoke(); isInteractable = false; }
private void ButtonSelected() { PlayAudioClip(); animator.SetBool(DOWN_HASH, true); ButtonSelectedEvent?.Invoke(buttonId); if (audioClips != null) { SetNextAudioClip(); } }