Exemplo n.º 1
0
        /// <summary>
        /// Called when new item is selected.
        /// </summary>
        protected override void SelectionChangedAction()
        {
            viewPanel.SetImage(itemBinder);

            if (scrollPanel != null)
            {
                Controls.Remove(scrollPanel);
            }

            parts       = GenerateParts();
            attachments = GenerateAttachments();

            if (parts != null || attachments != null)
            {
                scrollPanel      = new ScrollPanel();
                scrollPanel.Size = new Size(676, 248);

                if (parts != null)
                {
                    scrollPanel.Controls.Add(parts, 0, 0);
                }

                if (attachments != null)
                {
                    scrollPanel.Controls.Add(attachments, 1, 0);
                }

                Controls.Add(scrollPanel, 1, 0);
            }
        }
Exemplo n.º 2
0
 static Button CreateDemoButton(string demoName, ScrollPanel demoPanel, IWidget demoPane)
 {
     return(new Button(demoPanel.UIStyle, demoName)
     {
         OnActionPerformed = (sender, args) => demoPanel.Content = demoPane
     });
 }
Exemplo n.º 3
0
    void Start()
    {
        this.flexibleWindow           = new FlexibleWindow();
        this.flexibleWindow.MaxHeight = 200;

        this.tabPanel = new TabPanel()
        {
            Labels = new string[] { "Basic", "Vectors", "Others" }
        };

        this.foldoutPanel = new FoldoutPanel()
        {
            Title = "Vectors"
        };

        this.scrollPanel = new ScrollPanel()
        {
            MinWidth  = 500,
            MinHeight = 150,
        };

        this.intGUI = new IntGUI()
        {
            Title = "Int Value"
        };
        this.floatGUI = new FloatGUI()
        {
            Title = "Float Value"
        };
        this.stringGUI = new StringGUI()
        {
            Title = "String Value"
        };
        this.boolGUI = new BoolGUI()
        {
            Title = "Bool Value"
        };

        this.vector2GUI = new Vector2GUI()
        {
            Title = "Vector2 Value"
        };
        this.vector3GUI = new Vector3GUI()
        {
            Title = "Vector3 Value"
        };
        this.vector4GUI = new Vector4GUI()
        {
            Title = "Vector4 Value"
        };

        this.ipv4GUI = new IPv4GUI()
        {
            Title = "IPv4 Value"
        };
        this.colorGUI = new ColorGUI()
        {
            Title = "Color Value"
        };
    }
Exemplo n.º 4
0
    void Start()
    {
        panel = new ScrollPanel(new Rect(50, 50, 300, 200));
        panel.ShowDefaultBackground = true;

        panel.Add(new RadioGroup("My radio group", "a", "b", "c", "d", "e", "f", "g", "h", "i")
        {
            ButtonsPerRow = 3
        });
        panel.Add(new Box());
        panel.Add(new Spacer(20));

        for (int i = 0; i < 15; ++i)
        {
            var textBox = new TextBox(i.ToString());
            panel.Add(new Button("Test button").OnClicked(b => textBox.KeyboardControlProperty.Value = true));
            if (i == 1)
            {
                textBox.KeyboardControlProperty.BindBoth(() => keyboard, b => keyboard = b);
            }
            panel.Add(textBox);
            var label = new Label("Test label " + i.ToString());
            panel.Add(new Toggle("Test toggle").OnToggled((t, oldChecked, newChecked) => label.Visible = !newChecked));
            panel.Add(label);
            panel.Add(new SelectionGrid().AddButton("1").AddButton("2").AddButton("3"));
            panel.Add(new PasswordBox().OnEnterPressed(t => Debug.Log(t.TextProperty.Value)));
            panel.Add(new Spacer(20));
        }
    }
Exemplo n.º 5
0
        public override void OnAwake()
        {
            base.OnAwake();

            Caption = "Inspector";

            _name           = AddComponent <Text> ();
            _name.Height    = 15;
            _name.Offset    = new Point(13 + 19, 36);
            _name.Alignment = Alignment.TopLeft;

            _active = SceneObject.Instantiate <CheckBox> (this);
            _active.RectTransform.Padding = new Padding(23, 44);
            _active.Ctrl.CheckedChanged  += (b) => ChangeContextActivity(b);
            _active.Active = false;

            _line = SceneObject.Instantiate <Panel> (this);
            _line.RectTransform.Size      = new Point(0, 1);
            _line.RectTransform.Alignment = Alignment.TopHStretch;
            _line.RectTransform.Padding   = new Padding(17, 56, 26, 0);
            _line.Background.Color        = Color.Gray;
            _line.Active = false;

            _scrollPlanel = SceneObject.Instantiate <ScrollPanel>(this);
            _scrollPlanel.RectTransform.Padding = new Padding(13, 13 + 23 + 22, 14, 14);

            RectTransform.LayoutChanged += () =>
            {
                _scrollPlanel.SetPanelSize(RectTransform.Width - 13 - 14 - 8, _scrollPlanel.Panel.RectTransform.Height);
            };
        }
Exemplo n.º 6
0
        private void CallList_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListBox list = sender as ListBox;

            RemoveList((list.Tag as ListTag).Right);

            //create a new listbox to the right
            ListBox lb = new ListBox();

            lb.Size              = list.Size;
            lb.Location          = new Point(list.Right + 4, 4);
            lb.IntegralHeight    = false;
            lb.Anchor            = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left;
            lb.FormattingEnabled = true;
            lb.DrawMode          = DrawMode.OwnerDrawFixed;
            lb.ItemHeight        = HotspotsList.ItemHeight;
            lb.Tag     = new ListTag();
            lb.Format += new ListControlConvertEventHandler(CallList_Format);
            lb.SelectedIndexChanged += new EventHandler(CallList_SelectedIndexChanged);
            lb.DrawItem             += new DrawItemEventHandler(CallList_DrawItem);

            if (UpdateParents(list.SelectedItem as Call, lb))
            {
                ScrollPanel.Controls.Add(lb);
                ScrollPanel.ScrollControlIntoView(lb);
                (list.Tag as ListTag).Right = lb;
            }
        }
    private void BuildCurrentPanel(List <int> position, List <List <int> > childlist)
    {
        List <int> currentposition = position;
        string     currentname     = "";

        switch (position.Count)
        {
        case 0:
            break;

        case 1:
            currentname = maindatabase.DatabaseMapLogic [position [0]].Name;
            break;

        case 2:
            currentname = maindatabase.DatabaseMapLogic[position[0]].Content[position [1]].Name;
            break;

        case 3:
            currentname = maindatabase.DatabaseMapLogic [position [0]].Content [position [1]].SubtypeList [position [2]].Name;
            break;
        }
        List <List <int> > currentchildlist = childlist;

        currentscrollpanel = new ScrollPanel(currentposition, currentname, currentchildlist);
    }
