Пример #1
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);
            }
        }
Пример #2
0
        public Chatbox(IResourceManager resourceManager, IUserInterfaceManager userInterfaceManager,
                       IKeyBindingManager keyBindingManager)
        {
            _resourceManager = resourceManager;
            _userInterfaceManager = userInterfaceManager;
            _keyBindingManager = keyBindingManager;

            Position = new Vector2i((int)CluwneLib.CurrentClippingViewport.Width - (int)Size.X - 10, 10);

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

            _textInputLabel = new Label("", "CALIBRI", _resourceManager)
                                  {
                                      Text =
                                          {
                                              Size = new Vector2i(ClientArea.Width - 10, 12),
                                              Color = new SFML.Graphics.Color(0, 128, 0)
                                          }
                                  };

            _chatColors = new Dictionary<ChatChannel, SFML.Graphics.Color>
                              {
                                  [ChatChannel.Default] = new SFML.Graphics.Color(128, 128, 128),
                                  [ChatChannel.Damage ] = Color.Red,
                                  [ChatChannel.Radio  ] = new SFML.Graphics.Color(0, 100, 0),
                                  [ChatChannel.Server ] = Color.Blue,
                                  [ChatChannel.Player ] = new SFML.Graphics.Color(0, 128, 0),
                                  [ChatChannel.Lobby  ] = Color.White,
                                  [ChatChannel.Ingame ] = new SFML.Graphics.Color(0, 128, 0),
                                  [ChatChannel.OOC    ] = Color.White,
                                  [ChatChannel.Emote  ] = Color.Cyan,
                                  [ChatChannel.Visual ] = Color.Yellow,
                              };
        }
Пример #3
0
        public Chatbox(IResourceManager resourceManager, IUserInterfaceManager userInterfaceManager,
                       IKeyBindingManager keyBindingManager)
        {
            _resourceManager = resourceManager;
            _userInterfaceManager = userInterfaceManager;
            _keyBindingManager = keyBindingManager;

            Position = new Point((int)CluwneLib.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},
                              };
        }
Пример #4
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) (CluwneLib.CurrentRenderTarget.Size.X/2f) - (int) (ClientArea.Width/2f),
                                 (int) (CluwneLib.CurrentRenderTarget.Size.Y/2f) - (int) (ClientArea.Height/2f));
            _placementManager.PlacementCanceled += PlacementManagerPlacementCanceled;
        }
Пример #5
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;
            }
        }
Пример #6
0
        public MainScreen(IDictionary<Type, object> managers)
            : base(managers)
        {
            _Width = (int) CluwneLib.Camera.ViewSize.X;
            _Height = (int) CluwneLib.Camera.ViewSize.Y;
            _background = ResourceManager.GetSprite("mainbg_filler");
          //  _background.Smoothing = Smoothing.Smooth;

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

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

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

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

            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(_Width -  _lblVersion.ClientArea.Width  - 3,
                                             _Height - _lblVersion.ClientArea.Height - 3);


            _imgTitle = new SimpleImage
            {
                Sprite = "SpaceStationLogoColor",
                Position = new Point(_Width-550, 100),
            };

			_lblVersion.Update(0);
			_imgTitle.Update(0);
			_txtConnect.Position = new Point(_imgTitle.ClientArea.Left + 40, _imgTitle.ClientArea.Bottom + 50);
			_txtConnect.Update(0);
			_btnConnect.Position = new Point(_txtConnect.Position.X, _txtConnect.ClientArea.Bottom + 20);
			_btnConnect.Update(0);
			_btnOptions.Position = new Point(_btnConnect.Position.X, _btnConnect.ClientArea.Bottom + 20);
			_btnOptions.Update(0);
			_btnExit.Position = new Point(_btnOptions.Position.X, _btnOptions.ClientArea.Bottom + 20);
			_btnExit.Update(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);
     }
 }
Пример #8
0
 public void AddLine(string text, SFML.Graphics.Color color)
 {
     Label newLabel = new Label(text, "MICROGBE", this._resourceManager);
     newLabel.Position = new Vector2i(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 = new SFML.Graphics.Color(245, 245, 245);
            _message.Text.Color = new SFML.Graphics.Color(245, 245, 245);
        }
Пример #10
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 Vector2f(1, 1);
            healthPc.Text.Shadowed = true;
            healthPc.Text.Color = new SFML.Graphics.Color(255, 250, 240);
        }
Пример #11
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);
        }
Пример #12
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;
            }
        }
 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;
     }
 }
Пример #14
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 = (CluwneSprite) reply.ParamsList[0];
                _entityDescription.Position = new Point(10,
                                                        (int) _entitySprite.Height +
                                                        _entityDescription.ClientArea.Height + 10);
            }
            else
                _entityDescription.Position = new Point(10, 10);
        }
