FlexibleFrame.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using Assets;
  2. using Bitsplash.DatePicker;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. using UnityEngine.UI;
  7. namespace Bitsplash.Vector
  8. {
  9. public class FlexibleFrame : MaskableGraphic , IDatePickerSettingsItem
  10. {
  11. [SerializeField]
  12. [HideInInspector]
  13. private bool isOpen;
  14. public string EditorTitle { get { return gameObject.name; } }
  15. public int Order { get { return 3; } }
  16. public bool ShowLeft = true;
  17. public bool ShowTop = true;
  18. public bool ShowRight = true;
  19. public bool ShowBottom = true;
  20. public float LineThickness = 2f;
  21. public float Offset = 0f;
  22. public float TextureTile = 1f;
  23. protected override void OnPopulateMesh(VertexHelper vh)
  24. {
  25. vh.Clear();
  26. var rect = GetPixelAdjustedRect();
  27. Rect xRect = CommonMethods.VerticalTextureTile(TextureTile);
  28. if(ShowLeft)
  29. CommonMethods.DrawVertical(rect.x - Offset, rect, LineThickness, xRect, color, vh);
  30. if(ShowRight)
  31. CommonMethods.DrawVertical(rect.x + rect.width + Offset, rect, LineThickness, xRect, color, vh);
  32. Rect yRect = CommonMethods.HorizontalTextureTile(TextureTile);
  33. if(ShowTop)
  34. CommonMethods.DrawHorizontal(rect.y - Offset, rect, LineThickness, yRect, color, vh);
  35. if (ShowBottom)
  36. CommonMethods.DrawHorizontal(rect.y + rect.height + Offset, rect, LineThickness, yRect, color, vh);
  37. }
  38. }
  39. }