コード例 #1
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            SkinnerEditorUtility.DrawLine();
            EditorGUILayout.LabelField(EditorConst.UserLogicSampleTitle);
            SkinnerEditorUtility.DrawLine();

            UserLogic drawTarget = serializedObject.targetObject as UserLogic;

            ReloadDummyData(drawTarget);

            var scriptableLogic = SkinPartsInspectorAccess.GetSkinInspector(typeof(ScriptableLogic));

            // ダミーデータをマッピングする
            dummyProperty.serializedObject.Update();
            dummyEditorSkinPartsProperty.MapProperties(dummyProperty);

            GUI.enabled = false;

            // ダミーデータを描画
            UserLogicExtension.SetActiveUserLogic(drawTarget);
            scriptableLogic.CleanupFields(dummyEditorSkinPartsProperty);
            scriptableLogic.DrawInspector(dummyEditorSkinPartsProperty);
            UserLogicExtension.ReleaseActiveUserLogic();

            GUI.enabled = true;

            // ダミーデータを更新
            dummyProperty.serializedObject.ApplyModifiedPropertiesWithoutUndo();

            SkinnerEditorUtility.DrawLine();
        }
コード例 #2
0
        public void DrawInspector(EditorSkinPartsPropertry property)
        {
            SkinnerEditorUtility.ResetArray(property.objectReferenceValues, AnimationSample.ObjectLength);
            SkinnerEditorUtility.ResetArray(property.floatValues, AnimationSample.FloatLength);
            var gameObjectProperty    = property.objectReferenceValues.GetArrayElementAtIndex(AnimationSample.GameObjectIndex);
            var animationClipProperty = property.objectReferenceValues.GetArrayElementAtIndex(AnimationSample.AnimationClipIndex);
            var timeProperty          = property.floatValues.GetArrayElementAtIndex(AnimationSample.TimeIndex);

            gameObjectProperty.objectReferenceValue    = EditorGUILayout.ObjectField(SkinContent.RootGameObject, gameObjectProperty.objectReferenceValue, typeof(GameObject), true);
            animationClipProperty.objectReferenceValue = EditorGUILayout.ObjectField(SkinContent.AnimationClip, animationClipProperty.objectReferenceValue, typeof(AnimationClip), false);
            if (!animationClipProperty.hasMultipleDifferentValues && animationClipProperty.objectReferenceValue is AnimationClip)
            {
                var clip = animationClipProperty.objectReferenceValue as AnimationClip;
                EditorGUILayout.Slider(timeProperty, 0, clip.length, SkinContent.SampleTime);
            }
            else
            {
                bool showMixedValue = EditorGUI.showMixedValue;
                if (timeProperty.hasMultipleDifferentValues)
                {
                    EditorGUI.showMixedValue = true;
                }
                timeProperty.floatValue  = EditorGUILayout.FloatField(SkinContent.SampleTime, timeProperty.floatValue);
                EditorGUI.showMixedValue = showMixedValue;
            }
        }
コード例 #3
0
 protected override void CleanupFieldsOtherThanObjectReference(EditorSkinPartsPropertryWithoutObjectReference property)
 {
     SkinnerEditorUtility.CleanArray(property.boolValues);
     SkinnerEditorUtility.CleanArray(property.colorValues, OutlineColor.ColorLength);
     SkinnerEditorUtility.CleanArray(property.floatValues);
     SkinnerEditorUtility.CleanArray(property.intValues);
     SkinnerEditorUtility.CleanArray(property.vector4Values);
     SkinnerEditorUtility.CleanArray(property.stringValues);
 }
コード例 #4
0
 protected override void CleanupFieldsOtherThanObjectReference(EditorSkinPartsPropertryWithoutObjectReference property)
 {
     SkinnerEditorUtility.CleanArray(property.boolValues);
     SkinnerEditorUtility.CleanArray(property.colorValues);
     SkinnerEditorUtility.CleanArray(property.floatValues);
     SkinnerEditorUtility.CleanArray(property.intValues);
     SkinnerEditorUtility.CleanArray(property.vector4Values, TransformRotation.VectorLength, Vector3.one);
     SkinnerEditorUtility.CleanArray(property.stringValues);
 }
コード例 #5
0
        public void DrawInspector(EditorSkinPartsPropertry property)
        {
            SkinnerEditorUtility.ResetArray(property.objectReferenceValues, ImageSprite.ObjectLength);
            var imageProperty = property.objectReferenceValues.GetArrayElementAtIndex(ImageSprite.ImageIndex);
            SerializedProperty spriteProperty = property.objectReferenceValues.GetArrayElementAtIndex(ImageSprite.SpriteIndex);

            imageProperty.objectReferenceValue  = EditorGUILayout.ObjectField(SkinContent.Image, imageProperty.objectReferenceValue, typeof(Image), true);
            spriteProperty.objectReferenceValue = EditorGUILayout.ObjectField(SkinContent.Sprite, spriteProperty.objectReferenceValue, typeof(Sprite), false);
        }
