Пример #1
0
        private NewEraWindow(Manager manager, Era era)
            : base(manager)
        {
            Init();

            Width = 950;
            Height = 550;

            _lblEraImage = new ImageBox(manager);
            _lblEraImage.Init();
            _lblEraImage.Left = 4;
            _lblEraImage.Top = 10;          
            _lblEraImage.Width = 924;
            _lblEraImage.Height = 472;
            _lblEraImage.Image = era.Image;
            Add(_lblEraImage);

            _lblDescription = new Label(manager);
            _lblDescription.Init();
            _lblDescription.Left = 4;
            _lblDescription.Top = 482;
            _lblDescription.Width = 924;
            _lblDescription.Height = 16;
            _lblDescription.Text = string.Format(Strings.TXT_KEY_UI_NEWERA_WELCOME, era.Title);
            Add(_lblDescription);

            Manager.Add(this);
        }
Пример #2
0
        public virtual void CreatePlayerInfo(Manager manager, Player player, Control control, ref int yPos)
        {
            var playerAvatar = player.Avatar;

            var imageIcon = new Button(manager) {
                Glyph = new Glyph(playerAvatar),
                Height = (int)(playerAvatar.Height / 1.5),
                Width = (int)(playerAvatar.Width / 1.5),
                Left = 16,
                Top = 16,
                Parent = control,
                Color = player.PlayerColor,
                Name = IgnoreString
            };
            imageIcon.Init();
            imageIcon.FocusGained += (sender, args) => imageIcon.Enabled = false;

            var descriptionText = new Label(manager) {
                Left = imageIcon.Left + imageIcon.Width + 16, Width = 200,
                Height = imageIcon.Height,
                Top = 25,
                Text = String.Format(
                    "Player Name : {0}\n\n" +
                    "Player Cash : ${1:N0}\n\n" +
                    "Player Total Worth : ${2:N0}\n\n" +
                    "Player Position : {3:N0}\n\n",
                    player.Name, player.Cash, player.TotalValue, PlayerPos(player)),
                Alignment = Alignment.TopLeft,
                Parent = control,
                Name = IgnoreString
            };
            descriptionText.Init();

            yPos = imageIcon.Top + imageIcon.Height + 16;
        }
        public AddComponentView(Sidebar sidebar, Control parent, int Left, int Top, int Height)
            : base(sidebar, parent, Left, Top, false)
        {
            this.Height = Height;
            base.Initialize();
            ItemCreator = Creator;
            ColorChangeOnSelect = false;
            Width = parent.Width - 15;
            sidebar.ui.detailedViews.Remove(this);

            lblCompName = new Label(manager);
            lblCompName.Init();
            lblCompName.Parent = parent;
            lblCompName.Width = 400;
            //lblCompName.Height = 250;
            lblCompName.Top = backPanel.Height + Top;
            lblCompName.Left = 10;
            lblCompName.Text = "";
            lblCompName.TextColor = UserInterface.TomShanePuke;

            lblDescription = new Label(manager);
            lblDescription.Init();
            lblDescription.Parent = parent;
            lblDescription.Width = 400;
            lblDescription.Top = lblCompName.Top + lblCompName.Height;//backPanel.Height + Top + 10;
            lblDescription.Left = 10;
            lblDescription.Height = 70;
            lblDescription.Text = "l";
        }
Пример #4
0
        public override int AddInformation(Manager manager, Player player, Control control, int yPos)
        {
            var currentHouse = player.House;
            const int spacing = 20;
            int xPos = spacing;
            if (currentHouse == null) {
                var noHouseLabel = new Label(manager) { Text = "You have no house to sell!", Width = 400, Left = xPos, Top = yPos, Name = IgnoreString };
                noHouseLabel.Init();
                control.Add(noHouseLabel);
            } else {
                var houseGraphic = manager.Game.Content.Load<Texture2D>(currentHouse.HouseGraphic);
                yPos += 20;
                // Put the house graphic into an image box
                var imageBox = new ImageBox(manager) {
                    Left = 16,
                    Top = yPos,
                    Image = houseGraphic,
                    Color = Color.White,
                    Width = houseGraphic.Width,
                    Height = houseGraphic.Height,
                    Name = IgnoreString,
                    Parent = control
                };
                imageBox.Init();

                var descriptionText = new Label(manager) {
                    Text =
                        String.Format(
                            "Name : {0}\n\n" +
                            "Average Value: ${1:N0}\n\n" +
                            "Current Value: ${2:N0}\n\n" +
                            "Bought for : ${3:N0}\n\n" +
                            "Total profit :: ${4:N0}",
                            currentHouse.Name, currentHouse.InitialValue, currentHouse.Value, currentHouse.PlayerBuyingValue, currentHouse.PlayerBuyingValue - currentHouse.Value),
                    Top = yPos,
                    Left = imageBox.Width + 60,
                    Height = 130,
                    Width = 200,
                    Parent = control,
                    Name = IgnoreString
                };
                yPos += imageBox.Height + 20;
                var sellHouseButton = new Button(manager) {
                    Text =
                        "Sell House",
                    Width = 400, Left = xPos, Top = yPos,
                    Name = IgnoreString
                };
                sellHouseButton.Click += (sender, args) => {
                    _houseCallback(player, currentHouse);
                    PopulateTab(manager, player, control);
                };
                sellHouseButton.Init();
                control.Add(sellHouseButton);
            }
            return yPos;
        }
Пример #5
0
 public TowerBaseInfoWindow(Manager manager)
     : base(manager)
 {
     lblInterval = new Label(manager);
     lblDamage = new Label(manager);
     lblDescription = new RappingLabel(manager);
     lblRange = new Label(manager);
     lblPrice = new Label(manager);
     manager.Add(this);
 }
Пример #6
0
 public GameOverWindow(Manager manager, GamePlayScreen screen)
     : base(manager)
 {
     GamePlayScreen = screen;
     LostMessage = new RappingLabel(manager);
     Points = new Label(manager);
     RestartGame = new Button(manager);
     GoMainMenu = new Button(manager);
     ExitGame = new Button(manager);
     manager.Add(this);
 }
Пример #7
0
        private void CreateMessage(Manager manager, GameInfo gameInfo, IGameState waitState)
        {
            var currentPlayer = gameInfo.CurrentPlayer;

            var messageWindow = new Window(manager) { Text = "Pay Day!", AutoScroll = false, CloseButtonVisible = false};
            messageWindow.Init();
            messageWindow.SetSize(400, 230);
            var message = new Label(manager) { Text = "Well Done! you have received your Pay Day! \nBelow are the details.", Width = 400, Height = 40, Left = 5, Top = 10 };
            message.Init();
            message.Parent = messageWindow;
            var careerImage = gameInfo.Content.Load<Texture2D>("Images/career_icons/" +
                                                               gameInfo.CurrentPlayer.CurrentCareer);
            var career = new ImageBox(manager) {
                Image = careerImage,
                Width = careerImage.Width,
                Height = careerImage.Height,
                Top = 50,
                Left = 16,
                StayOnBack = true
            };
            career.Init();
            career.Parent = messageWindow;

            var icon = new ImageBox(manager) {
                Image =
                    gameInfo.Content.Load<Texture2D>("Images/payday"),
                Top = 60,
                Left = career.Left + career.Width + 70
            };
            icon.Init();
            icon.Parent = messageWindow;

            var job = new Label(manager) { Text = "Current Career:\n" + currentPlayer.CurrentCareer.Title, Top = 110, Left = 10, Width = 150, Height = 50 };
            job.Init();
            job.Parent = messageWindow;

            var salary = new Label(manager) {
                Text = String.Format("Level {1} Promotion\nReceived: ${0:N0}",
                currentPlayer.CurrentCareer.Salary[currentPlayer.PromotionLevel],
                currentPlayer.PromotionLevel + 1),
                Top = 110, Left = 140, Width = 140, Height = 50
            };
            salary.Init();
            salary.Parent = messageWindow;

            var close = new Button(manager) { Text = "OK", Top = 160, Left = messageWindow.Width / 2 - 50 };
            close.Init();
            close.Parent = messageWindow;
            close.Click += (sender, args) => { messageWindow.Close(); WindowClosed(gameInfo, waitState); };
            messageWindow.Closed += (sender, args) => WindowClosed(gameInfo, waitState);
            gameInfo.Manager.Add(messageWindow);
            messageWindow.Init();
            gameInfo.Content.Load<SoundEffect>("Sounds/coins").Play();
        }
        public GamemodeWindow(Sidebar sidebar)
        {
            this.manager = sidebar.manager;
            this.sidebar = sidebar;

            window = new Window(manager);
            window.Init();
            window.Left = sidebar.master.Left;
            window.Width = sidebar.master.Width;
            window.Top = 0;
            window.Height = 600;
            window.Text = "Game Mode";
            manager.Add(window);

            TitlePanel titlePanel = new TitlePanel(sidebar, window, "Game Mode", true);
            titlePanel.btnBack.Click += (s, e) => window.Close();

            HeightCounter += titlePanel.topPanel.Height + LeftPadding * 2;

            lblMode = new Label(manager);
            lblMode.Init();
            lblMode.Parent = window;
            lblMode.Top = HeightCounter;
            lblMode.Left = LeftPadding;
            lblMode.Text = "Game Mode Options";
            lblMode.Width = 120;
            lblMode.TextColor = Color.Black;

            //cbMode = new ComboBox(manager);
            //cbMode.Init();
            //cbMode.Parent = window;
            //cbMode.Left = lblMode.Left + lblMode.Width;
            //cbMode.Top = HeightCounter;
            //cbMode.Width = 100;
            //
            //foreach (GameModes m in Enum.GetValues(typeof(GameModes)))
            //{
            //    cbMode.Items.Add(m);
            //}
            HeightCounter += lblMode.Height + LeftPadding * 3;

            insViewModes = new InspectorView(sidebar, window, LeftPadding, HeightCounter);
            insViewModes.Width -= 20;
            insViewModes.Height -= 100;
            HeightCounter += insViewModes.Height + LeftPadding * 3;
            insViewModes.SetRootObject(OrbIt.globalGameMode);

            //insViewGlobal = new InspectorView(sidebar, window, LeftPadding, HeightCounter);
            //insViewGlobal.Width -= 20;
            //insViewGlobal.Height -= 100;

            window.Refresh();
        }
