コード例 #1
0
        //----------------------------------------------------------------------
        public BasicDemoPane(MainMenuManager _manager)
            : base(_manager)
        {
            int iRows = 3;

            var gridGroup = new NuclearUI.GridGroup(Manager.MenuScreen, 2, iRows, false, 0);

            gridGroup.AnchoredRect = NuclearUI.AnchoredRect.CreateTopLeftAnchored(0, 0, 400, iRows * 50);
            AddChild(gridGroup);

            int iRowIndex = 0;

            //------------------------------------------------------------------
            gridGroup.AddChildAt(new NuclearUI.Label(Manager.MenuScreen, "Select Flavor", NuclearUI.Anchor.Start), 0, iRowIndex);

            {
                var lItems = new List <NuclearUI.DropDownItem>();
                lItems.Add(new NuclearUI.DropDownItem(Manager.MenuScreen, "Chocolate", Flavor.Chocolate));
                lItems.Add(new NuclearUI.DropDownItem(Manager.MenuScreen, "Vanilla", Flavor.Vanilla));
                lItems.Add(new NuclearUI.DropDownItem(Manager.MenuScreen, "Cheese", Flavor.Cheese));

                NuclearUI.DropDownBox dropDownBox = new NuclearUI.DropDownBox(Manager.MenuScreen, lItems, 0);
                gridGroup.AddChildAt(dropDownBox, 1, iRowIndex);
            }

            iRowIndex++;

            //------------------------------------------------------------------
            gridGroup.AddChildAt(new NuclearUI.Label(Manager.MenuScreen, "Choose Cone Size", NuclearUI.Anchor.Start), 0, iRowIndex);

            {
                var sizeSlider = new NuclearUI.Slider(Manager.MenuScreen, 1, 5, 1, 1);
                gridGroup.AddChildAt(sizeSlider, 1, iRowIndex);
            }

            iRowIndex++;

            //------------------------------------------------------------------
            gridGroup.AddChildAt(new NuclearUI.Label(Manager.MenuScreen, "Clicky clicky", NuclearUI.Anchor.Start), 0, iRowIndex);

            {
                var button = new NuclearUI.Button(Manager.MenuScreen, "Get Ice Cream!");
                button.ClickHandler = delegate {
                    Manager.MessagePopup.Setup("Oh noes!", "It melted already. Sorry.", NuclearWinter.i18n.Common.Close, false);
                    Manager.MessagePopup.Open(600, 250);
                };
                gridGroup.AddChildAt(button, 1, iRowIndex);
            }

            iRowIndex++;

            //------------------------------------------------------------------
        }
コード例 #2
0
        //----------------------------------------------------------------------
        public BasicDemoPane(MainMenuManager _manager)
            : base(_manager)
        {
            int iRows = 3;

            var gridGroup = new NuclearUI.GridGroup(Manager.MenuScreen, 2, iRows, false, 0);

            gridGroup.AnchoredRect = NuclearUI.AnchoredRect.CreateTopLeftAnchored(0, 0, 400, iRows * 50);

            var gridGroup2 = new NuclearUI.GridGroup(Manager.MenuScreen, 1, 1, false, 0);

            gridGroup2.AnchoredRect = NuclearUI.AnchoredRect.CreateBottomAnchored(20, 0, 20, 50);

            AddChild(gridGroup);
            AddChild(gridGroup2);

            int iRowIndex = 0;

            //------------------------------------------------------------------
            gridGroup.AddChildAt(new NuclearUI.Label(Manager.MenuScreen, "Select Flavor", NuclearUI.Anchor.Start), 0, iRowIndex);

            {
                var lItems = new List <NuclearUI.DropDownItem>();
                lItems.Add(new NuclearUI.DropDownItem(Manager.MenuScreen, "Chocolate", Flavor.Chocolate));
                lItems.Add(new NuclearUI.DropDownItem(Manager.MenuScreen, "Vanilla", Flavor.Vanilla));
                lItems.Add(new NuclearUI.DropDownItem(Manager.MenuScreen, "Cheese", Flavor.Cheese));

                List <NuclearWinter.ScreenMode> modes = NuclearWinter.Resolution.SortedScreenModes;

                foreach (NuclearWinter.ScreenMode mode in modes)
                {
                    lItems.Add(new NuclearUI.DropDownItem(Manager.MenuScreen, mode.ToString(), Flavor.Vanilla));
                }

                NuclearUI.DropDownBox dropDownBox = new NuclearUI.DropDownBox(Manager.MenuScreen, lItems, 0);
                gridGroup.AddChildAt(dropDownBox, 1, iRowIndex);
            }

            iRowIndex++;

            //------------------------------------------------------------------
            gridGroup.AddChildAt(new NuclearUI.Label(Manager.MenuScreen, "Draw Distance", NuclearUI.Anchor.Start), 0, iRowIndex);

            {
                var sizeSlider = new NuclearUI.Slider(Manager.MenuScreen, 1, 5, 1, 1);
                gridGroup.AddChildAt(sizeSlider, 1, iRowIndex);
            }

            iRowIndex++;

            //------------------------------------------------------------------
            gridGroup.AddChildAt(new NuclearUI.Label(Manager.MenuScreen, "Clicky Clicky", NuclearUI.Anchor.Start), 0, iRowIndex);

            {
                var button = new NuclearUI.Button(Manager.MenuScreen, "Go!");
                button.ClickHandler = delegate
                {
                    Manager.MessagePopup.Setup("Oh noes!", "It melted already. Sorry.", NuclearWinter.i18n.Common.Close, false);
                    Manager.MessagePopup.Open(600, 250);
                };
                gridGroup.AddChildAt(button, 1, iRowIndex);
            }

            iRowIndex++;

            //------------------------------------------------------------------

            // Add button to second GridGroup
            {
                var button = new NuclearUI.Button(Manager.MenuScreen, "Apply Changes");
                button.ClickHandler = delegate
                {
                    Manager.MessagePopup.Setup("Oh noes!", "It melted already. Sorry.", NuclearWinter.i18n.Common.Close, false);
                    Manager.MessagePopup.Open(600, 250);
                };
                gridGroup2.AddChildAt(button, 0, 0);
            }
        }
