Button.cs 706 B

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