Пример #9
0
        /// <summary>
        /// Shows the simple input dialog.
        /// </summary>
        public void ShowSimpleInputDialog(Manager manager, string caption, string text, string initialValue,
            TomShane.Neoforce.Controls.EventHandler okBtnEventHandler)
        {
            window = new Window(manager);
            window.Init();
            window.Width = 450;
            window.Height = 150;
            window.Text = caption;
            window.Closing += OnSimpleInputDialogClosing;
            window.Visible = true;

            Label label = new Label(manager);
            label.Init();
            label.Text = text;
            label.Width = 400;
            label.Height = 20;
            label.Left = 5;
            label.Top = 5;
            label.Parent = window;

            TextBox textBox = new TextBox(manager);
            textBox.Init();
            textBox.Width = 400;
            textBox.Height = 20;
            textBox.Left = 5;
            textBox.Top = 40;
            textBox.Text = initialValue;
            textBox.Parent = window;

            Button btnSimpleInputDialogOk = new Button(manager);
            btnSimpleInputDialogOk.Init();
            btnSimpleInputDialogOk.Text = "Ok";
            btnSimpleInputDialogOk.Width = 100;
            btnSimpleInputDialogOk.Height = 30;
            btnSimpleInputDialogOk.Left = 5;
            btnSimpleInputDialogOk.Top = 75;
            btnSimpleInputDialogOk.Click += okBtnEventHandler;
            btnSimpleInputDialogOk.Click += OnClickBtnSimpleInputDialogOk;
            btnSimpleInputDialogOk.Tag = textBox; // Textbox as Tag, to access the value
            btnSimpleInputDialogOk.Parent = window;

            Button btnSimpleInputDialogCancel = new Button(manager);
            btnSimpleInputDialogCancel.Init();
            btnSimpleInputDialogCancel.Text = "Cancel";
            btnSimpleInputDialogCancel.Width = 100;
            btnSimpleInputDialogCancel.Height = 30;
            btnSimpleInputDialogCancel.Left = 110;
            btnSimpleInputDialogCancel.Top = 75;
            btnSimpleInputDialogCancel.Click += OnClickBtnSimpleInputDialogCancel;
            btnSimpleInputDialogCancel.Parent = window;

            manager.Add(window);
        }
Пример #10
0
        //Class Constructor
        public StatePause(bool editor)
            : base(StateID.Pause)
        {
            //Draw cursor
            m_VisibleCursor = true;
            m_PopUp = true;
            m_Editor = editor;

            //Nulling value
            m_Help = null;
            m_PauseButtons = null;
        }
Пример #11
0
        public CreateWorldDialog(Manager manager, LobbyWindow parent)
            : base(manager)
        {
            roomList = parent;
            //Setup the window
            Text = "Create World";
            TopPanel.Visible = false;
            Resizable = false;
            Width = 250;
            Height = 190;
            Center();

            //Add controls
            lblName = new Label(manager) { Left = 8, Top = 8, Text = "Name:", Width = this.ClientWidth - 16 };
            lblName.Init();
            Add(lblName);

            txtName = new TextBox(manager) { Left = 8, Top = lblName.Bottom + 4, Width = this.ClientWidth - 16 };
            txtName.Init();
            txtName.TextChanged += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                if (txtName.Text.Length > Bricklayer.Common.Networking.Messages.CreateRoomMessage.MaxNameLength)
                    txtName.Text = txtName.Text.Truncate(Bricklayer.Common.Networking.Messages.CreateRoomMessage.MaxNameLength);
            });
            Add(txtName);

            lblDescription = new Label(manager) { Left = 8, Top = txtName.Bottom + 4, Text = "Description:", Width = this.ClientWidth - 16 };
            lblDescription.Init();
            Add(lblDescription);

            txtDescription = new TextBox(manager) { Left = 8, Top = lblDescription.Bottom + 4, Width = this.ClientWidth - 16, Height = 34, Mode = TextBoxMode.Multiline, ScrollBars = ScrollBars.None };
            txtDescription.Init();
            txtDescription.TextChanged += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                //Filter the text by checking for length and lines
                if (txtDescription.Text.Length > Bricklayer.Common.Networking.Messages.CreateRoomMessage.MaxDescriptionLength)
                    txtDescription.Text = txtDescription.Text.Truncate(Bricklayer.Common.Networking.Messages.CreateRoomMessage.MaxDescriptionLength);
                int newLines = txtDescription.Text.Count(c => c == '\n');
                if (newLines >= Bricklayer.Common.Networking.Messages.CreateRoomMessage.MaxDescriptionLines)
                {
                    txtDescription.Text = txtDescription.Text.Substring(0, txtDescription.Text.Length - 1);
                    txtDescription.CursorPosition = 0;
                }
            });
            Add(txtDescription);

            createBtn = new Button(manager) { Top = 8, Text = "Create" };
            createBtn.Init();
            createBtn.Left = (Width / 2) - (createBtn.Width / 2);
            createBtn.Click += CreateBtn_Click;
            BottomPanel.Add(createBtn);
        }
Пример #12
0
        public override void Add(ScreenManager screenManager)
        {
            Game.CurrentGameState = GameState.Login;
            base.Add(screenManager);
            (Manager.Game as Application).BackgroundImage = ContentPack.Textures["gui\\background"];

            //Add the logo image
            LogoImage = new ImageBox(Manager) { Image = ContentPack.Textures["gui\\logosmall"], SizeMode = SizeMode.Centered };
            LogoImage.SetSize(LogoImage.Image.Width, LogoImage.Image.Height);
            LogoImage.SetPosition((Window.Width / 2) - (LogoImage.Width / 2), 0);
            LogoImage.Init();
            Window.Add(LogoImage);

            //Add github contribute link
            GithubIcon = new ImageBox(Manager) { Image = ContentPack.Textures["gui\\github"], SizeMode = SizeMode.Auto, };
            GithubIcon.ToolTip.Text = "We love open source! Contribute to Bricklayer at our GitHub repo.";
            GithubIcon.SetSize(GithubIcon.Width, GithubIcon.Height);
            GithubIcon.SetPosition(Window.Width - GithubIcon.Width - 8, Window.Height - GithubIcon.Height - 8);
            GithubIcon.Init();
            GithubIcon.Color = Color.White * .6f;
            //Click/Hover events
            GithubIcon.MouseOut += new MouseEventHandler(delegate(object o, MouseEventArgs e)
            {
                GithubIcon.Color = Color.White * .6f;
            });
            GithubIcon.MouseOver += new MouseEventHandler(delegate(object o, MouseEventArgs e)
            {
                GithubIcon.Color = Color.White;
            });
            GithubIcon.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                if (Manager.Game.IsActive) Process.Start(githubLink); //Open the link in a browser
            });
            Window.Add(GithubIcon);

            //Add version tag
            Version = new Label(Manager) { Font = FontSize.Default14 };
            Version.SetSize(200, 16);
            Version.SetPosition(8, Window.Height - Version.Height - 8);
            Version.Init();
            Version.Text = AssemblyVersionName.GetVersion();
            Window.Add(Version);

            //Add the login window
            Login = new ServerWindow(Manager);
            Login.Init();
            if (Login.Top - 24 < LogoImage.Height + LogoImage.Top) //If it is too close to logo, move it down a bit
                Login.Top = LogoImage.Height + LogoImage.Top - 24;
            Window.Add(Login);
            Login.Show();
        }
