Example #1
0
        public TileSpawnPanel(Size size, IResourceManager resourceManager, IPlacementManager placementManager)
            : base("Tile Spawn Panel", size, resourceManager)
        {
            _resourceManager = resourceManager;
            _placementManager = placementManager;

            _tileList = new ScrollableContainer("tilespawnlist", new Size(200, 400), _resourceManager)
                            {Position = new Point(5, 5)};
            components.Add(_tileList);

            var searchLabel = new Label("Tile Search:", "CALIBRI", _resourceManager) {Position = new Point(210, 0)};
            components.Add(searchLabel);

            _tileSearchTextbox = new Textbox(125, _resourceManager) {Position = new Point(210, 20)};
            _tileSearchTextbox.OnSubmit += tileSearchTextbox_OnSubmit;
            components.Add(_tileSearchTextbox);

            _clearLabel = new Label("[Clear Filter]", "CALIBRI", _resourceManager)
                              {
                                  DrawBackground = true,
                                  DrawBorder = true,
                                  Position = new Point(210, 55)
                              };

            _clearLabel.Clicked += ClearLabelClicked;
            _clearLabel.BackgroundColor = Color.Gray;
            components.Add(_clearLabel);

            BuildTileList();

            Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f),
                                 (int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f));
            _placementManager.PlacementCanceled += PlacementManagerPlacementCanceled;
        }
Example #2
0
        public Chatbox(IResourceManager resourceManager, IUserInterfaceManager userInterfaceManager,
                       IKeyBindingManager keyBindingManager)
        {
            _resourceManager = resourceManager;
            _userInterfaceManager = userInterfaceManager;
            _keyBindingManager = keyBindingManager;

            Position = new Point(Gorgon.CurrentClippingViewport.Width - (int)Size.X - 10, 10);

            ClientArea = new Rectangle(Position.X, Position.Y, (int) Size.X, (int) Size.Y);

            _textInputLabel = new Label("", "CALIBRI", _resourceManager)
                                  {
                                      Text =
                                          {
                                              Size = new Size(ClientArea.Width - 10, 12),
                                              Color = Color.Green
                                          }
                                  };

            _chatColors = new Dictionary<ChatChannel, Color>
                              {
                                  {ChatChannel.Default, Color.Gray},
                                  {ChatChannel.Damage, Color.Red},
                                  {ChatChannel.Radio, Color.DarkGreen},
                                  {ChatChannel.Server, Color.Blue},
                                  {ChatChannel.Player, Color.Green},
                                  {ChatChannel.Lobby, Color.White},
                                  {ChatChannel.Ingame, Color.Green},
                                  {ChatChannel.OOC, Color.White},
                                  {ChatChannel.Emote, Color.Cyan},
                                  {ChatChannel.Visual, Color.Yellow},
                              };
        }
Example #3
0
        private void BuildList(Banlist banList)
        {
            int yOffset = 40;
            foreach (BanEntry entry in banList.List)
            {
                var line = new Label("IP: " + entry.ip + "\tReason: " + entry.reason +
                                     "\tTemporary: " + entry.tempBan + "\tExpires: " +
                                     entry.expiresAt.ToString("d/M/yyyy HH:mm:ss"), "CALIBRI", _resourceManager)
                               {Position = new Point(5, yOffset + 5)};

                components.Add(line);
                var unbanButton = new Button("Unban", _resourceManager)
                                      {
                                          Position =
                                              new Point(line.ClientArea.Right + 10,
                                                        yOffset + (int) (line.ClientArea.Height/3f))
                                      };

                components.Add(unbanButton);
                unbanButton.UserData = entry.ip;
                unbanButton.Clicked += UnbanButtClicked;
                unbanButton.Update(0);

                yOffset += 35;
            }
        }
Example #4
0
        public void GetSVarsCallback(object sender, GetSVarsEventArgs args)
        {
            _sVars = args.SVars;

            int off_y = 5;
            components.Clear();

            foreach (MarshalComponentParameter svar in _sVars)
            {
                var newLabel = new Label(svar.Family.ToString() + " : " + svar.Parameter.MemberName + " =  ", "CALIBRI",
                                         _resourceManager);
                newLabel.Update(0);

                newLabel.Position = new Point(5, off_y);
                newLabel.DrawBorder = true;
                newLabel.DrawBackground = true;

                GuiComponent newComp = CreateEditField(svar);
                newComp.Update(0);
                newComp.Position = new Point(newLabel.ClientArea.Right + 8, off_y);

                off_y += newLabel.ClientArea.Height + 5;

                components.Add(newLabel);
                components.Add(newComp);
            }
        }
Example #5
0
 private void _reslistbox_ItemSelected(Label item, Listbox sender)
 {
     if (vmList.ContainsKey(item.Text.Text))
     {
         VideoMode sel = vmList[item.Text.Text];
         ConfigurationManager.SetResolution((uint)sel.Width, (uint)sel.Height);
         ConfigurationManager.SetDisplayRefresh((uint)sel.RefreshRate);
     }
 }
