private void Resolve(ActionButtonNode leaf) { autoSelectStackLength = 1; List <int> path = new List <int> (); ActionButtonNode current = leaf; while (current != root) { path.Add(current.Siblings().ToList().IndexOf(current)); current = current.parent; } path.Reverse(); foreach (int i in path) { } if (OnPathResolved != null) { OnPathResolved(this, path); } }
private void InstantiateAndSetOnClickForBack(ActionButtonNode n) { GameObject back = Instantiate(optTemplate); back.SetActive(true); back.transform.SetParent(actionsContainer, false); Text t = back.GetComponentInChildren <Text> (); t.text = "<"; back.GetComponent <OptButton> ().OnOptMousedOver += (button) => { UIManager.instance.Tooltip.SetText("Back"); UIManager.instance.Tooltip.Show(back.transform as RectTransform); }; back.GetComponent <OptButton> ().OnOptMousedOut += (button) => { UIManager.instance.Tooltip.Hide(); // UIManager.instance.tooltip.SetText(n.disabledReason); }; back.GetComponent <OptButton> ().OnOptLeftClicked += (button) => { //this needs to call set new action node set DisableLeft(); DisableRight(); ActionButtonNode curr = n; Debug.Log("Auto stack backing: " + autoSelectStackLength); for (int i = 0; i < autoSelectStackLength; i++) { curr = curr.parent; } autoSelectStackLength = 1; SetCurrentActionNodes(curr.Siblings()); }; }