Пример #13
0
        public override int AddInformation(Manager manager, Player player, Control control, int yPos)
        {
            const int spacing = 16;

            var title = new ImageBox(manager)
                            {
                                Image = manager.Game.Content.Load<Texture2D>("images/assetstitle"),
                                Top = yPos,
                                Left = 150,
                                Parent = control,
                                Width = 150,
                                Name = IgnoreString
                            };
            title.Init();
            yPos += title.Height/2;

            foreach (var assetList in player.Assets)
            {
                foreach (var asset in assetList.Value)
                {
                    var assetName = new Label(manager)
                    {
                        Text = String.Format("Type: {0}   Value: ${1:N0}",
                                             asset.Name, asset.Value),
                        Top = yPos+spacing,
                        Width = 400,
                        Left = 120,
                        Parent = control,
                       Name = IgnoreString
                    };

                    var texture = manager.Game.Content.Load<Texture2D>(asset.AssetPath);
                    var imageBox = new ImageBox(manager)
                    {
                        Image = texture,
                        Parent = control,
                        Left = 40,
                        Top = yPos,
                       Name = IgnoreString,
                       Color = Color.White
                    };

                    assetName.Init();
                    yPos += imageBox.Height + spacing;
                }
            }

            return yPos + 30;
        }
Пример #14
0
        //Class Constructor
        public StateInitEditor()
            : base(StateID.InitEditor)
        {
            //Draw cursor
            m_VisibleCursor = true;
            m_PopUp = true;

            //Set Values
            HeightIndex = 1;
            WidthIndex = 0;

            //Nulling value
            m_Label = null;
            m_Buttons = null;
        }
Пример #15
0
        public override void Add(ScreenManager screenManager)
        {
            base.Add(screenManager);
            Window.Focused = true;
            Bar = new StatusBar(Manager) { Top = Window.Height - 24, Width = Window.Width };
            Bar.Init();
            Window.Add(Bar);
            StatsLabel = new Label(Manager) { Top = 4, Left = 8, Width = Window.Width - 16, Text = "" };
            StatsLabel.Init();
            Bar.Add(StatsLabel);

            LeaveButton = new Button(Manager) { Right = Bar.ClientWidth - 4, Top = 4, Height = 16, Text = "Lobby" };
            LeaveButton.Init();
            LeaveButton.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                ScreenManager.SwitchScreen(new LobbyScreen());
            });
            Bar.Add(LeaveButton);

            Sidebar = new StatusBar(Manager);
            Sidebar.Init();
            Sidebar.SetSize(SidebarWidth, (int)((Window.Height - Bar.Height)));
            Sidebar.SetPosition(Window.Width - Sidebar.Width, 0);
            Window.Add(Sidebar);

            PlayerList = new ListBox(Manager);
            PlayerList.Init();
            PlayerList.SetSize(SidebarWidth, (int)((Window.Height - Bar.Height - 4) * .25f));
            PlayerList.SetPosition(1, 2);
            Sidebar.Add(PlayerList);

            ChatBox = new Console(Manager);
            Manager.Add(ChatBox);
            ChatBox.Init();
            ChatBox.SetSize(PlayerList.Width, (int)((Window.Height - Bar.Height - 4) * .75f));
            ChatBox.SetPosition(Sidebar.Left + 1, PlayerList.Bottom + 1);
            ChatBox.ChannelsVisible = false;
            ChatBox.MessageSent += new ConsoleMessageEventHandler(SentChat);
            ChatBox.Channels.Add(new ConsoleChannel(0, "Global", Color.White));
            // Select default channel
            ChatBox.SelectedChannel = 0;
            // Do we want to add timestamp or channel name at the start of every message?
            ChatBox.MessageFormat = ConsoleMessageFormats.None;
            ChatBox.TextBox.TextChanged += TextBox_TextChanged;

            //Hide them until we recieve the Init packet
            ChatBox.Visible = PlayerList.Visible = Sidebar.Visible = false;
        }
Пример #16
0
        public AddServerDialog(Manager manager, ServerWindow parent, int index, bool edit, string name, string address)
            : base(manager)
        {
            //Are we editing a server or adding one (They use same dialog)
            Edit = edit;
            Index = index;
            ServerList = parent;
            //Setup the window
            Text = Edit ? "Edit Server" : "Add Server";
            TopPanel.Visible = false;
            Resizable = false;
            Width = 250;
            Height = 180;
            Center();

            //Add controls
            NameLbl = new Label(manager) { Left = 8, Top = 8, Text = "Name:", Width = this.ClientWidth - 16 };
            NameLbl.Init();
            Add(NameLbl);

            NameTxt = new TextBox(manager) { Left = 8, Top = NameLbl.Bottom + 4, Width = this.ClientWidth - 16 };
            NameTxt.Init();
            NameTxt.Text = name;
            NameTxt.TextChanged += NameTxt_TextChanged;
            Add(NameTxt);

            AddressLbl = new Label(manager) { Left = 8, Top = NameTxt.Bottom + 8,
                Text = string.Format("Address: (Default port is {0})", Bricklayer.Common.GlobalSettings.DefaultPort),
                Width = this.ClientWidth - 16 };
            AddressLbl.Init();
            Add(AddressLbl);

            AddressTxt = new TextBox(manager) { Left = 8, Top = AddressLbl.Bottom + 4, Width = this.ClientWidth - 16 };
            AddressTxt.Init();
            AddressTxt.Text = address;
            AddressTxt.TextChanged += AddressTxt_TextChanged;
            Add(AddressTxt);

            SaveBtn = new Button(manager) { Top = 8, Text = Edit ? "Save" : "Add", };
            SaveBtn.Init();
            SaveBtn.Left = (Width / 2) - (SaveBtn.Width / 2);
            SaveBtn.Click += SaveBtn_Click;
            SaveBtn.Enabled = false;
            BottomPanel.Add(SaveBtn);

            if (Edit)
                Validate(); //Validate existing text
        }
Пример #17
0
        void AddCreepsButton_Click(object sender, EventArgs e)
        {
            try {
                int    health  = Convert.ToInt32(_healthOfCreeps.Text);
                int    speed   = Convert.ToInt32(_speedOfCreeps.Text);
                int    number  = Convert.ToInt32(_numberOfCreeps.Text);
                string texture = _creepTexture.Text.Substring(0, 3).ToLower();
                for (int i = 0; i < number; i++)
                {
                    _currentCreepList.Add(new Creep(health, speed, texture));
                }
                UpdateCreepBox();
            } catch (Exception) {
                _isEditorActive = false;
                var msg = new Window(_manager);
                msg.Init();
                msg.Text    = "Fehler";
                msg.Visible = true;
                msg.Width   = 255;
                msg.Height  = 100;
                msg.Center();
                msg.Closed += delegate { _isEditorActive = true; };
                var lbl = new Label(_manager);
                lbl.Init();
                lbl.Text   = "Bitte verwenden Sie korrekte Eingaben!";
                lbl.Parent = msg;
                lbl.Width  = 230;
                lbl.Left   = 5;
                lbl.Top    = 5;

                var close = new Button(_manager);
                close.Init();
                close.Text   = "Schließen";
                close.Width  = 100;
                close.Parent = msg;
                close.Left   = (msg.ClientWidth / 2) - (close.Width / 2);
                close.Top    = msg.ClientHeight - close.Height - 8;
                close.Anchor = Anchors.Bottom;
                close.Click += delegate { msg.Close(); };

                _manager.Add(msg);
            }
        }
        public PlayerView(Sidebar sidebar, Control parent, int Left, int Top)
            : base(sidebar, parent, Left, Top, false)
        {
            playerGroup = sidebar.room.groups.player;

            btnEditAllPlayers = new Button(manager);
            btnEditAllPlayers.Init();
            btnEditAllPlayers.Parent = parent;
            btnEditAllPlayers.Text = "Edit All Players";
            btnEditAllPlayers.Width = 150;
            btnEditAllPlayers.Left = parent.Width / 2 - btnEditAllPlayers.Width / 2;
            btnEditAllPlayers.Top = Top + VertPadding * 2;
            HeightCounter +=  btnEditAllPlayers.Height * 2;
            btnEditAllPlayers.Click += (s, e) =>
            {
                editGroupWindow = new EditNodeWindow(sidebar, "All Players", room.groups.player.Name, ViewType.Group);
                editGroupWindow.componentView.SwitchGroup(room.groups.player);
                //editGroupWindow.componentView.SwitchNode(n, false);

            };

            lblPlayers = new Label(manager);
            lblPlayers.Init();
            lblPlayers.Parent = parent;
            lblPlayers.Text = "Players";
            lblPlayers.Width = 150;
            lblPlayers.Left = LeftPadding;
            lblPlayers.TextColor = Color.Black;
            lblPlayers.Top = HeightCounter;
            HeightCounter += lblPlayers.Height + VertPadding;
            Width = parent.Width - LeftPadding * 4;

            base.Initialize();

            insView = new InspectorView(sidebar, parent, Left, HeightCounter);
            insView.GroupSync = true;
            insView.Height = 120;
            insView.Width = Width;
            this.ItemCreator += ItemCreatorDelegate;

            InitializePlayers();
        }
