public static SkillTexture FsmTextureField(GUIContent label, Skill fsm, SkillTexture fsmObject) { if (label == null) { label = GUIContent.none; } EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); if (fsmObject.get_UseVariable()) { fsmObject = VariableEditor.DoFsmTexturePopup(label, fsm, fsmObject); } else { EditorGUILayout.PrefixLabel(label); fsmObject.set_Value((Texture)EditorGUILayout.ObjectField(fsmObject.get_Value(), typeof(Texture), !SkillEditor.SelectedFsmIsPersistent(), new GUILayoutOption[] { GUILayout.Width(80f), GUILayout.Height(80f) })); GUILayout.FlexibleSpace(); } fsmObject = (SkillTexture)VariableEditor.VariableToggle(fsmObject, label.get_text()); VariableEditor.EndVariableEditor(fsmObject); return(fsmObject); }
public static SkillVector3 FsmVector3Field(GUIContent label, Skill fsm, SkillVector3 fsmVector3) { EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); if (fsmVector3.get_UseVariable()) { fsmVector3 = VariableEditor.DoFsmVector3Popup(label, fsm, fsmVector3); } else { fsmVector3.set_Value(EditorGUILayout.Vector3Field(label.get_text(), fsmVector3.get_Value(), new GUILayoutOption[0])); } fsmVector3 = (SkillVector3)VariableEditor.VariableToggle(fsmVector3, label.get_text()); VariableEditor.EndVariableEditor(fsmVector3); return(fsmVector3); }
public static SkillColor FsmColorField(GUIContent label, Skill fsm, SkillColor fsmColor) { EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); if (fsmColor.get_UseVariable()) { fsmColor = VariableEditor.DoFsmColorPopup(label, fsm, fsmColor); } else { fsmColor.set_Value(EditorGUILayout.ColorField(label, fsmColor.get_Value(), new GUILayoutOption[0])); } fsmColor = (SkillColor)VariableEditor.VariableToggle(fsmColor, label.get_text()); VariableEditor.EndVariableEditor(fsmColor); return(fsmColor); }
public static SkillRect FsmRectField(GUIContent label, Skill fsm, SkillRect fsmRect) { EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); if (fsmRect.get_UseVariable()) { fsmRect = VariableEditor.DoFsmRectPopup(label, fsm, fsmRect); } else { fsmRect.set_Value(EditorGUILayout.RectField(label.get_text(), fsmRect.get_Value(), new GUILayoutOption[0])); } fsmRect = (SkillRect)VariableEditor.VariableToggle(fsmRect, label.get_text()); VariableEditor.EndVariableEditor(fsmRect); return(fsmRect); }
public static SkillBool FsmBoolField(GUIContent label, Skill fsm, SkillBool fsmBool) { EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); if (fsmBool.get_UseVariable()) { fsmBool = VariableEditor.DoFsmBoolPopup(label, fsm, fsmBool); } else { fsmBool.set_Value(EditorGUILayout.Toggle(label, fsmBool.get_Value(), new GUILayoutOption[0])); } fsmBool = (SkillBool)VariableEditor.VariableToggle(fsmBool, label.get_text()); VariableEditor.EndVariableEditor(fsmBool); return(fsmBool); }
public static SkillFloat FsmFloatSlider(GUIContent label, Skill fsm, SkillFloat fsmFloat, float minSliderValue, float maxSliderValue) { EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); if (fsmFloat.get_UseVariable()) { fsmFloat = VariableEditor.DoFsmFloatPopup(label, fsm, fsmFloat); } else { fsmFloat.set_Value(SkillEditorGUILayout.FloatSlider(label, fsmFloat.get_Value(), minSliderValue, maxSliderValue)); } fsmFloat = (SkillFloat)VariableEditor.VariableToggle(fsmFloat, label.get_text()); VariableEditor.EndVariableEditor(fsmFloat); return(fsmFloat); }
public static SkillEnum FsmEnumField(GUIContent label, Skill fsm, SkillEnum fsmEnum, Type objectType) { fsmEnum.set_EnumType(objectType); EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); if (fsmEnum.get_UseVariable()) { fsmEnum = VariableEditor.DoFsmEnumPopup(label, fsm, fsmEnum, objectType); } else { fsmEnum.set_Value(EditorGUILayout.EnumPopup(label, fsmEnum.get_Value(), new GUILayoutOption[0])); } fsmEnum = (SkillEnum)VariableEditor.VariableToggle(fsmEnum, label.get_text()); VariableEditor.EndVariableEditor(fsmEnum); return(fsmEnum); }
public static SkillArray FsmArrayField(GUIContent label, Skill fsm, SkillArray fsmArray, VariableType typeConstraint) { EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); if (fsmArray.get_UseVariable()) { fsmArray = VariableEditor.DoFsmArrayPopup(label, fsm, fsmArray, typeConstraint); } else { fsmArray.SetType(typeConstraint); GUILayout.Label(label, new GUILayoutOption[0]); } fsmArray = (SkillArray)VariableEditor.VariableToggle(fsmArray, label.get_text()); VariableEditor.EndVariableEditor(fsmArray); return(fsmArray); }
public static SkillMaterial FsmMaterialField(GUIContent label, Skill fsm, SkillMaterial fsmObject) { if (label == null) { label = GUIContent.none; } EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); if (fsmObject.get_UseVariable()) { fsmObject = VariableEditor.DoFsmMaterialPopup(label, fsm, fsmObject); } else { fsmObject.set_Value((Material)EditorGUILayout.ObjectField(label, fsmObject.get_Value(), typeof(Material), !SkillEditor.SelectedFsmIsPersistent(), new GUILayoutOption[0])); } fsmObject = (SkillMaterial)VariableEditor.VariableToggle(fsmObject, label.get_text()); VariableEditor.EndVariableEditor(fsmObject); return(fsmObject); }
public static SkillQuaternion FsmQuaternionField(GUIContent label, Skill fsm, SkillQuaternion fsmQauternion) { EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); if (fsmQauternion.get_UseVariable()) { fsmQauternion = VariableEditor.DoFsmQuaternionPopup(label, fsm, fsmQauternion); } else { Vector3 vector = EditorGUILayout.Vector3Field(label.get_text(), fsmQauternion.get_Value().get_eulerAngles(), new GUILayoutOption[0]); if (vector != fsmQauternion.get_Value().get_eulerAngles()) { fsmQauternion.set_Value(Quaternion.Euler(vector)); } } fsmQauternion = (SkillQuaternion)VariableEditor.VariableToggle(fsmQauternion, label.get_text()); VariableEditor.EndVariableEditor(fsmQauternion); return(fsmQauternion); }
private static NamedVariable VariableToggle(NamedVariable variable, string label) { bool flag = VariableEditor.VariableToggle(variable.get_UseVariable()); if (flag != variable.get_UseVariable()) { if (!flag) { return(SkillVariable.GetNewVariableOfSameType(variable)); } variable.set_UseVariable(true); variable.set_Name(null); if (EditorGUI.get_actionKey()) { return(EditorCommands.AddVariable(SkillVariable.GetVariableType(variable), label.Trim(new char[] { '*' }).ToCamelCase())); } } return(variable); }
public static SkillObject FsmObjectField(GUIContent label, Skill fsm, SkillObject fsmObject, Type objectTypeConstraint, object[] attributes) { if (label == null) { label = GUIContent.none; } if (fsmObject == null) { SkillObject fsmObject2 = new SkillObject(); fsmObject2.set_ObjectType(objectTypeConstraint); fsmObject = fsmObject2; } EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); if (!objectTypeConstraint.IsAssignableFrom(fsmObject.get_ObjectType())) { fsmObject.set_ObjectType(objectTypeConstraint); } if (fsmObject.get_UseVariable()) { fsmObject = VariableEditor.DoFsmObjectPopup(label, fsm, fsmObject, objectTypeConstraint); } else { ObjectPropertyDrawer objectPropertyDrawer = ObjectPropertyDrawers.GetObjectPropertyDrawer(fsmObject.get_ObjectType()); if (objectPropertyDrawer != null) { fsmObject.set_Value(objectPropertyDrawer.OnGUI(label, fsmObject.get_Value(), !SkillEditor.SelectedFsmIsPersistent(), attributes)); } else { fsmObject.set_Value(EditorGUILayout.ObjectField(label, fsmObject.get_Value(), fsmObject.get_ObjectType(), !SkillEditor.SelectedFsmIsPersistent(), new GUILayoutOption[0])); } } fsmObject = (SkillObject)VariableEditor.VariableToggle(fsmObject, label.get_text()); VariableEditor.EndVariableEditor(fsmObject); return(fsmObject); }
public static SkillInt FsmIntField(GUIContent label, Skill fsm, SkillInt fsmInt, object[] attributes) { EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); if (fsmInt.get_UseVariable()) { fsmInt = VariableEditor.DoFsmIntPopup(label, fsm, fsmInt); } else { UIHint uIHint = CustomAttributeHelpers.GetUIHint(attributes); UIHint uIHint2 = uIHint; if (uIHint2 == 8) { fsmInt.set_Value(EditorGUILayout.LayerField(label, Convert.ToInt32(fsmInt.get_Value(), CultureInfo.get_CurrentCulture()), new GUILayoutOption[0])); } else { fsmInt.set_Value(EditorGUILayout.IntField(label, fsmInt.get_Value(), new GUILayoutOption[0])); } } fsmInt = (SkillInt)VariableEditor.VariableToggle(fsmInt, label.get_text()); VariableEditor.EndVariableEditor(fsmInt); return(fsmInt); }
public static SkillString FsmStringField(GUIContent label, Skill fsm, SkillString fsmString, object[] attributes) { if (fsmString.get_UseVariable()) { EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); fsmString = VariableEditor.DoFsmStringPopup(label, fsm, fsmString); } else { if (fsmString.get_Value() == null) { fsmString.set_Value(string.Empty); } EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); UIHint uIHint = CustomAttributeHelpers.GetUIHint(attributes); switch (uIHint) { case 1: { GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.Label(label, new GUILayoutOption[0]); Rect rect = GUILayoutUtility.GetRect(SkillEditorContent.TempContent(fsmString.get_Value(), ""), SkillEditorStyles.TextArea, new GUILayoutOption[] { GUILayout.MinHeight(44f) }); rect.set_width(340f); fsmString.set_Value(EditorGUI.TextArea(rect, fsmString.get_Value())); GUILayout.EndVertical(); goto IL_363; } case 2: fsmString.set_Value(ActionEditor.EditComponentName(label, fsmString.get_Value(), typeof(Behaviour))); goto IL_363; case 3: fsmString.set_Value(ActionEditor.EditComponentName(label, fsmString.get_Value(), typeof(MonoBehaviour))); ActionEditor.TrySetBehaviourContext(fsmString.get_Value()); goto IL_363; case 4: fsmString.set_Value(ActionEditor.EditMethodName(label, fsmString.get_Value(), false)); goto IL_363; case 6: fsmString.set_Value(EditorGUILayout.TextField(label, fsmString.get_Value(), new GUILayoutOption[0])); ActionEditor.AnimationNamePopup(fsmString); goto IL_363; case 7: fsmString.set_Value(EditorGUILayout.TagField(label, fsmString.get_Value(), new GUILayoutOption[0])); goto IL_363; case 8: StringEditor.LayerNamePopup(label, fsmString, null, null); goto IL_363; case 11: { fsmString.set_Value(EditorGUILayout.TextField(label, fsmString.get_Value(), new GUILayoutOption[0])); EditorGUI.BeginChangeCheck(); string text = SkillEditorGUILayout.ScriptListPopup(); if (EditorGUI.EndChangeCheck() && text != "") { fsmString.set_Value(text); goto IL_363; } goto IL_363; } case 15: fsmString.set_Value(EditorGUILayout.TextField(label, fsmString.get_Value(), new GUILayoutOption[0])); ActionEditor.FsmNamePopup(fsmString); goto IL_363; case 16: fsmString.set_Value(ActionEditor.EditFsmEvent(label, fsmString.get_Value())); goto IL_363; case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: fsmString.set_Value(EditorGUILayout.TextField(label, fsmString.get_Value(), new GUILayoutOption[0])); ActionEditor.VariablePopup(fsmString, uIHint); goto IL_363; case 32: fsmString.set_Value(EditorGUILayout.TextField(label, fsmString.get_Value(), new GUILayoutOption[0])); ActionEditor.AnimatorFloatPopup(fsmString); goto IL_363; case 33: fsmString.set_Value(EditorGUILayout.TextField(label, fsmString.get_Value(), new GUILayoutOption[0])); ActionEditor.AnimatorBoolPopup(fsmString); goto IL_363; case 34: fsmString.set_Value(EditorGUILayout.TextField(label, fsmString.get_Value(), new GUILayoutOption[0])); ActionEditor.AnimatorIntPopup(fsmString); goto IL_363; case 35: fsmString.set_Value(EditorGUILayout.TextField(label, fsmString.get_Value(), new GUILayoutOption[0])); ActionEditor.AnimatorTriggerPopup(fsmString); goto IL_363; case 36: StringEditor.SortingLayerNamePopup(label, fsmString, null, null); goto IL_363; } fsmString.set_Value(EditorGUILayout.TextField(label, fsmString.get_Value(), new GUILayoutOption[0])); } IL_363: fsmString = (SkillString)VariableEditor.VariableToggle(fsmString, label.get_text()); VariableEditor.EndVariableEditor(fsmString); return(fsmString); }