Пример #15
0
		private void _mainmenubtt_Clicked(Label sender, MouseButtonEventArgs e)
        {
            StateManager.RequestStateChange<MainScreen>();
        }
Пример #16
0
 private void _applybtt_Clicked(Label sender, MouseButtonEventArgs e)
 {
     ApplyVideoMode();
 }
Пример #17
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;
     }
 }
Пример #18
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;
        }
Пример #19
0
		private void NewEntryClicked(Label sender, MouseButtonEventArgs e)
        {
            SetItem(sender, true);
        }
Пример #20
0
 public override void Dispose()
 {
     _disposing = true;
     TextSubmitted = null;
     _entries.Clear();
     _textInputLabel = null;
     _chatColors.Clear();
     base.Dispose();
 }
Пример #21
0
		private void _connectbtt_Clicked(Label sender, MouseButtonEventArgs e)
        {
        }
Пример #22
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;

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

            IOrderedEnumerable<VideoMode> modes = from v in SFML.Window.VideoMode.FullscreenModes where 
                                     (v.Height > 748 && v.Width > 1024) //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);
                    _lstResolution.AddItem(GetVmString(vm));
                }
            }

            if (
                 vmList.Any(
                    x=>
                    x.Value.Width == CluwneLib.Camera.ViewSize.X && x.Value.Height == CluwneLib.Camera.ViewSize.Y ))
                    
            {
                KeyValuePair<string, VideoMode> curr =
                    vmList.FirstOrDefault(
                        x =>
                        x.Value.Width == CluwneLib.Camera.ViewSize.X &&
                        x.Value.Height == CluwneLib.Camera.ViewSize.Y );
                        
                _lstResolution.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 == CluwneLib.Camera.ViewSize.X &&
                        x.Value.Height == CluwneLib.Camera.ViewSize.Y);
                _lstResolution.SelectItem(curr.Key, false);
            }

            _ticketBg = ResourceManager.GetSprite("ticketoverlay");

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

            _btnApply = new Label("Apply", "CALIBRI", ResourceManager);
            _btnApply.DrawBorder = true;
            _btnApply.Clicked += _applybtt_Clicked;


            _lstResolution.Position = new Point(45 , (int)(CluwneLib.Camera.ViewSize.Y / 2.5f));
			_lstResolution.Update(0);
			_chkFullscreen.Position = new Point(_lstResolution.Position.X,
												_lstResolution.Position.Y + _lstResolution.ClientArea.Height + 10);
			_chkFullscreen.Update(0);
			_chkVsync.Position = new Point(_chkFullscreen.Position.X,
										   _chkFullscreen.Position.Y + _chkFullscreen.ClientArea.Height + 10);
			_chkVsync.Update(0);
			_lblFullscreen.Position = new Point(_chkFullscreen.Position.X + _chkFullscreen.ClientArea.Width + 3,
												_chkFullscreen.Position.Y + (int)(_chkFullscreen.ClientArea.Height / 2f) -
												(int)(_lblFullscreen.ClientArea.Height / 2f));
			_lblFullscreen.Update(0);
			_lblVsync.Position = new Point(_chkVsync.Position.X + _chkVsync.ClientArea.Width + 3,
										   _chkVsync.Position.Y + (int)(_chkVsync.ClientArea.Height / 2f) -
										   (int)(_chkVsync.ClientArea.Height / 2f));
			_lblVsync.Update(0);
			_btnMainMenu.Position = new Point(_lstResolution.Position.X + 650, _lstResolution.Position.Y);
			_btnMainMenu.Update(0);
			_btnApply.Position = new Point(_btnMainMenu.Position.X,
										   _btnMainMenu.Position.Y + _btnMainMenu.ClientArea.Height + 5);
			_btnApply.Update(0);
        }
Пример #23
0
 private void _connectbtt_Clicked(Label sender, MouseInputEventArgs e)
 {
 }
Пример #24
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);
            }
        }
Пример #25
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) (CluwneLib.CurrentRenderTarget.Size.X/2f) - (int) (ClientArea.Width/2f),
                                 (int) (CluwneLib.CurrentRenderTarget.Size.Y/2f) - (int) (ClientArea.Height/2f));
            _placementManager.PlacementCanceled += PlacementManagerPlacementCanceled;
        }
Пример #26
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);
            }
        }
Пример #27
0
 private void _connectbtt_Clicked(Label sender, MouseButtonEventArgs e)
 {
 }
Пример #28
0
 private void _exitbtt_Clicked(Label sender)
 {
     Environment.Exit(0);
 }