Пример #19
0
        public LobbyDataControl(Manager manager, LobbySaveData data)
            : base(manager)
        {
            //Setup
            Passive = false;
            Height = 60;
            ClientWidth = (700 / 2) - 16;
            Data = data;

            //Background "gradient" image
            //TODO: Make an actual control. not a statusbar
            Gradient = new StatusBar(manager);
            Gradient.Init();
            Gradient.Alpha = .8f;
            Add(Gradient);

            for (int i = 0; i < 5; i++)
            {
                imgRating[i] = new ImageBox(Manager) { Top = 4, Width = 16, Height = 16, Left = ClientWidth - (((4 - i) * 18) + 48) };
                imgRating[i].Init();
                bool half = data.Rating > i + .25 && data.Rating < i + .75;
                bool whole = data.Rating >= i + .75;
                imgRating[i].Image = whole ? ContentPack.Textures["gui\\icons\\full_star"] : half ? ContentPack.Textures["gui\\icons\\half_star"] : ContentPack.Textures["gui\\icons\\empty_star"];
                Add(imgRating[i]);
            }

            lblStats = new Label(Manager) { Width = 100, Left = ClientWidth - 100 - 16, Top = imgRating[0].Bottom + 4, Alignment = Alignment.TopLeft, TextColor = new Color(160,160,160) };
            lblStats.Init();
            lblStats.Text = string.Format("Online: {0}\nPlays: {1}", data.Online, "N/A" /*data.Plays*/);
            Add(lblStats);

            //Add controls
            lblName = new Label(Manager) { Width = 100, Text = data.Name, Left = 4, Top = 4, Font = FontSize.Default14, Alignment = Alignment.TopLeft };
            lblName.Init();
            Add(lblName);
            lblName.Text = data.Name;

            lblDescription = new Label(Manager) { Width = 200, Text = data.Name, Left = 4, Top = lblName.Bottom + 4, Alignment = Alignment.TopLeft };
            lblDescription.Init();
            Add(lblDescription);
            lblDescription.Text = data.Description;
        }
Пример #20
0
        ////////////////////////////////////////////////////////////////////////////
        public void Init()
        {
            // Create and setup Window control.
            window = new Window(manager);
            window.Init();
            window.Text = "Please Wait";
            window.Width = 300;
            window.Height = 175;
            window.Center();
            window.Visible = true;
            window.CloseButtonVisible = false;

            text = new Label(manager);
            text.Init();
            text.Text = "";
            text.Width = 250;
            text.Height = 24;
            text.Left = 20;
            text.Top = 20;
            text.Anchor = Anchors.Left;
            text.Parent = window;

            bar = new ProgressBar(manager);
            bar.Init();
            bar.Width = 260;
            bar.Height = 15;
            bar.Left = 20;
            bar.Top = 60;
            bar.Anchor = Anchors.Left;
            bar.Parent = window;
            bar.Value = 0;
            bar.Mode = ProgressBarMode.Default;

            cancel = new Button(manager);
            cancel.Init();
            cancel.Left = window.Width - cancel.Width - 20;
            cancel.Top = 110;
            cancel.Text = "Cancel";
            cancel.Anchor = Anchors.Right;
            cancel.Parent = window;
        }
Пример #21
0
        public AddServerDialog(Manager manager, ServerWindow parent, int index, bool edit, string name, string address)
            : base(manager)
        {
            //Are we editing a server or adding one (They use same dialog)
            Edit = edit;
            Index = index;
            ServerList = parent;
            //Setup the window
            Text = Edit ? "Edit Server" : "Add Server";
            TopPanel.Visible = false;
            Resizable = false;
            Width = 250;
            Height = 180;
            Center();

            //Add controls
            NameLbl = new Label(manager) { Left = 8, Top = 8, Text = "Name:", Width = this.ClientWidth - 16 };
            NameLbl.Init();
            Add(NameLbl);

            NameTxt = new TextBox(manager) { Left = 8, Top = NameLbl.Bottom + 4, Width = this.ClientWidth - 16 };
            NameTxt.Init();
            NameTxt.Text = name;
            Add(NameTxt);

            AddressLbl = new Label(manager) { Left = 8, Top = NameTxt.Bottom + 8, Text = "Address: (Default port is 14242)", Width = this.ClientWidth - 16 };
            AddressLbl.Init();
            Add(AddressLbl);

            AddressTxt = new TextBox(manager) { Left = 8, Top = AddressLbl.Bottom + 4, Width = this.ClientWidth - 16 };
            AddressTxt.Init();
            AddressTxt.Text = address;
            Add(AddressTxt);

            SaveBtn = new Button(manager) { Top = 8, Text = Edit ? "Save" : "Add", };
            SaveBtn.Init();
            SaveBtn.Left = (Width / 2) - (SaveBtn.Width / 2);
            SaveBtn.Click += SaveBtn_Click;
            BottomPanel.Add(SaveBtn);
        }
Пример #22
0
        public ServerDataControl(Manager manager, ServerPinger pinger, ServerSaveData server)
            : base(manager)
        {
            //Setup
            Passive = false;
            Height = 76;
            ClientWidth = 450 - 16;
            Data = server;

            //Background "gradient" image
            //TODO: Make an actual control. not a statusbar
            Gradient = new StatusBar(manager);
            Gradient.Init();
            Gradient.Alpha = .8f;
            Add(Gradient);

            //Add controls
            Name = new Label(Manager) { Width = this.Width, Text = server.Name, Left = 4, Top = 4, Font = FontSize.Default14, Alignment = Alignment.TopLeft};
            Name.Init();
            Add(Name);

            Stats = new Label(Manager) { Width = this.Width, Text = string.Empty, Alignment = Alignment.TopLeft, Top = 4, Font = FontSize.Default14, };
            Stats.Init();
            Add(Stats);

            Motd = new Label(Manager) { Width = this.Width, Left = 4, Top = Name.Bottom + 8, Font = FontSize.Default8, Alignment = Alignment.TopLeft };
            Motd.Init();
            Motd.Text = "Querying server for data...";
            Motd.Height = (int)Manager.Skin.Fonts["Default8"].Height * 2;
            Add(Motd);

            Host = new Label(Manager) { Width = this.Width, Text = server.GetHostString(), Alignment = Alignment.TopLeft, Left = 4, Top = Motd.Bottom, TextColor = Color.LightGray };
            Host.Init();
            Add(Host);

            //Ping the server for stats on a seperate thread
            new Thread(() => PingServer(pinger)).Start();
        }
        public TitlePanel(Sidebar sidebar, Control parent, string Title, bool BackButton, int Top = 0, int Padding = 5)
        {
            this.Padding = Padding;
            topPanel = new Panel(sidebar.manager);
            topPanel.Init();
            topPanel.Parent = parent;
            topPanel.Left = Padding;
            topPanel.Top = Top + Padding;
            topPanel.Width = parent.Width - Padding * 3;
            if (parent is SideBar) topPanel.Width -= Padding * 1;
            int col = 30;
            topPanel.Color = new Color(col, col, col);
            topPanel.BevelBorder = BevelBorder.All;
            topPanel.BevelStyle = BevelStyle.Flat;
            topPanel.BevelColor = Color.Black;

            lblTitle = new Label(sidebar.manager);
            lblTitle.Init();
            lblTitle.Parent = topPanel;
            lblTitle.Top = Padding * 2;
            lblTitle.Width = 120;
            lblTitle.Left = parent.Width / 2 - lblTitle.Width / 4;
            //lblTitle.Text = Title;
            this.Title = Title;
            topPanel.Height = 24 + Padding * 3;

            if (!BackButton) return;
            btnBack = new Button(sidebar.manager);
            btnBack.Init();
            btnBack.Parent = topPanel;
            btnBack.Top = Padding;
            btnBack.Text = "Back";
            btnBack.Width = 40;
            btnBack.Left = Padding;
            //topPanel.Height = btnBack.Height + Padding * 3;
        }