Example #6
0
 public void AddLine(string text, Color color)
 {
     Label newLabel = new Label(text, "MICROGBE", this._resourceManager);
     newLabel.Position = new Point(5, last_y);
     newLabel.TextColor = color;
     newLabel.Update(0);
     last_y = newLabel.ClientArea.Bottom;
     components.Add(newLabel);
 }
        public DisconnectedScreenBlocker(IStateManager stateManager, IUserInterfaceManager userInterfaceManager,
                                         IResourceManager resourceManager, string message = "Connection closed.")
        {
            _stateManager = stateManager;
            _resourceManager = resourceManager;
            _userInterfaceManager = userInterfaceManager;
            _userInterfaceManager.DisposeAllComponents();

            _message = new Label(message, "CALIBRI", _resourceManager);
            _mainMenuButton = new Button("Main Menu", _resourceManager);
            _mainMenuButton.Clicked += MainMenuButtonClicked;
            _mainMenuButton.Label.Color = Color.WhiteSmoke;
            _message.Text.Color = Color.WhiteSmoke;
        }
Example #8
0
        public HealthPanel()
        {
            ComponentClass = GuiComponentType.Undefined;

            healthMeterBg = _resMgr.GetSprite("healthMeterBg");
            healthMeterOverlay = _resMgr.GetSprite("healthMeterOverlay");
            healthMeterGrid = _resMgr.GetSprite("healthMeterGrid");
            panelBG = _resMgr.GetSprite("healthBg");
            _backgroundSprite = _resMgr.GetSprite("blip");

            healthPc = new Label("100", "CALIBRI", _resMgr);
            healthPc.Text.ShadowOffset = new Vector2D(1, 1);
            healthPc.Text.Shadowed = true;
            healthPc.Text.Color = Color.FloralWhite;
        }
Example #9
0
        public Window(string windowTitle, Size size, IResourceManager resourceManager)
            : base(windowTitle, size, resourceManager)
        {
            _resourceManager = resourceManager;

            closeButton = new ImageButton
                              {
                                  ImageNormal = "closewindow"
                              };

            closeButton.Clicked += CloseButtonClicked;
            title = new Label(windowTitle, "CALIBRI", _resourceManager);
            gradient = new GradientBox();
            DrawBackground = true;
            Update(0);
        }
Example #10
0
        public MainScreen(IDictionary<Type, object> managers)
            : base(managers)
        {
            _background = ResourceManager.GetSprite("mainbg_filler");
            _background.Smoothing = Smoothing.Smooth;

            _buttConnect = new ImageButton
                               {
                                   ImageNormal = "connect_norm",
                                   ImageHover = "connect_hover"
                               };
            _buttConnect.Clicked += _buttConnect_Clicked;

            _buttOptions = new ImageButton
                               {
                                   ImageNormal = "options_norm",
                                   ImageHover = "options_hover"
                               };
            _buttOptions.Clicked += _buttOptions_Clicked;

            _buttExit = new ImageButton
                            {
                                ImageNormal = "exit_norm",
                                ImageHover = "exit_hover"
                            };
            _buttExit.Clicked += _buttExit_Clicked;

            _connectTextbox = new Textbox(100, ResourceManager) {Text = ConfigurationManager.GetServerAddress()};
            _connectTextbox.OnSubmit += ConnectTextboxOnSubmit;
            _connectTextbox.SetVisible(false);

            Assembly assembly = Assembly.GetExecutingAssembly();
            FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);

            _lblVersion = new Label("v. " + fvi.FileVersion, "CALIBRI", ResourceManager);
            _lblVersion.Text.Color = Color.WhiteSmoke;
            _lblVersion.Position = new Point(Gorgon.Screen.Width - _lblVersion.ClientArea.Width - 3,
                                             Gorgon.Screen.Height - _lblVersion.ClientArea.Height - 3);

            _titleImage = new SimpleImage
                              {
                                  Sprite = "SpaceStationLogoColor",
                                  Position = new Point(Gorgon.Screen.Width - 550, 100)
                              };
        }
