Пример #1
0
        private void Start()
        {
            _mmoSimpleActionbarController = MmoSimpleActionbarController.Instance;
            _mmoSimpleActionbarController.UseActionButtonEvent              += UseActionButtonEvent;
            _mmoSimpleActionbarController.GlobalCooldownEvent               += OnGlobalCooldownInitiate;
            _mmoSimpleActionbarController.AddActionToActionButtonEvent      += OnAddActionToActionButton;
            _mmoSimpleActionbarController.RemoveActionFromActionButtonEvent += OnRemoveActionFromActionButton;
            _mmoSimpleActionbarController.SetActionButtonKeybindLabelEvent  += OnKeybindChanged;

            _root = GetComponent <UIDocument>().rootVisualElement;
            var i = 0;

            for (; i < _mmoSimpleActionbarController.ActionButtonCount; i++)
            {
                var name   = $"ActionButton{i + 1}";
                var action = _root.Q <VisualElement>(name);

                //Set cooldown container to display none
                action.Q <VisualElement>("HotbarCooldownContainer").style.display = DisplayStyle.None;

                _actionbarIndexes.Add(i, action);

                action.RegisterCallback <ClickEvent>(HandleActionClicked);
            }

            StartCoroutine(RefreshActionBar());
        }
Пример #2
0
        private void Start()
        {
            //initialize UI
            _actionbarController = MmoSimpleActionbarController.Instance;

            _actionbarController.AddActionToActionButtonEvent      += ActionbarControllerOnAddActionToActionButtonEvent;
            _actionbarController.SetActionButtonDisabledEvent      += ActionbarControllerOnSetActionButtonDisabledEvent;
            _actionbarController.SetActionButtonKeybindLabelEvent  += ActionbarControllerOnSetActionButtonKeybindLabelEvent;
            _actionbarController.RemoveActionFromActionButtonEvent += ActionbarControllerOnRemoveActionFromActionButtonEvent;
            _actionbarController.GlobalCooldownEvent    += ActionbarControllerOnGlobalCooldownEvent;
            _actionbarController.UseActionButtonEvent   += ActionbarControllerOnUseActionButtonEvent;
            _actionbarController.OnActionbarInitialized += OnActionbarInitialized;
        }