Пример #24
0
		////////////////////////////////////////////////////////////////////////////

		////////////////////////////////////////////////////////////////////////////    
		private void InitStats()
		{
			pnlStats = new SideBarPanel(Manager);
			pnlStats.Init();
			pnlStats.Passive = true;
			pnlStats.Parent = sidebar;
			pnlStats.Left = 16;
			pnlStats.Width = sidebar.Width - pnlStats.Left;
			pnlStats.Height = 64;
			pnlStats.Top = ClientHeight - 16 - pnlStats.Height;
			pnlStats.Anchor = Anchors.Left | Anchors.Bottom;
			pnlStats.CanFocus = false;

			lblObjects = new Label(Manager);
			lblObjects.Init();
			lblObjects.Parent = pnlStats;
			lblObjects.Left = 8;
			lblObjects.Top = 8;
			lblObjects.Height = 16;
			lblObjects.Width = pnlStats.Width - lblObjects.Left * 2; ;
			lblObjects.Alignment = Alignment.MiddleLeft;

			lblAvgFps = new Label(Manager);
			lblAvgFps.Init();
			lblAvgFps.Parent = pnlStats;
			lblAvgFps.Left = 8;
			lblAvgFps.Top = 24;
			lblAvgFps.Height = 16;
			lblAvgFps.Width = pnlStats.Width - lblObjects.Left * 2;
			lblAvgFps.Alignment = Alignment.MiddleLeft;

			lblFps = new Label(Manager);
			lblFps.Init();
			lblFps.Parent = pnlStats;
			lblFps.Left = 8;
			lblFps.Top = 40;
			lblFps.Height = 16;
			lblFps.Width = pnlStats.Width - lblObjects.Left * 2;
			lblFps.Alignment = Alignment.MiddleLeft;
		}
        public OptionsWindow(Sidebar sidebar)
        {
            UserInterface.GameInputDisabled = true;
            this.manager = sidebar.manager;
            this.sidebar = sidebar;

            window = new Window(manager);
            window.Init();
            window.Left = sidebar.master.Left;
            window.Width = sidebar.master.Width;
            window.Top = 200;
            window.Height = 200;
            window.Width = 240;
            window.Text = "Options";
            window.Resizable = false;
            window.Movable = false;

            window.Closed += delegate { UserInterface.GameInputDisabled = false; };
            window.ShowModal();
            manager.Add(window);

            btnOk = new Button(manager);
            btnOk.Init();
            btnOk.Parent = window;
            btnOk.Left = LeftPadding;
            btnOk.Top = window.Height - (btnOk.Height * 3);
            btnOk.Text = "Ok";// +"\u2713";
            btnOk.Click += (s, e) => window.Close();

            //btnLoadLevel = new Button(manager);
            //btnLoadLevel.Init();
            //window.Add(btnLoadLevel);
            //btnLoadLevel.Width += 30;
            //btnLoadLevel.Left = window.Width - btnLoadLevel.Width - LeftPadding * 5;
            //btnLoadLevel.Text = "Load Level";
            //btnLoadLevel.Top = window.Height - (btnLoadLevel.Height * 3);
            //btnLoadLevel.Click += btnLoadLevel_Click;
            //
            //btnSaveLevel = new Button(manager);
            //btnSaveLevel.Init();
            //window.Add(btnSaveLevel);
            //btnSaveLevel.Width += 30;
            //btnSaveLevel.Left = window.Width - btnSaveLevel.Width - LeftPadding * 5;
            //btnSaveLevel.Text = "Save Level";
            //btnSaveLevel.Top = btnLoadLevel.Top - btnSaveLevel.Height - LeftPadding;
            //btnSaveLevel.Click += btnSaveLevel_Click;

            lblUserLevel = new Label(manager);
            lblUserLevel.Init();
            lblUserLevel.Parent = window;
            lblUserLevel.Left = LeftPadding;
            lblUserLevel.Top = HeightCounter;
            lblUserLevel.Text = "User Level";
            lblUserLevel.Width += 10;

            cbUserLevel = new ComboBox(manager);
            cbUserLevel.Init();
            cbUserLevel.Parent = window;
            cbUserLevel.Top = HeightCounter;
            cbUserLevel.Left = lblUserLevel.Width;
            cbUserLevel.Width = 150;
            HeightCounter += cbUserLevel.Height;
            cbUserLevel.TextColor = Color.Black;
            foreach(string ul in Enum.GetNames(typeof(UserLevel)))
            {
                cbUserLevel.Items.Add(ul);
            }
            cbUserLevel.ItemIndexChanged += (s, e) =>
            {
                sidebar.userLevel = (UserLevel)cbUserLevel.ItemIndex;

            };
            int count = 0;
            foreach(object s in cbUserLevel.Items)
            {
                if (s.ToString().Equals(sidebar.userLevel.ToString()))
                {
                    cbUserLevel.ItemIndex = count;
                }
                count++;
            }

            Label lblRes = new Label(manager);
            lblRes.Init();
            lblRes.Parent = window;
            lblRes.Left = LeftPadding;
            lblRes.Top = HeightCounter;
            lblRes.Text = "Resolution";
            lblRes.Width += 10;

            ComboBox cbResolutions = new ComboBox(manager);
            cbResolutions.Init();
            cbResolutions.Parent = window;
            cbResolutions.Top = HeightCounter;
            cbResolutions.Left = lblUserLevel.Width;
            cbResolutions.Width = 150;
            HeightCounter += cbResolutions.Height;
            cbUserLevel.TextColor = Color.Black;
            foreach (resolutions r in Enum.GetValues(typeof(resolutions)))
            {
                cbResolutions.Items.Add(r);
            }
            cbResolutions.ItemIndexChanged += (s, e) =>
            {
                OrbIt.game.setResolution((resolutions)cbResolutions.ItemIndex, OrbIt.game.Graphics.IsFullScreen);
                if (OrbIt.game.Graphics.IsFullScreen)
                    OrbIt.game.prefFullScreenResolution = (resolutions)cbResolutions.ItemIndex;
                else OrbIt.game.prefWindowedResolution = (resolutions)cbResolutions.ItemIndex;

            };

            CreateCheckBox("FullScreen", OrbIt.isFullScreen, (o, e) =>
            {
                if ((o as CheckBox).Checked) OrbIt.game.setResolution(resolutions.AutoFullScreen, true);
                else OrbIt.game.setResolution(resolutions.WXGA_1280x800, false);
            });
            CreateCheckBox("Hide Links", sidebar.ui.game.room.DrawLinks, (o, e) => sidebar.ui.game.room.DrawLinks = !(o as CheckBox).Checked);

            CreateCheckBox("Edit Selected Node", false, (o, e) => Utils.notImplementedException() );

            //CreateCheckBox("Edit Selected Node", sidebar.EditSelectedNode, (o, e) => sidebar.EditSelectedNode = (o as CheckBox).Checked);
        }
