Example #1
0
        public void Initialize()
        {
            TextBox IP = new TextBox(MainCanvas.Instance);
            IP.Text = "127.0.0.1";
            IP.SetPosition(10, 10);

            NumericUpDown Port = new NumericUpDown(MainCanvas.Instance);
            Port.Max = ushort.MaxValue;
            Port.Min = 0;
            Port.Value = 54987;
            Port.SetPosition(10, 40);

            Button Connect = new Button(MainCanvas.Instance);
            Connect.Text = "Connect";
            Connect.SetPosition(10, 70);
            Connect.Clicked += delegate(Base sender, ClickedEventArgs args) {
                NetPeerConfiguration config = new NetPeerConfiguration("Xanatos");
                Program.Connection = new NetClient(config);
                Program.Connection.Start();
                Program.Connection.Connect(IP.Text, (int)Port.Value);

                while (((NetClient)Program.Connection).ConnectionStatus != NetConnectionStatus.Connected) {
                    Thread.Sleep(500);
                    Program.Connection.ReadMessages(new List<NetIncomingMessage>());
                }
                Message.RegisterClient(Program.Connection);

                new PlayerJoining().Send();
            };
        }
Example #2
0
        Base ConstructFindGame()
        {
            Base FindGame = new Base(MainCanvas.GetCanvas());
            FindGame.SetSize(300, 300);

            Label EnterIP = new Label(FindGame);
            EnterIP.AutoSizeToContents = true;
            EnterIP.SetText("Enter an IP:");
            EnterIP.SetPosition(10, 10);

            TextBox IPAddress = new TextBox(FindGame);
            IPAddress.SetText("127.0.0.1");
            IPAddress.SetPosition(10, 40);
            IPAddress.SetSize(260, 20);

            TextBox Port = new TextBox(FindGame);
            Port.SetText("54987");
            Port.SetPosition(10, 70);
            Port.SetSize(260, 20);

            Button Connect = new Button(FindGame);
            Connect.SetText("Connect");
            Connect.SetPosition(10, 200);
            Connect.SetSize(200, 20);
            Connect.Clicked += delegate(Base sender, ClickedEventArgs args) {
                Program.Connect(IPAddress.Text, Int32.Parse(Port.Text));
                MainMenu.Hide();
                FindGame.Hide();

                Connecting.Show();
            };

            Button Back = new Button(FindGame);
            Back.SetText("Back");
            Back.SetPosition(10, 225);
            Back.SetSize(200, 20);
            Back.Clicked += delegate(Base sender, ClickedEventArgs args) {
                Mode = MenuMode.MainMenu;
                MainMenu.Show();
                FindGame.Hide();
            };

            return FindGame;
        }
Example #3
0
        public PackageEditor(Package package)
            : base(DevelopmentMenu.Instance)
        {
            this.Resource = package;
            this.SetPosition((int)MouseManager.GetMousePositionWindows().X, (int)MouseManager.GetMousePositionWindows().Y);

            Label lblName = new Label(this);
            lblName.AutoSizeToContents = true;
            lblName.Text = "Name";
            lblName.SetPosition(10, 10);

            TextBox tbName = new TextBox(this);
            tbName.SetPosition(50, 10);
            tbName.SetSize(150, 20);
            tbName.Text = Resource.Name;
            tbName.TextChanged += tbName_TextChanged;

            this.SetSize(220, 80);
        }
Example #4
0
        public ResourceNode(Base parent, Resource res)
            : base(parent)
        {
            this.Resource = res;

            this.Text = res.Name;
            this.m_Title.Font = new Gwen.Font(MainCanvas.Renderer, "Arial");

            tbRename = new TextBox(m_Title);
            tbRename.SetPosition(16, 0);
            tbRename.Height = 16;
            tbRename.AutoSizeToContents = true;
            tbRename.Hide();

            tbRename.BoundsChanged += new GwenEventHandler<EventArgs>(tbRename_BoundsChanged);

            tbRename.SubmitPressed += delegate(Base sender, EventArgs args) { EndRename(); };
            //this.Unselected += delegate(Base sender, EventArgs args) { EndRename(); };
        }