Ejemplo n.º 1
0
 protected override void button_Clicked(ImageButton sender)
 {
     if (_items.Exists(x => x.Key == sender))
     {
         KeyValuePair<ImageButton, object> sel = _items.Find(x => x.Key == sender);
         Selected = _items.IndexOf(sel);
     }
 }
Ejemplo n.º 2
0
 private void tabButton_Clicked(ImageButton sender)
 {
     if (_tabs.Exists(x => x.Key == sender))
     {
         KeyValuePair<ImageButton, TabContainer> tab = _tabs.Find(x => x.Key == sender);
         SelectTab(tab.Value);
     }
 }
Ejemplo n.º 3
0
        public void AddTab(TabContainer newTab)
        {
            var newButton = new ImageButton();
            newButton.Clicked += tabButton_Clicked;

            _tabs.Add(new KeyValuePair<ImageButton, TabContainer>(newButton, newTab));
            rebuildButtonIcons();
        }
Ejemplo n.º 4
0
        public override void AddItem(ImageButton button, Object associatedData)
        {
            if (button == null || associatedData == null) return;

            if (!_items.Exists(x => x.Key == button || x.Value == associatedData))
            {
                _items.Add(new KeyValuePair<ImageButton, object>(button, associatedData));
                button.Clicked += button_Clicked;
            }

            ScrollOffset = (int)Math.Floor(_items.Count / 2f); //start in the middle. cosmetic thing only.
            Selected = ScrollOffset;
        }
Ejemplo n.º 5
0
        public bool ShowArrows = true; //Show side arrows?

        public Showcase()
        {
            _resourceManager = IoCManager.Resolve<IResourceManager>();

            _buttonLeft = new ImageButton();
            _buttonLeft.Clicked += _buttonLeft_Clicked;

            _buttonRight = new ImageButton();
            _buttonRight.Clicked += _buttonRight_Clicked;

            _selectionGlow = new SimpleImage();

            Update(0);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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)
                              };
        }
Ejemplo n.º 8
0
        void _shwDepa_SelectionChanged(ImageButton sender, object associatedData)
        {
            _tabJob._shwJobs.ClearItems();

            if (associatedData is DepartmentInfo)
            {
                DepartmentInfo info = (DepartmentInfo) associatedData;

                _tabJob._imgJobGrad.Color = Color.FromArgb(_tabJob._imgJobGrad.Color.A, ColorTranslator.FromHtml(info.Department.DepartmentColorHex));

                _tabJob._lblDep.Text.Text = info.Department.Name;

                foreach (JobDefinition def in info.JobDefs)
                {
                    var newJob = new ImageButton
                    {
                        ImageNormal = def.JobIcon
                    };

                    _tabJob._shwJobs.AddItem(newJob, def);
                }
            }
        }
Ejemplo n.º 9
0
        void _shwJobs_SelectionChanged(ImageButton sender, object associatedData)
        {
            if (associatedData != null && associatedData is JobDefinition)
            {
                JobDefinition jobDef = (JobDefinition) associatedData;

                _tabJob._lbljobName.Text.Text = jobDef.Name;
                _tabJob._lbljobDesc.Text.Text = jobDef.Description;

                var netManager = IoCManager.Resolve<INetworkManager>();
                NetOutgoingMessage playerJobSpawnMsg = netManager.CreateMessage();
                playerJobSpawnMsg.Write((byte) NetMessage.RequestJob);
                playerJobSpawnMsg.Write(jobDef.Name);
                netManager.SendMessage(playerJobSpawnMsg, NetDeliveryMethod.ReliableOrdered);
            }
        }
