Exemplo n.º 1
0
        public HandsGui()
        {
            IoCManager.InjectDependencies(this);

            var textureHandLeft   = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_l.png");
            var textureHandRight  = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_r.png");
            var textureHandActive = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_active.png");
            var storageTexture    = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/back.png");

            _rightStatusPanel = new ItemStatusPanel(true);
            _leftStatusPanel  = new ItemStatusPanel(false);

            _leftButton  = new ItemSlotButton(textureHandLeft, storageTexture);
            _rightButton = new ItemSlotButton(textureHandRight, storageTexture);
            var hBox = new HBoxContainer
            {
                SeparationOverride = 0,
                Children           = { _rightStatusPanel, _rightButton, _leftButton, _leftStatusPanel }
            };

            AddChild(hBox);

            _leftButton.OnPressed         += args => HandKeyBindDown(args, HandNameLeft);
            _leftButton.OnStoragePressed  += args => _OnStoragePressed(args, HandNameLeft);
            _rightButton.OnPressed        += args => HandKeyBindDown(args, HandNameRight);
            _rightButton.OnStoragePressed += args => _OnStoragePressed(args, HandNameRight);

            // Active hand
            _leftButton.AddChild(ActiveHandRect = new TextureRect
            {
                Texture      = textureHandActive,
                TextureScale = (2, 2)
            });
Exemplo n.º 2
0
        public HandsGui()
        {
            IoCManager.InjectDependencies(this);

            AddChild(_guiContainer = new HBoxContainer
            {
                SeparationOverride = 0,
                Children           =
                {
                    (_rightPanel             = ItemStatusPanel.FromSide(HandLocation.Right)),
                    (_handsColumn            = new VBoxContainer
                    {
                        Children             =
                        {
                            (_topPanel       = ItemStatusPanel.FromSide(HandLocation.Middle)),
                            (_handsContainer = new HBoxContainer())
                        }
                    }),
                    (_leftPanel              = ItemStatusPanel.FromSide(HandLocation.Left))
                }
            });
            _leftHandTexture   = _resourceCache.GetTexture("/Textures/Interface/Inventory/hand_l.png");
            _middleHandTexture = _resourceCache.GetTexture("/Textures/Interface/Inventory/hand_l.png");
            _rightHandTexture  = _resourceCache.GetTexture("/Textures/Interface/Inventory/hand_r.png");
        }
Exemplo n.º 3
0
        public HandsGui()
        {
            IoCManager.InjectDependencies(this);

            _configManager.OnValueChanged(CCVars.HudTheme, UpdateHudTheme, invokeImmediately: true);

            AddChild(_guiContainer = new HBoxContainer
            {
                SeparationOverride  = 0,
                HorizontalAlignment = HAlignment.Center,
                Children            =
                {
                    (_handsColumn                   = new VBoxContainer
                    {
                        Children                    =
                        {
                            (_topPanel              = ItemStatusPanel.FromSide(HandLocation.Middle)),
                            (_handsContainer        = new HBoxContainer {
                                HorizontalAlignment = HAlignment.Center
                            })
                        }
                    }),
                }
            });
            _leftHandTexture   = _gameHud.GetHudTexture("hand_l.png");
            _middleHandTexture = _gameHud.GetHudTexture("hand_l.png");
            _rightHandTexture  = _gameHud.GetHudTexture("hand_r.png");
        }
        public HandsGui(HandsComponent hands, HandsSystem handsSystem)
        {
            _handsComponent = hands;
            _handsSystem    = handsSystem;

            RobustXamlLoader.Load(this);
            IoCManager.InjectDependencies(this);

            StatusPanel = ItemStatusPanel.FromSide(HandLocation.Middle);
            StatusContainer.AddChild(StatusPanel);
            StatusPanel.SetPositionFirst();
        }
Exemplo n.º 5
0
        public HandsGui()
        {
            IoCManager.InjectDependencies(this);

            MouseFilter = MouseFilterMode.Stop;

            TextureHandLeft   = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_l.png");
            TextureHandRight  = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_r.png");
            TextureHandActive = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_active.png");

            TexturesCooldownOverlay = new Texture[CooldownLevels];
            for (var i = 0; i < CooldownLevels; i++)
            {
                TexturesCooldownOverlay[i] =
                    _resourceCache.GetTexture($"/Textures/UserInterface/Inventory/cooldown-{i}.png");
            }

            _rightStatusPanel = new ItemStatusPanel(true);
            _leftStatusPanel  = new ItemStatusPanel(false);

            _leftContainer = new Control {
                MouseFilter = MouseFilterMode.Ignore
            };
            _rightContainer = new Control {
                MouseFilter = MouseFilterMode.Ignore
            };
            var hBox = new HBoxContainer
            {
                SeparationOverride = 0,
                Children           = { _rightStatusPanel, _rightContainer, _leftContainer, _leftStatusPanel },
                MouseFilter        = MouseFilterMode.Ignore
            };

            AddChild(hBox);

            var textureLeft = new TextureRect
            {
                Texture      = TextureHandLeft,
                TextureScale = (2, 2)
            };

            textureLeft.OnKeyBindDown += args => HandKeyBindDown(args, HandNameLeft);

            _leftContainer.AddChild(textureLeft);

            var textureRight = new TextureRect
            {
                Texture      = TextureHandRight,
                TextureScale = (2, 2)
            };

            textureRight.OnKeyBindDown += args => HandKeyBindDown(args, HandNameRight);

            _rightContainer.AddChild(textureRight);

            _leftContainer.AddChild(ActiveHandRect = new TextureRect
            {
                MouseFilter  = MouseFilterMode.Ignore,
                Texture      = TextureHandActive,
                TextureScale = (2, 2)
            });