public override void OnInspectorGUI() { EditorGUILayout.PropertyField(serializedObject.FindProperty("m_BlockName")); SerializedProperty ty = serializedObject.FindProperty("m_Type"); BlockType type = (BlockType)Enum.Parse(typeof(BlockType), ty.enumNames[ty.enumValueIndex], true); ShowBlockTypeEnum(ty); SerializedProperty fs = serializedObject.FindProperty("m_Flags"); BlockFlags flags = (target as Block).Flags; EditorGUILayout.PropertyField(fs); SerializedProperty vertexType = serializedObject.FindProperty("m_VertexType"); BlockVertexType v = (BlockVertexType)Enum.Parse(typeof(BlockVertexType), vertexType.enumNames[vertexType.enumValueIndex], true); EditorGUILayout.PropertyField(vertexType); if ((flags & BlockFlags.Liquid) == BlockFlags.Liquid && v == BlockVertexType.PerpendicularQuads) { Debug.LogWarning("液体的顶点类型应该是立方体"); } EditorGUILayout.PropertyField(serializedObject.FindProperty("m_MoveResistance")); EditorGUILayout.PropertyField(serializedObject.FindProperty("m_LightOpacity")); EditorGUILayout.PropertyField(serializedObject.FindProperty("m_LightValue")); EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Hardness")); EditorGUILayout.PropertyField(serializedObject.FindProperty("m_DestoryEffectColor")); EditorGUILayout.Space(); m_ExtraAssets.DoLayoutList(); EditorGUILayout.Space(); UVFoldout(v); EditorGUILayout.Space(); AudioClipsFoldout(type); serializedObject.ApplyModifiedProperties(); }
private void UVFoldout(BlockVertexType type) { if (m_UVFoldout = EditorGUILayout.BeginFoldoutHeaderGroup(m_UVFoldout, "UV Data")) { switch (type) { case BlockVertexType.Cube: CubeUV(); break; case BlockVertexType.PerpendicularQuads: PerpendicularQuadsUV(); break; default: NoneUV(); break; } } EditorGUILayout.EndFoldoutHeaderGroup(); }