Skip to content

Commit

Permalink
Merge pull request #174 from amazingalek/dev
Browse files Browse the repository at this point in the history
* Improved combination input UI
* OWML config menu
* Mod dependency fixes
* Fixes to menus and input
  • Loading branch information
amazingalek authored Jul 14, 2020
2 parents 9d02cfe + 0107764 commit e0f76eb
Show file tree
Hide file tree
Showing 100 changed files with 2,496 additions and 1,053 deletions.
3 changes: 3 additions & 0 deletions OWML.Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ public class Constants
{
public const string QuitKeyPhrase = "{RageAgainstTheDyingOfTheLight}";
public const string ConsolePortArgument = "consolePort";
public const string OwmlConfigFileName = "OWML.Config.json";
public const string OwmlDefaultConfigFileName = "OWML.DefaultConfig.json";
public const string OwmlManifestFileName = "OWML.Manifest.json";
}
}
3 changes: 3 additions & 0 deletions OWML.Common/IHarmonyHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ public interface IHarmonyHelper
{
void AddPrefix<T>(string methodName, Type patchType, string patchMethodName);
void AddPrefix(MethodBase methodInfo, Type patchType, string patchMethodName);

void AddPostfix<T>(string methodName, Type patchType, string patchMethodName);
void AddPostfix(MethodBase methodInfo, Type patchType, string patchMethodName);

void EmptyMethod<T>(string methodName);
void EmptyMethod(MethodBase methodInfo);

void Transpile<T>(string methodName, Type patchType, string patchMethodName);
void Transpile(MethodBase methodInfo, Type patchType, string patchMethodName);
}
Expand Down
1 change: 1 addition & 0 deletions OWML.Common/IModConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public interface IModConfig
bool Enabled { get; set; }
bool RequireVR { get; set; }
Dictionary<string, object> Settings { get; set; }

T GetSettingsValue<T>(string key);
void SetSettingsValue(string key, object value);

Expand Down
2 changes: 0 additions & 2 deletions OWML.Common/IModData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@ public interface IModData
IModManifest Manifest { get; }
IModConfig Config { get; }
IModConfig DefaultConfig { get; }

void ResetConfig();
}
}
3 changes: 1 addition & 2 deletions OWML.Common/IModInputCombination.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.ObjectModel;
using System.Collections.ObjectModel;
using UnityEngine;

namespace OWML.Common
Expand Down
5 changes: 4 additions & 1 deletion OWML.Common/IModInputHandler.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace OWML.Common
using System.Collections.Generic;

namespace OWML.Common
{
public interface IModInputHandler
{
Expand All @@ -14,5 +16,6 @@ public interface IModInputHandler
bool IsNewlyPressed(IModInputCombination combo);
bool WasTapped(IModInputCombination combo);
bool WasNewlyReleased(IModInputCombination combo);
List<string> GetWarningMessages(string combinations);
}
}
6 changes: 3 additions & 3 deletions OWML.Common/IOwmlConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ public interface IOwmlConfig
string ManagedPath { get; }
string PluginsPath { get; }
string DataPath { get; }
string OWMLPath { get; }
string OWMLPath { get; set; }
string ModsPath { get; }
string OutputFilePath { get; }
string LogFilePath { get; }
bool Verbose { get; }
bool BlockInput { get; }
bool Verbose { get; set; }
bool BlockInput { get; set; }
}
}
14 changes: 3 additions & 11 deletions OWML.Common/Menus/IModButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,24 @@

namespace OWML.Common.Menus
{
public interface IModButton
public interface IModButton : IModButtonBase
{
event Action OnClick;
string Title { get; set; }
int Index { get; set; }
Button Button { get; }
void Initialize(IModMenu menu);
string Title { get; set; }

IModButton Copy();
new IModButton Copy();
IModButton Copy(string title);
IModButton Copy(int index);
IModButton Copy(string title, int index);

IModButton Duplicate();
IModButton Duplicate(string title);
IModButton Duplicate(int index);
IModButton Duplicate(string title, int index);

IModButton Replace();
IModButton Replace(string title);
IModButton Replace(int index);
IModButton Replace(string title, int index);

void Show();
void Hide();

void SetControllerCommand(SingleAxisCommand inputCommand);
}
}
26 changes: 26 additions & 0 deletions OWML.Common/Menus/IModButtonBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using UnityEngine.UI;