Example #11
0
        private void BuildList(NetIncomingMessage message)
        {
            byte playerCount = message.ReadByte();
            int yOffset = 40;
            for (int i = 0; i < playerCount; i++)
            {
                string name = message.ReadString();
                var status = (SessionStatus) message.ReadByte();
                string job = message.ReadString();
                string ip = message.ReadString();
                bool isAdmin = message.ReadBoolean();

                var line = new Label("Name: " + name + "    Status: " + status + "    Job: " + job + "    IP: " + ip,
                                     "CALIBRI", _resourceManager)
                               {
                                   Position = new Point(5, yOffset + 5),
                                   Text = {Color = isAdmin ? Color.DarkCyan : Color.Black}
                               };

                components.Add(line);

                var kickButton = new Button("Kick", _resourceManager)
                                     {
                                         Position =
                                             new Point(line.ClientArea.Right + 10,
                                                       yOffset + (int) (line.ClientArea.Height/3f))
                                     };
                components.Add(kickButton);
                kickButton.UserData = ip;
                kickButton.Clicked += KickButtonClicked;
                kickButton.Update(0);

                var banButt = new Button("Ban", _resourceManager)
                                  {
                                      Position =
                                          new Point(kickButton.ClientArea.Right + 5,
                                                    yOffset + (int) (line.ClientArea.Height/3f))
                                  };
                components.Add(banButt);
                banButt.UserData = ip;
                banButt.Clicked += BanButtonClicked;

                yOffset += 35;
            }
        }
Example #12
0
 private void PopulateList()
 {
     if (assignedComp == null) return;
     components.Clear();
     int pos_y = 10;
     foreach (PlayerAction act in assignedComp.Actions)
     {
         var newButt = new PlayerActionButton(act, _resourceManager);
         newButt.Position = new Point(10, pos_y);
         newButt.Update(0);
         var newLabel = new Label(act.Name, "CALIBRI", _resourceManager);
         newLabel.Update(0);
         newLabel.Position = new Point(10 + newButt.ClientArea.Width + 5,
                                       pos_y + (int) (newButt.ClientArea.Height/2f) -
                                       (int) (newLabel.ClientArea.Height/2f));
         components.Add(newButt);
         components.Add(newLabel);
         pos_y += 5 + newButt.ClientArea.Height;
     }
 }
Example #13
0
        public ExamineWindow(Size size, Entity entity, IResourceManager resourceManager)
            : base(entity.Name, size, resourceManager)
        {
            _resourceManager = resourceManager;
            _entityDescription = new Label(entity.GetDescriptionString(), "CALIBRI", _resourceManager);

            components.Add(_entityDescription);

            ComponentReplyMessage reply = entity.SendMessage(entity, ComponentFamily.Renderable,
                                                             ComponentMessageType.GetSprite);

            SetVisible(true);

            if (reply.MessageType == ComponentMessageType.CurrentSprite)
            {
                _entitySprite = (Sprite) reply.ParamsList[0];
                _entityDescription.Position = new Point(10,
                                                        (int) _entitySprite.Height +
                                                        _entityDescription.ClientArea.Height + 10);
            }
            else
                _entityDescription.Position = new Point(10, 10);
        }
Example #14
0
        public Lobby(IDictionary<Type, object> managers)
            : base(managers)
        {
            _background = ResourceManager.GetSprite("mainbg");
            _background.Smoothing = Smoothing.Smooth;

            _mainbg = new SimpleImage
                          {
                              Sprite = "lobby_mainbg"
                          };

            _imgStatus = new SimpleImage
                             {
                                 Sprite = "lobby_statusbar"
                             };

            _lblServer = new Label("SERVER:", "MICROGME", ResourceManager);
            _lblServer.Text.Color = Color.WhiteSmoke;
            _serverLabels.Add(_lblServer);

            _lblServerInfo = new Label("LLJK#1", "MICROGME", ResourceManager);
            _lblServerInfo.Text.Color = Color.DarkRed;
            _serverLabels.Add(_lblServerInfo);

            _lblMode = new Label("GAMEMODE:", "MICROGME", ResourceManager);
            _lblMode.Text.Color = Color.WhiteSmoke;
            _serverLabels.Add(_lblMode);

            _lblModeInfo = new Label("SECRET", "MICROGME", ResourceManager);
            _lblModeInfo.Text.Color = Color.DarkRed;
            _serverLabels.Add(_lblModeInfo);

            _lblPlayers = new Label("PLAYERS:", "MICROGME", ResourceManager);
            _lblPlayers.Text.Color = Color.WhiteSmoke;
            _serverLabels.Add(_lblPlayers);

            _lblPlayersInfo = new Label("17/32", "MICROGME", ResourceManager);
            _lblPlayersInfo.Text.Color = Color.DarkRed;
            _serverLabels.Add(_lblPlayersInfo);

            _lblPort = new Label("PORT:", "MICROGME", ResourceManager);
            _lblPort.Text.Color = Color.WhiteSmoke;
            _serverLabels.Add(_lblPort);

            _lblPortInfo = new Label("1212", "MICROGME", ResourceManager);
            _lblPortInfo.Text.Color = Color.DarkRed;
            _serverLabels.Add(_lblPortInfo);

            _tabs = new TabbedMenu
                        {
                            TopSprite = "lobby_tab_top",
                            MidSprite = "lobby_tab_mid",
                            BotSprite = "lobby_tab_bot",
                            TabOffset = new Point(-8, 300)
                        };

            _tabJob = new JobTab("lobbyTabJob", new Size(793, 450), ResourceManager)
                          {
                              tabSpriteName = "lobby_tab_bcase"
                          };
            _tabs.AddTab(_tabJob);
            _tabJob._shwDepa.SelectionChanged += new Showcase.ShowcaseSelectionChangedHandler(_shwDepa_SelectionChanged);
            _tabJob._shwJobs.SelectionChanged += new Showcase.ShowcaseSelectionChangedHandler(_shwJobs_SelectionChanged);

            _tabCharacter = new TabContainer("lobbyTabCharacter", new Size(793, 450), ResourceManager)
                                {
                                    tabSpriteName = "lobby_tab_person"
                                };
            _tabs.AddTab(_tabCharacter);

            _tabObserve = new TabContainer("lobbyTabObserve", new Size(793, 450), ResourceManager)
                              {
                                  tabSpriteName = "lobby_tab_eye"
                              };
            _tabs.AddTab(_tabObserve);

            _tabServer = new PlayerListTab("lobbyTabServer", new Size(793, 450), ResourceManager)
                             {
                                 tabSpriteName = "lobby_tab_info"
                             };
            _tabs.AddTab(_tabServer);

            _tabs.SelectTab(_tabJob);

            _lobbyChat = new Chatbox(ResourceManager, UserInterfaceManager, KeyBindingManager)
                {
                    Size = new Vector2D(780,225),
                };

            _lobbyChat.Update(0);

            _imgChatBg = new SimpleImage()
            {
                Sprite = "lobby_chatbg",
            };

            _lobbyChat.TextSubmitted += new Chatbox.TextSubmitHandler(_lobbyChat_TextSubmitted);

        }
