private void DoGUI() { if (bNoGUI) { return; } if (oList == null) { Close(); return; } GUILayout.Space(4f); EditorGUILayout.BeginHorizontal(); if (tNode.bIsBridgeStart) { xWindowType = (WindowTypeEnum)EditorGUILayout.Popup("Category: ", (int)tWindowType, WindowTypeDescBridge, GUILayout.Width(312f)); } else { if (xWindowType == WindowTypeEnum.Edge) { SxWindowType = WindowTypeEnumShort.Edge; } else if (xWindowType == WindowTypeEnum.Extrusion) { SxWindowType = WindowTypeEnumShort.Extrusion; } else { SxWindowType = WindowTypeEnumShort.Groups; } SxWindowType = (WindowTypeEnumShort)EditorGUILayout.Popup("Category: ", (int)StWindowType, WindowTypeDesc, GUILayout.Width(312f)); if (SxWindowType == WindowTypeEnumShort.Extrusion) { xWindowType = WindowTypeEnum.Extrusion; } else if (SxWindowType == WindowTypeEnumShort.Edge) { xWindowType = WindowTypeEnum.Edge; } else { xWindowType = WindowTypeEnum.Groups; } StWindowType = SxWindowType; } if (xWindowType != tWindowType) { Initialize(xWindowType, tNode); EditorGUILayout.EndHorizontal(); return; } EditorGUILayout.LabelField(""); EditorGUILayout.LabelField("Single-click items to load", EditorStyles.boldLabel, GUILayout.Width(200f)); EditorGUILayout.EndHorizontal(); if (oList.Count == 0) { return; } int oCount = oList.Count; int WidthSpacing = 160; int HeightSpacing = 200; int HeightOffset = 30; int ScrollHeightOffset = 25; int xCount = 0; int yCount = 0; int yMod = Mathf.FloorToInt((float)position.width / 142f) - 1; int yMax = 0; if (yMod == 0) { yMax = 1; } else { yMax = Mathf.CeilToInt((float)oCount / (float)yMod); } bool bScrolling = false; if ((((yMax) * HeightSpacing) + 25) > position.height) { scrollPos = GUI.BeginScrollView(new Rect(0, 25, position.width - 10, position.height - 30), scrollPos, new Rect(0, 0, (yMod * WidthSpacing) + 25, (((yMax) * HeightSpacing) + 50))); bScrolling = true; HeightOffset = ScrollHeightOffset; } EditorGUILayout.BeginHorizontal(); bool bClicked = false; for (int i = 0; i < oCount; i++) { if (i > 0) { if (yMod == 0) { EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); yCount += 1; xCount = 0; } else { if (i % yMod == 0) { EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); yCount += 1; xCount = 0; } } } if (xCount == 0) { bClicked = DoItem((xCount * WidthSpacing) + 5, (yCount * HeightSpacing) + HeightOffset, i); } else { bClicked = DoItem(xCount * WidthSpacing, (yCount * HeightSpacing) + HeightOffset, i); } if (bClicked) { if (tWindowType == WindowTypeEnum.Extrusion) { GSD.Roads.Splination.SplinatedMeshMaker SMM = tNode.AddSplinatedObject(); SMM.SetDefaultTimes(tNode.bIsEndPoint, tNode.tTime, tNode.NextTime, tNode.idOnSpline, tNode.GSDSpline.distance); SMM.LoadFromLibrary(oList[i].FileName, oList[i].bIsDefault); SMM.bIsGSD = oList[i].bIsDefault; SMM.Setup(true); } else if (tWindowType == WindowTypeEnum.Edge) { GSD.Roads.EdgeObjects.EdgeObjectMaker EOM = tNode.AddEdgeObject(); EOM.SetDefaultTimes(tNode.bIsEndPoint, tNode.tTime, tNode.NextTime, tNode.idOnSpline, tNode.GSDSpline.distance); EOM.LoadFromLibrary(oList[i].FileName, oList[i].bIsDefault); EOM.bIsGSD = oList[i].bIsDefault; EOM.Setup(); } else if (tWindowType == WindowTypeEnum.Groups) { tNode.LoadWizardObjectsFromLibrary(oList[i].FileName, oList[i].bIsDefault, oList[i].bIsBridge); } else if (tWindowType == WindowTypeEnum.BridgeComplete) { tNode.LoadWizardObjectsFromLibrary(oList[i].FileName, oList[i].bIsDefault, oList[i].bIsBridge); } tNode.bQuitGUI = true; oList.Clear(); oList = null; EditorGUILayout.EndHorizontal(); if (bScrolling) { GUI.EndScrollView(); } bNoGUI = true; Close(); return; } xCount += 1; } EditorGUILayout.EndHorizontal(); if (bScrolling) { GUI.EndScrollView(); } }
private void DoGUI() { if(bNoGUI){ return; } if(oList == null){ Close(); return; } GUILayout.Space(4f); EditorGUILayout.BeginHorizontal(); if(tNode.bIsBridgeStart){ xWindowType = (WindowTypeEnum)EditorGUILayout.Popup("Category: ",(int)tWindowType,WindowTypeDescBridge,GUILayout.Width(312f)); }else{ if(xWindowType == WindowTypeEnum.Edge){ SxWindowType = WindowTypeEnumShort.Edge; }else if(xWindowType == WindowTypeEnum.Extrusion){ SxWindowType = WindowTypeEnumShort.Extrusion; }else{ SxWindowType = WindowTypeEnumShort.Groups; } SxWindowType = (WindowTypeEnumShort)EditorGUILayout.Popup("Category: ",(int)StWindowType,WindowTypeDesc,GUILayout.Width(312f)); if(SxWindowType == WindowTypeEnumShort.Extrusion){ xWindowType = WindowTypeEnum.Extrusion; }else if(SxWindowType == WindowTypeEnumShort.Edge){ xWindowType = WindowTypeEnum.Edge; }else{ xWindowType = WindowTypeEnum.Groups; } StWindowType = SxWindowType; } if(xWindowType != tWindowType){ Initialize(xWindowType,tNode); EditorGUILayout.EndHorizontal(); return; } EditorGUILayout.LabelField(""); EditorGUILayout.LabelField("Single-click items to load",EditorStyles.boldLabel,GUILayout.Width(200f)); EditorGUILayout.EndHorizontal(); if(oList.Count == 0){ return; } int oCount = oList.Count; int WidthSpacing = 160; int HeightSpacing = 200; int HeightOffset = 30; int ScrollHeightOffset = 25; int xCount = 0; int yCount = 0; int yMod = Mathf.FloorToInt((float)position.width / 142f) - 1; int yMax = 0; if(yMod == 0){ yMax = 1; }else{ yMax = Mathf.CeilToInt((float)oCount/(float)yMod); } bool bScrolling = false; if((((yMax) * HeightSpacing)+25) > position.height){ scrollPos = GUI.BeginScrollView(new Rect(0, 25,position.width-10, position.height-30), scrollPos,new Rect (0, 0, (yMod*WidthSpacing)+25, (((yMax)*HeightSpacing)+50))); bScrolling= true; HeightOffset=ScrollHeightOffset; } EditorGUILayout.BeginHorizontal(); bool bClicked = false; for(int i=0;i<oCount;i++){ if(i > 0){ if(yMod == 0){ EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); yCount+=1; xCount=0; }else{ if(i % yMod == 0){ EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); yCount+=1; xCount=0; } } } if(xCount == 0){ bClicked = DoItem((xCount*WidthSpacing)+5,(yCount*HeightSpacing)+HeightOffset,i); }else{ bClicked = DoItem(xCount*WidthSpacing,(yCount*HeightSpacing)+HeightOffset,i); } if(bClicked){ if(tWindowType == WindowTypeEnum.Extrusion){ GSD.Roads.Splination.SplinatedMeshMaker SMM = tNode.AddSplinatedObject(); SMM.SetDefaultTimes(tNode.bIsEndPoint,tNode.tTime,tNode.NextTime,tNode.idOnSpline,tNode.GSDSpline.distance); SMM.LoadFromLibrary(oList[i].FileName,oList[i].bIsDefault); SMM.bIsGSD = oList[i].bIsDefault; SMM.Setup(true); }else if(tWindowType == WindowTypeEnum.Edge){ GSD.Roads.EdgeObjects.EdgeObjectMaker EOM = tNode.AddEdgeObject(); EOM.SetDefaultTimes(tNode.bIsEndPoint,tNode.tTime,tNode.NextTime,tNode.idOnSpline,tNode.GSDSpline.distance); EOM.LoadFromLibrary(oList[i].FileName,oList[i].bIsDefault); EOM.bIsGSD = oList[i].bIsDefault; EOM.Setup(); }else if(tWindowType == WindowTypeEnum.Groups){ tNode.LoadWizardObjectsFromLibrary(oList[i].FileName,oList[i].bIsDefault,oList[i].bIsBridge); }else if(tWindowType == WindowTypeEnum.BridgeComplete){ tNode.LoadWizardObjectsFromLibrary(oList[i].FileName,oList[i].bIsDefault,oList[i].bIsBridge); } tNode.bQuitGUI = true; oList.Clear(); oList = null; EditorGUILayout.EndHorizontal(); if(bScrolling){ GUI.EndScrollView(); } bNoGUI = true; Close(); return; } xCount+=1; } EditorGUILayout.EndHorizontal(); if(bScrolling){ GUI.EndScrollView(); } }