Exemplo n.º 8
0
        public void ChildPropertyDoesNotCrashOnSelf()
        {
            var p = new ScrollPanel(LayoutTestStyle.Create());

            p.Content = new LayoutTestWidget();
            p.Content = p.Content;
        }
Exemplo n.º 9
0
        private void AddBlocks(ScrollPanel palette)
        {
            selectableBlocks = new Dictionary <string, SelectableBlock>();
            int x         = PALETTE_SPACING;
            int y         = PALETTE_SPACING;
            int blockSize = GameplayState.BLOCK_SIZE * GUIElement.scale;

            foreach (Block block in resources.GetBlocks())
            {
                SelectableBlock blockSelect  = new SelectableBlock(new Rectangle(x, y, blockSize, blockSize), block, palette);
                Action          selectAction = () =>
                {
                    if (selectedBlock == blockSelect)
                    {
                        return;                                                   //already selected
                    }
                    if (selectedBlock != null)
                    {
                        selectedBlock.Deselect();
                    }
                    selectedBlock = blockSelect;
                };
                blockSelect.SetSelectAction(selectAction);

                selectableBlocks[block.name] = blockSelect;
                palette.AddScrollable(blockSelect);

                x += blockSize + PALETTE_SPACING;
                if (x + blockSize > palette.GetInnerBounds().Width)
                {
                    x  = PALETTE_SPACING;
                    y += blockSize + PALETTE_SPACING;
                }
            }
        }
Exemplo n.º 10
0
        public static Widget CreateRootPanel(IUIStyle uiStyle)
        {
            var basicDemoPane = new BasicDemoPane(uiStyle);

            var demoPanel = new ScrollPanel(uiStyle)
            {
                VerticalScrollbarMode = ScrollbarMode.None,
                Content = basicDemoPane
            }.DoWith(d => d.AddStyleClass("DemoPanel"));

            // Splitter
            return(new Splitter(uiStyle, Direction.Left)
            {
                Anchor = AnchoredRect.CreateFull(10),
                Collapsable = true,
                Collapsed = true,
                FirstPane = new BoxGroup(uiStyle, Orientation.Vertical, 0)
                {
                    { CreateDemoButton("Basic", demoPanel, basicDemoPane), true },
                    { CreateDemoButton("Notebook", demoPanel, new NotebookPane(uiStyle)), true },
                    { CreateDemoButton("Text Area", demoPanel, new TextAreaPane(uiStyle)), true },
                    { CreateDemoButton("Custom Viewport", demoPanel, new CustomViewportPane(uiStyle)), true }
                },
                SecondPane = demoPanel,
                FirstPaneMinSize = 200
            });
        }
Exemplo n.º 11
0
        private void SetColumnWidths()
        {
            ScrollPanel glc           = this.configScrollPanel;
            int         nControlCount = glc.Controls.Count;

            for (int g = 0; g < glc.Controls.Count; g++)
            {
                GroupListView2 glv = (GroupListView2)glc.Controls[g];
                if (glv == null)
                {
                    continue;
                }

                ConfigListView listview = glv.EmbeddLV;
                if (listview == null)
                {
                    continue;
                }

                if (1 < listview.Columns.Count)
                {
                    int nWidth = listview.Width;
                    listview.Columns[0].Width = FirstColumnWidth;
                    listview.Columns[1].Width = nWidth - FirstColumnWidth;
                }
            }
        }
Exemplo n.º 12
0
    internal void OnSetFirstPosition()
    {
        Vector3 POS = ScrollPanel.GetComponent <RectTransform> ().localPosition;

        POS.x = MainPanel.GetComponent <RectTransform> ().rect.width / 2;
        ScrollPanel.GetComponent <RectTransform> ().localPosition = POS;
    }
Exemplo n.º 13
0
    public void OnEnable()
    {
        ScrollPanel scrollPanel = (ScrollPanel)target;

        mDataProvider   = scrollPanel.gameObject.GetComponent <ScrollViewDataProvider>();
        mLayoutProvider = scrollPanel.gameObject.GetComponent <ScrollViewLayoutProvider>();
        mScrollRect     = scrollPanel.GetComponentInChildren <ScrollRect>();
    }
Exemplo n.º 14
0
        void scrollBar_ValueChanged(object sender, EventArgs e)
        {
            ScrollPanel.StopMovement();

            float yDiff = ScrollPanel.ContentPanel.Height - ScrollPanel.Height;

            ScrollPanel.ScrollToLocation(new Vector2(ScrollPanel.ContentPanel.X, -yDiff * ScrollBar.Value));
        }
Exemplo n.º 15
0
 public override void ClearChildren()
 {
     ScrollPanel.ClearChildren();
     if (AutoSize)
     {
         ResizeToContent();
     }
 }
Exemplo n.º 16
0
        public override bool AddChild(UIControl control)
        {
            bool success = ScrollPanel.AddChild(control);

            if (success && AutoSize)
            {
                ResizeToContent();
            }
            return(success);
        }
Exemplo n.º 17
0
        public override bool RemoveChild(UIControl control)
        {
            bool added = ScrollPanel.RemoveChild(control);

            if (added && AutoSize)
            {
                ResizeToContent();
            }
            return(added);
        }
Exemplo n.º 18
0
        protected override void Initialize()
        {
            base.Initialize();

            IsMouseVisible = true;

            input = new Input();

            //initialize GUI
            gui = new GUIContainer(new Rectangle(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));

            //structure editor
            structureEditPanel = new StructureEditPanel(new Rectangle(0, FILE_BAR_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT - FILE_BAR_HEIGHT - EDIT_BAR_HEIGHT), this);
            gui.Add(structureEditPanel);

            //top bar (new, load, save)
            Panel fileBar = new Panel(new Rectangle(0, 0, SCREEN_WIDTH, FILE_BAR_HEIGHT));

            gui.Add(fileBar);

            Button newButton = new Button(new Rectangle(0, 0, FILE_BUTTON_WIDTH, FILE_BAR_HEIGHT), "New", New, fileBar);

            gui.Add(newButton);

            Button openButton = new Button(new Rectangle(FILE_BUTTON_WIDTH, 0, FILE_BUTTON_WIDTH, FILE_BAR_HEIGHT), "Open", Open, fileBar);

            gui.Add(openButton);

            Button saveButton = new Button(new Rectangle(2 * FILE_BUTTON_WIDTH, 0, FILE_BUTTON_WIDTH, FILE_BAR_HEIGHT), "Save", Save, fileBar);

            gui.Add(saveButton);

            //bottom bar (block palette, anchors, properties)
            ScrollPanel palette = new ScrollPanel(new Rectangle(0, SCREEN_HEIGHT - EDIT_BAR_HEIGHT, PALETTE_WIDTH, EDIT_BAR_HEIGHT), "Blocks");

            gui.Add(palette);
            AddBlocks(palette);

            ScrollPanel anchors = new ScrollPanel(new Rectangle(PALETTE_WIDTH, SCREEN_HEIGHT - EDIT_BAR_HEIGHT, ANCHOR_WIDTH, EDIT_BAR_HEIGHT), "Anchors");

            gui.Add(anchors);
            //TODO: add stuff to anchors

            ContainerPanel propertiesPanel = new ContainerPanel(new Rectangle(PALETTE_WIDTH + ANCHOR_WIDTH, SCREEN_HEIGHT - EDIT_BAR_HEIGHT, PROPERTIES_WIDTH, EDIT_BAR_HEIGHT), "Properties");

            gui.Add(propertiesPanel);
            //TODO: add stuff to properties
            nameTextBox = new TextBox(new Rectangle(PALETTE_WIDTH + ANCHOR_WIDTH, SCREEN_HEIGHT - EDIT_BAR_HEIGHT, PROPERTIES_WIDTH, TEXT_BOX_HEIGHT), propertiesPanel);
            //freqTextBox
            //minPerChunkTextBox
            //maxPerChunkTextBox

            //TODO: draw current layer button (foreground/background)
        }
Exemplo n.º 19
0
        public void ChildPropertyFailOnForeignParent()
        {
            var p = new ScrollPanel(LayoutTestStyle.Create());

            Assert.Throws <InvalidOperationException>(
                () =>
            {
                var child = new LayoutTestWidget();
                child.AddNotify(new LayoutTestWidget());
                p.Content = child;
            });
        }
Exemplo n.º 20
0
        public ArenaManager(GameUpdater env, int pixelWidth, int pixelHeight)
        {
            this.env = env;
            this.selectedTrapType = TrapType.NoType;

            this.pixelWidth = pixelWidth;
            this.pixelHeight = pixelHeight;

            this.arenaTranslation = new Point(0, 0);

            this.scrollPanel = new ScrollPanel(this, scrollPanelWidth, pixelWidth, pixelHeight);
        }
Exemplo n.º 21
0
    /// <summary>
    /// Method for adding submenu.
    /// </summary>
    /// <param name="button">Menu item button</param>
    /// <param name="cssClass">Button css class</param>
    /// <param name="identifier">Button identifier</param>
    private CMSPanel CreateSubMenu(MenuItem button, string cssClass, int identifier)
    {
        // Generate sub items container
        var pnlSubItems = new CMSPanel();

        pnlSubItems.ID       = "pnlSubItems" + identifier;
        pnlSubItems.ShortID  = "ps" + identifier;
        pnlSubItems.CssClass = "SubMenuItems ContextMenu";

        // Forward scroll button
        Panel pnlForward = new Panel
        {
            ID       = "pnlForward",
            CssClass = "ForwardScroller"
        };

        // Backward scroll button
        Panel pnlBackward = new Panel
        {
            ID       = "pnlBackward",
            CssClass = "BackwardScroller"
        };

        // Scrollable area
        ScrollPanel pnlMenu = new ScrollPanel
        {
            ID                        = "pnlCultureList",
            ShortID                   = "pcl" + identifier,
            CssClass                  = "ContextMenuContainer",
            ScrollAreaCssClass        = "PortalContextMenu UniMenuContextMenu",
            Layout                    = RepeatDirection.Vertical,
            InnerItemClass            = "Item",
            ForwardScrollerControlID  = pnlForward.ID,
            BackwardScrollerControlID = pnlBackward.ID,
            ScrollStep                = 200
        };

        pnlSubItems.Controls.Add(pnlForward);
        pnlSubItems.Controls.Add(pnlBackward);
        pnlSubItems.Controls.Add(pnlMenu);

        // Add menu items
        int subIdentifier = 0;

        foreach (SubMenuItem item in button.SubItems)
        {
            AddSubMenuItem(pnlMenu, item, cssClass, subIdentifier);
            subIdentifier++;
        }

        return(pnlSubItems);
    }
    private void LoadElement(int id, ScrollPanel scrollpanel)
    {
        Debug.Log("Loading element " + id);
        ScrollContentList.Add(Instantiate(ScrollPanelPrefab));
        ScrollContentList [id].transform.SetParent(ScrollContent.transform, false);
        //CurrentLevelList.Add (new List<ScrollPanel>());
        ScrollPanelManager manager = ScrollContentList[id].GetComponent <ScrollPanelManager>();

        manager.ID    = id;
        manager.Panel = scrollpanel;
        manager.StartScrollPanelManager();
        ScrollContentList [id].transform.gameObject.SetActive(true);
    }
Exemplo n.º 23
0
        protected override void LoadContent()
        {
            // TODO: use this.Content to load your game content here eg.

            w = new DecoratedWindow();
            //w.Size=new Vector2<float>(600,200);
            w.LocalPosition = new Vector2 <float> (50, 50);
            //w.Insets = defaultWindowState.Insets;
            Label l = new Label("BigFont", "Drag Me", new Vector3 <byte>(255, 0, 255));

            l.LocalPosition = new Vector2 <float> (0, 0);
            w.AddChild(l);
            l.MouseDragListeners += delegate(GuiComponent c, Vector2 <float> mouseDelta) {
                Console.WriteLine("Mouse drag: " + mouseDelta);
                c.LocalPosition += mouseDelta;
            };
            w2               = new Window();
            w2.Size          = new Vector2 <float>(200, 200);
            w2.LocalPosition = new Vector2 <float>(200, 200);
            ButtonBar buttonBar = new ButtonBar(new string[] { "Show Window", "PopUp" },
                                                new Action <string>[] { DoShow, ShowPopUp });

            w2.AddChild(buttonBar);
            w2.AllLoaded += delegate(GuiComponent obj) {
                w2.Pack();
            };
            popup = new Window();
            ButtonBar popupButtons = new ButtonBar(new String[] { "A button", "Another button", "Close" }
                                                   , new Action <string>[] { DoPop, DoPop, DoPop });

            popupButtons.Vertical = true;
            popup.AddChild(popupButtons);
            popup.AllLoaded += delegate(GuiComponent obj) {
                popup.Pack();
                popup.Enabled = false;                 // hide
            };
            scrollWindow        = new DecoratedWindow();
            scrollWindow.Layout = new GridLayoutManager(1, 1);
            ScrollPanel scrollpanel = new ScrollPanel();

            scrollWindow.AddChild(scrollpanel);
            scrollpanel.Layout = new HorizontalLayout();
            ImagePanel imgPanel = new ImagePanel("Thumbnails", 0, 7);

            scrollpanel.AddChild(imgPanel);
            scrollWindow.AllLoaded += delegate(GuiComponent obj) {
                scrollWindow.Pack();
                scrollWindow.Size = new Vector2 <float>(250, scrollWindow.Size.Y);
            };
            scrollpanel.ContentContainerDrag = new Vector3 <float>(1.0f, float.MaxValue, float.MaxValue);
        }
Exemplo n.º 24
0
    void Start()
    {
//		JSONObject data = new JSONObject ();
//		data.AddField ("2", "5");
//		data.AddField ("3", "1");
//		data.AddField ("4", "2");
//		JSONObject jdata = new JSONObject ();
//		jdata.AddField ("data", data);
//		OnInventoryListResponse (jdata);

        float GridSize = (MainPanel.GetComponent <RectTransform> ().rect.height / 2) - 10;

        ScrollPanel.GetComponent <GridLayoutGroup> ().cellSize = new Vector2(GridSize, GridSize);
    }
        public DefaultTabHeaderPanel(ITabControl tabControl,
                                     IVisualBootstrapper visualBootstrapper) :
            base(visualBootstrapper)
        {
            _indicatorRect = new RenderRectangle();
            _itemsControl  = tabControl;
            _tabsUsed      = Size.Empty;
            _indicatord    = Size.Empty;

            _indicator = new HorizontalRule(visualBootstrapper)
            {
                HorizontalAlignment = HorizontalAlignments.Left,
                Background          = visualBootstrapper.ColorPalette.Secondary
            };
            MarginProperty.AddTransition(_indicator, new ThicknessTransition(_indicator,
                                                                             MarginProperty, TimeSpan.FromSeconds(0.3), TimeSpan.Zero, TransitionFunctionType.Ease));
            WidthProperty.AddTransition(_indicator, new QuantifiedDoubleTransition(_indicator,
                                                                                   WidthProperty, TimeSpan.FromSeconds(0.3), TimeSpan.Zero, TransitionFunctionType.Ease));

            _separator = new HorizontalRule(visualBootstrapper);

            Background = visualBootstrapper.ColorPalette.Background;

            var stackPanel = new UniformStackPanel(visualBootstrapper)
            {
                Orientation = Orientations.Horizontal
            };

            var sourcePropertyAccessor = visualBootstrapper.GetPropertyAccessor(
                tabControl.GetType(), nameof(tabControl.TabItems));

            var spBinding = new OneWayCollectionBinding(tabControl, nameof(tabControl.TabItems),
                                                        stackPanel, nameof(Children), null, sourcePropertyAccessor);

            stackPanel.AddBinding(spBinding);

            _scrollPanel = new ScrollPanel(visualBootstrapper)
            {
                Content               = stackPanel,
                ScrollMode            = ScrollMode.Horizontal,
                IsScrollWithMouseDrag = true,
                VerticalAlignment     = VerticalAlignments.Top
            };

            VerticalAlignment = VerticalAlignments.Top;

            AddChildren(_scrollPanel, _indicator, _separator);

            tabControl.PropertyChanged += OnTabPropertyChanged;
        }
Exemplo n.º 26
0
    private void activateComponentsPanel(ScrollPanel scroll, Mech mech)
    {
        int i = 0;

        foreach (Part.slot s in mech.parts.Keys)
        {
            GameObject newButton = (GameObject)Instantiate(slotButtonPrefab);
            newButton.transform.SetParent(scroll.contentPanel);
            newButton.transform.localScale = new Vector3(1, 1, 1);

            RectTransform buttonTransform = newButton.GetComponent <RectTransform>();
            buttonTransform.anchorMin        = new Vector2(.03f, 1f);
            buttonTransform.anchorMax        = new Vector2(0.97f, 1f);
            buttonTransform.anchoredPosition = new Vector2(0, (-0.55f - i) * buttonHeight);
            buttonTransform.sizeDelta        = new Vector2(scroll.contentPanel.rect.width * 0.90f, buttonHeight);
            buttonTransform.tag = dynamicTag;

            Button         buttonComponent = newButton.GetComponent <Button>();
            SlotButtonLink SB = new SlotButtonLink(s, buttonComponent);
            buttonComponent.onClick.AddListener(() => selectSlot(SB.slot));

            Part p = this.activeMech.parts[s];
            if (null != p)
            {
                buttonTransform.Find("Mech Name").GetComponent <Text>().text = p.displayName;

                //part display information here
            }
            else
            {
                foreach (Text t in buttonTransform.GetComponentsInChildren <Text>())
                {
                    t.text = "";
                }
            }

            buttonTransform.Find("Slot Overlay").GetComponentInChildren <Text>().text = s.ToString();
            i++;
        }

        if (Mathf.Abs(i * buttonHeight) > Mathf.Abs(scroll.viewport.rect.y))
        {
            scroll.contentPanel.sizeDelta = new Vector2(scroll.contentPanel.rect.x, Mathf.Abs((i + 0.55f) * buttonHeight) - Mathf.Abs(scroll.viewport.rect.y));
        }

        secondPanel.Find("Top Panel").gameObject.SetActive(true);

        secondScroll.scrollPanel.gameObject.SetActive(true);
    }
