Example #1
0
        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;
            }
        }
Example #2
0
        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);
            }
        }
Example #3
0
 void Start()
 {
     selection       = GetComponent <iSelectable>();
     imagesTransform = transform.Find("Images");
     targetZ         = 0f;
     selectedZ       = -selectedZ;
     spinner         = GetComponent <SelectionSpinner>();
 }
Example #4
0
 public static bool IsSelect(iSelectable obj)
 {
     return(pool.Contains(obj));
 }
Example #5
0
        public static void Select(iSelectable obj)
        {
            Clear();

            SelectAppend(obj);
        }
Example #6
0
 public static void SelectAppend(iSelectable obj)
 {
     pool.Add(obj);
 }