Пример #29
0
        public Lobby(IDictionary<Type, object> managers)
            : base(managers)
        {
            _background = ResourceManager.GetSprite("mainbg");
            _background.Smoothing = true;

            _imgMainBg = 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),
                            ZDepth = 2
                        };

            _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 Vector2(780,225),
                };

            _lobbyChat.Update(0);

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

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

            _btnReady = new ImageButton()
            {
                ImageNormal = "lobby_ready",
                ImageHover = "lobby_ready_green",
                //BlendingMode = BlendingModes.None,
                ZDepth = 1
            };
            _btnReady.Clicked += _btnReady_Clicked;
            _btnReady.Update(0);

            _lblServerInfo.FixedWidth = 100;
            _lblModeInfo.FixedWidth = 90;
            _lblPlayersInfo.FixedWidth = 60;
            _lblPortInfo.FixedWidth = 50;

            UpdateGUIPosition();
        }
Пример #30
0
 private void _mainmenubtt_Clicked(Label sender, MouseButtonEventArgs e)
 {
     StateManager.RequestStateChange <MainScreen>();
 }
Пример #31
0
 private void ClearLabelClicked(Label sender, MouseButtonEventArgs e)
 {
     _clearLabel.BackgroundColor = new SFML.Graphics.Color(128, 128, 128);
     BuildEntityList();
 }
Пример #32
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;

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

            IOrderedEnumerable <VideoMode> modes = from v in SFML.Window.VideoMode.FullscreenModes where
                                                   (v.Height > 748 && v.Width > 1024) //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);
                    _lstResolution.AddItem(GetVmString(vm));
                }
            }

            if (
                vmList.Any(
                    x =>
                    x.Value.Width == CluwneLib.Screen.Size.X && x.Value.Height == CluwneLib.Screen.Size.Y))

            {
                KeyValuePair <string, VideoMode> curr =
                    vmList.FirstOrDefault(
                        x =>
                        x.Value.Width == CluwneLib.Screen.Size.X &&
                        x.Value.Height == CluwneLib.Screen.Size.Y);

                _lstResolution.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 == CluwneLib.Screen.Size.X &&
                        x.Value.Height == CluwneLib.Screen.Size.Y);
                _lstResolution.SelectItem(curr.Key, false);
            }

            _ticketBg = ResourceManager.GetSprite("ticketoverlay");

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

            _btnApply            = new Label("Apply", "CALIBRI", ResourceManager);
            _btnApply.DrawBorder = true;
            _btnApply.Clicked   += _applybtt_Clicked;


            _lstResolution.Position = new Point(45, (int)(CluwneLib.Screen.Size.Y / 2.5f));
            _lstResolution.Update(0);
            _chkFullscreen.Position = new Point(_lstResolution.Position.X,
                                                _lstResolution.Position.Y + _lstResolution.ClientArea.Height + 10);
            _chkFullscreen.Update(0);
            _chkVsync.Position = new Point(_chkFullscreen.Position.X,
                                           _chkFullscreen.Position.Y + _chkFullscreen.ClientArea.Height + 10);
            _chkVsync.Update(0);
            _lblFullscreen.Position = new Point(_chkFullscreen.Position.X + _chkFullscreen.ClientArea.Width + 3,
                                                _chkFullscreen.Position.Y + (int)(_chkFullscreen.ClientArea.Height / 2f) -
                                                (int)(_lblFullscreen.ClientArea.Height / 2f));
            _lblFullscreen.Update(0);
            _lblVsync.Position = new Point(_chkVsync.Position.X + _chkVsync.ClientArea.Width + 3,
                                           _chkVsync.Position.Y + (int)(_chkVsync.ClientArea.Height / 2f) -
                                           (int)(_chkVsync.ClientArea.Height / 2f));
            _lblVsync.Update(0);
            _btnMainMenu.Position = new Point(_lstResolution.Position.X + 650, _lstResolution.Position.Y);
            _btnMainMenu.Update(0);
            _btnApply.Position = new Point(_btnMainMenu.Position.X,
                                           _btnMainMenu.Position.Y + _btnMainMenu.ClientArea.Height + 5);
            _btnApply.Update(0);
        }
Пример #33
0
		private void _applybtt_Clicked(Label sender, MouseButtonEventArgs e)
        {
            ApplyVideoMode();
        }
Пример #34
0
		private void ClearLabelClicked(Label sender, MouseButtonEventArgs e)
        {
            _clearLabel.BackgroundColor = Color.Gray;
            BuildEntityList();
        }
Пример #35
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);
        
     }
 }
Пример #36
0
        public ContextMenuButton(ContextMenuEntry entry, Vector2f size, IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;

            UserData = entry.ComponentMessage;
            Size = size;
            _currentColor = new SFML.Graphics.Color(128, 128, 128);
            _iconSprite = _resourceManager.GetSprite(entry.IconName);
            _textLabel = new Label(entry.EntryName, "CALIBRI", _resourceManager);
            _textLabel.Update(0);
        }
Пример #37
0
 private void _exitbtt_Clicked(Label sender)
 {
     Environment.Exit(0);
 }