Example #15
0
 private void NewEntryClicked(Label sender, MouseInputEventArgs e)
 {
     SetItem(sender, true);
 }
Example #16
0
        public OptionsMenu(IDictionary <Type, object> managers)
            : base(managers)
        {
            _background           = ResourceManager.GetSprite("mainbg");
            _background.Smoothing = Smoothing.Smooth;

            _lblfullscreen = new Label("Fullscreen", "CALIBRI", ResourceManager);

            _chkfullscreen               = new Checkbox(ResourceManager);
            _chkfullscreen.Value         = ConfigurationManager.GetFullscreen();
            _chkfullscreen.ValueChanged += _chkfullscreen_ValueChanged;

            _lblvsync = new Label("Vsync", "CALIBRI", ResourceManager);

            _chkvsync               = new Checkbox(ResourceManager);
            _chkvsync.Value         = ConfigurationManager.GetVsync();
            _chkvsync.ValueChanged += _chkvsync_ValueChanged;

            _reslistbox = new Listbox(250, 150, ResourceManager);
            _reslistbox.ItemSelected += _reslistbox_ItemSelected;

            IOrderedEnumerable <VideoMode> modes = from v in Gorgon.CurrentDriver.VideoModes
                                                   where
                                                   (v.Height > 748 && v.Width > 1024) &&
                                                   v.Format == BackBufferFormats.BufferRGB888 && v.RefreshRate >= 59
                                                   //GOSH I HOPE NOONES USING 16 BIT COLORS. OR RUNNING AT LESS THAN 59 hz
                                                   orderby v.Height * v.Width ascending
                                                   select v;

            if (!modes.Any())
            {
                //No compatible videomodes at all. It is likely the game is being run on a calculator. TODO handle this.
                Application.Exit();
            }

            foreach (VideoMode vm in modes)
            {
                if (!vmList.ContainsKey(GetVmString(vm)))
                {
                    vmList.Add(GetVmString(vm), vm);
                    _reslistbox.AddItem(GetVmString(vm));
                }
            }

            if (
                vmList.Any(
                    x =>
                    x.Value.Width == Gorgon.CurrentVideoMode.Width && x.Value.Height == Gorgon.CurrentVideoMode.Height &&
                    x.Value.RefreshRate ==
                    (Gorgon.Screen.Windowed ? Gorgon.DesktopVideoMode.RefreshRate : Gorgon.CurrentVideoMode.RefreshRate)))
            {
                KeyValuePair <string, VideoMode> curr =
                    vmList.FirstOrDefault(
                        x =>
                        x.Value.Width == Gorgon.CurrentVideoMode.Width &&
                        x.Value.Height == Gorgon.CurrentVideoMode.Height &&
                        x.Value.RefreshRate ==
                        (Gorgon.Screen.Windowed
                             ? Gorgon.DesktopVideoMode.RefreshRate
                             : Gorgon.CurrentVideoMode.RefreshRate));
                _reslistbox.SelectItem(curr.Key, false);
            }
            else
            {
                //No match due to different refresh rate in windowed mode. Just pick first resolution based on size only.
                KeyValuePair <string, VideoMode> curr =
                    vmList.FirstOrDefault(
                        x =>
                        x.Value.Width == Gorgon.CurrentVideoMode.Width &&
                        x.Value.Height == Gorgon.CurrentVideoMode.Height);
                _reslistbox.SelectItem(curr.Key, false);
            }

            _ticketbg = ResourceManager.GetSprite("ticketoverlay");

            _mainmenubtt            = new Label("Main Menu", "CALIBRI", ResourceManager);
            _mainmenubtt.DrawBorder = true;
            _mainmenubtt.Clicked   += _mainmenubtt_Clicked;

            _applybtt            = new Label("Apply", "CALIBRI", ResourceManager);
            _applybtt.DrawBorder = true;
            _applybtt.Clicked   += _applybtt_Clicked;
        }
