TC_TerrainLayerGUI.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using UnityEngine;
  2. using UnityEditor;
  3. using System.Collections;
  4. namespace TerrainComposer2
  5. {
  6. static public class TC_TerrainLayerGUI
  7. {
  8. static public void Draw(TC_TerrainLayer terrainLayer)
  9. {
  10. Vector2 pos = new Vector2(TC_NodeWindow.window.position.width / 2, TC_NodeWindow.window.position.height / 2);
  11. TD.DrawTextureScaled(pos.x, pos.y, TD.texShelfStart, Color.white, false, StretchMode.None, StretchMode.Screen);
  12. TD.DrawTextureScaled(pos.x + TD.texShelfStart.width, pos.y, TD.texShelfBackGround2, Color.white, false, StretchMode.Right, StretchMode.Screen);
  13. float scrollY = 0;
  14. for (int i = 0; i < 6; i++) DrawLayerGroup(terrainLayer, i, ref pos, ref scrollY);
  15. }
  16. static public void DrawLayerGroup(TC_TerrainLayer terrainLayer, int index, ref Vector2 pos, ref float scrollY)
  17. {
  18. TC_GlobalSettings g = TC_Settings.instance.global;
  19. Event eventCurrent = Event.current;
  20. TC_LayerGroup layerGroup = terrainLayer.layerGroups[index];
  21. if (layerGroup == null) return;
  22. Vector2 posOld = pos;
  23. float t = 0;
  24. TC_LayerGroupGUI.Draw(layerGroup, false, ref pos, 1, false, false, ref t);
  25. Rect rect;
  26. rect = new Rect(posOld.x + 50, posOld.y - 18, 400, 100);
  27. TD.DrawTextureScaled(posOld.x - 44, posOld.y, 100, TD.texLineHorizontal, g.colLayerGroup);
  28. Color buttonColor;
  29. if (layerGroup.visible)
  30. {
  31. if (layerGroup.active) buttonColor = Color.green; else buttonColor = Color.red;
  32. }
  33. else buttonColor = Color.white;
  34. if (TD.DrawButton(rect, TC.outputNames[layerGroup.outputId], 64, true, Color.white, TD.editorSkinMulti == 1 ? buttonColor : new Color(buttonColor.r * 0.4f, buttonColor.g * 0.4f, buttonColor.b * 0.4f, 1)))
  35. {
  36. // Debug.Log("Clicked Button");
  37. TD.ClickOutputButton(layerGroup);
  38. eventCurrent.Use();
  39. }
  40. for (int i = 0; i < 3; i++)
  41. {
  42. rect = TD.GetRectScaled(pos.x - 32 + 25, pos.y + 33 + (i * 32), 32, 32); rect.xMin = 0;
  43. TD.DrawTexture(rect, TD.texSeparatorCenter, new Color(1, 1, 1, 0.5f));
  44. rect = TD.GetRectScaled(pos.x + 25, pos.y + 33 + (i * 32), 32, 32);
  45. TD.DrawTexture(rect, TD.texSeparatorRight, new Color(1, 1, 1, 0.5f));
  46. }
  47. pos.y += TD.cardHeight;
  48. pos.y += g.outputVSpace;
  49. // scrollY += startY - startOffset.y;
  50. // else GlobalManager.singleton.scrollAdd.y = 0;
  51. pos.x = posOld.x;
  52. }
  53. }
  54. }