public static void OpenTab(this SuperController sc, Atom selectedAtom, string tabName) { if (tabName == null) { return; } sc.SelectController(selectedAtom.mainController); sc.activeUI = SuperController.ActiveUI.SelectedOptions; sc.ShowMainHUDAuto(); var selector = selectedAtom.gameObject.GetComponentInChildren <UITabSelector>(true); if (selector == null) { return; } selector.SetActiveTab(tabName); }
Node CreateNode(AnimationPattern ap) { Node foundNode = nodes.Find((other) => { return(other.ap == ap); }); if (foundNode != null) { sc.SelectController(containingAtom.mainController); return(foundNode); } Node node = new Node(ui, ap); //ap.containingAtom.SetOn(false); ap.SetBoolParamValue("on", false); ap.Pause(); ap.ResetAnimation(); lineMaterial = ap.rootLineDrawerMaterial; if (nodes.Contains(node) == false) { nodes.Add(node); } node.connectButton.button.onClick.AddListener(() => { sc.SelectModeAtom((atom) => { if (atom == ap.containingAtom) { SuperController.LogError("Can't make a connection to itself."); return; } AnimationPattern childAP = atom.GetStorableByID("AnimationPattern") as AnimationPattern; if (childAP == null) { SuperController.LogError("Only Animation Patterns can be selected."); return; } Node childNode = CreateNode(childAP); Transition transition = CreateTransition(node.atom, childNode.atom); if (transition != null) { node.transitions.Add(transition); PerformSave(); } }); }); node.disconnectButton.button.onClick.AddListener(() => { node.transitions.ForEach((t) => { t.OnDestroy(); transitions.Remove(t); }); node.transitions.Clear(); }); sc.SelectController(containingAtom.mainController); return(node); }