-
Notifications
You must be signed in to change notification settings - Fork 15
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 #127 from amazingalek/dev
Input, VR, Steam
- Loading branch information
Showing
59 changed files
with
2,633 additions
and
138 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using System.Collections.ObjectModel; | ||
using UnityEngine; | ||
|
||
namespace OWML.Common | ||
{ | ||
public interface IModInputCombination | ||
{ | ||
float LastPressedMoment { get; } | ||
float PressDuration { get; } | ||
string ModName { get; } | ||
string Name { get; } | ||
string FullName { get; } | ||
ReadOnlyCollection<KeyCode> Singles { get; } | ||
ReadOnlyCollection<long> Hashes { get; } | ||
bool IsFirst { get; } | ||
|
||
void InternalSetPressed(bool isPressed = true); | ||
} | ||
} |
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 @@ | ||
namespace OWML.Common | ||
{ | ||
public interface IModInputHandler | ||
{ | ||
IModInputCombination RegisterCombination(IModBehaviour mod, string name, string combination); | ||
void UnregisterCombination(IModInputCombination combo); | ||
bool IsPressedExact(IModInputCombination combo); | ||
bool IsNewlyPressedExact(IModInputCombination combo); | ||
bool WasTappedExact(IModInputCombination combo); | ||
bool WasNewlyReleasedExact(IModInputCombination combo); | ||
bool IsPressed(IModInputCombination combo); | ||
bool IsNewlyPressed(IModInputCombination combo); | ||
bool WasTapped(IModInputCombination combo); | ||
bool WasNewlyReleased(IModInputCombination combo); | ||
} | ||
} |
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,8 @@ | ||
namespace OWML.Common.Menus | ||
{ | ||
public interface IModComboInput : IModInput<string> | ||
{ | ||
IModComboInput Copy(); | ||
IModComboInput Copy(string key); | ||
} | ||
} |
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,33 @@ | ||
using System; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
namespace OWML.Common.Menus | ||
{ | ||
public interface IModLayoutButton | ||
{ | ||
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); | ||
} | ||
} |
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
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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"gamePath": "C:/Program Files/Epic Games/OuterWilds", | ||
"verbose": false | ||
} | ||
"verbose": false, | ||
"combinationsBlockInput" : false | ||
} |
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
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,59 @@ | ||
using System; | ||
using System.Collections.ObjectModel; | ||
using System.Collections.Generic; | ||
using OWML.Common; | ||
using UnityEngine; | ||
|
||
namespace OWML.ModHelper.Input | ||
{ | ||
public class BindingChangeListener : MonoBehaviour | ||
{ | ||
private ModInputHandler _inputHandler; | ||
private bool _updateInputsNext, _updateInputs; | ||
|
||
internal void Initialize(ModInputHandler inputHandler, IModEvents events) | ||
{ | ||
_inputHandler = inputHandler; | ||
events.Subscribe<TitleScreenManager>(Common.Events.AfterStart); | ||
events.OnEvent += OnEvent; | ||
} | ||
|
||
private void OnEvent(MonoBehaviour behaviour, Common.Events ev) | ||
{ | ||
if (behaviour.GetType() == typeof(TitleScreenManager) && ev == Common.Events.AfterStart) | ||
{ | ||
_updateInputsNext = true; | ||
} | ||
} | ||
|
||
private void Start() | ||
{ | ||
DontDestroyOnLoad(gameObject); | ||
GlobalMessenger.AddListener("KeyBindingsChanged", new Callback(PrepareForUpdate)); | ||
} | ||
|
||
private void PrepareForUpdate() | ||
{ | ||
_updateInputsNext = true; | ||
} | ||
|
||
private void Update() | ||
{ | ||
if (_updateInputs) | ||
{ | ||
_updateInputs = false; | ||
UpdateInputs(); | ||
} | ||
if (_updateInputsNext) | ||
{ | ||
_updateInputs = true; | ||
_updateInputsNext = false; | ||
} | ||
} | ||
|
||
public void UpdateInputs() | ||
{ | ||
_inputHandler.UpdateGamesBindings(); | ||
} | ||
} | ||
} |
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,74 @@ | ||
using UnityEngine; | ||
using System.Collections.Generic; | ||
|
||
namespace OWML.ModHelper.Input | ||
{ | ||
internal class InputInterceptor | ||
{ | ||
public static void SingleAxisUpdatePost( | ||
SingleAxisCommand __instance, | ||
ref float ____value, | ||
List<KeyCode> ____posKeyCodes, | ||
List<KeyCode> ____negKeyCodes | ||
) | ||
{ | ||
foreach (var key in ____posKeyCodes) | ||
{ | ||
if (ModInputHandler.Instance.IsPressedAndIgnored(key)) | ||
{ | ||
____value = 0f; | ||
} | ||
} | ||
foreach (var key in ____negKeyCodes) | ||
{ | ||
if (ModInputHandler.Instance.IsPressedAndIgnored(key)) | ||
{ | ||
____value = 0f; | ||
} | ||
} | ||
} | ||
|
||
public static void DoubleAxisUpdatePost( | ||
DoubleAxisCommand __instance, | ||
ref Vector2 ____value, | ||
List<KeyCode> ____posXKeyCodes, | ||
List<KeyCode> ____negXKeyCodes, | ||
List<KeyCode> ____posYKeyCodes, | ||
List<KeyCode> ____negYKeyCodes | ||
) | ||
{ | ||
if (OWInput.UsingGamepad()) | ||
{ | ||
return; | ||
} | ||
foreach (var key in ____posXKeyCodes) | ||
{ | ||
if (ModInputHandler.Instance.IsPressedAndIgnored(key)) | ||
{ | ||
____value.x = 0f; | ||
} | ||
} | ||
foreach (var key in ____negXKeyCodes) | ||
{ | ||
if (ModInputHandler.Instance.IsPressedAndIgnored(key)) | ||
{ | ||
____value.x = 0f; | ||
} | ||
} | ||
foreach (var key in ____posYKeyCodes) | ||
{ | ||
if (ModInputHandler.Instance.IsPressedAndIgnored(key)) | ||
{ | ||
____value.y = 0f; | ||
} | ||
} | ||
foreach (var key in ____negYKeyCodes) | ||
{ | ||
if (ModInputHandler.Instance.IsPressedAndIgnored(key)) | ||
{ | ||
____value.y = 0f; | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.