Browse Source

Merge pull request #471 from snozbot/pr-467

Added pr changes to new branch
master
Chris Gregan 9 years ago
parent
commit
7bf352c04f
  1. 35
      Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs
  2. 9
      Assets/Fungus/Flowchart/Editor/Extensions.meta
  3. 45
      Assets/Fungus/Flowchart/Editor/Extensions/SerializedPropertyExtensions.cs
  4. 12
      Assets/Fungus/Flowchart/Editor/Extensions/SerializedPropertyExtensions.cs.meta
  5. 41
      Assets/Fungus/Flowchart/Editor/VariableListAdaptor.cs

35
Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs

@ -465,41 +465,6 @@ namespace Fungus
; ;
} }
private void ResetValue(SerializedProperty element) {
switch (element.type) {
case "string":
element.stringValue = "";
break;
case "Vector2f":
element.vector2Value = Vector2.zero;
break;
case "Vector3f":
element.vector3Value = Vector3.zero;
break;
case "Rectf":
element.rectValue = new Rect();
break;
case "Quaternionf":
element.quaternionValue = Quaternion.identity;
break;
case "int":
element.intValue = 0;
break;
case "float":
element.floatValue = 0f;
break;
case "UInt8":
element.boolValue = false;
break;
case "ColorRGBA":
element.colorValue = Color.black;
break;
default:
if (element.type.StartsWith("PPtr"))
element.objectReferenceValue = null;
break;
}
}
} }
} }

9
Assets/Fungus/Flowchart/Editor/Extensions.meta

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 895ead76bb3488c4481a5ae7d88c03df
folderAsset: yes
timeCreated: 1462775995
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

45
Assets/Fungus/Flowchart/Editor/Extensions/SerializedPropertyExtensions.cs

@ -0,0 +1,45 @@
using UnityEditor;
using UnityEngine;
namespace Fungus
{
public static class SerializedPropertyExtensions
{
public static void ResetValue(this SerializedProperty element) {
switch (element.type) {
case "string":
element.stringValue = "";
break;
case "Vector2f":
element.vector2Value = Vector2.zero;
break;
case "Vector3f":
element.vector3Value = Vector3.zero;
break;
case "Rectf":
element.rectValue = new Rect();
break;
case "Quaternionf":
element.quaternionValue = Quaternion.identity;
break;
case "int":
element.intValue = 0;
break;
case "float":
element.floatValue = 0f;
break;
case "UInt8":
element.boolValue = false;
break;
case "ColorRGBA":
element.colorValue = Color.black;
break;
default:
if (element.type.StartsWith("PPtr"))
element.objectReferenceValue = null;
break;
}
}
}
}

12
Assets/Fungus/Flowchart/Editor/Extensions/SerializedPropertyExtensions.cs.meta

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ffbc18a30fa1a6547a0ef5fc3389c9c0
timeCreated: 1462775995
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

41
Assets/Fungus/Flowchart/Editor/VariableListAdaptor.cs

@ -51,12 +51,12 @@ namespace Fungus
public void Add() { public void Add() {
int newIndex = _arrayProperty.arraySize; int newIndex = _arrayProperty.arraySize;
++_arrayProperty.arraySize; ++_arrayProperty.arraySize;
ResetValue(_arrayProperty.GetArrayElementAtIndex(newIndex)); _arrayProperty.GetArrayElementAtIndex(newIndex).ResetValue();
} }
public void Insert(int index) { public void Insert(int index) {
_arrayProperty.InsertArrayElementAtIndex(index); _arrayProperty.InsertArrayElementAtIndex(index);
ResetValue(_arrayProperty.GetArrayElementAtIndex(index)); _arrayProperty.GetArrayElementAtIndex(index).ResetValue();
} }
public void Duplicate(int index) { public void Duplicate(int index) {
@ -191,43 +191,6 @@ namespace Fungus
: EditorGUI.GetPropertyHeight(this[index], GUIContent.none, false) : EditorGUI.GetPropertyHeight(this[index], GUIContent.none, false)
; ;
} }
private void ResetValue(SerializedProperty element) {
switch (element.type) {
case "string":
element.stringValue = "";
break;
case "Vector2f":
element.vector2Value = Vector2.zero;
break;
case "Vector3f":
element.vector3Value = Vector3.zero;
break;
case "Rectf":
element.rectValue = new Rect();
break;
case "Quaternionf":
element.quaternionValue = Quaternion.identity;
break;
case "int":
element.intValue = 0;
break;
case "float":
element.floatValue = 0f;
break;
case "UInt8":
element.boolValue = false;
break;
case "ColorRGBA":
element.colorValue = Color.black;
break;
default:
if (element.type.StartsWith("PPtr"))
element.objectReferenceValue = null;
break;
}
}
} }
} }

Loading…
Cancel
Save