TC_SelectItemGroupGUI.cs 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using UnityEngine;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. #if UNITY_EDITOR
  6. using UnityEditor;
  7. #endif
  8. namespace TerrainComposer2
  9. {
  10. static public class TC_SelectItemGroupGUI
  11. {
  12. static public int Draw(TC_SelectItemGroup selectItemGroup, ref Vector2 pos, Color color, Color colSelectItem, Color colBracket, float activeMulti)
  13. {
  14. bool nodeFoldout = selectItemGroup.parentItem.nodeFoldout;
  15. // bool select = false;
  16. // Draw total node
  17. // DropDownMenu();
  18. //if (selectItemGroup.itemList.Count > 1)
  19. //{
  20. // RenderTexture previewTex;
  21. // if (selectItemGroup.itemList.Count == 1) previewTex = selectItemGroup.itemList[0].displayRenderTex; else previewTex = selectItemGroup.displayRenderTex;
  22. // startOffset.x -= TD.texCardBody.width;
  23. TD.DrawBracket(ref pos, nodeFoldout, true, colBracket * activeMulti, ref selectItemGroup.foldout, true, selectItemGroup.itemList.Count > 0);
  24. //if (TC_Settings.instance.hasMasterTerrain && selectItemGroup.outputId != TC.treeOutput && selectItemGroup.outputId != TC.objectOutput)
  25. //{
  26. // Vector2 sliderPos = TD.GetPosition(new Vector2(startOffset.x + 6, (startOffset.y + 84)));
  27. // GUIUtility.ScaleAroundPivot(new Vector2(TD.scale / 1.5f, TD.scale / 1.5f), new Vector2(sliderPos.x, sliderPos.y));
  28. // if (selectItemGroup.itemValues.values.Count > 0)
  29. // {
  30. // GUI.changed = false;
  31. // selectItemGroup.itemValues.values[0].mix = GUI.HorizontalSlider(new Rect(sliderPos.x, sliderPos.y, 93, 10), selectItemGroup.itemValues.values[0].mix, 0, 1.5f);
  32. // if (GUI.changed) selectItemGroup.CalcSelectItemGroupPreview();
  33. // }
  34. //// selectItemGroup.itemValues.values[index].value = GUIW.MinMaxSlider(new Rect(sliderPos.x, sliderPos.y + 20, 78, 10), selectItemGroup.itemValues.values[index].value, 0.0f, 100.0f, new Vector2(200.0f, 25.0f));
  35. // GUI.matrix = Matrix4x4.Scale(new Vector3(1, 1, 1));
  36. //}
  37. //if (selectItemGroup.itemList.Count != 0)
  38. //{
  39. // TD.DrawRect(new Rect(startOffset.x - 9, (startOffset.y + TD.cardHeight / 2) - 5, 18, 10), TC_Settings.instance.global.colTextBackGround);
  40. // TD.DrawText(new Vector2(startOffset.x + 2, startOffset.y + TD.cardHeight / 2), selectItemGroup.itemList.Count.ToString(), 8, FontStyle.Bold, Color.white, HorTextAlign.Center, VerTextAlign.Center);
  41. //}
  42. if (selectItemGroup.foldout > 0)
  43. {
  44. if (selectItemGroup.itemList.Count > 1)
  45. {
  46. bool isCulled = false;
  47. pos.x -= TD.texCardBody.width;
  48. TD.DrawNode(selectItemGroup, pos, color, Color.white, ref isCulled, activeMulti, nodeFoldout, false, false);
  49. }
  50. if (selectItemGroup.foldout == 2)
  51. {
  52. TC_SelectItem selectItem;
  53. for (int i = selectItemGroup.itemList.Count - 1; i >= 0; --i)
  54. {
  55. selectItem = selectItemGroup.itemList[i];
  56. //if (index < 0)
  57. //{
  58. // startOffset.x -= 5;
  59. // if (TC.filterGroups[-(index + 1)].Draw(ref startOffset, color, colorFilter, -(index + 1)) == 1) LeftClickMenu("Erase FilterGroup");
  60. //}
  61. if (selectItem != null)
  62. {
  63. pos.x -= TD.nodeWidthHSpace;
  64. TC_SelectItemGUI.Draw(selectItemGroup, activeMulti, i, nodeFoldout, ref pos, colSelectItem);
  65. }
  66. }
  67. }
  68. }
  69. if (nodeFoldout)
  70. {
  71. int mouseClick = TD.DrawNodeCount(selectItemGroup, ref pos, selectItemGroup.itemList.Count, nodeFoldout, ref selectItemGroup.foldout, (selectItemGroup.foldout == 0 ? colBracket : (color * 0.75f)) * activeMulti);
  72. if (mouseClick == 0 && selectItemGroup.itemList.Count == 0) selectItemGroup.Add<TC_SelectItem>("", false, false, true);
  73. }
  74. TD.DrawBracket(ref pos, nodeFoldout, false, colBracket * activeMulti, ref selectItemGroup.foldout, true, selectItemGroup.itemList.Count > 0);
  75. return 0;
  76. }
  77. }
  78. }