EventGraphWindowItem NewItem(INodedEvent theEvent) { EventGraphWindowItem newItem = new EventGraphWindowItem(theEvent, RemoveItem, this); items.Add(newItem); return(newItem); }
public void DrawLinks() { Handles.BeginGUI(); for (int i = 0; i < moments.Count; i++) { BaseMoment moment = moments[i].moment; for (int u = 0; u < moment.iEvents.Count; u++) { UnityEngine.Object otherNode = moment.iEvents[u]; if (otherNode is INodedEvent) { INodedEvent otherDisplay = otherNode as INodedEvent; Rect targetRect = otherDisplay.WindowRect; DrawBezierRight(WindowRect.position + moments[i].lastDrawnPos, new Vector2(targetRect.xMin, targetRect.y + 28)); } else { Debug.LogWarning("Le moment apparenant a: " + NodeLabel + " a un lien vers un IEvent qui n'est pas IEventDisplay." + " Destruction du lien."); moment.RemoveNulls(); break; } } } Handles.EndGUI(); }
private void RemoveAllLinksTo(IBaseEvent theEvent, Object on) { FieldInfo[] fields = on.GetType().GetFields(); for (int i = 0; i < fields.Length; i++) { if (fields[i].FieldType.IsSubclassOf(typeof(BaseMoment))) { BaseMoment moment = fields[i].GetValue(on) as BaseMoment; moment.RemoveIEvent(theEvent.AsObject()); } } if (on is INodedEvent) { INodedEvent onDisplay = on as INodedEvent; BaseMoment[] additionalMoments; string[] additionalNames; onDisplay.GetAdditionalMoments(out additionalMoments, out additionalNames); if (additionalMoments != null) { for (int i = 0; i < additionalMoments.Length; i++) { additionalMoments[i].RemoveIEvent(theEvent.AsObject()); } } } }
void ClearItems(bool repaint = true) { ongoingLink.source = null; items = null; lastHilighted = null; copyNode = null; Repaint(); }
void Copy() { if (lastHilighted == null) { Debug.Log("Cannot copy. No selected node."); } else { copyNode = lastHilighted.myEvent; } }
public INodedEvent AddEvent(INodedEvent existingEvent) { events.Add(existingEvent.AsObject()); existingEvent.Graph = this; if (onEventsAddedOrRemoved != null) { onEventsAddedOrRemoved(); } return(existingEvent); }
void NewVirtualEvent(INodedEvent newEvent, string name) { newEvent.name = name; newEvent.MoveToPos(contextMenuMousePos); if (ongoingLink.source != null) { ongoingLink.BuildLink(newEvent.AsObject()); } newEvent.LinkToGraph(); MarkSceneAsDirty(); }
public EventGraphWindowItem(INodedEvent myEvent, Action <EventGraphWindowItem> removeRequest, EventGraphWindow window) { this.myEvent = myEvent; if (myEvent == null) { throw new Exception("my event == null"); } this.removeRequest = removeRequest; this.parentWindow = window; BuildEntryTypes(); BuildNamedMoments(); }
public void RemoveEvent(INodedEvent theEvent) { if (theEvent is IBaseEvent) { RemoveAllLinksTo(theEvent as IBaseEvent); } if (events.Remove(theEvent.AsObject())) { if (onEventsAddedOrRemoved != null) { onEventsAddedOrRemoved(); } } }
void Paste() { if (copyNode == null || copyNode.AsObject() == null) { Debug.Log("Cannot paste. No copied node."); } else { INodedEvent newEvent = Instantiate(copyNode.AsObject()) as INodedEvent; newEvent.LinkToGraph(); newEvent.MoveToPos(copyNode.WindowRect.position + Vector2.one * 75); MarkSceneAsDirty(); } }
void NewVirtualEvent(Type type, string name) { INodedEvent newEvent = ScriptableObject.CreateInstance(type) as INodedEvent; NewVirtualEvent(newEvent, name); }
public bool ContainsEvent(INodedEvent existingEvent) { return(events.Contains(existingEvent.AsObject())); }