-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc153af
commit 4f0cfc5
Showing
16 changed files
with
267 additions
and
11 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 +1,6 @@ | ||
- Added more events | ||
- Added more events. | ||
- Allow binding keybind config to panel visibility. | ||
- Added `clearpickups` command (removes all pickups in a radius). | ||
- Fixed some inputs not working sometimes. | ||
- Various bug fixes. | ||
- SUI improvements. |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,54 @@ | ||
using RedLoader; | ||
using UnityEngine.InputSystem; | ||
|
||
namespace SonsSdk; | ||
|
||
public abstract class CustomState | ||
{ | ||
public bool IsActive { get; private set; } | ||
|
||
protected InputAction[] ActionsToDisable; | ||
|
||
protected CustomState() {} | ||
|
||
protected CustomState(InputAction[] actionsToDisable) | ||
{ | ||
ActionsToDisable = actionsToDisable; | ||
} | ||
|
||
public void Start() | ||
{ | ||
if(ActionsToDisable != null) | ||
foreach (var action in ActionsToDisable) | ||
action.Disable(); | ||
|
||
OnStart(); | ||
GlobalEvents.OnUpdate.Subscribe(OnUpdateInternal); | ||
IsActive = true; | ||
} | ||
|
||
public void End() | ||
{ | ||
IsActive = false; | ||
GlobalEvents.OnUpdate.Subscribe(OnUpdateInternal); | ||
OnEnd(); | ||
|
||
if(ActionsToDisable != null) | ||
foreach (var action in ActionsToDisable) | ||
action.Enable(); | ||
} | ||
|
||
private void OnUpdateInternal() | ||
{ | ||
if(!IsActive) | ||
return; | ||
|
||
OnUpdate(); | ||
} | ||
|
||
protected abstract void OnStart(); | ||
|
||
protected abstract void OnEnd(); | ||
|
||
protected abstract void OnUpdate(); | ||
} |
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,64 @@ | ||
using Shapes; | ||
using UnityEngine; | ||
|
||
namespace SonsSdk; | ||
|
||
public class PreviewBox : IDisposable | ||
{ | ||
public GameObject Container; | ||
public Transform Transform; | ||
public Cuboid Cube; | ||
|
||
public bool IsActive { get; private set; } | ||
|
||
public PreviewBox() | ||
{ | ||
Container = new GameObject("PreviewBox"); | ||
Transform = Container.transform; | ||
Cube = Container.AddComponent<Cuboid>(); | ||
|
||
IsActive = true; | ||
} | ||
|
||
public PreviewBox(Color color) : this() | ||
{ | ||
SetColor(color); | ||
} | ||
|
||
public PreviewBox SetColor(Color color) | ||
{ | ||
Cube.Color = color; | ||
return this; | ||
} | ||
|
||
public void Set(Vector3 pos, Vector3 size) | ||
{ | ||
Transform.SetPositionAndRotation(pos, Quaternion.identity); | ||
Transform.localScale = size; | ||
} | ||
|
||
public void Set(Vector3 pos, Vector3 size, Quaternion rot) | ||
{ | ||
Transform.SetPositionAndRotation(pos, rot); | ||
Transform.localScale = size; | ||
} | ||
|
||
public void SetActive(bool active) | ||
{ | ||
if (active && !IsActive) | ||
{ | ||
Container.SetActive(true); | ||
IsActive = true; | ||
} | ||
else if (!active && IsActive) | ||
{ | ||
Container.SetActive(false); | ||
IsActive = false; | ||
} | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
Container.TryDestroy(); | ||
} | ||
} |
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,11 +1,40 @@ | ||
using UnityEngine; | ||
using RedLoader; | ||
using SonsSdk; | ||
using UnityEngine; | ||
|
||
namespace SUI; | ||
|
||
public class SPanelOptions : SContainerOptions | ||
{ | ||
public string Id { get; internal set; } | ||
|
||
private bool _closeOnKeyRelease; | ||
|
||
public SPanelOptions(GameObject root) : base(root) | ||
{ | ||
} | ||
|
||
public SPanelOptions BindKeyConfig(KeybindConfigEntry keybind, bool closeOnKeyRelease = false) | ||
{ | ||
_closeOnKeyRelease = closeOnKeyRelease; | ||
keybind.Notify(KeyPressed, KeyReleased); | ||
return this; | ||
} | ||
|
||
private void KeyPressed() | ||
{ | ||
if (_closeOnKeyRelease) | ||
{ | ||
Active(true); | ||
return; | ||
} | ||
|
||
Toggle(); | ||
} | ||
|
||
private void KeyReleased() | ||
{ | ||
if(_closeOnKeyRelease) | ||
Active(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
Oops, something went wrong.