namespace OWML.Common.Menus
{
public interface IModButtonBase
{
event Action OnClick;
int Index { get; set; }
Button Button { get; }
bool IsSelected { get; }
void Initialize(IModMenu menu);

IModButtonBase Copy();
IModButtonBase Copy(int index);

IModButtonBase Duplicate();
IModButtonBase Duplicate(int index);

IModButtonBase Replace();
IModButtonBase Replace(int index);

void Show();
void Hide();
}
}
1 change: 1 addition & 0 deletions OWML.Common/Menus/IModComboInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
public interface IModComboInput : IModInput<string>
{
IModLayoutButton Button { get; }
IModComboInput Copy();
IModComboInput Copy(string key);
}
Expand Down
4 changes: 1 addition & 3 deletions OWML.Common/Menus/IModConfigMenu.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
namespace OWML.Common.Menus
{
public interface IModConfigMenu : IModPopupMenu
public interface IModConfigMenu : IModConfigMenuBase
{
IModData ModData { get; }
IModBehaviour Mod { get; }

void Initialize(Menu modMenuCopy, IModToggleInput toggleTemplate, IModSliderInput sliderTemplate, IModTextInput textInputTemplate, IModNumberInput numberInputTemplate, IModComboInput comboInputTemplate);
}
}
10 changes: 10 additions & 0 deletions OWML.Common/Menus/IModConfigMenuBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace OWML.Common.Menus
{
public interface IModConfigMenuBase : IModPopupMenu
{
IModManifest Manifest { get; }

void Initialize(Menu modMenuCopy, IModToggleInput toggleTemplate, IModSliderInput sliderTemplate,
IModTextInput textInputTemplate, IModNumberInput numberInputTemplate, IModComboInput comboInputTemplate);
}
}
7 changes: 7 additions & 0 deletions OWML.Common/Menus/IModFieldInput.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace OWML.Common.Menus
{
public interface IModFieldInput<T> : IModInput<T>
{
IModButton Button { get; }
}
}
9 changes: 1 addition & 8 deletions OWML.Common/Menus/IModInput.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
using System;
using UnityEngine;

namespace OWML.Common.Menus
{
public interface IModInput<T>
public interface IModInput<T> : IModInputBase
{
event Action<T> OnChange;
T Value { get; set; }
MonoBehaviour Element { get; }
string Title { get; set; }
int Index { get; set; }
void Show();
void Hide();
void Initialize(IModMenu menu);
}
}
15 changes: 15 additions & 0 deletions OWML.Common/Menus/IModInputBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using UnityEngine;

namespace OWML.Common.Menus
{
public interface IModInputBase
{
MonoBehaviour Element { get; }
string Title { get; set; }
int Index { get; set; }
bool IsSelected { get; }
void Show();
void Hide();
void Initialize(IModMenu menu);
}
}
10 changes: 10 additions & 0 deletions OWML.Common/Menus/IModInputCombinationElement.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace OWML.Common.Menus
{
public interface IModInputCombinationElement : IModToggleInput
{
IModLayoutManager Layout { get; }
void Destroy();
void DestroySelf();
new IModInputCombinationElement Copy(string combination);
}
}
14 changes: 14 additions & 0 deletions OWML.Common/Menus/IModInputCombinationElementMenu.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;

namespace OWML.Common.Menus
{
public interface IModInputCombinationElementMenu : IModMenu
{
event Action<string> OnConfirm;
event Action OnCancel;

void Initialize(PopupInputMenu menu);
void Open(string value, string comboName, IModInputCombinationMenu combinationMenu = null,
IModInputCombinationElement element = null);
}
}
17 changes: 17 additions & 0 deletions OWML.Common/Menus/IModInputCombinationMenu.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;

namespace OWML.Common.Menus
{
public interface IModInputCombinationMenu : IModPopupMenu
{
event Action<string> OnConfirm;
event Action OnCancel;

List<IModInputCombinationElement> CombinationElements { get; }
string GenerateCombination();
void FillMenu(string combination);
void Initialize(Menu menu, IModInputCombinationElement combinationElementTemplate);
void RemoveCombinationElement(IModInputCombinationElement element);
}
}
30 changes: 2 additions & 28 deletions OWML.Common/Menus/IModLayoutButton.cs
Original file line number Diff line number Diff line change
@@ -1,33 +1,7 @@
using System;
using UnityEngine;
using UnityEngine.UI;

