static string Stringify(SerializedObject instance, string indent, bool skipFirst) { if (instance is SerializedAtom) return Stringify(instance as SerializedAtom, indent, skipFirst); if (instance is SerializedAggregate) return Stringify(instance as SerializedAggregate, indent, skipFirst); if (instance is SerializedCollection) return Stringify(instance as SerializedCollection, indent, skipFirst); throw new InvalidOperationException(); }
public override SerializedObject Serialize() { var serializedObject = new SerializedObject(); serializedObject.Id = GameRegistry.Instance.GetObjectId<FloorObject>(); return serializedObject; }
public override void Deserialize(IntVector3 position, SerializedObject serializedObject) { this.Type = (WallType) serializedObject.Properties[0]; this.rotation = (Rotation) serializedObject.Properties[1]; SpawnWall(this.Type, position, this.rotation); }
public override SerializedObject Serialize() { var serializedObject = new SerializedObject(); serializedObject.Id = GameRegistry.Instance.GetObjectId<DoorObject>(); serializedObject.Properties.Add(this.rotation); return serializedObject; }
/// /// <summary> * Creates copies of the current associator. Note that this method /// * now uses Serialization to perform a deep copy, so the Associator /// * object must be fully Serializable. Any currently built model will /// * now be copied as well. /// * </summary> /// * <param name="model"> an example associator to copy </param> /// * <param name="num"> the number of associators copies to create. </param> /// * <returns> an array of associators. </returns> /// * <exception cref="Exception"> if an error occurs </exception> /// //JAVA TO VB & C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static TimeSeries[] makeCopies(TimeSeries model, int num) throws Exception public static TimeSeries[] makeCopies(TimeSeries model, int num) { if (model == null) { throw new Exception("No model time series analysis set"); } TimeSeries[] analyzers = new TimeSeries[num]; SerializedObject so = new SerializedObject(model); for (int i = 0; i < analyzers.Length; i++) { analyzers[i] = (TimeSeries) so.getObject(); } return analyzers; }
static string Stringify(SerializedObject instance, string indent) { return Stringify(instance, indent, false); }
static string NameString(SerializedObject instance, string indent, bool skip) { return (skip ? string.Empty : indent) + (instance.Name == null ? "(unnamed)" : "'" + instance.Name + "'"); }
public override void Deserialize(SpaceStation.Util.IntVector3 position, SerializedObject serializedObject) { throw new System.NotImplementedException(); }
public override void Deserialize(IntVector3 position, SerializedObject serializedObject) { SpawnFloor(position); }
public static void ChildNamePopUpParentOverride(this SerializedProperty _childNameProperty, SerializedObject _sourceRef, SerializedProperty _parentProperty) { var parent = _parentProperty.GetRootValue <GameObject>(); ChildNamePopUpParentOverride(_childNameProperty, _sourceRef, parent, _parentProperty.displayName); }
void OnEnable() { myTarget = (NetworkFields)target; so = new SerializedObject(target); prop = so.GetIterator(); }
public override void Deserialize(IntVector3 position, SerializedObject serializedObject) { var rotation = (Rotation) serializedObject.Properties[0]; SpawnDoor(position, rotation); }
private SerializedObject obj;//序列化SpecialEnum private void OnEnable() { obj = new SerializedObject(target); se = target as SpecialEnum; }
public static void ChildNamePopUpParentOverride(this SerializedProperty _childNameProperty, SerializedObject _sourceRef, GameObject _parent, string _parentFieldName) { var childName = _childNameProperty.GetRootValue <ChildName>(); childName.overrideParent = true; if (childName.parent != _parent) { childName.overridePropertyName = _parentFieldName; childName.parent = _parent; _sourceRef.Update(); } EditorGUILayout.PropertyField(_childNameProperty); }
static string TypeString(SerializedObject instance) { return instance.Type == null ? string.Empty : " :: " + instance.Type; }
public override void OnFlowWindowScreenMenuGUI(FD.FlowWindow windowSource, GenericMenu menu) { menu.AddItem(new GUIContent("Components Editor..."), on: false, func: (object win) => { var window = win as FD.FlowWindow; var screen = window.GetScreen() as LayoutWindowType; if (screen != null) { FlowSystemEditorWindow.GetWindow<FlowSystemEditorWindow>().SetDisabled(); //this.window = window; this.screen = screen; this.editor = Editor.CreateEditor(window.GetScreen()) as IPreviewEditor; this.component = null; this.hovered = null; this.element = null; this.listScrollPosition = Vector2.zero; var serializedObject = new SerializedObject(this.screen); var layout = serializedObject.FindProperty("layout"); var components = layout.FindPropertyRelative("components"); this.props.Clear(); for (int i = 0; i < components.arraySize; ++i) { var component = components.GetArrayElementAtIndex(i); this.props.Add(component); this.screen.layout.components[i].OnComponentChanged(this.screen, this.screen.layout.components[i].component); } this.settingsScrollPosition = Vector2.zero; this.opened = true; } }, userData: windowSource); }
void DrawCameraGUI(tk2dCamera target, bool complete) { bool allowProjectionParameters = target.SettingsRoot == target; bool oldGuiEnabled = GUI.enabled; SerializedObject so = this.serializedObject; SerializedObject cam = new SerializedObject( target.camera ); SerializedProperty m_ClearFlags = cam.FindProperty("m_ClearFlags"); SerializedProperty m_BackGroundColor = cam.FindProperty("m_BackGroundColor"); SerializedProperty m_CullingMask = cam.FindProperty("m_CullingMask"); SerializedProperty m_TargetTexture = cam.FindProperty("m_TargetTexture"); SerializedProperty m_Near = cam.FindProperty("near clip plane"); SerializedProperty m_Far = cam.FindProperty("far clip plane"); SerializedProperty m_Depth = cam.FindProperty("m_Depth"); SerializedProperty m_RenderingPath = cam.FindProperty("m_RenderingPath"); SerializedProperty m_HDR = cam.FindProperty("m_HDR"); if (complete) { EditorGUILayout.PropertyField( m_ClearFlags ); EditorGUILayout.PropertyField( m_BackGroundColor ); EditorGUILayout.PropertyField( m_CullingMask ); EditorGUILayout.Space(); } tk2dCameraSettings cameraSettings = target.CameraSettings; tk2dCameraSettings inheritedSettings = target.SettingsRoot.CameraSettings; TransparencySortMode transparencySortMode = inheritedSettings.transparencySortMode; GUI.enabled &= allowProjectionParameters; inheritedSettings.projection = (tk2dCameraSettings.ProjectionType)EditorGUILayout.EnumPopup("Projection", inheritedSettings.projection); EditorGUI.indentLevel++; if (inheritedSettings.projection == tk2dCameraSettings.ProjectionType.Orthographic) { inheritedSettings.orthographicType = (tk2dCameraSettings.OrthographicType)EditorGUILayout.EnumPopup("Type", inheritedSettings.orthographicType); switch (inheritedSettings.orthographicType) { case tk2dCameraSettings.OrthographicType.OrthographicSize: inheritedSettings.orthographicSize = Mathf.Max( 0.001f, EditorGUILayout.FloatField("Orthographic Size", inheritedSettings.orthographicSize) ); break; case tk2dCameraSettings.OrthographicType.PixelsPerMeter: inheritedSettings.orthographicPixelsPerMeter = Mathf.Max( 0.001f, EditorGUILayout.FloatField("Pixels per Meter", inheritedSettings.orthographicPixelsPerMeter) ); break; } inheritedSettings.orthographicOrigin = (tk2dCameraSettings.OrthographicOrigin)EditorGUILayout.EnumPopup("Origin", inheritedSettings.orthographicOrigin); } else if (inheritedSettings.projection == tk2dCameraSettings.ProjectionType.Perspective) { inheritedSettings.fieldOfView = EditorGUILayout.Slider("Field of View", inheritedSettings.fieldOfView, 1, 179); transparencySortMode = (TransparencySortMode)EditorGUILayout.EnumPopup("Sort mode", transparencySortMode); } EditorGUI.indentLevel--; GUI.enabled = oldGuiEnabled; if (complete) { EditorGUILayout.Space(); GUILayout.Label("Clipping Planes"); GUILayout.BeginHorizontal(); GUILayout.Space(14); GUILayout.Label("Near"); if (m_Near != null) EditorGUILayout.PropertyField(m_Near, GUIContent.none, GUILayout.Width(60) ); GUILayout.Label("Far"); if (m_Far != null) EditorGUILayout.PropertyField(m_Far, GUIContent.none, GUILayout.Width(60) ); GUILayout.EndHorizontal(); cameraSettings.rect = EditorGUILayout.RectField("Normalized View Port Rect", cameraSettings.rect); EditorGUILayout.Space(); if (m_Depth != null) EditorGUILayout.PropertyField(m_Depth); if (m_RenderingPath != null) EditorGUILayout.PropertyField(m_RenderingPath); if (m_TargetTexture != null) EditorGUILayout.PropertyField(m_TargetTexture); if (m_HDR != null) EditorGUILayout.PropertyField(m_HDR); } cam.ApplyModifiedProperties(); so.ApplyModifiedProperties(); if (transparencySortMode != inheritedSettings.transparencySortMode) { inheritedSettings.transparencySortMode = transparencySortMode; target.camera.transparencySortMode = transparencySortMode; // Change immediately in the editor EditorUtility.SetDirty(target); EditorUtility.SetDirty(target.camera); } }
public static ReorderableList ReorderableListCustom(this SerializedProperty _listProperty, SerializedObject _sourceRef, System.Type _elementType, string _header = "", int _addFieldAmount = 0) { var list = new ReorderableList(_sourceRef, _listProperty, true, true, true, true); int fieldAmount = 1; list.drawHeaderCallback = (Rect position) => { EditorGUI.LabelField(position, _header); }; list.drawElementCallback = (Rect position, int index, bool isActive, bool isFocused) => { var element = _listProperty.GetArrayElementAtIndex(index); var fieldInfos = _elementType.GetFields(BindingFlags.Public | BindingFlags.Instance); fieldAmount = fieldInfos.Length + _addFieldAmount; EditorGUI.PropertyField(position, element, true); list.elementHeight = fieldAmount * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing); }; return(list); }