Example #17
0
        private void HandlePlayerList(NetIncomingMessage message)
        {
            byte playerCount = message.ReadByte();
            _serverPlayers = playerCount;
            _tabServer._scPlayerList.components.Clear();
            int offY = 0;
            for (int i = 0; i < playerCount; i++)
            {
                string currName = message.ReadString();
                var currStatus = (SessionStatus)message.ReadByte();
                float currRoundtrip = message.ReadFloat();

                Label newLabel = new Label(currName + "\t\tStatus: " + currStatus + "\t\tLatency: " + Math.Truncate(currRoundtrip * 1000) + " ms", "MICROGBE", ResourceManager);
                newLabel.Position = new Point(0, offY);
                newLabel.TextColor = Color.Black;
                newLabel.Update(0);
                offY += newLabel.ClientArea.Height;
                _tabServer._scPlayerList.components.Add(newLabel);
            }
        }
Example #18
0
        private void BuildTileList(string searchStr = null)
        {
            int maxWidth = 0;
            int yOffset = 5;

            _tileList.components.Clear();
            _tileList.ResetScrollbars();

            Type type = typeof (Tile);
            List<Assembly> asses = AppDomain.CurrentDomain.GetAssemblies().ToList();
            List<Type> types =
                asses.SelectMany(t => t.GetTypes()).Where(p => type.IsAssignableFrom(p) && !p.IsAbstract).ToList();

            IEnumerable<string> rawNames = from a in types
                                           select a.Name;

            if (types.Count > 255)
            {
                throw new ArgumentOutOfRangeException("types.Count", "Can not load more than 255 types of tiles.");
            }


            List<string> typeNames = (searchStr == null)
                                         ? rawNames.ToList()
                                         : rawNames.Where(x => x.ToLower().Contains(searchStr.ToLower())).ToList();

            if (searchStr != null) _clearLabel.BackgroundColor = Color.LightGray;

            foreach (string entry in typeNames)
            {
                var tileLabel = new Label(entry, "CALIBRI", _resourceManager);
                _tileList.components.Add(tileLabel);
                tileLabel.Position = new Point(5, yOffset);
                tileLabel.DrawBackground = true;
                tileLabel.DrawBorder = true;
                tileLabel.Update(0);
                yOffset += 5 + tileLabel.ClientArea.Height;
                tileLabel.Clicked += TileLabelClicked;
                if (tileLabel.ClientArea.Width > maxWidth) maxWidth = tileLabel.ClientArea.Width;
            }

            foreach (GuiComponent curr in _tileList.components.Where(curr => curr.GetType() == typeof (Label)))
                ((Label) curr).FixedWidth = maxWidth;
        }
Example #19
0
 private void _exitbtt_Clicked(Label sender)
 {
     Environment.Exit(0);
 }
Example #20
0
        private void LabelName_Clicked(Label sender, MouseInputEventArgs e)
        {
            switch (e.Buttons)
            {
                case MouseButtons.Left:
                    {
                        PropWindowStruct? selected = null;

                        if (ObjPropList.Any(x => x.LabelName == sender))
                            selected = ObjPropList.First(x => x.LabelName == sender);

                        if (selected.HasValue)
                        {
                            if (selected.Value.IsListItem)
                            {
                                if (selected.Value.ListItem != null)
                                    RebuildPropList(selected.Value.ListItem);
                            }
                            else if (fields.First(x => x.Name == selected.Value.VarName) != null)
                            {
                                FieldInfo field = fields.First(x => x.Name == selected.Value.VarName);
                                object fieldVar = field.GetValue(assigned);
                                if (fieldVar == null) return;

                                RebuildPropList(fieldVar);
                            }
                        }
                        break;
                    }
            }
        }
Example #21
0
 private void _reslistbox_ItemSelected(Label item, Listbox sender)
 {
     if (vmList.ContainsKey(item.Text.Text))
     {
         VideoMode sel = vmList[item.Text.Text];
         ConfigurationManager.SetResolution((uint) sel.Width, (uint) sel.Height);
         ConfigurationManager.SetDisplayRefresh((uint) sel.RefreshRate);
     }
 }
