void _OnGUI_Selected(Path path, iSelectable selectable, Action <iSelectable> cbk = null) { bool isPath = selectable is Path; string label = string.Format("{0}##Project_{1}_{2}", selectable.name, isPath ? "Path" : "File", path.name); bool isSelected = curSelected == selectable; ImGuiTreeNodeFlags flag = baseFlag | (isPath ? ImGuiTreeNodeFlags.None : ImGuiTreeNodeFlags.Leaf) | (isSelected ? ImGuiTreeNodeFlags.Selected : ImGuiTreeNodeFlags.None); if (ImGui.TreeNodeEx(label, flag)) { if (cbk != null) { cbk(selectable); } ImGui.TreePop(); } if (ImGui.IsItemClicked()) { if (!clicked && curSelected != selectable) { curSelected = selectable; Selector.Select(selectable); } clicked = true; } }
public void OnGUI() { var selectArr = Selector.GetSelected(); if (selectArr == null || selectArr.Count == 0) { return; } iSelectable selectable = selectArr[0]; if (selectable == null) { return; } if (selectable is Path) { ImGui.Text(selectable.name); return; } if (selectable is File) { File f = selectable as File; OnGUI_File(f); } else if (selectable is SceneNode) { SceneNode node = selectable as SceneNode; OnGUI_SceneNode(node); } }
void Start() { selection = GetComponent <iSelectable>(); imagesTransform = transform.Find("Images"); targetZ = 0f; selectedZ = -selectedZ; spinner = GetComponent <SelectionSpinner>(); }
public static bool IsSelect(iSelectable obj) { return(pool.Contains(obj)); }
public static void Select(iSelectable obj) { Clear(); SelectAppend(obj); }
public static void SelectAppend(iSelectable obj) { pool.Add(obj); }