LineNode.cs 1013 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. namespace WXB
  6. {
  7. class LineNode : NodeBase
  8. {
  9. public Font font;
  10. public FontStyle fs;
  11. public int fontSize;
  12. float height = 0f;
  13. public override float getHeight() { return height; }
  14. public override float getWidth() { return 0f; }
  15. public override void fill(ref Vector2 currentpos, List<Line> lines, float maxWidth, float pixelsPerUnit)
  16. {
  17. height = FontCache.GetLineHeight(font, (int)(fontSize * pixelsPerUnit), fs) / pixelsPerUnit;
  18. lines.Add(new Line(new Vector2(NextLineX, height)));
  19. }
  20. public override void render(float maxWidth, RenderCache cache, ref float x, ref uint yline, List<Line> lines, float offsetX, float offsetY)
  21. {
  22. yline++;
  23. x = offsetX;
  24. }
  25. public override void Release()
  26. {
  27. base.Release();
  28. height = 0f;
  29. }
  30. };
  31. }