Esempio n. 1
0
 private void Plugin_Update_Item_onClicked(uiControl c)
 {
     if (checkbox != null)
     {
         checkbox.isChecked = !checkbox.isChecked;
     }
 }
Esempio n. 2
0
        private void tabPanel_onLayout(uiControl c)
        {
            pl_errors.alignTop();
            pl_errors.CenterHorizontally();

            //pl_thumb.alignTop();
            pl_thumb.moveBelow(pl_errors, 2);
            pl_thumb.CenterHorizontally();

            //pl_toggle.CenterHorizontally();
            //pl_toggle.moveBelow(pl_thumb, 5);

            pl_title.moveBelow(pl_thumb, 10);
            pl_title.CenterHorizontally();

            pl_vers.moveBelow(pl_title, 1);
            pl_vers.CenterHorizontally();

            pl_auth.moveBelow(pl_vers, 1);
            pl_auth.CenterHorizontally();

            pl_desc.alignLeftSide(3);
            pl_desc.moveBelow(pl_auth, 10);

            //btn_copy_json.moveBelow(pl_desc, 5);
        }
Esempio n. 3
0
        /// <summary>
        /// Child controls can use this function to query what kind of size constraints the parent will impose on them.
        /// </summary>
        internal virtual Vector2 Constrain_Child_Size(uiControl c, Vector2 requested_size)
        {
            Vector2 max = available_area;// This is the maximum size available to this control

            // We want to determine if the calling control's maximum extents would go outside the maximum possible extents of this control.
            // And if so, scale back the requested size so it fits within our limits.
            if (isSizeConstrained)
            {
                max.x = Get_Content_Area().width;
            }

            if (CONFIRM_SIZE)
            {
                SLog.Info("{0}  Confirm Child Size Constraint  |  Available Area: {1}  |  Requested Size: {2}  ", this, max, requested_size);
            }

            if ((requested_size.x + c.Pos.x) > max.x)
            {
                requested_size.x = (max.x - c.Pos.x);
            }
            if ((requested_size.y + c.Pos.y) > max.y)
            {
                requested_size.y = (max.y - c.Pos.y);
            }

            return(requested_size);
        }
Esempio n. 4
0
 private void Clicked_Snd_Handler(uiControl c)
 {
     if (playClickSound)
     {
         Sound.Play(SoundId.BTN_CLICK);
     }
 }
Esempio n. 5
0
        private void InstructionsTab_onLayout(uiControl c)
        {
            ins_title.alignTop(5);
            ins_title.CenterHorizontally();

            ins_text.moveBelow(ins_title, 6);
            ins_text.CenterHorizontally();
        }
        private void Download_info_onLayout(uiControl c)
        {
            progress_text.alignLeftSide();
            progress_text.alignTop();

            progress_bar.moveBelow(progress_text, 2);
            progress_bar.FloodX();
        }
 public override bool Remove(uiControl c)
 {
     if (CurrentTab == null)
     {
         throw new ArgumentNullException(this.ToString() + ": CurrentTab is NULL!");
     }
     return(CurrentTab.Remove(c));
 }
        private void StatusPanel_onLayout(uiControl c)
        {
            //uiText ld_text = (uiText)loading_tab["ld_text"];
            ld_text.CenterVertically();
            ld_text.CenterHorizontally();

            retry_pl_list_btn.moveBelow(ld_text);
            retry_pl_list_btn.CenterHorizontally();
        }
 public override uiControl Add(string name, uiControl c)
 {
     if (CurrentTab == null)
     {
         throw new ArgumentNullException(this.ToString() + ": CurrentTab is NULL!");
     }
     //PLog.Info("{0} ADDING: ({2}){1}", this, c, name);
     return(CurrentTab.Add(name, c));
 }
