Button.cs 634 B

123456789101112131415161718192021
  1. using System;
  2. using UnityEngine;
  3. namespace MeidoPhotoStudio.Plugin
  4. {
  5. public class Button : BaseControl
  6. {
  7. public string Label { get; set; }
  8. public Button(string label) => Label = label;
  9. public void Draw(GUIStyle buttonStyle, params GUILayoutOption[] layoutOptions)
  10. {
  11. if (GUILayout.Button(Label, buttonStyle, layoutOptions)) OnControlEvent(EventArgs.Empty);
  12. }
  13. public override void Draw(params GUILayoutOption[] layoutOptions)
  14. {
  15. GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);
  16. Draw(buttonStyle, layoutOptions);
  17. }
  18. }
  19. }