Exemplo n.º 1
0
        private void SlotDropped(EquipmentSlotUi sender, Entity dropped)
        {
            _userInterfaceManager.DragInfo.Reset();

            if (_playerManager.ControlledEntity == null)
            {
                return;
            }

            Entity entity = _playerManager.ControlledEntity;

            var equipment = (EquipmentComponent)entity.GetComponent(ComponentFamily.Equipment);

            equipment.DispatchEquip(dropped.Uid); //Serverside equip component will equip and remove from hands.
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        private void SlotDropped(EquipmentSlotUi sender, Entity dropped)
        {
            _userInterfaceManager.DragInfo.Reset();

            if (_playerManager.ControlledEntity == null)
                return;

            Entity entity = _playerManager.ControlledEntity;

            var equipment = (EquipmentComponent) entity.GetComponent(ComponentFamily.Equipment);

            equipment.DispatchEquip(dropped.Uid); //Serverside equip component will equip and remove from hands.
        }
Exemplo n.º 4
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);
        }