-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TitleShortcuts - Add HoneySelect2 version
- Loading branch information
1 parent
9665246
commit 50fe2a6
Showing
4 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/TitleShortcuts.HoneySelect2/TitleShortcuts.HoneySelect2.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Import Project="..\BuildSettings.Common.props" /> | ||
<Import Project="..\BuildSettings.HoneySelect2.props" /> | ||
<ItemGroup> | ||
<PackageReference Include="BepInEx.Core" Version="5.4.4" /> | ||
<PackageReference Include="IllusionLibs.HoneySelect2.Assembly-CSharp" Version="2020.5.29.4" /> | ||
<PackageReference Include="IllusionLibs.HoneySelect2.Assembly-CSharp-firstpass" Version="2020.5.29.4" /> | ||
<PackageReference Include="IllusionLibs.HoneySelect2.IL" Version="2020.5.29.4" /> | ||
<PackageReference Include="IllusionLibs.HoneySelect2.UnityEngine.CoreModule" Version="2018.4.11.4" /> | ||
<PackageReference Include="IllusionLibs.HoneySelect2.UnityEngine.UI" Version="2018.4.11.4" /> | ||
<PackageReference Include="IllusionLibs.HoneySelect2.UnityEngine.UIModule" Version="2018.4.11.4" /> | ||
</ItemGroup> | ||
<Import Project="..\TitleShortcuts.Core\TitleShortcuts.Core.projitems" Label="Shared" /> | ||
<Import Project="..\Common.Core\Common.Core.projitems" Label="Shared" /> | ||
<Import Project="..\Common.HoneySelect2\Common.HoneySelect2.projitems" Label="Shared" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
using AIProject; | ||
using BepInEx; | ||
using BepInEx.Configuration; | ||
using KeelPlugins.HoneySelect2; | ||
using System.Collections; | ||
using HS2; | ||
using TitleShortcuts.Core; | ||
using UnityEngine; | ||
using UnityEngine.Events; | ||
using UnityEngine.SceneManagement; | ||
|
||
[assembly: System.Reflection.AssemblyFileVersion(TitleShortcuts.HoneySelect2.TitleShortcuts.Version)] | ||
|
||
namespace TitleShortcuts.HoneySelect2 | ||
{ | ||
[BepInProcess(Constants.MainGameProcessName)] | ||
[BepInPlugin(GUID, PluginName, Version)] | ||
public class TitleShortcuts : TitleShortcutsCore | ||
{ | ||
public const string Version = "1.3.0." + BuildNumber.Version; | ||
|
||
private ConfigEntry<KeyboardShortcut> StartFemaleMaker { get; set; } | ||
private ConfigEntry<KeyboardShortcut> StartMaleMaker { get; set; } | ||
private ConfigEntry<KeyboardShortcut> StartUploader { get; set; } | ||
private ConfigEntry<KeyboardShortcut> StartDownloader { get; set; } | ||
private ConfigEntry<KeyboardShortcut> StartGame { get; set; } | ||
|
||
private TitleScene titleScene; | ||
|
||
protected override void Awake() | ||
{ | ||
base.Awake(); | ||
|
||
StartFemaleMaker = Config.Bind(SECTION_HOTKEYS, "Open female maker", new KeyboardShortcut(KeyCode.F)); | ||
StartMaleMaker = Config.Bind(SECTION_HOTKEYS, "Open male maker", new KeyboardShortcut(KeyCode.M)); | ||
StartUploader = Config.Bind(SECTION_HOTKEYS, "Open uploader", new KeyboardShortcut(KeyCode.U)); | ||
StartDownloader = Config.Bind(SECTION_HOTKEYS, "Open downloader", new KeyboardShortcut(KeyCode.D)); | ||
StartGame = Config.Bind(SECTION_HOTKEYS, "Open main game", new KeyboardShortcut(KeyCode.G)); | ||
|
||
SceneManager.sceneLoaded += StartInput; | ||
} | ||
|
||
private void StartInput(Scene scene, LoadSceneMode mode) | ||
{ | ||
StopAllCoroutines(); | ||
|
||
titleScene = FindObjectOfType<TitleScene>(); | ||
|
||
if (titleScene) StartCoroutine(InputCheck()); | ||
} | ||
|
||
private IEnumerator InputCheck() | ||
{ | ||
while (titleScene) | ||
{ | ||
if (!Manager.Scene.IsNowLoadingFade) | ||
{ | ||
if (StartFemaleMaker.Value.IsPressed()) StartMode(titleScene.OnMakeFemale, "Starting female maker"); | ||
else if (StartMaleMaker.Value.IsPressed()) StartMode(titleScene.OnMakeMale, "Starting male maker"); | ||
else if (StartUploader.Value.IsPressed()) StartMode(titleScene.OnUpload, "Starting uploader"); | ||
else if (StartDownloader.Value.IsPressed()) StartMode(titleScene.OnDownload, "Starting downloader"); | ||
else if (StartGame.Value.IsPressed()) StartMode(titleScene.OnPlay, "Starting main game"); | ||
} | ||
|
||
yield return null; | ||
} | ||
|
||
void StartMode(UnityAction action, string msg) | ||
{ | ||
var configWindow = FindObjectOfType<Config.ConfigWindow>(); | ||
if (!configWindow || !configWindow.active) | ||
{ | ||
Log.Message(msg); | ||
action(); | ||
titleScene = null; | ||
} | ||
} | ||
} | ||
} | ||
} |