Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 3
0
        public void AddLine(string text, SFML.Graphics.Color color)
        {
            bool  atBottom = scrollbarV.Value >= scrollbarV.max;
            Label newLabel = new Label(text, "MICROGBE", this._resourceManager)
            {
                Position  = new Vector2i(5, last_y),
                TextColor = color
            };

            newLabel.Update(0);
            last_y = newLabel.ClientArea.Bottom();
            components.Add(newLabel);
            if (atBottom)
            {
                Update(0);
                scrollbarV.Value = scrollbarV.max;
            }
        }
Ejemplo n.º 4
0
        public override void Update(float frameTime)
        {
            const int x_inner   = 4;
            const int y_inner   = 25;
            const int dec_inner = 7;

            panelBG.Position            = new Vector2f(Position.X, Position.Y);
            healthMeterBg.Position      = new Vector2f(Position.X + x_inner, Position.Y + y_inner);
            healthMeterOverlay.Position = new Vector2f(Position.X + x_inner, Position.Y + y_inner);
            healthMeterGrid.Position    = new Vector2f(Position.X + x_inner, Position.Y + y_inner);

            var panelBounds = panelBG.GetLocalBounds();

            ClientArea = new FloatRect(panelBounds.Left, panelBounds.Top, panelBounds.Width, panelBounds.Height).Round();

            var healthMeterBounds = healthMeterOverlay.GetLocalBounds();

            healthMeterInner = new IntRect(Position.X + x_inner + dec_inner, Position.Y + y_inner + dec_inner,
                                           (int)(healthMeterBounds.Width - (2 * dec_inner)),
                                           (int)(healthMeterBounds.Height - (2 * dec_inner)));
            healthPc.Position = new Vector2i(healthMeterInner.Left + 5,
                                             (int)
                                             (healthMeterInner.Top + (healthMeterInner.Height / 2f) -
                                              (healthPc.ClientArea.Height / 2f)) - 2);
            healthPc.Update(frameTime);

            Entity entity = _playerManager.ControlledEntity;

            if (entity != null && entity.HasComponent(ComponentFamily.Damageable))
            {
                var   comp    = (HealthComponent)entity.GetComponent(ComponentFamily.Damageable);
                float _health = comp.GetHealth();

                healthPct = comp.GetHealth() / comp.GetMaxHealth();
                if (float.IsNaN(healthPct))
                {
                    healthPct = 1;                         //This can happen when the components are not ready yet.
                }
                interpCol          = ColorUtils.InterpolateBetween(ColCritical, ColHealthy, healthPct);
                healthPc.Text.Text = Math.Round((healthPct * 100)).ToString() + "%";
            }

            blipTime += frameTime;
        }
 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;
     }
 }
Ejemplo n.º 6
0
        public void AddLine(string message, ChatChannel channel)
        {
            if (_disposing)
            {
                return;
            }

            int lineHeight = 12;

            bool atBottom = scrollbarV.Value >= scrollbarV.max;

            foreach (string content in CheckInboundMessage(message))
            {
                var label = new Label(content, "CALABRI", _resourceManager)
                {
                    Position = new Vector2i(5, last_y),
                    Text     =
                    {
                        Size  = new Vector2i(ClientArea.Width - 10, lineHeight),
                        Color = _chatColors[channel],
                    }
                };
                label.Update(0);
                last_y = label.ClientArea.Bottom();
                components.Add(label);

                // If the message had newlines adjust the bottom to fix the extra lines
                if (message.Split('\n').Length > 0)
                {
                    last_y += lineHeight * (message.Split('\n').Length - 1);
                }
            }

            if (atBottom)
            {
                Update(0);
                scrollbarV.Value = scrollbarV.max;
            }
        }