Example #22
0
        private void _lstOverride_ItemSelected(Label item, Listbox sender)
        {
            var pMan = (PlacementManager) _placementManager;

            if (pMan.CurrentMode != null)
            {
                var newObjInfo = new PlacementInformation
                                     {
                                         PlacementOption = item.Text.Text,
                                         EntityType = pMan.CurrentPermission.EntityType,
                                         Range = -1,
                                         IsTile = pMan.CurrentPermission.IsTile
                                     };

                _placementManager.Clear();
                _placementManager.BeginPlacing(newObjInfo);
            }
        }
Example #23
0
        public EntitySpawnPanel(Size size, IResourceManager resourceManager, IPlacementManager placementManager)
            : base("Entity Spawn Panel", size, resourceManager)
        {
            _resourceManager = resourceManager;
            _placementManager = placementManager;

            _entityList = new ScrollableContainer("entspawnlist", new Size(200, 400), _resourceManager)
                              {Position = new Point(5, 5)};
            components.Add(_entityList);

            var searchLabel = new Label("Entity Search:", "CALIBRI", _resourceManager) {Position = new Point(210, 0)};
            components.Add(searchLabel);

            _entSearchTextbox = new Textbox(125, _resourceManager) {Position = new Point(210, 20)};
            _entSearchTextbox.OnSubmit += entSearchTextbox_OnSubmit;
            components.Add(_entSearchTextbox);

            _clearLabel = new Label("[Clear Filter]", "CALIBRI", _resourceManager)
                              {
                                  DrawBackground = true,
                                  DrawBorder = true,
                                  Position = new Point(210, 55)
                              };

            _overLabel = new Label("Override Placement:", "CALIBRI", _resourceManager)
                             {
                                 Position = _clearLabel.Position + new Size(0, _clearLabel.ClientArea.Height + 15)
                             };

            components.Add(_overLabel);

            var initOpts = new List<string>();

            initOpts.AddRange(new[]
                                  {
                                      "None",
                                      "AlignNone",
                                      "AlignFree",
                                      "AlignSimilar",
                                      "AlignTileAny",
                                      "AlignTileEmpty",
                                      "AlignTileNonSolid",
                                      "AlignTileSolid",
                                      "AlignWall",
                                      "AlignWallTops"
                                  });

            _lstOverride = new Listbox(150, 125, resourceManager, initOpts);
            _lstOverride.SelectItem("None");
            _lstOverride.ItemSelected += _lstOverride_ItemSelected;
            _lstOverride.Position = _overLabel.Position + new Size(0, _overLabel.ClientArea.Height);
            components.Add(_lstOverride);

            _clearLabel.Clicked += ClearLabelClicked;
            _clearLabel.BackgroundColor = Color.Gray;
            components.Add(_clearLabel);

            _eraserButton = new ImageButton
                                {
                                    ImageNormal = "erasericon",
                                    Position =
                                        new Point(_clearLabel.Position.X + _clearLabel.ClientArea.Width + 5,
                                                  _clearLabel.Position.Y)
                                };

            //eraserButton.Position = new Point(clearLabel.ClientArea.Right + 5, clearLabel.ClientArea.Top); Clientarea not updating properly. FIX THIS
            _eraserButton.Clicked += EraserButtonClicked;
            components.Add(_eraserButton);

            BuildEntityList();

            Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f),
                                 (int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f));
            _placementManager.PlacementCanceled += PlacementManagerPlacementCanceled;
        }
Example #24
0
 private void _connectbtt_Clicked(Label sender, MouseInputEventArgs e)
 {
 }
Example #25
0
 private void _mainmenubtt_Clicked(Label sender, MouseInputEventArgs e)
 {
     StateManager.RequestStateChange<MainScreen>();
 }
Example #26
0
 private void _exitbtt_Clicked(Label sender)
 {
     Environment.Exit(0);
 }
Example #27
0
        private void SetItem(Label toSet, bool raiseEvent = false)
        {
            if (ItemSelected != null && raiseEvent) ItemSelected(toSet, this);

            CurrentlySelected = toSet;
            _selectedLabel.Text = toSet.Text.Text;
            _dropDown.SetVisible(false);

            ((ListboxItem) toSet).Selected = true;
            IEnumerable<ListboxItem> notSelected = from ListboxItem item in _dropDown.components
                                                   where item != toSet
                                                   select item;
            foreach (ListboxItem curr in notSelected) curr.Selected = false;
        }
Example #28
0
 private void _connectbtt_Clicked(Label sender, MouseInputEventArgs e)
 {
 }
Example #29
0
 private void RebuildList()
 {
     CurrentlySelected = null;
     _dropDown.components.Clear();
     int offset = 0;
     foreach (
         ListboxItem newEntry in _contentStrings.Select(str => new ListboxItem(str, _width, _resourceManager)))
     {
         newEntry.Position = new Point(0, offset);
         newEntry.Update(0);
         newEntry.Clicked += NewEntryClicked;
         _dropDown.components.Add(newEntry);
         offset += (int) newEntry.Text.Height;
     }
 }