Пример #26
0
        public void Initialize()
        {
            manager.Initialize();

            #region /// Master ///
            master = new SideBar(manager);
            master.Init();
            master.Name = "Sidebar";
            master.Width = Width;
            master.Height = OrbIt.game.MainWindow.ClientArea.Height;
            master.Visible = true;
            master.Anchor = Anchors.Top | Anchors.Left | Anchors.Bottom;

            ui.game.MainWindow.Add(master);
            #endregion

            #region  /// tabcontrol ///
            tbcMain = new TabControl(manager);
            tbcMain.Init();
            //tbcMain.BackColor = Color.Transparent;
            //tbcMain.Color = Color.Transparent;
            tbcMain.Parent = master;
            tbcMain.Left = 0;
            tbcMain.Top = 0;
            tbcMain.Width = master.Width - 5;
            tbcMain.Height = master.Height - 40;
            tbcMain.Anchor = Anchors.All;
            activeTabControl = tbcMain;
            #endregion

            #region  /// Page1 ///

            tbcMain.AddPage();
            tbcMain.TabPages[0].Text = "First";
            TabPage first = tbcMain.TabPages[0];
            tbcMain.SelectedIndex = 0;

            #region  /// Title ///
            title1 = new Label(manager);
            title1.Init();
            title1.Parent = first;

            title1.Top = HeightCounter;
            title1.Text = "Node List";
            title1.Width = 130;
            title1.Left = first.Width / 2 - title1.Width / 2; //TODO : Center auto
            HeightCounter += VertPadding + title1.Height;
            title1.Anchor = Anchors.Left;
            #endregion

            #region  /// List Main ///
            lstMain = new ListBox(manager);
            lstMain.Init();
            lstMain.Parent = first;

            lstMain.Top = HeightCounter;
            lstMain.Left = LeftPadding;
            lstMain.Width = first.Width - LeftPadding * 2;
            lstMain.Height = first.Height / 5; HeightCounter += VertPadding + lstMain.Height;
            lstMain.Anchor = Anchors.Top | Anchors.Left | Anchors.Bottom;

            lstMain.HideSelection = false;
            lstMain.ItemIndexChanged += lstMain_ItemIndexChanged;
            lstMain.Click += lstMain_Click;
            lstMain.Refresh();
            //room.nodes.CollectionChanged += nodes_Sync;

            mainNodeContextMenu = new ContextMenu(manager);
            ConvertIntoList = new MenuItem("Make Default of new Group.");
            ConvertIntoList.Click += ConvertIntoList_Click;
            PromoteToDefault = new MenuItem("Make Default of current Group");
            PromoteToDefault.Click += PromoteToDefault_Click;
            mainNodeContextMenu.Items.Add(ConvertIntoList);
            lstMain.ContextMenu = mainNodeContextMenu;

            ui.SetScrollableControl(lstMain, lstMain_ChangeScrollPosition);
            #endregion

            #region  /// List Picker ///

            cbListPicker = new ComboBox(manager);
            cbListPicker.Init();
            cbListPicker.Parent = first;
            cbListPicker.MaxItems = 20;

            cbListPicker.Width = first.Width - LeftPadding * 6;
            cbListPicker.Left = LeftPadding;
            cbListPicker.Top = HeightCounter;
            cbListPicker.Items.Add("Other Objects");
            cbListPicker.ItemIndex = 0;
            //cbListPicker.
            cbListPicker.Click += cbListPicker_Click;
            cbListPicker.ItemIndexChanged += cbListPicker_ItemIndexChanged;

            #endregion

            #region /// Delete Group Button ///

            btnDeleteGroup = new Button(manager);
            btnDeleteGroup.Init();
            btnDeleteGroup.Parent = first;
            btnDeleteGroup.Left = LeftPadding + cbListPicker.Width + 5;
            btnDeleteGroup.Width = 15;
            btnDeleteGroup.Height = cbListPicker.Height;
            btnDeleteGroup.Top = HeightCounter; HeightCounter += VertPadding + cbListPicker.Height;
            btnDeleteGroup.Text = "X";
            btnDeleteGroup.Click += btnDeleteGroup_Click;

            #endregion

            #region  /// Remove Node Button ///
            btnRemoveNode = new Button(manager);
            btnRemoveNode.Init();
            btnRemoveNode.Parent = first;

            btnRemoveNode.Top = HeightCounter;
            btnRemoveNode.Width = first.Width / 2 - LeftPadding;
            btnRemoveNode.Height = 24;
            btnRemoveNode.Left = LeftPadding;

            btnRemoveNode.Text = "Remove Node";
            btnRemoveNode.Click += btnRemoveNode_Click;
            #endregion

            #region  /// Remove All Nodes Button ///
            btnRemoveAllNodes = new Button(manager);
            btnRemoveAllNodes.Init();
            btnRemoveAllNodes.Parent = first;

            btnRemoveAllNodes.Top = HeightCounter;
            //btnRemoveAllNodes.Width = first.Width / 2 - LeftPadding;
            btnRemoveAllNodes.Width = first.Width / 2 - LeftPadding;
            btnRemoveAllNodes.Height = 24; HeightCounter += VertPadding + btnRemoveAllNodes.Height;
            btnRemoveAllNodes.Left = LeftPadding + btnRemoveNode.Width;

            btnRemoveAllNodes.Text = "Remove All";
            btnRemoveAllNodes.Click += btnRemoveAllNodes_Click;
            #endregion

            #region  /// Add Componenet ///
            btnAddComponent = new Button(manager);
            btnAddComponent.Init();
            btnAddComponent.Parent = first;

            btnAddComponent.Top = HeightCounter;
            btnAddComponent.Width = first.Width / 2 - LeftPadding;
            btnAddComponent.Height = 20;
            btnAddComponent.Left = LeftPadding;

            btnAddComponent.Text = "Add Component";
            btnAddComponent.Click += btnAddComponent_Click;
            #endregion

            #region  /// Default Node ///
            btnDefaultNode = new Button(manager);
            btnDefaultNode.Init();
            btnDefaultNode.Parent = first;

            btnDefaultNode.Top = HeightCounter;
            btnDefaultNode.Width = first.Width / 2 - LeftPadding;
            btnDefaultNode.Height = 20; HeightCounter += VertPadding + btnDefaultNode.Height;
            btnDefaultNode.Left = LeftPadding + btnRemoveNode.Width;

            btnDefaultNode.Text = "Default Node";
            btnDefaultNode.Click += btnDefaultNode_Click;
            #endregion

            #region  /// Presets Dropdown ///
            cbPresets = new ComboBox(manager);
            cbPresets.Init();
            cbPresets.Parent = first;
            cbPresets.MaxItems = 20;
            cbPresets.Width = 160;
            cbPresets.Left = LeftPadding;
            cbPresets.Top = HeightCounter; HeightCounter += cbPresets.Height;
            Assets.NodePresets.CollectionChanged += NodePresets_Sync;
            cbPresets.ItemIndexChanged += cbPresets_ItemIndexChanged;
            cbPresets.Click += cmbPresets_Click;
            #endregion

            inspectorArea = new InspectorArea(this, first, LeftPadding, HeightCounter);

            HeightCounter += inspectorArea.Height;

            #region  /// Apply to Group ///
            btnApplyToAll = new Button(manager);
            btnApplyToAll.Init();
            btnApplyToAll.Parent = first;

            btnApplyToAll.Text = "Apply To Group";
            btnApplyToAll.Top = HeightCounter;
            btnApplyToAll.Width = first.Width / 2 - LeftPadding;
            btnApplyToAll.Height = 20; //HeightCounter += VertPadding + btnApplyToAll.Height;
            btnApplyToAll.Left = LeftPadding;
            btnApplyToAll.Click += applyToAllNodesMenuItem_Click;
            #endregion

            #region  /// Save as Preset ///
            btnSaveNode = new Button(manager);
            btnSaveNode.Init();
            btnSaveNode.Text = "Save Node";
            btnSaveNode.Top = HeightCounter;
            btnSaveNode.Width = first.Width / 2 - LeftPadding;
            btnSaveNode.Height = 20; HeightCounter += VertPadding + btnSaveNode.Height;
            btnSaveNode.Left = LeftPadding + btnApplyToAll.Width;
            btnSaveNode.Parent = first;
            btnSaveNode.Click += btnSaveNode_Click;
            #endregion

            #endregion

            #region  /// Page 2 ///
            tbcMain.AddPage();
            tbcMain.TabPages[1].Text = "Second";
            TabPage second = tbcMain.TabPages[1];
            HeightCounter = 0;

            #endregion

            inspectorArea.ResetInspectorBox(ActiveDefaultNode);

            InitializeSecondPage();
            InitializeThirdPage();
        }
        public void Initialize()
        {
            HeightCounter = 0;
            Width = parent.Width - LeftPadding * 2;

            #region /// GroupBox (back panel) ///
            backPanel = new Panel(manager);
            backPanel.Init();
            //backPanel.Left = Left;//change
            backPanel.Top = Top;
            backPanel.Width = Width;
            backPanel.Parent = parent;
            backPanel.Text = "";
            backPanel.Color = sidebar.master.BackColor;

            #endregion

            int WidthReduction = 15; //change

            #region  /// Inspector Address Label ///
            lblInspectorAddress = new Label(manager);
            lblInspectorAddress.Init();
            //lblInspectorAddress.Visible = false; //change
            lblInspectorAddress.Parent = backPanel;
            lblInspectorAddress.Top = HeightCounter; //HeightCounter += VertPadding + lblInspectorAddress.Height + 10;
            lblInspectorAddress.Width = Width - WidthReduction;
            lblInspectorAddress.Height = lblInspectorAddress.Height * 2; //HeightCounter += lblInspectorAddress.Height;
            labelDoubleHeight = lblInspectorAddress.Height;
            //lblInspectorAddress.Left = LeftPadding;
            //lblInspectorAddress.Anchor = Anchors.Left;
            lblInspectorAddress.Text = ">No Node Selected<";
            bool changed = false;
            lblInspectorAddress.TextChanged += delegate(object s, EventArgs e)
            {
                if (!changed)
                {
                    changed = true;
                    Label l = (Label)s;
                    l.Text = l.Text.wordWrap(25);
                }
                changed = false;
            };
            #endregion
            //btnToggleFields = new Button(manager);
            //btnToggleFields.Init();
            //btnToggleFields.Parent = backPanel;
            //btnToggleFields.Left = LeftPadding + backPanel.Width - 30;
            //btnToggleFields.Width = 15;
            //btnToggleFields.Height = 20;
            //btnToggleFields.Top = HeightCounter + 10;
            //btnToggleFields.Text = "F";
            //btnToggleFields.Click += delegate(object s, EventArgs e)
            //{
            //    this.GenerateFields = !this.GenerateFields;
            //    //ResetInspectorBox(ActiveInspectorParent.obj);
            //    ActiveInspectorParent.DoubleClickItem(this);
            //};

            HeightCounter += lblInspectorAddress.Height;

            #region  /// Component List ///
            InsBox = new ListBox(manager);
            InsBox.Init();
            //manager.Add(InsBox);
            InsBox.Parent = backPanel;

            InsBox.Top = HeightCounter;
            InsBox.Left = 10;
            InsBox.Width = Width - WidthReduction;
            InsBox.Height = 140; HeightCounter += InsBox.Height;

            InsBox.HideSelection = false;
            InsBox.ItemIndexChanged += InsBox_ItemIndexChanged;
            InsBox.Click += InsBox_Click;
            InsBox.DoubleClick += InsBox_DoubleClick;
            InsBox.Refresh();

            sidebar.ui.SetScrollableControl(InsBox, InsBox_ChangeScrollPosition);

            #region  /// Context Menu ///
            contextMenuInsBox = new ContextMenu(manager);
            applyToAllNodesMenuItem = new MenuItem("Apply to Group");
            applyToAllNodesMenuItem.Click += applyToAllNodesMenuItem_Click;
            toggleComponentMenuItem = new MenuItem("Toggle Component");
            toggleComponentMenuItem.Click += toggleComponentMenuItem_Click;
            removeComponentMenuItem = new MenuItem("Remove Component");
            removeComponentMenuItem.Click += removeComponentMenuItem_Click;
            toggleBoolMenuItem = new MenuItem("Toggle");
            toggleBoolMenuItem.Click += toggleBoolMenuItem_Click;
            toggleLinkMenuItem = new MenuItem("Toggle link");
            toggleLinkMenuItem.Click += toggleLinkMenuItem_Click;
            removeLinkMenuItem = new MenuItem("Delete link");
            removeLinkMenuItem.Click += removeLinkMenuItem_Click;
            addComponentToLinkMenuItem = new MenuItem("Add Link Component");
            addComponentToLinkMenuItem.Click += AddComponentToLinkMenuItem_Click;

            contextMenuInsBox.Items.Add(applyToAllNodesMenuItem);

            InsBox.ContextMenu = contextMenuInsBox;
            #endregion

            #endregion

            #region  /// GroupPanel ///
            GroupPanel groupPanel = new GroupPanel(manager);
            groupPanel.Init();
            groupPanel.Parent = backPanel;
            //groupPanel.Visible = false;//change
            groupPanel.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
            groupPanel.Width = Width - WidthReduction;
            groupPanel.Top = HeightCounter;
            groupPanel.Height = 90; HeightCounter += VertPadding + groupPanel.Height;
            groupPanel.Left = InsBox.Left;
            groupPanel.Text = "Inspector Property";
            #endregion

            #region  /// PropertyEditPanel ///
            propertyEditPanel = new PropertyEditPanel(this, groupPanel);
            #endregion

            backPanel.Height = groupPanel.Top + groupPanel.Height;
        }