Ejemplo n.º 7
0
        private void BuildTileList(string searchStr = null)
        {
            int maxWidth = 0;
            int yOffset  = 5;

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

            var tileDefs = IoCManager.Resolve <ITileDefinitionManager>().Select(td => td.Name);

            if (!string.IsNullOrEmpty(searchStr))
            {
                tileDefs = tileDefs.Where(s => s.IndexOf(searchStr, StringComparison.InvariantCultureIgnoreCase) >= 0);
                _clearLabel.BackgroundColor = new SFML.Graphics.Color(211, 211, 211);
            }

            foreach (string entry in tileDefs)
            {
                var tileLabel = new Label(entry, "CALIBRI", _resourceManager);
                _tileList.components.Add(tileLabel);
                tileLabel.Position       = new Vector2i(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;
            }
        }
Ejemplo n.º 8
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 Vector2i(10, pos_y);
                newButt.Update(0);
                var newLabel = new Label(act.Name, "CALIBRI", _resourceManager);
                newLabel.Update(0);
                newLabel.Position = new Vector2i(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;
            }
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
0
        public MainScreen(IDictionary<Type, object> managers)
            : base(managers)
        {
            _Width = (int) CluwneLib.Screen.Size.X;
            _Height = (int) CluwneLib.Screen.Size.Y;
            _background = ResourceManager.GetSprite("coderart");

            _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.Position = new Vector2i(_Width / 3, _Height / 2);
            _txtConnect.OnSubmit += ConnectTextboxOnSubmit;

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

            _lblVersion = new Label("v. " + fvi.FileVersion, "CALIBRI", ResourceManager);
            _lblVersion.Text.Color = new SFML.Graphics.Color(245, 245, 245);

            _lblVersion.Position = new Vector2i(_Width -  _lblVersion.ClientArea.Width  - 3,
                                             _Height - _lblVersion.ClientArea.Height - 3);

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

            _lblVersion.Update(0);
            _imgTitle.Update(0);
            _txtConnect.Position = new Vector2i(_imgTitle.ClientArea.Left + 40, _imgTitle.ClientArea.Bottom() + 50);
            _txtConnect.Update(0);
            _btnConnect.Position = new Vector2i(_txtConnect.Position.X, _txtConnect.ClientArea.Bottom() + 20);
            _btnConnect.Update(0);
            _btnOptions.Position = new Vector2i(_btnConnect.Position.X, _btnConnect.ClientArea.Bottom() + 20);
            _btnOptions.Update(0);
            _btnExit.Position = new Vector2i(_btnOptions.Position.X, _btnOptions.ClientArea.Bottom() + 20);
            _btnExit.Update(0);
        }
Ejemplo n.º 12
0
        public JobTab(string uniqueName, Size size, IResourceManager resourceManager)
            : base(uniqueName, size, resourceManager)
        {
            _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);

            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);
        }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
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);
            }
        }
Ejemplo n.º 15
0
        private void BuildTileList(string searchStr = null)
        {
            int maxWidth = 0;
            int yOffset = 5;

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

            var tileDefs = IoCManager.Resolve<ITileDefinitionManager>().Select(td => td.Name);

            if (!string.IsNullOrEmpty(searchStr))
            {
                tileDefs = tileDefs.Where(s => s.IndexOf(searchStr, StringComparison.InvariantCultureIgnoreCase) >= 0);
                _clearLabel.BackgroundColor = Color.LightGray;
            }

            foreach (string entry in tileDefs)
            {
                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;
        }
Ejemplo n.º 16
0
        public JobTab(string uniqueName, Vector2i size, IResourceManager resourceManager)
            : base(uniqueName, size, resourceManager)
        {
            _imgWhatDep = new SimpleImage()
                {
                    Sprite = "lobby_whatdep"
                };

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

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

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

            _imgDepGrad = new SimpleImage()
            {
                Sprite = "lobby_depgrad",
                Color = Color.White.WithAlpha(120)
            };
            _imgDepGrad.Update(0);
            _imgDepGrad.Position = new Vector2i(_shwDepa.ClientArea.Left + (int)(_shwDepa.ClientArea.Width / 2f - _imgDepGrad.ClientArea.Width / 2f), _shwDepa.ClientArea.Top);

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

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

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

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

            _imgJobGrad = new SimpleImage()
            {
                Sprite = "lobby_jobgrad",
                Color = Color.White.WithAlpha(120)
            };
            _imgJobGrad.Update(0);
            _imgJobGrad.Position = new Vector2i(_shwJobs.ClientArea.Left + (int)(_shwJobs.ClientArea.Width / 2f - _imgJobGrad.ClientArea.Width / 2f), _shwJobs.ClientArea.Top);

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

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

            _lbljobName.Update(0);

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

            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);
        }