Ejemplo n.º 10
0
        public HumanComboGui(IPlayerManager playerManager, INetworkManager networkManager,
                             IResourceManager resourceManager, IUserInterfaceManager userInterfaceManager)
        {
            _networkManager = networkManager;
            _playerManager = playerManager;
            _resourceManager = resourceManager;
            _userInterfaceManager = userInterfaceManager;

            ComponentClass = GuiComponentType.ComboGui;

            #region Status UI

            _ResBlunt = new ArmorInfoLabel(DamageType.Bludgeoning, resourceManager);
            _ResBurn = new ArmorInfoLabel(DamageType.Burn, resourceManager);
            _ResFreeze = new ArmorInfoLabel(DamageType.Freeze, resourceManager);
            _ResPierce = new ArmorInfoLabel(DamageType.Piercing, resourceManager);
            _ResShock = new ArmorInfoLabel(DamageType.Shock, resourceManager);
            _ResSlash = new ArmorInfoLabel(DamageType.Slashing, resourceManager);
            _ResTox = new ArmorInfoLabel(DamageType.Toxin, resourceManager);

            #endregion

            _equipBg = _resourceManager.GetSprite("outline");

            _comboBg = _resourceManager.GetSprite("combo_bg");

            _comboClose = new ImageButton
                              {
                                  ImageNormal = "button_closecombo",
                              };

            _tabEquip = new ImageButton
                            {
                                ImageNormal = "tab_equip",
                            };
            _tabEquip.Clicked += TabClicked;

            _tabHealth = new ImageButton
                             {
                                 ImageNormal = "tab_health",
                             };
            _tabHealth.Clicked += TabClicked;

            _tabCraft = new ImageButton
                            {
                                ImageNormal = "tab_craft",
                            };
            _tabCraft.Clicked += TabClicked;

            _comboClose.Clicked += ComboCloseClicked;

            //Left Side - head, eyes, outer, hands, feet
            _slotHead = new EquipmentSlotUi(EquipmentSlot.Head, _playerManager, _resourceManager, _userInterfaceManager);
            _slotHead.Dropped += SlotDropped;

            _slotEyes = new EquipmentSlotUi(EquipmentSlot.Eyes, _playerManager, _resourceManager, _userInterfaceManager);
            _slotEyes.Dropped += SlotDropped;

            _slotOuter = new EquipmentSlotUi(EquipmentSlot.Outer, _playerManager, _resourceManager,
                                             _userInterfaceManager);
            _slotOuter.Dropped += SlotDropped;

            _slotHands = new EquipmentSlotUi(EquipmentSlot.Hands, _playerManager, _resourceManager,
                                             _userInterfaceManager);
            _slotHands.Dropped += SlotDropped;

            _slotFeet = new EquipmentSlotUi(EquipmentSlot.Feet, _playerManager, _resourceManager, _userInterfaceManager);
            _slotFeet.Dropped += SlotDropped;

            //Right Side - mask, ears, inner, belt, back
            _slotMask = new EquipmentSlotUi(EquipmentSlot.Mask, _playerManager, _resourceManager, _userInterfaceManager);
            _slotMask.Dropped += SlotDropped;

            _slotEars = new EquipmentSlotUi(EquipmentSlot.Ears, _playerManager, _resourceManager, _userInterfaceManager);
            _slotEars.Dropped += SlotDropped;

            _slotInner = new EquipmentSlotUi(EquipmentSlot.Inner, _playerManager, _resourceManager,
                                             _userInterfaceManager);
            _slotInner.Dropped += SlotDropped;

            _slotBelt = new EquipmentSlotUi(EquipmentSlot.Belt, _playerManager, _resourceManager, _userInterfaceManager);
            _slotBelt.Dropped += SlotDropped;

            _slotBack = new EquipmentSlotUi(EquipmentSlot.Back, _playerManager, _resourceManager, _userInterfaceManager);
            _slotBack.Dropped += SlotDropped;

            _txtDbg = new TextSprite("comboDlgDbg", "Combo Debug", _resourceManager.GetFont("CALIBRI"));

            _craftSlot1 = new CraftSlotUi(_resourceManager, _userInterfaceManager);
            _craftSlot2 = new CraftSlotUi(_resourceManager, _userInterfaceManager);

            _craftButton = new ImageButton
                               {
                                   ImageNormal = "wrenchbutt"
                               };
            _craftButton.Clicked += CraftButtonClicked;

            _craftStatus = new TextSprite("craftText", "Status", _resourceManager.GetFont("CALIBRI"))
                               {
                                   ShadowColor = Color.DimGray,
                                   ShadowOffset = new Vector2D(1, 1),
                                   Shadowed = true
                               };

            _blueprints = new ScrollableContainer("blueprintCont", new Size(210, 100), _resourceManager);
        }
Ejemplo n.º 11
0
        private void HandleJobList(NetIncomingMessage msg)
        {
            int byteNum = msg.ReadInt32();
            byte[] compressedXml = msg.ReadBytes(byteNum);

            string jobListXml = ZipString.UnZipStr(compressedXml);

            JobHandler.Singleton.LoadDefinitionsFromString(jobListXml);

            _tabJob._shwDepa.ClearItems();
            _tabJob._shwJobs.ClearItems();

            sortedJobs.Clear();

            foreach (DepartmentDefinition dep in JobHandler.Singleton.JobSettings.DepartmentDefinitions)
            {
                var depJobs = (from x in JobHandler.Singleton.JobSettings.JobDefinitions
                              where x.Department.ToLowerInvariant() == dep.Name.ToLowerInvariant()
                              where x.Available
                              orderby x.Name
                              select x).ToList();

                var newEntry = new KeyValuePair<DepartmentDefinition, List<JobDefinition>>(dep, depJobs);
                sortedJobs.Add(newEntry);

                var newDep = new ImageButton
                {
                    ImageNormal = dep.DepartmentIcon,
                };

                DepartmentInfo newInfo = new DepartmentInfo()
                    {
                        Department = dep,
                        JobDefs = depJobs
                    };

                _tabJob._shwDepa.AddItem(newDep, newInfo);
            }
        }
