public StartGameInterface()
        {
            base.initialize(1);
            base.blocking = false;

            MainView = new WindowView(GeeUI.GeeUI.RootView, Main.Center - new Vector2(200, 300),
                                      AssetManager.GetFont("Console")) { WindowText = "Start game" };

            PanelView p = new PanelView(MainView, Vector2.Zero);

            MainView.Width = 200;
            MainView.Height = 300;
            p.Width = 200;
            p.Height = 300;

            HostGameButton = new ButtonView(p, "Host", new Vector2(20, 200), AssetManager.GetFont("Console"));
            JoinGameButton = new ButtonView(p, "Connect", new Vector2(100, 200), AssetManager.GetFont("Console"));

            JoinGameButton.OnMouseClick += (sender, e) =>
            {
                Connect();
            };

            HostGameButton.OnMouseClick += (sender, e) =>
            {
                Host();
            };

            PlayerNameTextField = new TextFieldView(p, new Vector2(5, 10), AssetManager.GetFont("Console"))
            {
                Width = 180,
                Height = 20,
                MultiLine = false
            };
            ServerIPTextField = new TextFieldView(p, new Vector2(5, 110), AssetManager.GetFont("Console"))
            {
                Width = 180,
                Height = 20,
                MultiLine = false
            };
            ServerPortTextField = new TextFieldView(p, new Vector2(5, 160), AssetManager.GetFont("Console"))
            {
                Width = 180,
                Height = 20,
                MultiLine = false
            };

            //AnimationEditorButton = new ButtonView(Main.Center - new Vector2(0, 200), "Animation editor", AssetManager.GetFont("Console"), () => { destroy(); AnimationEditorInterface ae = new AnimationEditorInterface(); ae.initialize(1); });

            PlayerNameTextField.Text = "Player1";
            ServerIPTextField.Text = "127.0.0.1";
            ServerPortTextField.Text = "870";
        }
Beispiel #2
0
        public DropDownView(GeeUIMain theGeeUI, View parentView, Vector2 position)
            : base(theGeeUI, parentView)
        {
            this.numChildrenAllowed          = 1;
            ParentGeeUI.OnKeyPressedHandler += this.keyPressedHandler;
            var button = new ButtonView(theGeeUI, this, "", Vector2.Zero);

            button.Add(new Binding <int>(this.Width, button.Width));
            button.Add(new Binding <int>(this.Height, button.Height));
            button.OnMouseClick += delegate(object sender, EventArgs e)
            {
                ToggleDropDown();
                this.FilterView.TemporarilyIgnoreMouseClickAway = true;
            };

            button.OnMouseClickAway += delegate(object sender, EventArgs args)
            {
                HideDropDown();
            };

            button.OnMouseRightClick += (sender, args) =>
            {
                if (AllowRightClickExecute)
                {
                    ExecuteLast();
                }
            };

            button.Name = "button";

            this.DropDownPanelView = new PanelView(theGeeUI, theGeeUI.RootView, Vector2.Zero);
            DropDownPanelView.ChildrenLayouts.Add(new VerticalViewLayout(2, false));
            this.DropDownPanelView.SelectedNinepatch = this.DropDownPanelView.UnselectedNinepatch = GeeUIMain.NinePatchDropDown;

            FilterView = new TextFieldView(theGeeUI, DropDownPanelView, Vector2.Zero);

            // HACK
            FilterView.Height.Value = (int)(20 * theGeeUI.Main.MainFontMultiplier);

            FilterView.MultiLine = false;
            FilterView.Add(new Binding <int>(FilterView.Width, x => x - 8, DropDownPanelView.Width));
            FilterView.OnTextChanged = () =>
            {
                if (FilterView.Active && DropDownPanelView.Active && AllowFilterText)
                {
                    Refilter();
                }
            };

            DropDownListView = new ListView(theGeeUI, DropDownPanelView);
            DropDownListView.ChildrenLayouts.Add(new VerticalViewLayout(1, false));
            DropDownListView.ScrollMultiplier = 20;
            DropDownListView.Add(new Binding <int, Rectangle>(DropDownListView.Width, x => Math.Max(200, x.Width), DropDownListView.ChildrenBoundBox));
            DropDownListView.Add(new Binding <int, Rectangle>(DropDownListView.Height, x => x.Height, DropDownListView.ChildrenBoundBox));

            DropDownPanelView.Add(new Binding <int>(DropDownPanelView.Width, DropDownListView.Width));

            DropDownListView.Name = "DropList";
            DropDownPanelView.Add(new Binding <int>(DropDownPanelView.Height, (i1) => i1 + 2 + ((AllowFilterText && FilterView.Active) ? FilterView.BoundBox.Height : 0), DropDownListView.Height));

            DropDownPanelView.Active.Value = false;

            this.Add(new SetBinding <string>(this.Label, delegate(string value)
            {
                ((ButtonView)FindFirstChildByName("button")).Text = value;
            }));
        }
