private void RoofParams() { EditorGUILayout.LabelField("Roof", EditorStyles.boldLabel); rtype = (myRType) EditorGUILayout.EnumPopup("Roof type", rtype); switch (rtype) { case myRType.Flat: _building.roofType = Type.GetType(GetFullType(myRType.Flat)); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Roof decor texture"); inputRoofDecor = EditorGUILayout.Toggle(inputRoofDecor); if (inputRoofDecor) { roofDecorTexture = EditorGUILayout.ObjectField(roofDecorTexture, typeof(Texture), false, GUILayout.Height(55)); if (roofDecorTexture != null) _building.roofDecorMaterial = MaterialManager.Instance. FindByTextureName(roofDecorTexture.name); } else { _building.roofDecorMaterial = null; roofDecorTexture = null; } EditorGUILayout.EndHorizontal(); break; case myRType.SinglePeak: _building.roofType = Type.GetType(GetFullType(myRType.SinglePeak)); inputRoofDecor = false; _building.roofDecorMaterial = null; break; case myRType.DoublePeak: _building.roofType = Type.GetType(GetFullType(myRType.DoublePeak)); inputRoofDecor = false; _building.roofDecorMaterial = null; break; default: _building.roofType = null; inputRoofDecor = false; _building.roofDecorMaterial = null; break; } // roof texture EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Roof texture"); inputRoof = EditorGUILayout.Toggle(inputRoof); if (inputRoof) { roofTexture = EditorGUILayout.ObjectField(roofTexture, typeof(Texture), false, GUILayout.Height(55)); if (roofTexture != null) _building.roofMaterial = MaterialManager.Instance. FindByTextureName(roofTexture.name); } else { _building.roofMaterial = null; roofTexture = null; } EditorGUILayout.EndHorizontal(); // roof base texture EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Roof base texture"); inputRoofBase = EditorGUILayout.Toggle(inputRoofBase); if (inputRoofBase) { roofBaseTexture = EditorGUILayout.ObjectField(roofBaseTexture, typeof(Texture), false, GUILayout.Height(55)); if (roofBaseTexture != null) _building.roofBaseMaterial = MaterialManager.Instance. FindByTextureName(roofBaseTexture.name); } else { _building.roofBaseMaterial = null; roofBaseTexture = null; } EditorGUILayout.EndHorizontal(); }
private string GetFullType(myRType t) { return("Thesis." + t.ToString() + "Roof,Assembly-CSharp-firstpass"); }
private string GetFullType(myRType t) { return "Thesis." + t.ToString() + "Roof,Assembly-CSharp-firstpass"; }
private void RoofParams() { EditorGUILayout.LabelField("Roof", EditorStyles.boldLabel); rtype = (myRType)EditorGUILayout.EnumPopup("Roof type", rtype); switch (rtype) { case myRType.Flat: _building.roofType = Type.GetType(GetFullType(myRType.Flat)); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Roof decor texture"); inputRoofDecor = EditorGUILayout.Toggle(inputRoofDecor); if (inputRoofDecor) { roofDecorTexture = EditorGUILayout.ObjectField(roofDecorTexture, typeof(Texture), false, GUILayout.Height(55)); if (roofDecorTexture != null) { _building.roofDecorMaterial = MaterialManager.Instance. FindByTextureName(roofDecorTexture.name); } } else { _building.roofDecorMaterial = null; roofDecorTexture = null; } EditorGUILayout.EndHorizontal(); break; case myRType.SinglePeak: _building.roofType = Type.GetType(GetFullType(myRType.SinglePeak)); inputRoofDecor = false; _building.roofDecorMaterial = null; break; case myRType.DoublePeak: _building.roofType = Type.GetType(GetFullType(myRType.DoublePeak)); inputRoofDecor = false; _building.roofDecorMaterial = null; break; default: _building.roofType = null; inputRoofDecor = false; _building.roofDecorMaterial = null; break; } // roof texture EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Roof texture"); inputRoof = EditorGUILayout.Toggle(inputRoof); if (inputRoof) { roofTexture = EditorGUILayout.ObjectField(roofTexture, typeof(Texture), false, GUILayout.Height(55)); if (roofTexture != null) { _building.roofMaterial = MaterialManager.Instance. FindByTextureName(roofTexture.name); } } else { _building.roofMaterial = null; roofTexture = null; } EditorGUILayout.EndHorizontal(); // roof base texture EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Roof base texture"); inputRoofBase = EditorGUILayout.Toggle(inputRoofBase); if (inputRoofBase) { roofBaseTexture = EditorGUILayout.ObjectField(roofBaseTexture, typeof(Texture), false, GUILayout.Height(55)); if (roofBaseTexture != null) { _building.roofBaseMaterial = MaterialManager.Instance. FindByTextureName(roofBaseTexture.name); } } else { _building.roofBaseMaterial = null; roofBaseTexture = null; } EditorGUILayout.EndHorizontal(); }