Ejemplo n.º 12
0
 private void _buttConnect_Clicked(ImageButton sender)
 {
     if (!_connectTextbox.IsVisible())
     {
         _connectTextbox.SetVisible(true);
         return;
     }
     else
     {
         if (!_isConnecting)
             StartConnect(_connectTextbox.Text);
         else
         {
             _isConnecting = false;
             NetworkManager.Disconnect();
         }
     }
 }
Ejemplo n.º 13
0
 void _bttReady_Clicked(ImageButton sender)
 {
     var playerManager = IoCManager.Resolve<IPlayerManager>();
     playerManager.SendVerb("joingame", 0);
 }
Ejemplo n.º 14
0
 private void CloseButtonClicked(ImageButton sender)
 {
     Dispose();
 }
Ejemplo n.º 15
0
 private void _buttExit_Clicked(ImageButton sender)
 {
     Environment.Exit(0);
 }
Ejemplo n.º 16
0
 protected virtual void _buttonRight_Clicked(ImageButton sender)
 {
     if (Selected + 1 <= _items.Count - 1) Selected++;
 }
Ejemplo n.º 17
0
 protected virtual void _buttonLeft_Clicked(ImageButton sender)
 {
     if (Selected - 1 >= 0) Selected--;
 }
Ejemplo n.º 18
0
 protected override void _buttonRight_Clicked(ImageButton sender)
 {
     if (ScrollOffset + 1 <= _items.Count - 1) ScrollOffset++;
 }
Ejemplo n.º 19
0
 public override void Dispose()
 {
     _buttonRight = null;
     _buttonLeft = null;
     SelectionChanged = null;
     base.Dispose();
     GC.SuppressFinalize(this);
 }
Ejemplo n.º 20
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);
        }
Ejemplo n.º 21
0
 private void EraserButtonClicked(ImageButton sender)
 {
     _placementManager.ToggleEraser();
 }
Ejemplo n.º 22
0
 private void TabClicked(ImageButton sender)
 {
     if (sender == _tabEquip) ActivateTab(1);
     if (sender == _tabHealth) ActivateTab(2);
     if (sender == _tabCraft) ActivateTab(3);
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 24
0
 private void ComboOpenClicked(ImageButton sender)
     //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 {
     _showTabbedWindow = !_showTabbedWindow;
     _craftStatus.Text = "Status";
     _craftStatus.Color = Color.White;
 }
Ejemplo n.º 25
0
        private void _buttOptions_Clicked(ImageButton sender)
        {
            if (_isConnecting)
            {
                _isConnecting = false;
                NetworkManager.Disconnect();
            }

            StateManager.RequestStateChange<OptionsMenu>();
        }
Ejemplo n.º 26
0
 private void ComboCloseClicked(ImageButton sender)
 {
     _showTabbedWindow = false;
     _craftStatus.Text = "Status";
     _craftStatus.Color = Color.White;
 }
Ejemplo n.º 27
0
        private void CraftButtonClicked(ImageButton sender)
        {
            //craftTimer = new Timer_Bar(new Size(200,15), new TimeSpan(0,0,0,10));
            if (_craftSlot1.ContainingEntity == null || _craftSlot2.ContainingEntity == null) return;

            if (_playerManager != null)
                if (_playerManager.ControlledEntity != null)
                    if (_playerManager.ControlledEntity.HasComponent(ComponentFamily.Inventory))
                    {
                        var invComp =
                            (InventoryComponent) _playerManager.ControlledEntity.GetComponent(ComponentFamily.Inventory);
                        if (invComp.ContainedEntities.Count >= invComp.MaxSlots)
                        {
                            _craftStatus.Text = "Status: Not enough Space";
                            _craftStatus.Color = Color.DarkRed;
                            return;
                        }
                    }

            NetOutgoingMessage msg = _networkManager.CreateMessage();
            msg.Write((byte) NetMessage.CraftMessage);
            msg.Write((byte) CraftMessage.StartCraft);
            msg.Write(_craftSlot1.ContainingEntity.Uid);
            msg.Write(_craftSlot2.ContainingEntity.Uid);
            _networkManager.SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
        }
Ejemplo n.º 28
0
 protected override void _buttonLeft_Clicked(ImageButton sender)
 {
     if (ScrollOffset - 1 >= 0) ScrollOffset--;
 }