コード例 #6
0
        public void DrawInspector(EditorSkinPartsPropertry property)
        {
            SkinnerEditorUtility.ResetArray(property.objectReferenceValues, GraphicMaterial.ObjectLength);
            var graphicProperty  = property.objectReferenceValues.GetArrayElementAtIndex(GraphicMaterial.GraphicIndex);
            var materialProperty = property.objectReferenceValues.GetArrayElementAtIndex(GraphicMaterial.MaterialIndex);

            graphicProperty.objectReferenceValue  = EditorGUILayout.ObjectField(SkinContent.Graphic, graphicProperty.objectReferenceValue, typeof(Graphic), true);
            materialProperty.objectReferenceValue = EditorGUILayout.ObjectField(SkinContent.Material, materialProperty.objectReferenceValue, typeof(Material), false);
        }
コード例 #7
0
        public void DrawInspector(EditorSkinPartsPropertry property)
        {
            SkinnerEditorUtility.ResetArray(property.objectReferenceValues, RawImageTexture.ObjectLength);
            var rawImageProperty = property.objectReferenceValues.GetArrayElementAtIndex(RawImageTexture.RawImageIndex);
            SerializedProperty textureProperty = property.objectReferenceValues.GetArrayElementAtIndex(RawImageTexture.Texture2DIndex);

            rawImageProperty.objectReferenceValue = EditorGUILayout.ObjectField(SkinContent.RawImage, rawImageProperty.objectReferenceValue, typeof(RawImage), true);
            textureProperty.objectReferenceValue  = EditorGUILayout.ObjectField(SkinContent.Texture2D, textureProperty.objectReferenceValue, typeof(Texture2D), false);
        }
コード例 #8
0
 public void CleanupFields(EditorSkinPartsPropertry property)
 {
     SkinnerEditorUtility.CleanArray(property.objectReferenceValues, GraphicMaterial.ObjectLength);
     SkinnerEditorUtility.CleanObject <Graphic>(property.objectReferenceValues, GraphicMaterial.GraphicIndex);
     SkinnerEditorUtility.CleanObject <Material>(property.objectReferenceValues, GraphicMaterial.MaterialIndex);
     SkinnerEditorUtility.CleanArray(property.boolValues);
     SkinnerEditorUtility.CleanArray(property.colorValues);
     SkinnerEditorUtility.CleanArray(property.floatValues);
     SkinnerEditorUtility.CleanArray(property.intValues);
     SkinnerEditorUtility.CleanArray(property.vector4Values);
     SkinnerEditorUtility.CleanArray(property.stringValues);
 }
コード例 #9
0
 public void CleanupFields(EditorSkinPartsPropertry property)
 {
     SkinnerEditorUtility.CleanArray(property.objectReferenceValues, ImageSprite.ObjectLength);
     SkinnerEditorUtility.CleanObject <Image>(property.objectReferenceValues, ImageSprite.ImageIndex);
     SkinnerEditorUtility.CleanObject <Sprite>(property.objectReferenceValues, ImageSprite.SpriteIndex);
     SkinnerEditorUtility.CleanArray(property.boolValues);
     SkinnerEditorUtility.CleanArray(property.colorValues);
     SkinnerEditorUtility.CleanArray(property.floatValues);
     SkinnerEditorUtility.CleanArray(property.intValues);
     SkinnerEditorUtility.CleanArray(property.vector4Values);
     SkinnerEditorUtility.CleanArray(property.stringValues);
 }
コード例 #10
0
 public void CleanupFields(EditorSkinPartsPropertry property)
 {
     SkinnerEditorUtility.CleanArray(property.objectReferenceValues, AnimationSample.ObjectLength);
     SkinnerEditorUtility.CleanObject <GameObject>(property.objectReferenceValues, AnimationSample.GameObjectIndex);
     SkinnerEditorUtility.CleanObject <AnimationClip>(property.objectReferenceValues, AnimationSample.AnimationClipIndex);
     SkinnerEditorUtility.CleanArray(property.boolValues);
     SkinnerEditorUtility.CleanArray(property.colorValues);
     SkinnerEditorUtility.CleanArray(property.floatValues, AnimationSample.FloatLength);
     SkinnerEditorUtility.CleanArray(property.intValues);
     SkinnerEditorUtility.CleanArray(property.vector4Values);
     SkinnerEditorUtility.CleanArray(property.stringValues);
 }