Пример #28
0
        private void CreateWelcomeMessage()
        {
            var padding = 15;
            var window = new Window(_gameInfo.Manager) { Width = 400, Height = 300, Text = "Welcome to Game of Life!", AutoScroll = false, Resizable = false };
            var label = new Label(_gameInfo.Manager) {
                Width = window.Width, Parent = window, Height = 180, Top = padding, Left = padding,
                Text = "You are about to begin the game.  \nThe camera can be controlled using the following keys: \n\n -W A S D \n -Up Down Left Right \n\nAny active game objects visible on screen will glow. \n\nObjects outside of the visible area will have \nclickable arrows pointing to them. \n\nClicking the arrow will adjust the camera automatically. \n\nClose this window to begin."
            };
            label.Init();

            var close = new Button(_gameInfo.Manager) { Text = "Close", Parent = window, Top = window.Height - 75, Left = window.Width / 2 - 50 };
            close.Click += (sender, args) => window.Close();
            window.Closed += (sender, args) => BeginGame();
            close.Init();

            window.Init();
            _gameInfo.Manager.Add(window);
        }
 public void NewLabel(string s, int left, DetailedItem item, string name)
 {
     Label label = new Label(manager);
     label.Init();
     label.Parent = item.panel;
     label.Top = 1;
     label.Left = left;
     label.TextColor = Color.Black;
     label.Width = 30;
     label.Text = s;
     label.Name = name;
     if (s.Equals(UserInterface.Checkmark)) label.TextColor = UserInterface.TomShanePuke;
     else if (s.Equals(UserInterface.Cross)) label.TextColor = Color.Red;
     item.AddControl(label);
 }
Пример #30
0
        public LobbyWindow(Manager manager)
            : base(manager)
        {
            //Setup the window
            CaptionVisible = false;
            TopPanel.Visible = false;
            Movable = false;
            Resizable = false;
            Width = 700;
            Height = 500;
            Shadow = true;
            Center();

            //Group panels
            grpLobby = new GroupPanel(Manager) { Width = ClientWidth / 2, Height = ClientHeight - BottomPanel.Height + 2, Text = "Rooms" };
            grpLobby.Init();
            Add(grpLobby);

            grpServer = new GroupPanel(Manager) { Left = (ClientWidth / 2) - 1, Width = (ClientWidth / 2) + 1, Height = ClientHeight - BottomPanel.Height + 2, Text = "Server" };
            grpServer.Init();
            Add(grpServer);

            //Top controls
            txtSearch = new TextBox(Manager) { Left = 8, Top = 8, Width = (ClientWidth / 4) - 16, };
            txtSearch.Init();
            txtSearch.Text = searchStr;
            txtSearch.TextChanged += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                RefreshRooms();
            });
            //Show "Search..." text, but make it dissapear on focus
            txtSearch.FocusGained += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                if (txtSearch.Text.Trim() == searchStr)
                    txtSearch.Text = string.Empty;
            });
            txtSearch.FocusLost += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                if (txtSearch.Text.Trim() == string.Empty)
                    txtSearch.Text = searchStr;
            });
            grpLobby.Add(txtSearch);

            cmbSort = new ComboBox(Manager) { Left = txtSearch.Right + 8, Top = 8, Width = (ClientWidth / 4) - 16 - 20, };
            cmbSort.Init();
            cmbSort.Items.AddRange(sortFilters);
            cmbSort.ItemIndex = 0;
            cmbSort.ItemIndexChanged += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                RefreshRooms();
            });
            grpLobby.Add(cmbSort);

            btnReload = new Button(Manager) { Left = cmbSort.Right + 8, Top = 8, Width = 20, Height = 20, Text = string.Empty, };
            btnReload.Init();
            btnReload.Glyph = new Glyph(ContentPack.Textures["gui\\icons\\refresh"]);
            btnReload.ToolTip.Text = "Refresh";
            btnReload.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                Game.NetManager.Send(new RequestMessage(MessageTypes.Lobby));
            });
            grpLobby.Add(btnReload);

            //Main room list
            RoomListCtrl = new ControlList<LobbyDataControl>(Manager) { Left = 8, Top = txtSearch.Bottom + 8, Width = grpLobby.Width - 16, Height = grpLobby.Height - 16 - txtSearch.Bottom - 24 };
            RoomListCtrl.Init();
            grpLobby.Add(RoomListCtrl);

            //Server info labels
            lblName = new Label(Manager) { Text = "Loading...", Top = 8, Font = FontSize.Default20, Left = 8, Alignment = Alignment.MiddleCenter, Height = 30, Width = grpServer.ClientWidth - 16 };
            lblName.Init();
            grpServer.Add(lblName);

            lblDescription = new Label(Manager) { Text = string.Empty, Top = 8 + lblName.Bottom, Left = 8, Alignment = Alignment.MiddleCenter, Width = grpServer.ClientWidth - 16 };
            lblDescription.Init();
            grpServer.Add(lblDescription);

            lblInfo = new Label(Manager) { Text = string.Empty, Top = 8 + lblDescription.Bottom, Left = 8, Alignment = Alignment.TopLeft, Width = grpServer.ClientWidth - 16, Height = grpServer.Height };
            lblInfo.Init();
            grpServer.Add(lblInfo);
            //Bottom buttons
            btnCreate = new Button(Manager) { Top = 8, Text = "Create" };
            btnCreate.Left = (ClientWidth / 2) - (btnCreate.Width / 2);
            btnCreate.Init();
            btnCreate.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                CreateWorldDialog window = new CreateWorldDialog(manager, this);
                window.Init();
                Manager.Add(window);
                window.Show();
            });
            BottomPanel.Add(btnCreate);

            btnJoin = new Button(Manager) { Right = btnCreate.Left - 8, Top = 8, Text = "Join" };
            btnJoin.Init();
            btnJoin.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                JoinRoom(RoomListCtrl.ItemIndex);
            });
            BottomPanel.Add(btnJoin);

            btnDisconnect = new Button(Manager) { Left = btnCreate.Right + 8, Top = 8, Text = "Quit" };
            btnDisconnect.Init();
            btnDisconnect.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                Game.NetManager.Disconnect("Left Lobby");
                Game.CurrentGameState = GameState.Login;
                Interface.MainWindow.ScreenManager.SwitchScreen(new LoginScreen());
            });
            BottomPanel.Add(btnDisconnect);

            //When finished, request server send lobby data
            Game.NetManager.Send(new RequestMessage(MessageTypes.Lobby));
        }
Пример #31
0
        private void CreateFirstPage(Manager manager, Player[] playerList, TabPage control)
        {
            var yPos = 16;
            var padding = 10;
            // Get the player that won
            var winningPlayer = playerList.MaxBy(i => i.TotalValue);

            var winningPlayerLabel = new Label(manager) {
                Text = "The current leader is " + winningPlayer.Name,
                Width = 400,
                Alignment = Alignment.MiddleCenter,
                Parent = control,
                Top = yPos,
                Name = IgnoreString
            };
            yPos += winningPlayerLabel.Height + 16;

            var playerAvatar = winningPlayer.Avatar;

            var imageIcon = new Button(manager) {
                Glyph = new Glyph(playerAvatar),
                Height = (int)(playerAvatar.Height / 1.5),
                Width = (int)(playerAvatar.Width / 1.5),
                Left = 16,
                Name = IgnoreString,
                Top = yPos,
                Parent = control,
                Color = winningPlayer.PlayerColor,
            };
            imageIcon.Init();
            imageIcon.FocusGained += (sender, args) => imageIcon.Enabled = false;

            var descriptionText = new Label(manager) {
                Left = imageIcon.Left + imageIcon.Width + 16, Width = 200,
                Height = imageIcon.Height,
                Top = yPos + 9,
                Text = String.Format(
                    "Player Name : {0}\n\n" +
                    "Player Cash : ${1:N0}\n\n" +
                    "Player Total Worth : ${2:N0}\n\n" +
                    "Player Position : {3:N0}\n\n",
                    winningPlayer.Name, winningPlayer.Cash, winningPlayer.TotalValue, 1),
                Alignment = Alignment.TopLeft,
                Parent = control,
                Name = IgnoreString,
            };
            descriptionText.Init();

            yPos = imageIcon.Top + imageIcon.Height + 16;

            int playerCount = 0;

            var leaderBoard = new ImageBox(manager) {
                Image = manager.Game.Content.Load<Texture2D>("images/leaderboard"),
                Top = yPos - padding,
                Left = 200 - 100, Parent = control, Width = 250,
                                Name = IgnoreString
            };
            leaderBoard.Init();
            yPos += leaderBoard.Height / 3;
            foreach (var player in playerList.OrderByDescending(i => i.TotalValue))
            {
                playerCount++;
                var label = new Label(manager)
                                {
                                    Text = String.Format("{0}. {1}\n\n          " +
                                                         "Total Value : ${3:N0}\n          " +
                                                         "Current Cash : ${2:N0}",
                                                         playerCount, player.Name, player.Cash, player.TotalValue),
                                    Height = 50,
                                    Width = 400,
                                    Parent = control,
                                    Left = 80,
                                    Top = yPos,
                                    Name = IgnoreString
                                };
                yPos += label.Height + 10;
            }

            createdPages[control] = yPos + 30;
        }