Esempio n. 10
0
        private void Btn_copy_json_onClicked(uiControl c)
        {
            Plugin pl = Plugin.Get_Plugin(this.selected);

            if (pl == null)
            {
                SLog.Info("Unable to find plugin via hash: {0}", this.selected);
                return;
            }
            GUIUtility.systemCopyBuffer = pl.data.ToJSON();
        }
 private void change_selection(uiControl select)
 {
     if (current_selection != select && current_selection != null)
     {
         current_selection.Active = false;
     }
     current_selection = select;
     if (select != null)
     {
         select.Active = true;
     }
 }
        private void InfoTab_onLayout(uiControl c)
        {
            install_btn.alignTop(4);
            install_btn.CenterHorizontally();

            pl_title.moveBelow(install_btn, 10f);
            pl_title.CenterHorizontally();

            pl_auth.moveBelow(pl_title, 2f);
            pl_auth.CenterHorizontally();

            pl_desc.moveBelow(pl_auth, 5f);
        }
Esempio n. 13
0
        public void Apply(uiControl control)
        {
            switch (Mode)
            {
            case cSizeMode.FLOOD_X:
                control.FloodX(Offset);
                break;

            case cSizeMode.FLOOD_Y:
                control.FloodY(Offset);
                break;
            }
        }
        private void Btn_start_onClicked(uiControl c)
        {
            foreach (uiControl child in list.Get_Children())
            {
                Plugin_Update_Item itm = child as Plugin_Update_Item;
                if (itm.isChecked)
                {
                    Plugin plugin = Plugin.Get_Plugin(itm.plugin_hash);
                    download_queue.Add(plugin);
                }
            }

            process_downloads();
        }
Esempio n. 15
0
        public virtual void Set_Child_Index(uiControl child, int i)
        {
            int cidx = children.IndexOf(child);

            if (cidx > -1)
            {
                if (i < 0)
                {
                    i += cidx;
                }
                if (children.Remove(child))
                {
                    children.Insert(i, child);
                }
            }
        }
        private void Select_Plugin(uiControl c)
        {
            Plugin_StoreItem pl = (Plugin_StoreItem)c;

            if (selected_plugin != null)
            {
                selected_plugin.Active = false;
            }
            selected_plugin = pl;

            if (c != null)
            {
                tabPanel.Select_Tab(MAIN_TAB_NAME);
            }
            else
            {
                tabPanel.Select_Tab(INSTRUCTION_TAB_NAME);
            }

            if (c == null)
            {
                pl_title.Text          = "";
                pl_auth.Text           = "N/A";
                pl_desc.Text           = "N/A";
                install_btn.isDisabled = true;
                return;
            }
            else
            {
                install_btn.isDisabled = false;
            }
            c.Active = true;
            Plugin_Download_Data data = this.plugins[pl.plugin_hash];

            pl_title.Text = data.Name;
            pl_auth.Text  = String.Format("<color=#808080ff>Author:</color> {0}", data.Author);
            pl_desc.Text  = data.Description;
            if (pl_desc.Text == null || pl_desc.Text.Length <= 0)
            {
                pl_desc.Text = "N/A";
            }

            //install_btn.isVisible = !data.isInstalled;
            install_btn.isDisabled = data.isInstalled;
            install_btn.Text       = data.isInstalled ? "Installed" : "Download";
        }