Exemplo n.º 27
0
        private void AddEmbeddedControl()
        {
            ScrollPanel glc           = this.configScrollPanel;
            int         nControlCount = glc.Controls.Count;

            for (int g = 0; g < glc.Controls.Count; g++)
            {
                GroupListView2 glv = (GroupListView2)glc.Controls[g];
                if (glv == null)
                {
                    continue;
                }

                ConfigListView listview = glv.EmbeddLV;
                if (listview == null)
                {
                    continue;
                }

                string temp;
                for (int i = 0; i < listview.Items.Count; i++)
                {
                    // Add edit box
                    TextBox tb = new TextBox();
                    tb.Size         = new Size(SecondColumnWidth, 40);
                    tb.Font         = new System.Drawing.Font("Arial Narrow", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    tb.BorderStyle  = BorderStyle.FixedSingle;
                    tb.TextAlign    = HorizontalAlignment.Left;
                    tb.AutoSize     = false;
                    tb.Anchor       = ((System.Windows.Forms.AnchorStyles)(System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left);
                    tb.BackColor    = TextBoxBackColor;
                    tb.Click       += new System.EventHandler(this.tb_Click);
                    tb.TextChanged += new System.EventHandler(this.tb_TextChanged);

                    ListViewItem lvItemTemp = listview.Items[i];
                    temp    = lvItemTemp.Text;
                    tb.Text = listview.Items[i].SubItems[TextBoxColumn].Text;
                    tb.Tag  = listview.Items[i].SubItems[TextBoxColumn].Tag;

                    // text box
                    ConfigParam2 para2 = listview.Items[i].SubItems[TextBoxColumn].Tag as ConfigParam2;
                    para2.Obj = tb;

                    // Put it in the second column of every row
                    listview.AddEmbeddedControl(tb, TextBoxColumn, lvItemTemp.Index);
                    tb.Dispose();
                }
            }
        }
Exemplo n.º 28
0
        public void MeasureNoScroll()
        {
            var p = new ScrollPanel(LayoutTestStyle.Create())
            {
                // CornerSize = 10,
                Padding = new Insets(10),
                VerticalScrollbarMode = ScrollbarMode.None,
                Content = LayoutTestWidget.FixedSize(500, 300).WithAnchorRect(AnchoredRect.CreateFull(40))
            };

            p.UIStyle.StyleResolver.AddRoot(p);
            p.Measure(Size.Auto);

            p.DesiredSize.Should().Be(new Size(600, 400));
        }
Exemplo n.º 29
0
        public WorkbenchPanel(GameState state, int workbenchID)
            : base(((int)MessagePanel.Instance.GetBodySize().X / 2) - 300, ((int)Renderer.GetResoultion().Y / 2) - 325, 600, 400, BarMode.Close, state)
        {
            if (Instance != null)
            {
                Instance.Close();
            }
            Instance = this;

            _gameState   = state;
            _workbenchID = workbenchID;
            this.SetPanelLabel(CraftableData.GetWorkbench(workbenchID));

            _craftableIDs = new List <int>();
            for (int i = 0; i < CraftableData.GetCraftableDataCount(); i++)
            {
                if (CraftableData.GetCraftableData(i).WorkbenchID == workbenchID)
                {
                    _craftableIDs.Add(i);
                }
            }

            _craftingSelectionPanel = new ScrollPanel(0, 0, GetContentWidth() / 2, GetContentHeight(), BarMode.Empty, state);
            _craftingInfoPanel      = new ScrollPanel(GetContentWidth() / 2, 0, GetContentWidth() / 2, GetContentHeight(), BarMode.Empty, state);

            _craftingSelectionPanel.OnTrigger       += SelectCraftable;
            _craftingSelectionPanel.OnRenderContent += RenderCraftables;
            _craftingInfoPanel.OnRenderContent      += RenderCraftableInfo;

            _craftingSelectionPanel.DisableHorizontalScroll();
            _craftingInfoPanel.DisableHorizontalScroll();

            _countControl = new NumberControl(10, 10, state);
            _countControl.SetMinimum(1);
            _craftButton            = new Button("Craft", 20 + (int)_countControl.GetBodySize().X, 10, _craftingInfoPanel.GetContentWidth() - 30 - (int)_countControl.GetBodySize().X, 40, state);
            _craftButton.OnTrigger += CraftTrigger;

            _craftingInfoPanel.AddControl(_countControl);
            _craftingInfoPanel.AddControl(_craftButton);

            this.AddControl(_craftingSelectionPanel);
            this.AddControl(_craftingInfoPanel);

            int slotSize = _craftingSelectionPanel.GetContentWidth() / 5;
            int rows     = (int)Math.Ceiling(_craftableIDs.Count / 5f);

            _craftingSelectionPanel.SetScrollableHeight(slotSize * rows);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="itemBinder">An item to show</param>
        /// <param name="viewPanel">Panel that holds the image of the item</param>
        /// <param name="textBoxWidth">Width of the textBox</param>
        /// <param name="labeledControlWidth">Width of the labeled control</param>
        public InventorySlotItem(ItemBinder itemBinder, ViewPanel viewPanel, int textBoxWidth, int labeledControlWidth)
            : base(itemBinder, textBoxWidth, labeledControlWidth)
        {
            this.viewPanel = viewPanel;

            Size            = new Size(956, 268);
            CellBorderStyle = TableLayoutPanelCellBorderStyle.Inset;

            itemCore      = new TableLayoutPanel();
            itemCore.Size = new Size(262, 248);

            CreateSelector(ItemData.GetNameList());
            selector.DropDownStyle    = ComboBoxStyle.DropDown;
            selector.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            itemCore.Controls.Add(selector, 0, 0);

            imageLabel      = new Label();
            imageLabel.Size = new Size(IconData.ICON_WIDTH, IconData.ICON_HEIGHT);
            SetImage();
            itemCore.Controls.Add(imageLabel, 0, 1);

            basicInfo        = GenerateBasicInfo();
            basicInfo.Anchor = AnchorStyles.Top;
            itemCore.Controls.Add(basicInfo, 0, 2);

            Controls.Add(itemCore, 0, 0);

            parts       = GenerateParts();
            attachments = GenerateAttachments();

            if (parts != null || attachments != null)
            {
                scrollPanel      = new ScrollPanel();
                scrollPanel.Size = new Size(676, 248);

                if (parts != null)
                {
                    scrollPanel.Controls.Add(parts, 0, 0);
                }

                if (attachments != null)
                {
                    scrollPanel.Controls.Add(attachments, 1, 0);
                }

                Controls.Add(scrollPanel, 1, 0);
            }
        }
Exemplo n.º 31
0
    // Use this for initialization
    void Start()
    {
        rootScroll = new ScrollPanel(rootPanel);
        rootScroll.scrollPanel.gameObject.SetActive(false);
        rootPanel.Find("Top Panel").gameObject.SetActive(false);

        secondScroll = new ScrollPanel(secondPanel);
        secondScroll.scrollPanel.gameObject.SetActive(false);
        secondPanel.Find("Top Panel").gameObject.SetActive(false);
        secondEdgeButton.interactable = false;

        thirdScroll = new ScrollPanel(thirdPanel);
        thirdScroll.scrollPanel.gameObject.SetActive(false);
        thirdPanel.Find("Top Panel").gameObject.SetActive(false);
        thirdEdgeButton.interactable = false;
    }
Exemplo n.º 32
0
    void Start()
    {
        panel = new ScrollPanel(new Rect(50, 50, 300, 200));
        panel.ShowDefaultBackground = true;

        panel.Add(new RadioGroup("My radio group", "a", "b", "c", "d", "e", "f", "g", "h", "i") { ButtonsPerRow = 3 });
        panel.Add(new Box());
        panel.Add(new Spacer(20));

        for (int i = 0; i < 15; ++i)
        {

            var textBox = new TextBox(i.ToString());
            panel.Add(new Button("Test button").OnClicked(b=>textBox.KeyboardControlProperty.Value = true));
            if (i == 1) textBox.KeyboardControlProperty.BindBoth(()=>keyboard, b=>keyboard = b);
            panel.Add(textBox);
            var label = new Label("Test label " + i.ToString());
            panel.Add(new Toggle("Test toggle").OnToggled((t,oldChecked,newChecked) => label.Visible = !newChecked));
            panel.Add(label);
            panel.Add(new SelectionGrid().AddButton("1").AddButton("2").AddButton("3"));
            panel.Add(new PasswordBox().OnEnterPressed(t=>Debug.Log(t.TextProperty.Value)));
            panel.Add(new Spacer(20));
        }
    }
        private void InitializeWidget(LayoutOrientation orientation)
        {
            ImageBox_1 = new ImageBox();
            ImageBox_1.Name = "ImageBox_1";
            ProgressBar_1 = new ProgressBar();
            ProgressBar_1.Name = "ProgressBar_1";
            ImageBox_2 = new ImageBox();
            ImageBox_2.Name = "ImageBox_2";
            Button_1 = new Button();
            Button_1.Name = "Button_1";
            Label_1 = new Label();
            Label_1.Name = "Label_1";
            Label_level = new Label();
            Label_level.Name = "Label_level";
            Label_2 = new Label();
            Label_2.Name = "Label_2";
            Label_exp = new Label();
            Label_exp.Name = "Label_exp";
            Label_3 = new Label();
            Label_3.Name = "Label_3";
            Label_rem = new Label();
            Label_rem.Name = "Label_rem";
            ScrollPanel_1 = new ScrollPanel();
            ScrollPanel_1.Name = "ScrollPanel_1";
            Label_4 = new Label();
            Label_4.Name = "Label_4";

            // ImageBox_1
            ImageBox_1.Image = new ImageAsset("/Application/assets/statusbg.jpg");
            ImageBox_1.ImageScaleType = ImageScaleType.Center;

            // ImageBox_2
            ImageBox_2.Image = new ImageAsset("/Application/assets/myCharacter.png");
            ImageBox_2.ImageScaleType = ImageScaleType.Center;

            // Button_1
            Button_1.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
            Button_1.TextFont = new UIFont(FontAlias.System, 25, FontStyle.Regular);
            Button_1.BackgroundFilterColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);

            // Label_1
            Label_1.TextColor = new UIColor(255f / 255f, 191f / 255f, 116f / 255f, 255f / 255f);
            Label_1.Font = new UIFont(FontAlias.System, 40, FontStyle.Bold);
            Label_1.LineBreak = LineBreak.Character;
            Label_1.TextShadow = new TextShadowSettings()
            {
                Color = new UIColor(128f / 255f, 128f / 255f, 128f / 255f, 127f / 255f),
                HorizontalOffset = 2f,
                VerticalOffset = 2f,
            };

            // Label_level
            Label_level.TextColor = new UIColor(255f / 255f, 191f / 255f, 116f / 255f, 255f / 255f);
            Label_level.Font = new UIFont(FontAlias.System, 60, FontStyle.Bold);
            Label_level.LineBreak = LineBreak.Character;
            Label_level.HorizontalAlignment = HorizontalAlignment.Right;
            Label_level.VerticalAlignment = VerticalAlignment.Bottom;
            Label_level.TextShadow = new TextShadowSettings()
            {
                Color = new UIColor(128f / 255f, 128f / 255f, 128f / 255f, 127f / 255f),
                HorizontalOffset = 2f,
                VerticalOffset = 2f,
            };

            // Label_2
            Label_2.TextColor = new UIColor(255f / 255f, 191f / 255f, 116f / 255f, 255f / 255f);
            Label_2.Font = new UIFont(FontAlias.System, 40, FontStyle.Bold);
            Label_2.LineBreak = LineBreak.Character;
            Label_2.TextShadow = new TextShadowSettings()
            {
                Color = new UIColor(128f / 255f, 128f / 255f, 128f / 255f, 127f / 255f),
                HorizontalOffset = 2f,
                VerticalOffset = 2f,
            };

            // Label_exp
            Label_exp.TextColor = new UIColor(255f / 255f, 191f / 255f, 116f / 255f, 255f / 255f);
            Label_exp.Font = new UIFont(FontAlias.System, 32, FontStyle.Bold);
            Label_exp.LineBreak = LineBreak.Character;
            Label_exp.HorizontalAlignment = HorizontalAlignment.Right;
            Label_exp.VerticalAlignment = VerticalAlignment.Bottom;
            Label_exp.TextShadow = new TextShadowSettings()
            {
                Color = new UIColor(128f / 255f, 128f / 255f, 128f / 255f, 127f / 255f),
                HorizontalOffset = 2f,
                VerticalOffset = 2f,
            };

            // Label_3
            Label_3.TextColor = new UIColor(255f / 255f, 191f / 255f, 116f / 255f, 255f / 255f);
            Label_3.Font = new UIFont(FontAlias.System, 28, FontStyle.Bold);
            Label_3.LineBreak = LineBreak.Character;
            Label_3.VerticalAlignment = VerticalAlignment.Bottom;
            Label_3.TextShadow = new TextShadowSettings()
            {
                Color = new UIColor(128f / 255f, 128f / 255f, 128f / 255f, 127f / 255f),
                HorizontalOffset = 2f,
                VerticalOffset = 2f,
            };

            // Label_rem
            Label_rem.TextColor = new UIColor(255f / 255f, 191f / 255f, 116f / 255f, 255f / 255f);
            Label_rem.Font = new UIFont(FontAlias.System, 28, FontStyle.Bold);
            Label_rem.LineBreak = LineBreak.Character;
            Label_rem.HorizontalAlignment = HorizontalAlignment.Right;
            Label_rem.VerticalAlignment = VerticalAlignment.Bottom;
            Label_rem.TextShadow = new TextShadowSettings()
            {
                Color = new UIColor(128f / 255f, 128f / 255f, 128f / 255f, 127f / 255f),
                HorizontalOffset = 2f,
                VerticalOffset = 2f,
            };

            // ScrollPanel_1
            ScrollPanel_1.HorizontalScroll = false;
            ScrollPanel_1.VerticalScroll = true;
            ScrollPanel_1.ScrollBarVisibility = ScrollBarVisibility.ScrollableVisible;
            ScrollPanel_1_Skills = new Skills();
            ScrollPanel_1_Skills.UpdateSkills();
            ScrollPanel_1.PanelWidth = ScrollPanel_1_Skills.Width;
            ScrollPanel_1.PanelHeight = ScrollPanel_1_Skills.Height;
            ScrollPanel_1.PanelX = 0;
            ScrollPanel_1.PanelY = 0;
            ScrollPanel_1.AddChildLast(ScrollPanel_1_Skills);

            // Label_4
            Label_4.TextColor = new UIColor(255f / 255f, 191f / 255f, 116f / 255f, 255f / 255f);
            Label_4.Font = new UIFont(FontAlias.System, 40, FontStyle.Bold);
            Label_4.LineBreak = LineBreak.Character;
            Label_4.HorizontalAlignment = HorizontalAlignment.Center;
            Label_4.TextShadow = new TextShadowSettings()
            {
                Color = new UIColor(128f / 255f, 128f / 255f, 128f / 255f, 127f / 255f),
                HorizontalOffset = 2f,
                VerticalOffset = 2f,
            };

            // CharacterStatus
            this.RootWidget.AddChildLast(ImageBox_1);
            this.RootWidget.AddChildLast(ProgressBar_1);
            this.RootWidget.AddChildLast(ImageBox_2);
            this.RootWidget.AddChildLast(Button_1);
            this.RootWidget.AddChildLast(Label_1);
            this.RootWidget.AddChildLast(Label_level);
            this.RootWidget.AddChildLast(Label_2);
            this.RootWidget.AddChildLast(Label_exp);
            this.RootWidget.AddChildLast(Label_3);
            this.RootWidget.AddChildLast(Label_rem);
            this.RootWidget.AddChildLast(ScrollPanel_1);
            this.RootWidget.AddChildLast(Label_4);
            this.Transition = new JumpFlipTransition();
            SetWidgetLayout(orientation);

            UpdateLanguage();
        }
Exemplo n.º 34
0
        public override void Initialize()
        {
            fnt = new Font("msyh.ttc", 25);
            fntsmall = new Font("msyh.ttc", 15);
            fntborder = new Font("msyh.ttc", 15)
            {
                EnableBorder = true,
                BorderColor = Color.Black
            };

            spm = new ScrollPanel()
            {
                Margin = Origins.TopRight,
                Width = 1000,
                Height = GraphicsDevice.Viewport.Height - 80,
                Top = 80,
                Right = 0
            };

            b = new Button()
            {
                Bottom = 10,
                Left = 195,
                Width = 165,
                Height = 40,
                Margin = Origins.BottomLeft,
            };

            breturn = new Button()
            {
                Bottom = 10,
                Left = 10,
                Width = 165,
                Height = 40,
                Margin = Origins.BottomLeft
            };

            combob = new ComboBox()
            {
                Top = 120,
                Left = 10,
                Width = 350,
                Margin = Origins.TopLeft,
            };

            groupcb = new ComboBox()
            {
                Top = 10,
                Right = 300,
                Width = 200,
                Margin = Origins.TopRight,
                FocusColor = Color.CornflowerBlue,
            };

            sortcb = new ComboBox()
            {
                Top = 10,
                Right = 20,
                Width = 200,
                Margin = Origins.TopRight,
                FocusColor = Color.LightGreen,
            };

            tb = new TabControl()
            {
                Top = 54,
                Right = 10,
                Margin = Origins.TopRight,
                Width = GraphicsDevice.Viewport.Width,
                Height = GraphicsDevice.Viewport.Height,
                TabMargin = Origins.TopRight
            };

            bg = Sprite.CreateTextureFromFile(@"Content\menu-background-xmas-6.png");
            menu_osu = Sprite.CreateTextureFromFile(@"Content\010c0951.png");
            top = Sprite.CreateTextureFromFile(@"Content\songselect-top.png");

            Controls.Add(spm);
            Controls.Add(b);
            Controls.Add(breturn);
            Controls.Add(tb);
            Controls.Add(combob);
            Controls.Add(groupcb);
            Controls.Add(sortcb);

            base.Initialize();

            CreateMap();
            p_Click((object)maps[0], null);

            spm.Controls.AddRange(maps.ToArray());

            spm.ScrollSpeed = 150;
            b.Text = "开始颓废";
            breturn.Text = "返回母港";
            breturn.Click += Breturn_Click;

            combob.AddItem("地图信息");
            combob.AddItem("本地排行");
            combob.AddItem("在线排行");
            combob.AddItem("好友排行");
            combob.SelectedItem = "地图信息";
            groupcb.AddItem("不分组");
            groupcb.AddItem("作者");
            groupcb.AddItem("添加日期");
            groupcb.AddItem("长度");
            groupcb.AddItem("海域");
            groupcb.AddItem("地图名称");
            groupcb.AddItem("收藏夹");
            groupcb.AddItem("我做的图");
            groupcb.AddItem("最近玩过的");
            groupcb.SelectedItem = "不分组";

            sortcb.AddItem("海域编号");
            sortcb.AddItem("地图名称");
            sortcb.AddItem("作者");
            sortcb.AddItem("长度");
            sortcb.AddItem("添加日期");
            sortcb.SelectedItem = "海域编号";

            tb.AddTab(Control.Empty, "不分组");
            tb.AddTab(Control.Empty, "作者");
            tb.AddTab(Control.Empty, "最近玩过的");
            tb.AddTab(Control.Empty, "收藏夹");
            tb.SwitchTab(0);
            this.Show += MapSelect_Show;
            this.Leave += MapSelect_Leave;
        }
        private void InitializeWidget(LayoutOrientation orientation)
        {
            ImageBox_1 = new ImageBox();
            ImageBox_1.Name = "ImageBox_1";
            ScrollPanel_1 = new ScrollPanel();
            ScrollPanel_1.Name = "ScrollPanel_1";
            Button_1 = new Button();
            Button_1.Name = "Button_1";

            // ImageBox_1
            ImageBox_1.Image = new ImageAsset(new Image(ImageMode.Rgba,new ImageSize(960,544),new ImageColor(50,50,50,255)));
            ImageBox_1.ImageScaleType = ImageScaleType.Center;

            // ScrollPanel_1
            ScrollPanel_1.HorizontalScroll = false;
            ScrollPanel_1.VerticalScroll = true;
            ScrollPanel_1.ScrollBarVisibility = ScrollBarVisibility.ScrollableVisible;
            var ScrollPanel_1_CreditPanel = new CreditPanel();
            ScrollPanel_1.PanelWidth = ScrollPanel_1_CreditPanel.Width;
            ScrollPanel_1.PanelHeight = ScrollPanel_1_CreditPanel.Height;
            ScrollPanel_1.PanelX = 0;
            ScrollPanel_1.PanelY = 0;
            ScrollPanel_1.AddChildLast(ScrollPanel_1_CreditPanel);

            // Button_1
            Button_1.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
            Button_1.TextFont = new UIFont(FontAlias.System, 20, FontStyle.Regular);

            // Credit
            this.RootWidget.AddChildLast(ImageBox_1);
            this.RootWidget.AddChildLast(ScrollPanel_1);
            this.RootWidget.AddChildLast(Button_1);
            this.Transition = new CrossFadeTransition();

            SetWidgetLayout(orientation);

            UpdateLanguage();
        }
    /// <summary>
    /// Method for adding submenu.
    /// </summary>
    /// <param name="button">Menu item button</param>
    /// <param name="cssClass">Button css class</param>
    /// <param name="identifier">Button identifier</param>
    private CMSPanel CreateSubMenu(MenuItem button, string cssClass, int identifier)
    {
        // Generate sub items container
        var pnlSubItems = new CMSPanel();
        pnlSubItems.ID = "pnlSubItems" + identifier;
        pnlSubItems.ShortID = "ps" + identifier;
        pnlSubItems.CssClass = "SubMenuItems ContextMenu";

        // Forward scroll button
        Panel pnlForward = new Panel
        {
            ID = "pnlForward",
            CssClass = "ForwardScroller"
        };

        // Backward scroll button
        Panel pnlBackward = new Panel
        {
            ID = "pnlBackward",
            CssClass = "BackwardScroller"
        };

        // Scrollable area
        ScrollPanel pnlMenu = new ScrollPanel
        {
            ID = "pnlCultureList",
            ShortID = "pcl" + identifier,
            CssClass = "ContextMenuContainer",
            ScrollAreaCssClass = "PortalContextMenu UniMenuContextMenu",
            Layout = RepeatDirection.Vertical,
            InnerItemClass = "Item",
            ForwardScrollerControlID = pnlForward.ID,
            BackwardScrollerControlID = pnlBackward.ID,
            ScrollStep = 200
        };

        pnlSubItems.Controls.Add(pnlForward);
        pnlSubItems.Controls.Add(pnlBackward);
        pnlSubItems.Controls.Add(pnlMenu);

        // Add menu items
        int subIdentifier = 0;
        foreach (SubMenuItem item in button.SubItems)
        {
            AddSubMenuItem(pnlMenu, item, cssClass, subIdentifier);
            subIdentifier++;
        }

        return pnlSubItems;
    }