Пример #32
0
        private void InitializeControls()
        {
            _manager.Initialize();
            _manager.AutoCreateRenderTarget = true;

            _tabControl = new TabControl(_manager);
            _tabControl.Init();
            _tabControl.Left   = 600;
            _tabControl.Top    = 0;
            _tabControl.Width  = Width;
            _tabControl.Height = Height;
            _tabControl.Show();
            #region WavePage
            _wavePage      = _tabControl.AddPage();
            _wavePage.Text = "Waves";

            #region Constructors
            _health = new Label(_manager);
            _health.Init();
            _texture = new Label(_manager);
            _texture.Init();
            _speed = new Label(_manager);
            _speed.Init();
            _number = new Label(_manager);
            _number.Init();

            _waves = new ListBox(_manager);
            _waves.Init();
            _deleteWaveButton = new Button(_manager);
            _deleteWaveButton.Init();
            _addWaveButton = new Button(_manager);
            _addWaveButton.Init();
            _currentWave = new ListBox(_manager);
            _currentWave.Init();
            _addCreepsButton = new Button(_manager);
            _addCreepsButton.Init();
            _numberOfCreeps = new TextBox(_manager);
            _numberOfCreeps.Init();
            _speedOfCreeps = new TextBox(_manager);
            _speedOfCreeps.Init();
            _healthOfCreeps = new TextBox(_manager);
            _healthOfCreeps.Init();
            _creepTexture = new ComboBox(_manager);
            _creepTexture.Init();
            #endregion

            #region Properties
            _texture.Text   = "Textur";
            _texture.Top    = 2;
            _texture.Left   = 2;
            _texture.Parent = _wavePage;
            _wavePage.Add(_texture);

            _creepTexture.Items.AddRange(new[] { "Slyder", "Drone", "Ape", "Paw" });
            _creepTexture.Text      = "Slyder";
            _creepTexture.Width     = 80;
            _creepTexture.Left      = 2;
            _creepTexture.Top       = _texture.Top + _texture.Height + 2;
            _creepTexture.TextColor = Color.LightGray;
            _creepTexture.Parent    = _wavePage;

            _health.Text   = "Gesundheit";
            _health.Top    = 2;
            _health.Left   = _creepTexture.Left + _creepTexture.Width + 5;
            _health.Parent = _wavePage;

            _healthOfCreeps.Left      = _health.Left;
            _healthOfCreeps.Top       = _health.Top + _health.Height + 2;
            _healthOfCreeps.Width     = _health.Width;
            _healthOfCreeps.TextColor = Color.LightGray;
            _healthOfCreeps.Parent    = _wavePage;

            _speed.Text   = "Geschwindigkeit";
            _speed.Left   = _health.Left + _health.Width + 5;
            _speed.Top    = 2;
            _speed.Width  = 93;
            _speed.Parent = _wavePage;

            _speedOfCreeps.Left      = _speed.Left;
            _speedOfCreeps.Top       = _speed.Top + _speed.Height + 2;
            _speedOfCreeps.Width     = _speed.Width;
            _speedOfCreeps.TextColor = Color.LightGray;
            _speedOfCreeps.Parent    = _wavePage;

            _number.Text   = "Anzahl";
            _number.Top    = 2;
            _number.Left   = _speed.Left + _speed.Width + 5;
            _number.Width  = 40;
            _number.Parent = _wavePage;

            _numberOfCreeps.Left      = _number.Left;
            _numberOfCreeps.Top       = _number.Top + _number.Height + 2;
            _numberOfCreeps.Width     = _number.Width;
            _numberOfCreeps.TextColor = Color.LightGray;
            _numberOfCreeps.Parent    = _wavePage;

            _addCreepsButton.Text   = "Creeps hinzufügen";
            _addCreepsButton.Top    = _numberOfCreeps.Top + _numberOfCreeps.Height - _addCreepsButton.Height;
            _addCreepsButton.Left   = _numberOfCreeps.Left + _numberOfCreeps.Width + 5;
            _addCreepsButton.Width  = 120;
            _addCreepsButton.Parent = _wavePage;

            _currentWave.Left      = 2;
            _currentWave.Top       = _creepTexture.Top + _creepTexture.Height + 5;
            _currentWave.Width     = _addCreepsButton.Left + _addCreepsButton.Width;
            _currentWave.Height    = 150;
            _currentWave.TextColor = Color.LightGray;
            _currentWave.Parent    = _wavePage;

            _addWaveButton.Text   = "Wave hinzufügen";
            _addWaveButton.Left   = 2;
            _addWaveButton.Top    = _currentWave.Top + _currentWave.Height + 5;
            _addWaveButton.Width  = 150;
            _addWaveButton.Parent = _wavePage;

            _deleteWaveButton.Text   = "Wave löschen";
            _deleteWaveButton.Left   = _addWaveButton.Left + _addWaveButton.Width + 5;
            _deleteWaveButton.Top    = _currentWave.Top + _currentWave.Height + 5;
            _deleteWaveButton.Width  = _addWaveButton.Width;
            _deleteWaveButton.Parent = _wavePage;

            _waves.Left              = 2;
            _waves.Top               = _addWaveButton.Top + _addWaveButton.Height + 5;
            _waves.Width             = _currentWave.Width;
            _waves.Height            = 150;
            _waves.TextColor         = Color.LightGray;
            _waves.Parent            = _wavePage;
            _waves.ItemIndexChanged += _waves_ItemIndexChanged;
            #endregion

            #region Events
            _addCreepsButton.Click  += AddCreepsButton_Click;
            _addWaveButton.Click    += AddWaveButton_Click;
            _deleteWaveButton.Click += DeleteWaveButton_Click;
            #endregion
            #endregion

            #region SavePage
            _savePage      = _tabControl.AddPage();
            _savePage.Text = "Speichern & Laden";
            _path          = new TextBox(_manager);
            _path.Init();
            _path.Top      = 2;
            _path.Left     = 2;
            _path.Width    = 200;
            _path.Parent   = _savePage;
            _path.ReadOnly = true;

            _fileNameButton = new Button(_manager);
            _fileNameButton.Init();
            _fileNameButton.Text   = "...";
            _fileNameButton.Width  = 17;
            _fileNameButton.Height = _fileNameButton.Width;
            _fileNameButton.Top    = _path.Top + _path.Height / 2 - _fileNameButton.Height / 2;
            _fileNameButton.Left   = _path.Left + _path.Width + 2;
            _fileNameButton.Parent = _savePage;
            _fileNameButton.Click += delegate {
                var dlg = new SaveFileDialog {
                    Filter           = "Level-Dateien|*.xml",
                    InitialDirectory =
                        Path.GetFullPath(
                            Path.GetDirectoryName(
                                Assembly.GetExecutingAssembly().Location) +
                            @"\..\Content\Map")
                };
                dlg.ShowDialog();
                _path.Text = dlg.FileName;
            };

            _saveButton = new Button(_manager);
            _saveButton.Init();
            _saveButton.Top    = _path.Top + _path.Height + 2;
            _saveButton.Left   = 2;
            _saveButton.Text   = "Speichern";
            _saveButton.Width  = 120;
            _saveButton.Parent = _savePage;
            _saveButton.Click += delegate {
                if (_path.Text.Length > 0)
                {
                    string fileName = _path.Text;
                    Save(fileName);
                }
            };

            LoadButton = new Button(_manager);
            LoadButton.Init();
            LoadButton.Left   = 2;
            LoadButton.Top    = 50;
            LoadButton.Text   = "Laden";
            LoadButton.Width  = 120;
            LoadButton.Parent = _savePage;
            LoadButton.Click += LoadButton_Click;
            #endregion
            _manager.Add(_tabControl);
        }