public static EditorCache NewCache() { EditorCache cache = CreateInstance <EditorCache> (); cache.CanvasName = "New Canvas"; cache.Actors = ActorDatabase.CreateNew <ActorDatabase> (cache.CanvasName); cache.Conditions = ConditionDatabase.CreateNew <ConditionDatabase> (cache.CanvasName); cache.Nodes = NodeDatabase.CreateNew <NodeDatabase> (cache.CanvasName); cache.States = new EditorStates(cache); cache.Init(); SaveManager.SaveCanvas(ResourceManager.TEMPFILEPATH, false, cache); return(cache); }
public override void OnGUI() { base.OnGUI(); CanvasGUI.BeginGroup(Position, GUI.skin.box, actor.Tint, HasControl); if (Locked) { GUI.Label(new Rect(5, 5, 240, 20), name); GUI.Label(new Rect(5, 30, 240, 20), actor.name); } else { EditorCache cache = DialogueEditorGUI.Cache; string nodeName = name; if (CanvasGUI.TextField(new Rect(5, 5, 240, 20), ref nodeName)) { name = cache.Nodes.ItemNames[cache.Nodes.ItemNames.IndexOf(name)] = nodeName; } ActorDatabase actors = cache.Actors; actor = actors.Get(CanvasGUI.DropDownMenu(new Rect(5, 30, 240, 20), position, actors.GetIndex(actor), actors.ItemNames.ToArray())); } if (CanvasGUI.Button(new Rect(Position.size.x - 50, 5, 20, 20), new GUIContent("L"), GUI.skin.button)) { Locked = !Locked; } if (CanvasGUI.Button(new Rect(Position.size.x - 25, 5, 20, 20), new GUIContent("X"), GUI.skin.button)) { Delete(); } textArea = CanvasGUI.TextArea(new Rect(5, 55, 290, 115), textArea); if (CanvasGUI.Button(new Rect(5, 175, 290, 20), new GUIContent("Add Dialogue Option"), GUI.skin.button)) { options.Add(OptionNode.Create(options.NextItemName("Option"), this)); } CanvasGUI.EndGroup(); options.OnGUI(); }
public void ReplaceAllReferences(Func <ScriptableObject, ScriptableObject> ReplacedSO) { nodes = ReplacedSO(nodes) as NodeDatabase; actors = ReplacedSO(actors) as ActorDatabase; conditions = ReplacedSO(conditions) as ConditionDatabase; }