Example #30
0
 private void _applybtt_Clicked(Label sender, MouseInputEventArgs e)
 {
     ApplyVideoMode();
 }
Example #31
0
 private void ClearLabelClicked(Label sender, MouseInputEventArgs e)
 {
     _clearLabel.BackgroundColor = Color.Gray;
     BuildEntityList();
 }
Example #32
0
        public JobTab(string uniqueName, Size size, IResourceManager resourceManager)
            : base(uniqueName, size, resourceManager)
        {
            _bttReady = new ImageButton()
                {
                    ImageNormal = "lobby_ready",
                    ImageHover = "lobby_ready_green",
                    BlendingMode = BlendingModes.None
                };
            _bttReady.Clicked += _bttReady_Clicked;
            _bttReady.Update(0);

            _imgWhatDep = new SimpleImage()
                {
                    Sprite = "lobby_whatdep"
                };

            _imgWhatDep.Update(0);
            _imgWhatDep.Position = new Point((int)(size.Width / 2f - _imgWhatDep.ClientArea.Width / 2f),  30);
            _imgWhatDep.Update(0);

            _imgJobDesc = new SimpleImage()
            {
                Sprite = "lobby_descbg"
            };

            _shwDepa = new LobbyShowcase
            {
                Position = new Point(60, _imgWhatDep.ClientArea.Bottom + 5),
                Size = new Size(675, 80),
                ButtonLeft = "job_arrowleft",
                ButtonRight = "job_arrowright",
                SelectionBackground = "dep_glow",
                ItemSpacing = 20,
                //ItemOffsets = new Size(40, 0)
            };
            _shwDepa.Update(0);

            _imgDepGrad = new SimpleImage()
            {
                Sprite = "lobby_depgrad",
                Color = Color.FromArgb(120, Color.White),
                BlendingMode = BlendingModes.None
            };
            _imgDepGrad.Update(0);
            _imgDepGrad.Position = new Point(_shwDepa.ClientArea.X + (int)(_shwDepa.ClientArea.Width / 2f - _imgDepGrad.ClientArea.Width / 2f), _shwDepa.ClientArea.Top);

            _lblDep = new Label("DEPARTMENT", "MICROGBE", resourceManager)
            {
                BackgroundColor = Color.WhiteSmoke,
                DrawBackground = true,
                TextColor = Color.FromArgb(53,57,66)
            };

            _lblDep.Update(0);
            _lblDep.Position = new Point((int)(size.Width / 2f - _lblDep.ClientArea.Width / 2f), _shwDepa.ClientArea.Bottom + 5);
            _lblDep.Update(0);

            _imgJobFluff = new SimpleImage()
            {
                Sprite = "lobby_jobfluff"
            };
            _imgJobFluff.Position = new Point(_lblDep.ClientArea.X + (int)(_lblDep.ClientArea.Width / 2f - _imgJobFluff.ClientArea.Width / 2f), _lblDep.ClientArea.Bottom);

            _shwJobs = new LobbyShowcase
            {
                Position = new Point(60, _lblDep.ClientArea.Bottom + 25),
                Size = new Size(675, 80),
                ButtonLeft = "job_arrowleft",
                ButtonRight = "job_arrowright",
                SelectionBackground = "job_glow"
            };
            _shwJobs.Update(0);

            _imgJobGrad = new SimpleImage()
            {
                Sprite = "lobby_jobgrad",
                Color = Color.FromArgb(120, Color.White),
                BlendingMode = BlendingModes.None
            };
            _imgJobGrad.Update(0);
            _imgJobGrad.Position = new Point(_shwJobs.ClientArea.X + (int)(_shwJobs.ClientArea.Width / 2f - _imgJobGrad.ClientArea.Width / 2f), _shwJobs.ClientArea.Top);

            _imgJobDesc.Update(0);
            _imgJobDesc.Position = new Point(0, _shwJobs.ClientArea.Bottom - 12);
            _imgJobDesc.Update(0);

            _lbljobName = new Label(" ", "MICROGBE", resourceManager)
            {
                TextColor = Color.WhiteSmoke
            };
            _lbljobName.Position = new Point(3, _imgJobDesc.Position.Y + 4);

            _lbljobName.Update(0);

            _lbljobDesc = new Label(" ", "MICROGME", resourceManager)
            {
                TextColor = Color.WhiteSmoke
            };
            _lbljobDesc.Position = new Point(3, _lbljobName.ClientArea.Bottom + 5);

            _bttReady.Position = new Point(ClientArea.Width - _bttReady.ClientArea.Width - 5, _imgJobDesc.ClientArea.Bottom + 4);

            components.Add(_lblDep);
            components.Add(_imgWhatDep);
            components.Add(_imgDepGrad);
            components.Add(_shwDepa);
            components.Add(_imgJobGrad);
            components.Add(_shwJobs);
            components.Add(_imgJobFluff);
            components.Add(_imgJobDesc);
            components.Add(_lbljobDesc);
            components.Add(_lbljobName);
            components.Add(_bttReady);
        }
