-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from LIV/toggle-body-visibility
Add option to toggle gorilla body visibility
- Loading branch information
Showing
4 changed files
with
151 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CProgram_0020Files_0020_0028x86_0029_005CSteam_005Csteamapps_005Ccommon_005CGorilla_0020Tag_005CBepInEx_005Cplugins_005CBepinject_002DAuros_005CBepinject_002Edll/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CProgram_0020Files_0020_0028x86_0029_005CSteam_005Csteamapps_005Ccommon_005CGorilla_0020Tag_005CBepInEx_005Cplugins_005CComputerInterface_005CComputerInterface_002Edll/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CProgram_0020Files_0020_0028x86_0029_005CSteam_005Csteamapps_005Ccommon_005CGorilla_0020Tag_005CBepInEx_005Cplugins_005CExtenject_005CZenject_002Dusage_002Edll/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CProgram_0020Files_0020_0028x86_0029_005CSteam_005Csteamapps_005Ccommon_005CGorilla_0020Tag_005CBepInEx_005Cplugins_005CExtenject_005CZenject_002Edll/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005Crai_005CRepos_005CGorillaTagLIV_005CGorillaTagLIVUnity_005CAssets_005CLIV_005CPlugins_005Cx64_005CLIV_005FBridge_002Edll/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005Crai_005CRepos_005CGorillaTagLIV_005CGorillaTagLIVUnity_005CBuild_005CGorillaTagLIVUnity_005FData_005CManaged_005CLIV_002Edll/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> | ||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005Crai_005CRepos_005CGorillaTagLIV_005CGorillaTagLIVUnity_005CBuild_005CGorillaTagLIVUnity_005FData_005CManaged_005CLIV_002Edll/@EntryIndexedValue">True</s:Boolean> | ||
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
 | ||
<Assembly Path="C:\Program Files (x86)\Steam\steamapps\common\Gorilla Tag\BepInEx\plugins\Extenject\Zenject-usage.dll" />
 | ||
<Assembly Path="C:\Program Files (x86)\Steam\steamapps\common\Gorilla Tag\BepInEx\plugins\Extenject\Zenject.dll" />
 | ||
<Assembly Path="C:\Program Files (x86)\Steam\steamapps\common\Gorilla Tag\BepInEx\plugins\ComputerInterface\ComputerInterface.dll" />
 | ||
</AssemblyExplorer></s:String></wpf:ResourceDictionary> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
using System; | ||
using Bepinject; | ||
using ComputerInterface; | ||
using ComputerInterface.Interfaces; | ||
using ComputerInterface.ViewLib; | ||
using UnityEngine; | ||
using Zenject; | ||
|
||
namespace GorillaTagLIV | ||
{ | ||
public class LivComputerView : ComputerView | ||
{ | ||
private const string highlightColor = "52fc03"; | ||
private readonly UISelectionHandler selectionHandler; | ||
|
||
public LivComputerView() | ||
{ | ||
selectionHandler = new UISelectionHandler(EKeyboardKey.Up, EKeyboardKey.Down, EKeyboardKey.Enter); | ||
selectionHandler.MaxIdx = 3; | ||
selectionHandler.OnSelected += OnEntrySelected; | ||
selectionHandler.ConfigureSelectionIndicator($"<color=#{highlightColor}>></color> ", "", " ", ""); | ||
} | ||
|
||
private void OnEntrySelected(int index) | ||
{ | ||
if (index == 0) | ||
{ | ||
Plugin.Instance.ShowGorillaBody.Value = !Plugin.Instance.ShowGorillaBody.Value; | ||
} | ||
UpdateScreen(); | ||
} | ||
public override void OnShow(object[] args) | ||
{ | ||
base.OnShow(args); | ||
UpdateScreen(); | ||
} | ||
|
||
public override void OnKeyPressed(EKeyboardKey key) | ||
{ | ||
if (selectionHandler.HandleKeypress(key)) | ||
{ | ||
UpdateScreen(); | ||
return; | ||
} | ||
|
||
switch (key) | ||
{ | ||
case EKeyboardKey.Back: | ||
ReturnToMainMenu(); | ||
break; | ||
} | ||
} | ||
|
||
private void UpdateScreen() | ||
{ | ||
SetText(str => | ||
{ | ||
str.BeginCenter(); | ||
str.MakeBar('-', SCREEN_WIDTH, 0, "ffffff10"); | ||
str.AppendClr("LIV", highlightColor).EndColor().AppendLine(); | ||
str.MakeBar('-', SCREEN_WIDTH, 0, "ffffff10"); | ||
str.EndAlign().AppendLines(1); | ||
str.AppendLine(selectionHandler.GetIndicatedText(0, $"Show Gorilla Body: <color={(Plugin.Instance.ShowGorillaBody.Value ? $"#{highlightColor}>Yes" : "white>No")}</color>")); | ||
str.AppendLines(2); | ||
str.AppendClr("Press ENTER to toggle setting", "ffffff10").EndColor().AppendLine(); | ||
}); | ||
} | ||
} | ||
|
||
public class LivModComputerEntry : IComputerModEntry | ||
{ | ||
public string EntryName => "LIV"; | ||
|
||
public Type EntryViewType => typeof(LivComputerView); | ||
} | ||
|
||
internal class LivModComputerInstaller : Installer | ||
{ | ||
public override void InstallBindings() | ||
{ | ||
Container.Bind<IComputerModEntry>().To<LivModComputerEntry>().AsSingle(); | ||
} | ||
|
||
public static void Install() | ||
{ | ||
Zenjector.Install<LivModComputerInstaller>().OnProject(); | ||
} | ||
} | ||
} |
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