AssetBundleGraph.AssetBundleGraphEditorWindow.HandleConnectionEvent C# (CSharp) Method

HandleConnectionEvent() public method

public HandleConnectionEvent ( ConnectionEvent e ) : void
e ConnectionEvent
return void
        public void HandleConnectionEvent(ConnectionEvent e)
        {
            switch (modifyMode) {
                case ModifyMode.NONE: {
                    switch (e.eventType) {

                        case ConnectionEvent.EventType.EVENT_CONNECTION_TAPPED: {

                            if (Event.current.shift) {
                                Undo.RecordObject(this, "Select Objects");

                                var objectId = string.Empty;

                                if (e.eventSourceCon != null) {
                                    objectId = e.eventSourceCon.Id;
                                    if (!activeObject.idPosDict.ReadonlyDict().Any()) {
                                        activeObject = RenewActiveObject(new List<string>{objectId});
                                    } else {
                                        var additiveIds = new List<string>(activeObject.idPosDict.ReadonlyDict().Keys);

                                        // already contained, cancel.
                                        if (additiveIds.Contains(objectId)) {
                                            additiveIds.Remove(objectId);
                                        } else {
                                            additiveIds.Add(objectId);
                                        }

                                        activeObject = RenewActiveObject(additiveIds);
                                    }
                                }

                                UpdateActivationOfObjects(activeObject);
                                break;
                            }

                            Undo.RecordObject(this, "Select Connection");

                            var tappedConnectionId = e.eventSourceCon.Id;
                            foreach (var con in connections) {
                                if (con.Id == tappedConnectionId) {
                                    con.SetActive();
                                    activeObject = RenewActiveObject(new List<string>{con.Id});
                                } else {
                                    con.SetInactive();
                                }
                            }

                            // set deactive for all nodes.
                            foreach (var node in nodes) {
                                node.SetInactive();
                            }
                            break;
                        }
                        case ConnectionEvent.EventType.EVENT_CONNECTION_DELETED: {
                            Undo.RecordObject(this, "Delete Connection");

                            var deletedConnectionId = e.eventSourceCon.Id;

                            DeleteConnectionById(deletedConnectionId);

                            SaveGraphWithReload();
                            Repaint();
                            break;
                        }
                        default: {
                            break;
                        }
                    }
                    break;
                }
            }
        }