Beispiel #1
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);
            }
        }
Beispiel #2
0
        private void StatusPressed(BaseButton.ButtonEventArgs args, StatusControl status)
        {
            if (args.Event.Function != EngineKeyFunctions.UIClick)
            {
                return;
            }

            SendNetworkMessage(new ClickStatusMessage(status.Effect));
        }