コード例 #1
0
ファイル: GuiHelpers.cs プロジェクト: CarminaP/Diorama
        /// <summary>
        /// Draw an area for specific types
        /// </summary>
        /// <typeparam name="T">The desired type area</typeparam>
        /// <param name="property">The related serialized property</param>
        /// <param name="label">The label to write</param>
        /// <param name="parameters">Some formatted parameters</param>
        public static void DrawArea <T>(ref SerializedProperty property, string label, object parameters = null)
        {
            GUILayout.Button(label, EditorStyles.boldLabel);

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);

            if (typeof(T) == typeof(Texture2D))
            {
                GuiHelpers.DrawTexture2DField(ref property);
            }
            else if (typeof(T) == typeof(Texture3D))
            {
                GuiHelpers.DrawTexture3DField(ref property);
            }
            else if (typeof(T) == typeof(TransformParameters))
            {
                GuiHelpers.DrawTransformField(ref property);
            }
            else if (typeof(T) == typeof(VolumeInjectionCommonParameters))
            {
                GuiHelpers.DrawInjectionField(ref property, (int)parameters);
            }

            EditorGUILayout.EndVertical();
        }