TC_LayerGroupResultGUI.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using UnityEngine;
  2. using System.Collections;
  3. namespace TerrainComposer2
  4. {
  5. public class TC_LayerGroupResultGUI
  6. {
  7. static public void Draw(TC_LayerGroup layerGroup, ref Vector2 pos, float posOldX, float activeMulti, bool nodeFoldout)
  8. {
  9. TC_GlobalSettings g = TC_Settings.instance.global;
  10. TC_LayerGroupResult groupResult = layerGroup.groupResult;
  11. float x1 = pos.x - 78;
  12. if (groupResult.foldout < 2) x1 += nodeFoldout ? 126 : 135;
  13. x1 -= TD.texCardBody.width / 2;
  14. float y1 = pos.y + (layerGroup.nodeFoldout ? TD.cardHeight : 32);
  15. TD.DrawTextureScaled(x1 - (TD.texShelfLinesConnectUp.width / 2), y1 - 16, TD.texShelfLinesConnectUp, Color.white);
  16. TD.DrawTextureScaled(x1 - (TD.texShelfLinesConnectUp.width / 2), y1 - 16, TD.texLineConnectUp, g.colLayer * activeMulti);
  17. x1 += 30;
  18. if (layerGroup.foldout == 2 && groupResult.itemList.Count > 0)
  19. {
  20. TD.DrawTextureScaled(x1, y1 + 16, posOldX - x1 - g.layerHSpace, TD.texShelfLinesHorizontal, Color.white);
  21. TD.DrawTextureScaled(x1, y1 + 16, posOldX - x1 - g.layerHSpace, TD.texLineHorizontal, g.colLayer * activeMulti);
  22. }
  23. else
  24. {
  25. Vector2 posOld = pos;
  26. pos.x = x1 + 52;
  27. pos.y += layerGroup.nodeFoldout ? 258 : -94;
  28. int mouseClick = TD.DrawNodeCount(groupResult, ref pos, groupResult.itemList.Count, true, ref layerGroup.foldout, g.colLayer * activeMulti, g.rect.width);
  29. if (groupResult.itemList.Count == 0)
  30. {
  31. if (mouseClick == 0) groupResult.Add<TC_Layer>("", false);
  32. else if (mouseClick == 1) groupResult.Add<TC_LayerGroup>("", false);
  33. }
  34. else
  35. {
  36. if (mouseClick == 0) layerGroup.nodeFoldout = true;
  37. }
  38. pos = posOld;
  39. }
  40. TD.DrawBracket(ref pos, nodeFoldout, true, g.colLayerGroup * activeMulti, ref groupResult.foldout, true, true);
  41. if (groupResult.foldout == 2)
  42. {
  43. bool isCulled = false;
  44. pos.x -= TD.texCardBody.width;
  45. TD.DrawNode(groupResult, pos, g.colLayer, Color.white, ref isCulled, activeMulti, nodeFoldout, false, true);
  46. int mouseButton = TD.Button(new Rect(pos.x + 245.1f, pos.y + 6.5f, 20, 20), TD.texFoldout, true, new Color(1, 1, 1, 0.25f), Color.white, Color.white, true);
  47. if (mouseButton == 0)
  48. {
  49. if (layerGroup.foldout == 0) layerGroup.foldout = 2; else layerGroup.foldout = 0;
  50. }
  51. }
  52. else
  53. {
  54. if (nodeFoldout) TD.DrawNodeCount(groupResult, ref pos, 1, true, ref groupResult.foldout, g.colLayerGroup * activeMulti, 1);
  55. }
  56. TD.DrawBracket(ref pos, nodeFoldout, false, g.colLayerGroup * activeMulti, ref groupResult.foldout, true, true);
  57. }
  58. }
  59. }