예제 #1
0
        public void UpdateStatusEffects()
        {
            if (!CurrentlyControlled || _ui == null)
            {
                return;
            }
            _cooldown.Clear();
            _ui.VBox.DisposeAllChildren();

            foreach (var(key, statusEffect) in _status.OrderBy(x => (int)x.Key))
            {
                var status = new Control()
                {
                    Children =
                    {
                        new TextureRect
                        {
                            TextureScale = (2, 2),
                            Texture      = _resourceCache.GetTexture(statusEffect.Icon)
                        },
                    }
                };

                if (statusEffect.Cooldown.HasValue)
                {
                    var cooldown = new CooldownGraphic();
                    status.Children.Add(cooldown);
                    _cooldown[key] = cooldown;
                }

                _ui.VBox.AddChild(status);
            }
        }
예제 #2
0
        public void UpdateStatusEffects()
        {
            if (!CurrentlyControlled || _ui == null)
            {
                return;
            }
            _cooldown.Clear();
            _ui.VBox.DisposeAllChildren();

            foreach (var(key, effect) in _status.OrderBy(x => (int)x.Key))
            {
                var texture = _resourceCache.GetTexture(effect.Icon);
                var status  = new StatusControl(key, texture);

                if (effect.Cooldown.HasValue)
                {
                    var cooldown = new CooldownGraphic();
                    status.Children.Add(cooldown);
                    _cooldown[key] = cooldown;
                }

                status.OnPressed += args => StatusPressed(args, status);

                _ui.VBox.AddChild(status);
            }
        }
예제 #3
0
        public AlertControl(AlertPrototype alert, short?severity, IResourceCache resourceCache)
        {
            _resourceCache = resourceCache;
            Alert          = alert;
            _severity      = severity;
            var texture = _resourceCache.GetTexture(alert.GetIconPath(_severity));

            _icon = new TextureRect
            {
                TextureScale = (2, 2),
                Texture      = texture
            };

            Children.Add(_icon);
            _cooldownGraphic = new CooldownGraphic();
            Children.Add(_cooldownGraphic);
        }
예제 #4
0
        /// <summary>
        /// Creates an action slot for the specified number
        /// </summary>
        /// <param name="slotIndex">slot index this corresponds to, 0-9 (0 labeled as 1, 8, labeled "9", 9 labeled as "0".</param>
        public ActionSlot(ActionsUI actionsUI, ActionMenu actionMenu, byte slotIndex)
        {
            _actionsUI  = actionsUI;
            _actionMenu = actionMenu;
            _gameTiming = IoCManager.Resolve <IGameTiming>();
            SlotIndex   = slotIndex;
            MouseFilter = MouseFilterMode.Stop;

            MinSize           = (64, 64);
            VerticalAlignment = VAlignment.Top;
            TooltipDelay      = CustomTooltipDelay;
            TooltipSupplier   = SupplyTooltip;

            _number = new RichTextLabel
            {
                StyleClasses = { StyleNano.StyleClassHotbarSlotNumber }
            };
            _number.SetMessage(SlotNumberLabel());

            _bigActionIcon = new TextureRect
            {
                HorizontalExpand = true,
                VerticalExpand   = true,
                Stretch          = TextureRect.StretchMode.Scale,
                Visible          = false
            };
            _bigItemSpriteView = new SpriteView
            {
                HorizontalExpand  = true,
                VerticalExpand    = true,
                Scale             = (2, 2),
                Visible           = false,
                OverrideDirection = Direction.South,
            };
            _smallActionIcon = new TextureRect
            {
                HorizontalAlignment = HAlignment.Right,
                VerticalAlignment   = VAlignment.Bottom,
                Stretch             = TextureRect.StretchMode.Scale,
                Visible             = false
            };
            _smallItemSpriteView = new SpriteView
            {
                HorizontalAlignment = HAlignment.Right,
                VerticalAlignment   = VAlignment.Bottom,
                Visible             = false,
                OverrideDirection   = Direction.South,
            };

            _cooldownGraphic = new CooldownGraphic {
                Progress = 0, Visible = false
            };

            // padding to the left of the number to shift it right
            var paddingBox = new BoxContainer
            {
                Orientation      = LayoutOrientation.Horizontal,
                HorizontalExpand = true,
                VerticalExpand   = true,
                MinSize          = (64, 64)
            };

            paddingBox.AddChild(new Control()
            {
                MinSize = (4, 4),
            });