Exemplo n.º 1
0
        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";
        }
Exemplo n.º 2
0
        public ChatInterface()
        {
            base.initialize(10000);
            MainView = new View(GeeUI.GeeUI.RootView) { Width = 290, Height = 200, X = 10, Y = 500 - 240 };
            ChatEntryField = new TextFieldView(MainView, new Vector2(0, 180), AssetManager.GetFont("Console")) { Width = 290, Height = 20, MultiLine = false, AutoWrap = false};
            ChatLogField = new TextFieldView(MainView, new Vector2(0, 95), AssetManager.GetFont("Console"))
                               {Width = 290, Height = 75, Editable = false, MultiLine = true};
            ChatEntryField.OnEnterPressed += (sender, e) =>
                                                 {
                                                     string text = ChatEntryField.Text;
                                                     ChatEntryField.ClearText();
                                                     HideChatEntry();

                                                     if (text == "") return;
                                                     Packet1CSGameEvent pack = new Packet1CSGameEvent(GameServer.GameEvents.Player_Chat, false, text);
                                                     Main.clientNetworkManager.SendPacket(pack);

                                                 };
            HideChatEntry();
        }
Exemplo n.º 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();
                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;
            }));
        }
Exemplo n.º 4
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;
			}));
		}
Exemplo n.º 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;
        }
Exemplo n.º 6
0
 public override void destroy()
 {
     HostGameButton = null;
     JoinGameButton = null;
     PlayerNameTextField = null;
     ServerIPTextField = null;
     ServerPortTextField = null;
     AnimationEditorButton = null;
     GeeUI.GeeUI.RootView.RemoveChild(MainView);
     base.destroy();
 }