Beispiel #3
0
		public DropDownView(GeeUIMain theGeeUI, View parentView, Vector2 position)
			: base(theGeeUI, parentView)
		{
			this.numChildrenAllowed = 1;
			ParentGeeUI.OnKeyPressedHandler += this.keyPressedHandler;
			var button = new ButtonView(theGeeUI, this, "", Vector2.Zero);
			button.Add(new Binding<int>(this.Width, button.Width));
			button.Add(new Binding<int>(this.Height, button.Height));
			button.OnMouseClick += delegate(object sender, EventArgs e)
			{
				ToggleDropDown();
				button.TemporarilyIgnoreMouseClickAway = true;
				this.FilterView.TemporarilyIgnoreMouseClickAway = true;
			};

			button.OnMouseClickAway += delegate(object sender, EventArgs args)
			{
				HideDropDown();
			};

			button.OnMouseRightClick += (sender, args) =>
			{
				if (AllowRightClickExecute)
					ExecuteLast();
			};

			button.Name = "button";

			this.DropDownPanelView = new PanelView(theGeeUI, theGeeUI.RootView, Vector2.Zero);
			DropDownPanelView.ChildrenLayouts.Add(new VerticalViewLayout(2, false));
			this.DropDownPanelView.SelectedNinepatch = this.DropDownPanelView.UnselectedNinepatch = GeeUIMain.NinePatchDropDown;

			FilterView = new TextFieldView(theGeeUI, DropDownPanelView, Vector2.Zero);

			// HACK
			FilterView.Height.Value = (int)(20 * theGeeUI.Main.FontMultiplier);

			FilterView.MultiLine = false;
			FilterView.AllowTab = false;
			FilterView.Add(new Binding<int>(FilterView.Width, x => x - 8, DropDownPanelView.Width));
			FilterView.OnTextChanged = () =>
			{
				if (FilterView.Active && DropDownPanelView.Active && AllowFilterText)
				{
					Refilter();
				}
			};

			DropDownListView = new ListView(theGeeUI, DropDownPanelView);
			DropDownListView.ChildrenLayouts.Add(new VerticalViewLayout(1, false));
			DropDownListView.ScrollMultiplier = 20;
			DropDownListView.Add(new Binding<int, Rectangle>(DropDownListView.Width, x => Math.Max(200, x.Width), DropDownListView.ChildrenBoundBox));
			DropDownListView.Add(new Binding<int, Rectangle>(DropDownListView.Height, x => x.Height, DropDownListView.ChildrenBoundBox));

			DropDownPanelView.Add(new Binding<int>(DropDownPanelView.Width, DropDownListView.Width));

			DropDownListView.Name = "DropList";
			DropDownPanelView.Add(new Binding<int>(DropDownPanelView.Height, (i1) => i1 + 2 + ((AllowFilterText && FilterView.Active) ? FilterView.BoundBox.Height : 0), DropDownListView.Height));

			DropDownPanelView.Active.Value = false;

			this.Add(new SetBinding<string>(this.Label, delegate(string value)
			{
				((ButtonView)FindFirstChildByName("button")).Text = value;
			}));
		}
Beispiel #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            var font = Content.Load<SpriteFont>("testFont");
               /* agop = Content.Load<Texture2D>("agop");

            for(int i = 0; i < 35; i++)
            {
                var panel = new View(GeeUI.GeeUI.RootView) {Width = 300, Height = 300};
                for(int j = 0; j < 7; j++)
                {
                    var newImage = new ImageView(panel, agop);
                    newImage.ScaleVector = new Vector2(.75f);
                }
                panel.ChildrenLayout = new SpinViewLayout(130, 1.5f);
            }

            GeeUI.GeeUI.RootView.ChildrenLayout = new SpinViewLayout(350, -1.5f);

            */
            var panel = new PanelView(GeeUI.GeeUI.RootView, new Vector2(5, 5)) { Width = 600, Height = 400 };

            var tabs = new TabHost(panel, new Vector2(0, 0), font) { Width = 570, Height = 300 };

            var panel1 = new PanelView(null, Vector2.Zero);
            var panel2 = new PanelView(null, Vector2.Zero);

            tabs.AddTab("Tab 1", panel1);
            tabs.AddTab("Tab 2", panel2);
            new TextFieldView(panel1, Vector2.Zero, font) { Text = "This is tab 1.", Width = 380, Height = 230 };

            for (int i = 0; i < 50; i++)
            {
                var button = new ButtonView(panel2, "Button" + (i + 1), Vector2.Zero, font);
                button.Width = 70;
                button.OnMouseClick += (sender, e) => panel2.RemoveChild(button);
            }

            ButtonView switchLayouts = new ButtonView(panel, "Switch to Spinning Layout", Vector2.Zero, font);
            switchLayouts.OnMouseClick += (sender, e) =>
                                              {
                                                  if (panel2.ChildrenLayout is VerticalViewLayout)
                                                  {
                                                      panel2.ChildrenLayout = new SpinViewLayout(115);
                                                      switchLayouts.Text = "Switch to Vertical Layout";
                                                  }
                                                  else if (panel2.ChildrenLayout is SpinViewLayout)
                                                  {
                                                      panel2.ChildrenLayout = new VerticalViewLayout(2, true);
                                                      switchLayouts.Text = "Switch to Spinning Layout";
                                                  }
                                              };
            panel.ChildrenLayout = new VerticalViewLayout(4, true);
            panel2.ChildrenLayout = new VerticalViewLayout(2, true);
        }
