예제 #1
0
        public void Update_Plugins_List()
        {
            set_layout_dirty();
            list.Clear_Children();

            float dY = 3f;

            foreach (KeyValuePair <string, Plugin> kv in Loader.plugins)
            {
                try
                {
                    var sel = Create <Plugin_Manager_List_Item>();
                    sel.Set_Plugin(kv.Value);
                    sel.onClicked += Sel_onClicked;
                    list.Add(kv.Value.Hash, sel);
                }
                catch (Exception ex)
                {
                    SLog.Error(ex);
                }
            }

            if (list.isEmpty)
            {
                tab_need_plugins.Select();              // tabPanel.Set_Tab(NEED_PLUGINS_TAB_NAME);
            }
            else
            {
                tab_ins.Select(); // tabPanel.Set_Tab(INSTRUCTION_TAB_NAME);
            }
            // Set the very first plugin in our list as the active one
            //if (Loader.plugins.Count > 0) { this.Select_Plugin(Loader.plugins.First().Value); }
        }
예제 #2
0
        public void Refresh()
        {
            list.Clear_Children();

            HashSet <GameObject> rootObjects = new HashSet <GameObject>();

            foreach (GameObject go in UnityEngine.Object.FindObjectsOfType <GameObject>())
            {
                if (go.transform == null)
                {
                    rootObjects.Add(go);
                }
                else
                {
                    Transform xform = go.transform;
                    if (xform.parent == null && xform.gameObject != null)
                    {
                        rootObjects.Add(xform.gameObject);
                    }
                }
            }

            foreach (GameObject go in rootObjects)
            {
                var node = Spawn_Node(go, list);
                Populate_Single_Node(node);
            }

            set_layout_dirty();
            //set_area_dirty();
        }
예제 #3
0
 private void Update_info()
 {
     var_child_count.Value = (selection == null ? 0 : selection.transform.childCount).ToString();
     var_components.Clear_Children();
     if (selection != null)
     {
         Component[] comps = selection.GetComponents <Component>();
         foreach (var c in comps)
         {
             var n = Create <uiList_TreeNode>(var_components);
             n.Title      = c.GetType().Name;
             n.TextSize   = 12;
             n.Selectable = false;
         }
     }
 }
 public override void Clear_Children()
 {
     list.Clear_Children(); update_icon();
 }
        private void Rebuild_Plugins_UI()
        {
            pending_rebuild = false;
            list.Clear_Children();
            string search_str = search.text.ToLower();

            // add all the plugins to the sidebar
            foreach (KeyValuePair <string, Plugin_Download_Data> kv in this.plugins)
            {
                Plugin_Download_Data plugin = kv.Value;

                Plugin_Data dat = new Plugin_Data()
                {
                    AUTHOR      = plugin.Author,
                    NAME        = plugin.Name,
                    DESCRIPTION = plugin.Description
                };

                if (search_str.Length > 0)
                {
                    bool match = false;
                    if (plugin.Name.ToLower().IndexOf(search_str) > -1)
                    {
                        match = true;
                    }
                    if (plugin.Author.ToLower().IndexOf(search_str) > -1)
                    {
                        match = true;
                    }

                    if (!match)
                    {
                        continue;
                    }
                }


                Plugin_StoreItem itm = uiControl.Create <Plugin_StoreItem>();
                itm.onClicked += this.Select_Plugin;
                itm.Set_Plugin_Data(dat);
                list.Add(itm.plugin_hash, itm);
            }

            // select one of the plugins
            if (list.Get_Children().Count() > 0)
            {
                if (this.selected_plugin == null)
                {
                    //Select nothing, show instructions instead
                    //Select_Plugin(list.Get_Children()[0]);
                    tabPanel.Select_Tab(INSTRUCTION_TAB_NAME);
                }
                else
                {
                    uiControl found = null;
                    foreach (uiControl c in this.list.Get_Children())
                    {
                        Plugin_StoreItem itm = (Plugin_StoreItem)c;
                        if (itm.plugin_hash == selected_plugin.plugin_hash)
                        {
                            found = c;
                            break;
                        }
                    }

                    if (found != null)
                    {
                        Select_Plugin(found);
                    }
                    else
                    {
                        Select_Plugin(list.Get_Children().First());
                    }
                }
            }
            else
            {
                Select_Plugin(null);
            }
        }