コード例 #3
0
        public void Refresh()
        {
            mActionsGroup.Clear();

            TitleLabel.Text = m_aktUnit.strBez + " ID " + m_aktUnit.Id;

            ContentGroup.Clear();

            List<clsSubUnit> lisSubUnits = m_aktUnit.lisSubUnits;
            m_gridSubUnitRooster = new GridGroup(Manager.MenuScreen, 5, lisSubUnits.Count, false, 0);
            ContentGroup.AddChild(m_gridSubUnitRooster);

            for (int i = 0; i < lisSubUnits.Count; i++)
            {
                Image imgBtn = new Image(Manager.MenuScreen, base.Manager.Content.Load<Texture2D>("Sprites/" + lisSubUnits[i].objUnitType.strIconName));
                m_gridSubUnitRooster.AddChildAt(imgBtn, 0, i);

                Label subLabel = new Label(Manager.MenuScreen);
                subLabel.Font = Screen.Style.SmallFont;
                subLabel.Text = lisSubUnits[i].objUnitType.strBez;
                m_gridSubUnitRooster.AddChildAt(subLabel, 1, i);

                subLabel = new Label(Manager.MenuScreen);
                subLabel.Font = Screen.Style.SmallFont;
                subLabel.Text = "Move: " + lisSubUnits[i].objUnitType.intMovement.ToString();
                m_gridSubUnitRooster.AddChildAt(subLabel, 2, i);

                subLabel = new Label(Manager.MenuScreen);
                subLabel.Font = Screen.Style.SmallFont;
                subLabel.Text = "See: " + lisSubUnits[i].objUnitType.intSichtweite.ToString();
                m_gridSubUnitRooster.AddChildAt(subLabel, 3, i);

                BoxGroup testGroup = new BoxGroup(Screen, Orientation.Vertical, 0, Anchor.Center);
                m_gridSubUnitRooster.AddChildAt(testGroup, 4, i);

                //add Roosterrow
                Button mCommandButton = new Button(Screen);
                mCommandButton.Text = "Destroy " + lisSubUnits[i].ID.ToString();
                mCommandButton.Tag = lisSubUnits[i];
                mCommandButton.ClickHandler = new Action<Button>(entfernen_ClickHandler);
                testGroup.AddChild(mCommandButton, false);

            }

            mCloseButton.Text = "Schließen";

            foreach (ICommand aktCommandType in m_objCommandCollection.listRawCommands)
            {
                Button mCommandButton = new Button(Screen);
                mCommandButton.Text = aktCommandType.strTypeName;
                mCommandButton.Tag = aktCommandType;
                mCommandButton.ClickHandler = new Action<Button>(imgCommandIcon_ClickHandler);
                mActionsGroup.AddChild(mCommandButton);
            }

            mActionsGroup.AddChild(mCloseButton);
        }