XSpaceNode.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. namespace WXB
  6. {
  7. public class XSpaceNode : NodeBase
  8. {
  9. public override float getHeight()
  10. {
  11. return 0.01f;
  12. }
  13. public override float getWidth()
  14. {
  15. return d_offset;
  16. }
  17. public override void render(float maxWidth, RenderCache cache, ref float x, ref uint yline, List<Line> lines, float offsetX, float offsetY)
  18. {
  19. Vector2 pt = new Vector2(x + offsetX, offsetY);
  20. for (int i = 0; i < yline; ++i)
  21. pt.y += lines[i].y;
  22. // 因对齐,X轴偏移量
  23. float alignedX = AlignedFormatting(owner, formatting, maxWidth, lines[(int)(yline)].x, 0);
  24. if (x + d_offset + alignedX > maxWidth)
  25. {
  26. yline++;
  27. x = NextLineX;
  28. }
  29. else
  30. {
  31. x += d_offset;
  32. }
  33. // d_beginLine = yline;
  34. // d_endLine = yline;
  35. if (d_bNewLine == true)
  36. {
  37. yline++;
  38. x = NextLineX;
  39. }
  40. }
  41. public float d_offset;
  42. public override void Release()
  43. {
  44. base.Release();
  45. d_offset = 0f;
  46. }
  47. };
  48. }