SetPosNode.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. namespace WXB
  6. {
  7. public class SetPosNode : NodeBase
  8. {
  9. public TypePosition type = TypePosition.Relative;
  10. public float d_value = 0f;
  11. public override float getHeight()
  12. {
  13. return 0.0f;
  14. }
  15. public override float getWidth()
  16. {
  17. return 0;
  18. }
  19. protected override void AlterX(ref float x, float maxWidth)
  20. {
  21. switch (type)
  22. {
  23. case TypePosition.Absolute:
  24. x = d_value;
  25. break;
  26. case TypePosition.Relative:
  27. x = maxWidth * d_value;
  28. break;
  29. }
  30. }
  31. public override void render(float maxWidth, RenderCache cache, ref float x, ref uint yline, List<Line> lines, float offsetX, float offsetY)
  32. {
  33. AlterX(ref x, maxWidth);
  34. }
  35. public override void Release()
  36. {
  37. base.Release();
  38. d_value = 0f;
  39. }
  40. };
  41. }