Dialogues.Window AddWindow(object data) { Undo.RecordObject(CurrentDialogue, "Dialogue"); object[] Data = (object[])data; //Retrieving Data Vector2 Position = (Vector2)Data[0]; Dialogues.Window WindowClickedOn = (Dialogues.Window)Data[1]; Dialogues.WindowTypes Type = (Dialogues.WindowTypes)Data[2]; int ParentId = -1; if (WindowClickedOn != null) { ParentId = WindowClickedOn.ID; } //Creates the new window Dialogues.Window NewlyCreatedWindow = CreateNewWindow(Position, ParentId, Type); //Checks if this is the first node if (WindowClickedOn == null) { //It is the first node CurrentDialogue.Set[CurrentDialogue.CurrentSet].FirstWindow = NewlyCreatedWindow; } else { //It is not the first node WindowClickedOn.Connections.Add(NewlyCreatedWindow.ID); } CurrentDialogue.Set[CurrentDialogue.CurrentSet].Windows.Add(NewlyCreatedWindow); return(NewlyCreatedWindow); }
void EstablishNewWindowConnection(object data) { object[] Data = (object[])data; Vector2 Position = (Vector2)Data[0]; Dialogues.WindowTypes Type = (Dialogues.WindowTypes)Data[1]; object[] Vals = { Position, ConnectingCurrent, Type }; CreateConnection(AddWindow(Vals)); }
Dialogues.Window CreateNewWindow(Vector2 Position, int ParentId, Dialogues.WindowTypes Type = Dialogues.WindowTypes.Text) { Dialogues.Window NewWindow = new Dialogues.Window(CurrentDialogue.Set[CurrentDialogue.CurrentSet].CurrentId, ParentId, new Rect(Position, WindowSize), Type); CurrentDialogue.Set[CurrentDialogue.CurrentSet].CurrentId++; return(NewWindow); }