Example #33
0
        private void TileLabelClicked(Label sender, MouseInputEventArgs e)
        {
            foreach (GuiComponent curr in _tileList.components.Where(curr => curr.GetType() == typeof (Label)))
                ((Label) curr).BackgroundColor = Color.Gray;

            var newObjInfo = new PlacementInformation
                                 {
                                     PlacementOption = "AlignTileAny",
                                     TileType = sender.Text.Text,
                                     Range = 400,
                                     IsTile = true
                                 };

            if (sender.Text.Text == "Wall")
            {
                newObjInfo.PlacementOption = "AlignWallPlace";
            }

            _placementManager.BeginPlacing(newObjInfo);

            sender.BackgroundColor = Color.ForestGreen;
        }
Example #34
0
 private void _applybtt_Clicked(Label sender, MouseInputEventArgs e)
 {
     ApplyVideoMode();
 }
Example #35
0
        public OptionsMenu(IDictionary<Type, object> managers)
            : base(managers)
        {
            _background = ResourceManager.GetSprite("mainbg");
            _background.Smoothing = Smoothing.Smooth;

            _lblfullscreen = new Label("Fullscreen", "CALIBRI", ResourceManager);

            _chkfullscreen = new Checkbox(ResourceManager);
            _chkfullscreen.Value = ConfigurationManager.GetFullscreen();
            _chkfullscreen.ValueChanged += _chkfullscreen_ValueChanged;

            _lblvsync = new Label("Vsync", "CALIBRI", ResourceManager);

            _chkvsync = new Checkbox(ResourceManager);
            _chkvsync.Value = ConfigurationManager.GetVsync();
            _chkvsync.ValueChanged += _chkvsync_ValueChanged;

            _reslistbox = new Listbox(250, 150, ResourceManager);
            _reslistbox.ItemSelected += _reslistbox_ItemSelected;

            IOrderedEnumerable<VideoMode> modes = from v in Gorgon.CurrentDriver.VideoModes
                                                  where
                                                      (v.Height > 748 && v.Width > 1024) &&
                                                      v.Format == BackBufferFormats.BufferRGB888 && v.RefreshRate >= 59
                                                  //GOSH I HOPE NOONES USING 16 BIT COLORS. OR RUNNING AT LESS THAN 59 hz
                                                  orderby v.Height*v.Width ascending
                                                  select v;

            if (!modes.Any())
                //No compatible videomodes at all. It is likely the game is being run on a calculator. TODO handle this.
                Application.Exit();

            foreach (VideoMode vm in modes)
            {
                if (!vmList.ContainsKey(GetVmString(vm)))
                {
                    vmList.Add(GetVmString(vm), vm);
                    _reslistbox.AddItem(GetVmString(vm));
                }
            }

            if (
                vmList.Any(
                    x =>
                    x.Value.Width == Gorgon.CurrentVideoMode.Width && x.Value.Height == Gorgon.CurrentVideoMode.Height &&
                    x.Value.RefreshRate ==
                    (Gorgon.Screen.Windowed ? Gorgon.DesktopVideoMode.RefreshRate : Gorgon.CurrentVideoMode.RefreshRate)))
            {
                KeyValuePair<string, VideoMode> curr =
                    vmList.FirstOrDefault(
                        x =>
                        x.Value.Width == Gorgon.CurrentVideoMode.Width &&
                        x.Value.Height == Gorgon.CurrentVideoMode.Height &&
                        x.Value.RefreshRate ==
                        (Gorgon.Screen.Windowed
                             ? Gorgon.DesktopVideoMode.RefreshRate
                             : Gorgon.CurrentVideoMode.RefreshRate));
                _reslistbox.SelectItem(curr.Key, false);
            }
            else
            {
                //No match due to different refresh rate in windowed mode. Just pick first resolution based on size only.
                KeyValuePair<string, VideoMode> curr =
                    vmList.FirstOrDefault(
                        x =>
                        x.Value.Width == Gorgon.CurrentVideoMode.Width &&
                        x.Value.Height == Gorgon.CurrentVideoMode.Height);
                _reslistbox.SelectItem(curr.Key, false);
            }

            _ticketbg = ResourceManager.GetSprite("ticketoverlay");

            _mainmenubtt = new Label("Main Menu", "CALIBRI", ResourceManager);
            _mainmenubtt.DrawBorder = true;
            _mainmenubtt.Clicked += _mainmenubtt_Clicked;

            _applybtt = new Label("Apply", "CALIBRI", ResourceManager);
            _applybtt.DrawBorder = true;
            _applybtt.Clicked += _applybtt_Clicked;
        }
Example #36
0
 private void _mainmenubtt_Clicked(Label sender, MouseInputEventArgs e)
 {
     StateManager.RequestStateChange <MainScreen>();
 }