namespace OWML.Common.Menus
{
public interface IModLayoutButton
public interface IModLayoutButton : IModButtonBase
{
event Action OnClick;
HorizontalLayoutGroup LayoutGroup { get; }
int Index { get; set; }
Button Button { get; }
void UpdateState();
void Initialize(IModMenu menu);

IModLayoutButton Copy();
IModLayoutButton Copy(int index);

IModLayoutButton Duplicate();
IModLayoutButton Duplicate(int index);

IModLayoutButton Replace();
IModLayoutButton Replace(int index);

void Show();
void Hide();

void SetControllerCommand(SingleAxisCommand inputCommand);

void AddText(string text);
void AddPicture(Texture2D texture, float scale = 1.0f);
IModLayoutManager Layout { get; }
}
}
18 changes: 18 additions & 0 deletions OWML.Common/Menus/IModLayoutManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using UnityEngine;
using UnityEngine.UI;

namespace OWML.Common.Menus
{
public interface IModLayoutManager
{
LayoutGroup LayoutGroup { get; }
int ChildCount { get; }

void UpdateState();
void Clear();
void AddText(string text);
void AddTextAt(string text, int index);
void AddPicture(Texture2D texture, float scale = 1.0f);
void AddPictureAt(Texture2D texture, int index, float scale = 1.0f);
}
}
9 changes: 4 additions & 5 deletions OWML.Common/Menus/IModMainMenu.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
namespace OWML.Common.Menus
{
public interface IModMainMenu : IModMenu
public interface IModMainMenu : IModOWMenu
{
IModTabbedMenu OptionsMenu { get; }

new IModTabbedMenu OptionsMenu { get; }
new IModButton OptionsButton { get; }
new IModButton QuitButton { get; }
IModButton ResumeExpeditionButton { get; }
IModButton NewExpeditionButton { get; }
IModButton OptionsButton { get; }
IModButton ViewCreditsButton { get; }
IModButton SwitchProfileButton { get; }
IModButton QuitButton { get; }

void Initialize(TitleScreenManager titleScreenManager);
}
Expand Down
12 changes: 10 additions & 2 deletions OWML.Common/Menus/IModMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,20 @@ public interface IModMenu

Menu Menu { get; }

List<IModButtonBase> BaseButtons { get; }
List<IModButton> Buttons { get; }
List<IModLayoutButton> LayoutButtons { get; }
List<IModPromptButton> PromptButtons { get; }

[Obsolete("Use GetTitleButton instead")]
IModButton GetButton(string title);
IModButton GetTitleButton(string title);
IModPromptButton GetPromptButton(string title);

IModButton AddButton(IModButton button);
IModButton AddButton(IModButton button, int index);
IModLayoutButton AddLayoutButton(IModLayoutButton button);
IModLayoutButton AddLayoutButton(IModLayoutButton button, int index);
IModButtonBase AddButton(IModButtonBase button);
IModButtonBase AddButton(IModButtonBase button, int index);

List<IModToggleInput> ToggleInputs { get; }
IModToggleInput GetToggleInput(string title);
Expand Down
9 changes: 9 additions & 0 deletions OWML.Common/Menus/IModMenuWithSelectables.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

namespace OWML.Common.Menus
{
public interface IModMenuWithSelectables : IModPopupMenu
{
event Action OnCancel;
}
}
3 changes: 3 additions & 0 deletions OWML.Common/Menus/IModMenus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ public interface IModMenus
IModMainMenu MainMenu { get; }
IModPauseMenu PauseMenu { get; }
IModsMenu ModsMenu { get; }
IModConfigMenuBase OwmlMenu { get; }
IModInputMenu InputMenu { get; }
IModInputCombinationElementMenu InputCombinationElementMenu { get; }
IModInputCombinationMenu InputCombinationMenu { get; }
}
}
2 changes: 1 addition & 1 deletion OWML.Common/Menus/IModNumberInput.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace OWML.Common.Menus
{
public interface IModNumberInput : IModInput<float>
public interface IModNumberInput : IModFieldInput<float>
{
IModNumberInput Copy();
IModNumberInput Copy(string key);
Expand Down
9 changes: 9 additions & 0 deletions OWML.Common/Menus/IModOWMenu.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace OWML.Common.Menus
{
public interface IModOWMenu : IModMenu
{
IModTabbedMenu OptionsMenu { get; }
IModButton OptionsButton { get; }
IModButton QuitButton { get; }
}
}
Loading

0 comments on commit e0f76eb

Please sign in to comment.