Esempio n. 17
0
        public virtual uiControl Add(string name, uiControl c)
        {
            Add(c);
            uiControl tmp;

            if (child_map.TryGetValue(name, out tmp))
            {
                if (tmp != c)
                {
                    SLog.Info("[Plugin UI] Warning: assigning new control to a name that is already taken: {0}", name);
                }
            }

            child_map[name] = c;
            c.Name          = name;
            return(c);
        }
        private void Install_btn_onClicked(uiControl c)
        {
            if (selected_plugin == null)
            {
                Sound.Play(SoundId.NEGATIVE);
                return;
            }
            var    hash = selected_plugin.plugin_hash;
            string url  = this.plugins[hash].URL;

            if (url == null || url.Length <= 0)
            {
                SLog.Info("Cannot download plugin, Invalid URL: {0}", url);
                return;
            }

            Download_Plugin(hash, url);
        }
        public override void doLayout()
        {
            base.doLayout();
            uiControl name = this["name"];
            uiControl auth = this["author"];

            //name.area = new Rect(0f, 0f, area.width, name.Style.lineHeight);
            //auth.area = new Rect(10f, name.area.yMax, area.width, name.Style.lineHeight);
            name.alignTop();
            name.alignLeftSide();

            auth.moveBelow(name, 0);
            auth.alignLeftSide(8);

            download_info.alignLeftSide();
            download_info.moveBelow(auth, 0f);
            download_info.FloodX();
        }
        public void Handle(uiPanel parent, uiControl[] controls)
        {
            uiControl last = null;

            foreach (uiControl c in controls.Where(c => c != null))
            {
                if (last == null)
                {
                    c.alignTop();
                }
                else
                {
                    c.moveBelow(last);
                }

                last = c;
            }
        }
        public void Handle(uiPanel parent, uiControl[] controls)
        {
            var   inner_area = parent.Get_Content_Area();
            int   COLS       = Math.Max(1, (int)Math.Floor(inner_area.width / SIZE.x));
            float cw         = (float)COLS * SIZE.x;    // content width
            float exSpace    = (inner_area.width - cw); // left over space
            float off        = exSpace * 0.5f;          // How much offset to add to X on each row

            for (int i = 0; i < controls.Length; i++)
            {
                uiControl c = controls[i];
                int       x = (i % COLS);
                int       y = (i / COLS);

                c.Set_Size(SIZE);
                float X = ((float)x * SIZE.x) + off;
                float Y = ((float)y * SIZE.y);
                c.Set_Pos(X, Y);
            }
        }
        private void List_onLayout(uiControl c)
        {
            // Arrange all children into a cascading list
            Plugin_Update_Item last = null;

            foreach (uiControl child in list.Get_Children())
            {
                Plugin_Update_Item itm = child as Plugin_Update_Item;
                if (last == null)
                {
                    itm.alignTop();
                }
                else
                {
                    itm.moveBelow(last);
                }

                itm.FloodX();
                itm.isChecked = true;
                last          = itm;
            }
        }
Esempio n. 23
0
        protected void Add_Control(uiControl c)
        {
            if (c == null)
            {
                return;
            }
            if (children.Contains(c))
            {
                return;
            }

            set_layout_dirty();
            children.Add(c);

            c.Set_Parent(this);
            if (c.gameObject != null && this.gameObject != null)
            {
                c.gameObject.transform.SetParent(base.gameObject.transform, false);
                //c.rect.SetParent(base.gameObject.transform, false);
            }

            onChildAdded?.Invoke(c);
            update_area();
        }
Esempio n. 24
0
 private void PluginManager_onShown(uiControl c)
 {
     Update_Plugins_List();
 }
Esempio n. 25
0
 private void UiCheckbox_onClicked(uiControl c)
 {
     this.Checked = !this.Checked;
 }
Esempio n. 26
0
 protected bool Remove_Control(uiControl c)
 {
     set_layout_dirty();
     return(children.Remove(c));
 }
Esempio n. 27
0
 public virtual bool Remove(uiControl c)
 {
     return(Remove_Control(c));
 }
Esempio n. 28
0
 public virtual uiControl Add(uiControl c)
 {
     Add_Control(c);
     return(c);
 }
Esempio n. 29
0
 private void UiToggle_onClicked(uiControl c)
 {
     Checked = !Checked;
 }
Esempio n. 30
0
        private void Sel_onClicked(uiControl c)
        {
            Plugin_Manager_List_Item sel = c as Plugin_Manager_List_Item;

            Select_Plugin(sel.Get_Plugin());
        }