public ForkEditorFactoryImp() { this.forkEditors = new List <ForkEditor> (); this.forkEditors.Add(new ISwitchForkEditor()); this.forkEditors.Add(new ItemForkEditor()); this.defaultForkEditor = new ISwitchForkEditor(); }
public ForkEditorFactoryImp() { this.forkEditors = new List<ForkEditor> (); this.forkEditors.Add (new ISwitchForkEditor ()); this.forkEditors.Add (new ItemForkEditor ()); this.defaultForkEditor = new ISwitchForkEditor (); }
public void draw() { Checkable c = (Checkable)myNode.Content; string[] editors = ForkEditorFactory.Intance.CurrentForkEditors; int editorSelected = EditorGUILayout.Popup( ForkEditorFactory.Intance.ForkEditorIndex(c), ForkEditorFactory.Intance.CurrentForkEditors ); ForkEditor editor = ForkEditorFactory.Intance.createForkEditorFor(editors[editorSelected]); editor.useFork(c); editor.draw(); myNode.Content = editor.Result; if (Event.current.type != EventType.Layout) { int l = myNode.Childs.Length; if (l != 2) { while (l < 2) { myNode.addNewChild(); l++; } while (l > 2) { myNode.removeChild(l); l--; } myNode.Childs[0].Name = "Case fork True"; myNode.Childs[1].Name = "Case fork False"; //this.Repaint (); } } }
//int selectedTexture; public override void OnInspectorGUI() { EditorGUI.BeginChangeCheck(); serializedObject.Update(); SerializedProperty cell = serializedObject.FindProperty("destination"); SerializedProperty modep = serializedObject.FindProperty("mode"); SerializedProperty gep = serializedObject.FindProperty("sge"); SerializedProperty checkablep = serializedObject.FindProperty("checkable"); EditorGUILayout.PropertyField(cell); modep.intValue = GUILayout.Toolbar(modep.intValue, new string[] { "Always", "Event trigger", "Checkable" }); switch (modep.intValue) { case 1: { SerializableGameEvent ge = gep.objectReferenceValue as SerializableGameEvent; if (ge == null) { ge = ScriptableObject.CreateInstance <SerializableGameEvent> (); } string[] editors = EventEditorFactory.Intance.CurrentEventEditors; int editorSelected = 0; if (ge.Name == null) { ge.Name = ""; } for (int i = 1; i < editors.Length; i++) { if (editors [i].ToLower() == ge.Name.ToLower()) { editorSelected = i; } } int was = editorSelected; editorSelected = EditorGUILayout.Popup(editorSelected, EventEditorFactory.Intance.CurrentEventEditors); if (was != editorSelected && editorSelected == 0) { ge.Name = ""; } EventEditor editor = EventEditorFactory.Intance.createEventEditorFor(editors[editorSelected]); editor.useEvent(ge); editor.draw(); ge = editor.Result; gep.objectReferenceValue = ge; } break; case 2: { Checkable c = (Checkable)checkablep.objectReferenceValue; string[] editors = ForkEditorFactory.Intance.CurrentForkEditors; int editorSelected = EditorGUILayout.Popup( ForkEditorFactory.Intance.ForkEditorIndex(c), ForkEditorFactory.Intance.CurrentForkEditors ); ForkEditor editor = ForkEditorFactory.Intance.createForkEditorFor(editors[editorSelected]); editor.useFork(c); editor.draw(); checkablep.objectReferenceValue = editor.Result; } break; } if (EditorGUI.EndChangeCheck()) { } serializedObject.ApplyModifiedProperties(); }