Beispiel #5
0
        public Console()
        {
            MainView = new WindowView(GeeUI.GeeUI.RootView, Main.Center, AssetManager.GetFont("Console"));
            PanelView p = new PanelView(MainView, Vector2.Zero);
            MainView.Width = 505;
            MainView.Height = 400;
            p.Width = 505;
            p.Height = 400;
            MainView.Active = false;
            f = AssetManager.GetFont("Console");
            Color black = Color.Black;
            black.A = 200;
            active = false;
            _output = new TextFieldView(p, new Vector2(0, 0), AssetManager.GetFont("Console2"))
                         {Width = 490, Height = 330, Editable = false};
            _tI = new TextFieldView(p, new Vector2(0, _output.Height + 1), AssetManager.GetFont("Console"))
                     {Width = 490, Height = 20, MultiLine = false};

            _tI.OnEnterPressed += new View.MouseClickEventHandler((object sender, EventArgs e) =>
                                                                     {
                                                                         Enter();
                                                                     });

            UpdateConsole();

            InputManager.BindKey(() =>
            {
                if (PossibleCommands.Count == 0)
                    PossibleCommands = PreviousCommands;
                TrimCommands();
                if (CurrentSelection > 0)
                {
                    CurrentSelection--;
                    _tI.Text = PossibleCommands[CurrentSelection];
                }
            }, Keys.Up);
            InputManager.BindKey(() =>
            {
                if (PossibleCommands.Count == 0)
                    PossibleCommands = PreviousCommands;
                TrimCommands();
                if (CurrentSelection < PossibleCommands.Count - 1)
                {
                    CurrentSelection++;
                    _tI.Text = PossibleCommands[CurrentSelection];
                }
            }, Keys.Down);
            InputManager.BindMouse(() => { if (Shown) { ConsoleManager.offset -= ConsoleManager.offset > 0 ? 1 : 0; UpdateConsole(); } }, MouseButton.Scrollup);
            InputManager.BindMouse(() =>
            {
                if (Shown)
                {
                    int offset = ConsoleManager.offset;
                    if (offset < ConsoleManager.logNum - ConsoleManager.lines)
                    {
                        ConsoleManager.offset++;
                        UpdateConsole();
                    }
                }

            }, MouseButton.Scrolldown);
            base.depth = 100;
        }
        public InGameInterface()
        {
            MainView = new PanelView(GeeUI.GeeUI.RootView, Vector2.Zero) { Width = 800, Height = 50, Draggable = false };

            //Create a new invisible view to limit the draggable range of the Expanded Inventory view.
            View ContainerView = new View(GeeUI.GeeUI.RootView)
            {
                Width = 800,
                Height = 450,
                X = 0,
                Y = 50
            };
            ExpandedView = new PanelView(ContainerView, new Vector2(0, 55))
                               {
                                   Width = 200,
                                   Height = 200,
                                   Active = false,
                                   ChildrenLayout = new HorizontalViewLayout(20, true)
                               };

            BagSizeChange(20);

            Vector2 start = new Vector2(0, 0);
            base.blocking = false;
            start.Y = 10;
            start.X = 50;

            for (int i = 0; i < 9; i++)
            {
                ButtonView b = new ButtonView(MainView, new ImageView(null, AssetManager.GetTexture("white")), start) { Width = 25, Height = 25 };
                new TextView(b, "10", new Vector2(0, 21), AssetManager.GetFont("Console2")) { TextColor = Color.White, Width = 25, Height = 10, TextJustification = TextJustification.Center };
                int i1 = i;
                b.OnMouseClick += (sender, e) =>
                {
                    BlockPressed(i1);
                };

                _buttons.Add(b);
                start.X += 70;
            }

            InputManager.BindMouse(() =>
            {
                if (++CurSelected >= 9)
                    CurSelected = 0;
                BlockPressed(CurSelected);
            }, MouseButton.Scrollup);
            InputManager.BindMouse(() =>
            {
                if (--CurSelected < 0)
                    CurSelected = 8;
                BlockPressed(CurSelected);
            }, MouseButton.Scrolldown);

            InputManager.BindKey(() =>
            {
                if(!blocking && InterfaceManager.blocking) return;
                blocking = !blocking;
                ExpandedView.Active = blocking;
            }, Keys.C);
        }