void HotbarIcon_onLeftClick(object sender, EventArgs e)
        {
            bool childAvailable = false;

            foreach (var item in genericServices)
            {
                childAvailable |= item.HasPermissionToUse;
            }
            if (childAvailable)
            {
                if (_extensionMenuHotbar.selected)
                {
                    _extensionMenuHotbar.selected = false;
                    _extensionMenuHotbar.Hide();
                }
                else
                {
                    _extensionMenuHotbar.selected = true;
                    _extensionMenuHotbar.Show();
                }
            }
            else
            {
                Main.NewText("No mods loaded that add Extensions. See forum post for compatible mods.");
            }
        }
Exemple #2
0
        private void HotbarIcon_onLeftClick(object sender, EventArgs e)
        {
            bool childAvailable = false;

            foreach (var item in genericServices)
            {
                childAvailable |= item.HasPermissionToUse;
            }
            if (childAvailable)
            {
                if (_extensionMenuHotbar.selected)
                {
                    _extensionMenuHotbar.selected = false;
                    _extensionMenuHotbar.Hide();
                }
                else
                {
                    _extensionMenuHotbar.selected = true;
                    _extensionMenuHotbar.Show();
                }
            }
            else
            {
                Main.NewText(HEROsMod.HeroText("NoExtensionsLoadedNote"));
            }
        }
        public ExtensionMenuService()
        {
            genericServices = new List <GenericExtensionService>();

            IsHotbar = true;

            this._hotbarIcon             = new UIImage(UIView.GetEmbeddedTexture("Images/extensions"));
            this.HotbarIcon.Tooltip      = "Extension Tools";
            this.HotbarIcon.onLeftClick += HotbarIcon_onLeftClick;

            _extensionMenuHotbar = new ExtensionMenuWindow();
            _extensionMenuHotbar.HotBarParent = HEROsMod.ServiceHotbar;
            _extensionMenuHotbar.Hide();
            this.AddUIView(_extensionMenuHotbar);

            Hotbar = _extensionMenuHotbar;
        }