Example #1
0
 public void SetActiveTab(MenuTabs tab)
 {
     switch (tab)
     {
     case MenuTabs.Inventory:
         DisplayInventory(CurrInventoryPage);
         break;
     }
 }
Example #2
0
        public PauseMenu()
        {
            menuState = MenuTabs.Continue;

            string[] tabs = Enum.GetNames(typeof(MenuTabs));

            // Box has paddings from the sides.
            // Two from the left and right.
            int width = Game.window.Width - 4;
            // And two from top and the bottom.
            int height = tabs.Length + 4;

            signs  = new char[width * height];
            coords = new int[width * height][];

            Update();
        }
Example #3
0
    public void CloseMenu()
    {
        //Depopulate each list in pages
        foreach (List <GameObject> list in InventoryPages)
        {
            //Destroy each item in list
            foreach (GameObject g in list)
            {
                Destroy(g);
            }

            list.Clear();
        }

        //Clear list holding pages
        InventoryPages.Clear();
        //Deactivate gameobjects
        MenuContainer.SetActive(false);
        CurrentTab = MenuTabs.Inventory;
        MenuOpen   = false;
    }
Example #4
0
    public void ShowTab(MenuTabs tab)
    {
        if (currentlyShownTab == (int)tab)
        {
            return;
        }

        if (currentlyShownTab != -1)
        {
            HideCanvasGroup(tabCanvasGroups[currentlyShownTab]);
        }
        else
        {
            for (int i = 0; i < tabCanvasGroups.Count; i++)
            {
                if (i != (int)tab)
                {
                    HideCanvasGroup(tabCanvasGroups[i], true);
                }
            }
        }

        if (currentlyShownTab != (int)tab)
        {
            switch (tab)
            {
            case MenuTabs.Ranking:
                ShowRankingsTab(0);
                break;
            }
        }

        currentlyShownTab = (int)tab;
        ShowCanvasGroup(tabCanvasGroups[currentlyShownTab]);

        for (int i = 0; i < navigationButtonImages.Count; i++)
        {
            navigationButtonImages[i].color = i == currentlyShownTab ? activeTabColor : defaultTabColor;
        }
    }
Example #5
0
 private ToolStripMenuItem GetTab(string title)
 {
     return(MenuTabs.First((ToolStripMenuItem item) => { return item.Text == title; }));
 }
Example #6
0
 public void Start()
 {
     MenuTabs.AddTabs();
 }
Example #7
0
 public void ChangeTab(MenuTabs tab)
 {
     menuState = tab;
     Update();
 }
Example #8
0
        public void Handle(NewPluginFoundMessage message)
        {
            _messageBus.LogMessage(LogLevel.Debug, "Loading UI for plugin: {0}...", message.PluginDescription.PluginName);
            var menuEntries = message.PluginDescription.GetMenuEntries();

            if (menuEntries == null)
            {
                return;
            }

            foreach (var descriptor in menuEntries)
            {
                var tabName = descriptor.Tab.ToLower();
                Tab tab;
                if (_menuTabsMap.ContainsKey(tabName) == false)
                {
                    tab = new Tab(tabName);
                    _menuTabsMap[tabName] = tab;
                }
                else
                {
                    tab = _menuTabsMap[tabName];
                }

                var newMenuGroup = new Group(descriptor.ButtonsGroupName);

                foreach (var button in descriptor.Buttons)
                {
                    if (string.IsNullOrWhiteSpace(button.Label))
                    {
                        _messageBus.LogMessage(LogLevel.Warning, "Button {0}.{1}.{2} has no label defined. Skipping...", tabName, descriptor.ButtonsGroupName, button.Label);
                        continue;
                    }
                    if (button.OnClickCommand == null && button.OnClickDelegate == null)
                    {
                        _messageBus.LogMessage(LogLevel.Warning, "Button {0}.{1}.{2} does not define any action. Skipping...", tabName, descriptor.ButtonsGroupName, button.Label);
                        continue;
                    }

                    var newButton = new Button
                    {
                        Label    = button.Label,
                        Icon     = button.Icon,
                        OnClick  = button.OnClickCommand != null ? button.OnClickCommand : _delegateButtonHandler,
                        Delegate = button.OnClickDelegate
                    };
                    newButton.Icon.Freeze();
                    newMenuGroup.Buttons.Add(newButton);
                }
                DispatcherHelper.CheckBeginInvokeOnUI(() =>
                {
                    if (MenuTabs.Contains(tab) == false)
                    {
                        MenuTabs.Add(tab);
                    }

                    SelectedTab = MenuTabs[0];
                    tab.Groups.Add(newMenuGroup);
                });
            }
        }