コード例 #11
0
 public void CleanupFields(EditorSkinPartsPropertry property)
 {
     SkinnerEditorUtility.CleanArray(property.objectReferenceValues, RawImageTexture.ObjectLength);
     SkinnerEditorUtility.CleanObject <RawImage>(property.objectReferenceValues, RawImageTexture.RawImageIndex);
     SkinnerEditorUtility.CleanObject <Texture2D>(property.objectReferenceValues, RawImageTexture.Texture2DIndex);
     SkinnerEditorUtility.CleanArray(property.boolValues);
     SkinnerEditorUtility.CleanArray(property.colorValues);
     SkinnerEditorUtility.CleanArray(property.floatValues);
     SkinnerEditorUtility.CleanArray(property.intValues);
     SkinnerEditorUtility.CleanArray(property.vector4Values);
     SkinnerEditorUtility.CleanArray(property.stringValues);
 }
コード例 #12
0
 protected override void ResetArrayOtherThanObjectReference(EditorSkinPartsPropertryWithoutObjectReference property)
 {
     SkinnerEditorUtility.ResetArray(property.colorValues, OutlineColor.ColorLength);
 }
コード例 #13
0
 protected override void ResetArrayOtherThanObjectReference(EditorSkinPartsPropertryWithoutObjectReference property)
 {
     SkinnerEditorUtility.ResetArray(property.floatValues, CanvasGroupAlpha.FloatLength);
 }
コード例 #14
0
 protected override void ResetArrayOtherThanObjectReference(EditorSkinPartsPropertryWithoutObjectReference property)
 {
     SkinnerEditorUtility.ResetArray(property.boolValues, GraphicEnable.BoolLength);
 }
コード例 #15
0
 protected override void ResetArrayOtherThanObjectReference(EditorSkinPartsPropertryWithoutObjectReference property)
 {
     SkinnerEditorUtility.ResetArray(property.vector4Values, TransformRotation.VectorLength, true, Vector3.one);
 }
コード例 #16
0
        public void DrawInspector(EditorSkinPartsPropertry property)
        {
            SkinnerEditorUtility.ResetArray(property.objectReferenceValues, DefaultArrayLength, false);
            ResetArrayOtherThanObjectReference(property);

            var componentInfo = SkinnerEditorUtility.GetComponentInfos(typeof(T));


            for (int iz = 0; iz < property.objectReferenceValues.arraySize; iz++)
            {
                EditorGUILayout.BeginHorizontal();
                SerializedProperty gameObjectProperty = property.objectReferenceValues.GetArrayElementAtIndex(iz);
                m_FieldNumberTitle.text = string.Format(EditorConst.FieldNumberTitle, iz);
                gameObjectProperty.objectReferenceValue = EditorGUILayout.ObjectField(m_FieldNumberTitle, gameObjectProperty.objectReferenceValue, typeof(T), true);
                if (componentInfo.isComponent && componentInfo.allowMultiplyComponent)
                {
                    T        c = gameObjectProperty.objectReferenceValue as T;
                    int      componentIndex = -1;
                    List <T> componentList  = null;
                    if (c)
                    {
                        componentList  = (c as Component).gameObject.GetComponents <T>().ToList();
                        componentIndex = componentList.IndexOf(c);
                    }
                    bool guiEnabled = GUI.enabled;
                    if (componentIndex < 0)
                    {
                        componentIndex = 0;
                        GUI.enabled    = false;
                    }
                    int editIndex = EditorGUILayout.IntField(GUIContent.none, componentIndex, EditorConst.ComponentIndexFieldMaxWidth);
                    if (editIndex != componentIndex)
                    {
                        editIndex = Mathf.Clamp(editIndex, 0, componentList.Count - 1);
                        gameObjectProperty.objectReferenceValue = componentList[editIndex];
                        gameObjectProperty.serializedObject.ApplyModifiedProperties();
                    }
                    GUI.enabled = guiEnabled;
                }
                if (SkinnerEditorUtility.DrawAddButton(EditorConst.RemoveFieldButtonTitle, () => {
                    property.objectReferenceValues.GetArrayElementAtIndex(iz).objectReferenceValue = null;
                    property.objectReferenceValues.DeleteArrayElementAtIndex(iz);
                    property.objectReferenceValues.serializedObject.ApplyModifiedProperties();
                }))
                {
                    return;
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.BeginHorizontal();

            DrawOptionProperty(property);

            m_AddFieldButtonTitle.text = string.Format(EditorConst.AddFieldButtonTitle, SkinnerEditorUtility.GetEditorName(typeof(T).Name));

            bool isClicked = SkinnerEditorUtility.DrawAddButton(m_AddFieldButtonTitle, () => {
                property.objectReferenceValues.InsertArrayElementAtIndex(property.objectReferenceValues.arraySize);
                property.objectReferenceValues.serializedObject.ApplyModifiedProperties();
            });

            if (isClicked)
            {
                return;
            }
            EditorGUILayout.EndHorizontal();
        }
コード例 #17
0
 public void CleanupFields(EditorSkinPartsPropertry property)
 {
     SkinnerEditorUtility.CleanObjectReferenceArrayWithFlexibleSize <T>(property.objectReferenceValues, DefaultArrayLength);
     CleanupFieldsOtherThanObjectReference(property);
 }