void Awake() { m_creator = serializedObject.targetObject as EPMPolyTerrainCreator; m_creator.Init(); sectionStyle = new GUIStyle(); Texture2D tex = new Texture2D(1, 1); tex.SetPixel(0, 0, EditorGUIUtility.isProSkin ? new Color(0.18f, 0.18f, 0.18f) : new Color(0.88f, 0.88f, 0.88f)); tex.Apply(); sectionStyle.normal.background = tex; m_road = new GeneratingType("Road"); m_river = new GeneratingType("River"); m_hill = new GeneratingType("Hill"); m_mountain = new GeneratingType("Mountain"); m_sandGround = new GeneratingType("SandGround"); m_soilGround = new GeneratingType("SoilGround"); m_island = new GeneratingType("Island"); }
private void OnGUI() { GUILayout.Label("This is LDraw model importer for file format v1.0.2"); if (GUILayout.Button("Update blueprints")) { LDrawConfig.Instance.InitParts(); _ModelNames = LDrawConfig.Instance.ModelFileNames; } _CurrentType = (GeneratingType)EditorGUILayout.EnumPopup("Blueprint Type", _CurrentType); switch (_CurrentType) { case GeneratingType.ByName: _CurrentPart = EditorGUILayout.TextField("Name", _CurrentPart); break; case GeneratingType.Models: _CurrentIndex = EditorGUILayout.Popup("Models", _CurrentIndex, _ModelNames); break; } GenerateModelButton(); }
private void DrawPointListSection(int type) { List <List <Vector2d> > pointList = null; GeneratingType currentType = null; switch (type) { case 0: pointList = m_creator.g_customData.roadLists; currentType = m_road; break; case 1: pointList = m_creator.g_customData.riverLists; currentType = m_river; break; case 2: pointList = m_creator.g_customData.hillLists; currentType = m_hill; break; case 3: pointList = m_creator.g_customData.mountainLists; currentType = m_mountain; break; case 4: pointList = m_creator.g_customData.sandGroundLists; currentType = m_sandGround; break; case 5: pointList = m_creator.g_customData.soilGroundLists; currentType = m_soilGround; break; case 6: pointList = m_creator.g_customData.islandLists; currentType = m_island; break; } if (currentType == null) { return; } EditorGUILayout.BeginHorizontal(); currentType.expand = EditorGUILayout.Foldout(currentType.expand, currentType.name + " Section"); EditorGUI.indentLevel++; EditorGUILayout.EndHorizontal();; if (currentType.expand) { bool boolTemp = false; for (int i = 0; i < pointList.Count; i++) { EditorGUILayout.BeginHorizontal(); boolTemp = EditorGUILayout.Foldout(currentType.currentIndex == i, currentType.name + i.ToString()); if (boolTemp != (currentType.currentIndex == i)) { if (boolTemp == false) { currentType.currentIndex = -1; } } GUILayout.FlexibleSpace(); if (GUILayout.Button("Delete", GUILayout.Width(100))) { pointList.RemoveAt(i); return; } EditorGUILayout.EndHorizontal(); if (boolTemp == true) { currentType.currentIndex = i; DrawVector2ListField(pointList[i]); } } EditorGUILayout.BeginHorizontal(); GUILayout.Label("", GUILayout.Width(15)); //why? indentLevel doesn't work... if (GUILayout.Button("Add " + currentType.name, GUILayout.Width(150))) { pointList.Add(new List <Vector2d>()); } EditorGUILayout.EndHorizontal(); } EditorGUI.indentLevel--; }