1
0
mirror of https://github.com/YellowberryHN/WACCALauncher synced 2024-11-30 18:24:30 +01:00

some more, fix nuget path

This commit is contained in:
Zsolt Zitting 2023-08-24 18:45:14 -06:00
parent ab4a65e6c1
commit d62004c414
2 changed files with 50 additions and 30 deletions

View File

@ -317,14 +317,14 @@ namespace WACCALauncher
defVerMenu.Add(new ConfigMenuItem("Return to settings", ConfigMenuAction.Return)); defVerMenu.Add(new ConfigMenuItem("Return to settings", ConfigMenuAction.Return));
var mainMenu = new List<ConfigMenuItem>() { var mainMenu = new ConfigMenu(new List<ConfigMenuItem>() {
new ConfigMenuItem("set default version", ConfigMenuAction.Submenu, submenu: defVerMenu), new ConfigMenuItem("set default version", ConfigMenuAction.Submenu, submenu: defVerMenu),
new ConfigMenuItem("test VFD", ConfigMenuAction.Command, method: vfd_test), new ConfigMenuItem("test VFD", ConfigMenuAction.Command, method: vfd_test),
new ConfigMenuItem("exit to windows", ConfigMenuAction.Command, method: Application.Exit), new ConfigMenuItem("exit to windows", ConfigMenuAction.Command, method: Application.Exit),
new ConfigMenuItem("launch game", ConfigMenuAction.Return) new ConfigMenuItem("launch game", ConfigMenuAction.Return)
}; });
_menuManager = new MenuManager(mainMenu, "Launcher Settings"); _menuManager = new MenuManager(mainMenu);
waccaListTest.AssignMenuManager(_menuManager); waccaListTest.AssignMenuManager(_menuManager);
_loadingLabel.Font = _menuFont; _loadingLabel.Font = _menuFont;
@ -590,13 +590,12 @@ namespace WACCALauncher
public readonly string Name; public readonly string Name;
private readonly ConfigMenuAction _action; private readonly ConfigMenuAction _action;
private readonly Action _method; private readonly Action _method;
public readonly List<ConfigMenuItem> submenu; private readonly ConfigMenu ParentMenu;
public ConfigMenu Submenu { get; private set; }
private readonly List<string> _options; private readonly List<string> _options;
private readonly Version _version; private readonly Version _version;
public Label label; public ConfigMenuItem(string name, ConfigMenuAction action = ConfigMenuAction.None, Action method = null, ConfigMenu submenu = null, List<string> options = null, Version version = null) {
public ConfigMenuItem(string name, ConfigMenuAction action = ConfigMenuAction.None, Action method = null, List<ConfigMenuItem> submenu = null, List<string> options = null, Version version = null) {
this.Name = name; this.Name = name;
this._action = action; this._action = action;
@ -610,21 +609,11 @@ namespace WACCALauncher
throw new ArgumentException($"Menu item '{name}' was defined with VersionSelect type, but has no version associated."); throw new ArgumentException($"Menu item '{name}' was defined with VersionSelect type, but has no version associated.");
this._method = method; this._method = method;
this.submenu = submenu; this.Submenu = submenu;
this._options = options; this._options = options;
this._version = version; this._version = version;
} }
public void Activate()
{
label.ForeColor = Color.Red;
}
public void Deactivate()
{
label.ForeColor = Color.White;
}
public void Select(MainForm form) public void Select(MainForm form)
{ {
if (_action == ConfigMenuAction.Command) if (_action == ConfigMenuAction.Command)
@ -632,11 +621,11 @@ namespace WACCALauncher
// only works with static methods, why // only works with static methods, why
this._method(); this._method();
} }
else if (_action == ConfigMenuAction.Submenu && submenu != null) else if (_action == ConfigMenuAction.Submenu && Submenu != null)
{ {
Console.WriteLine("attempting submenu"); Console.WriteLine("attempting submenu");
form._menuManager.NavigateToSubMenu(Name); form._menuManager.NavigateToSubmenu(this);
form.waccaListTest.Update(); //form.waccaListTest.Update();
//form.GenerateMenu(_submenu); //form.GenerateMenu(_submenu);
} }
else if (_action == ConfigMenuAction.ItemSelect && _options != null) else if (_action == ConfigMenuAction.ItemSelect && _options != null)
@ -664,22 +653,52 @@ namespace WACCALauncher
} }
} }
public class ConfigMenu
{
public List<ConfigMenuItem> Items;
private ConfigMenu ParentMenu;
}
public class MenuManager public class MenuManager
{ {
private List<ConfigMenuItem> currentMenu; private ConfigMenu _rootMenu;
private ConfigMenu _currentMenu;
public readonly string name; public readonly string name;
public MenuManager(List<ConfigMenuItem> menu, string menuName) public MenuManager(ConfigMenu root)
{ {
currentMenu = menu; _rootMenu = root;
name = menuName; _currentMenu = _rootMenu;
} }
public List<ConfigMenuItem> GetCurrentMenu() public ConfigMenu GetCurrentMenu()
{ {
return currentMenu; return _currentMenu;
} }
public void NavigateToSubmenu(int index)
{
if (index >= 0 && index < _currentMenu.Items.Count)
{
var selectedMenuItem = _currentMenu.Items[index];
if (selectedMenuItem.Submenu != null)
{
selectedMenuItem.Submenu.ParentContainer = _currentMenu;
_currentMenu = selectedMenuItem.Submenu;
}
}
}
public void NavigateBack()
{
if (_currentContainer.ParentContainer != null)
{
_currentContainer = _currentContainer.ParentContainer;
}
}
/*
public void NavigateToSubMenu(string optionName) public void NavigateToSubMenu(string optionName)
{ {
if (optionName != string.Empty && optionName != null) if (optionName != string.Empty && optionName != null)
@ -699,6 +718,7 @@ namespace WACCALauncher
// currentMenu = currentMenu[0].Parent.SubItems; // currentMenu = currentMenu[0].Parent.SubItems;
// } // }
//} //}
*/
} }
} }

View File

@ -39,13 +39,13 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="INIFileParser, Version=2.5.2.0, Culture=neutral, PublicKeyToken=79af7b307b65cf3c, processorArchitecture=MSIL"> <Reference Include="INIFileParser, Version=2.5.2.0, Culture=neutral, PublicKeyToken=79af7b307b65cf3c, processorArchitecture=MSIL">
<HintPath>..\WACCAHelper\packages\ini-parser.2.5.2\lib\net20\INIFileParser.dll</HintPath> <HintPath>packages\ini-parser.2.5.2\lib\net20\INIFileParser.dll</HintPath>
</Reference> </Reference>
<Reference Include="SharpDX, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL"> <Reference Include="SharpDX, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\WACCAHelper\packages\SharpDX.4.2.0\lib\net45\SharpDX.dll</HintPath> <HintPath>packages\SharpDX.4.2.0\lib\net45\SharpDX.dll</HintPath>
</Reference> </Reference>
<Reference Include="SharpDX.DirectInput, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL"> <Reference Include="SharpDX.DirectInput, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\WACCAHelper\packages\SharpDX.DirectInput.4.2.0\lib\net45\SharpDX.DirectInput.dll</HintPath> <HintPath>packages\SharpDX.DirectInput.4.2.0\lib\net45\SharpDX.DirectInput.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />