DisplayText.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using UnityEngine;
  6. namespace CommonUnity3D.UGUI
  7. {
  8. public abstract class DisplayText : DisplayNode, ITextComponent
  9. {
  10. protected DisplayText(string name = "") : base(name)
  11. {
  12. }
  13. public DisplayNode Binding { get { return this; } }
  14. public abstract string Text { get; set; }
  15. public abstract int FontSize { get; set; }
  16. public abstract Color FontColor { get; set; }
  17. public abstract Vector2 TextOffset { get; set; }
  18. public abstract CommonUI.Data.TextAnchor Anchor { get; set; }
  19. public abstract CommonUI.Data.FontStyle Style { get; set; }
  20. public abstract bool IsUnderline { get; set; }
  21. public abstract Vector2 PreferredSize { get; }
  22. public abstract Rect LastCaretPosition { get; }
  23. public abstract void SetBorder(UnityEngine.Color bc, Vector2 distance);
  24. public abstract void SetShadow(UnityEngine.Color bc, Vector2 distance);
  25. public abstract void SetFont(UnityEngine.Font font);
  26. }
  27. public interface ITextComponent
  28. {
  29. DisplayNode Binding { get; }
  30. string Text { get; set; }
  31. int FontSize { get; set; }
  32. Color FontColor { get; set; }
  33. CommonUI.Data.FontStyle Style { get; set; }
  34. bool IsUnderline { get; set; }
  35. Vector2 TextOffset { get; set; }
  36. CommonUI.Data.TextAnchor Anchor { get; set; }
  37. Vector2 PreferredSize { get; }
  38. Rect LastCaretPosition { get; }
  39. void SetBorder(UnityEngine.Color bc, Vector2 distance);
  40. void SetShadow(UnityEngine.Color bc, Vector2 distance);
  41. void SetFont(UnityEngine.Font font);
  42. }
  43. }