Skip to content

Commit

Permalink
Controller fix (#105)
Browse files Browse the repository at this point in the history
* fixed controller input bug introduced in PR #99

* version
  • Loading branch information
amazingalek authored May 22, 2020
1 parent 3c91e5f commit 3600ccf
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion OWML.Launcher/OWML.Manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"author": "Alek",
"name": "OWML",
"uniqueName": "Alek.OWML",
"version": "0.3.51",
"version": "0.3.52",
"description": "The mod loader and mod framework for Outer Wilds"
}
14 changes: 14 additions & 0 deletions OWML.ModHelper/ControllerButton.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
using OWML.ModHelper.Events;
using UnityEngine;
using UnityEngine.UI;

namespace OWML.ModHelper
{
public class ControllerButton : MonoBehaviour
{
private Button _button;
private SingleAxisCommand _inputCommand;

public void Init(SingleAxisCommand inputCommand)
{
_button = GetComponent<Button>();
_inputCommand = inputCommand;
var imageElement = GetComponent<ButtonWithHotkeyImageElement>();
if (imageElement == null)
{
Expand All @@ -16,5 +22,13 @@ public void Init(SingleAxisCommand inputCommand)
var title = UITextLibrary.GetString(textId);
imageElement.SetPrompt(new ScreenPrompt(inputCommand, title));
}

private void Update()
{
if (_inputCommand != null && _button != null && OWInput.IsPressed(_inputCommand, InputMode.Menu))
{
_button.onClick.Invoke();
}
}
}
}
2 changes: 1 addition & 1 deletion OWML.SampleMods/OWML.EnableDebugMode/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"name": "EnableDebugMode",
"uniqueName": "Alek.EnableDebugMode",
"version": "0.2",
"owmlVersion": "0.3.51",
"owmlVersion": "0.3.52",
"description": "Enables the debug mode in Outer Wilds"
}
2 changes: 1 addition & 1 deletion OWML.SampleMods/OWML.LoadCustomAssets/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"name": "LoadCustomAssets",
"uniqueName": "Alek.LoadCustomAssets",
"version": "0.5",
"owmlVersion": "0.3.51",
"owmlVersion": "0.3.52",
"description": "A mod for testing loading of custom assets"
}

0 comments on commit 3600ccf

Please sign in to comment.