Skip to content

Commit

Permalink
More organisation
Browse files Browse the repository at this point in the history
  • Loading branch information
VolcanicArts committed Dec 10, 2022
1 parent 7083fb2 commit c810856
Show file tree
Hide file tree
Showing 27 changed files with 36 additions and 47 deletions.
2 changes: 1 addition & 1 deletion VRCOSC.Game/Graphics/ModuleListing/Listing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private void filter()
moduleCardFlow.ForEach(moduleCard =>
{
var hasValidTitle = moduleCard.Module.Title.Contains(searchTerm, StringComparison.InvariantCultureIgnoreCase);
var hasValidType = type is null || moduleCard.Module.ModuleType.Equals(type);
var hasValidType = type is null || moduleCard.Module.Type.Equals(type);

if (hasValidTitle && hasValidType)
moduleCard.Show();
Expand Down
12 changes: 6 additions & 6 deletions VRCOSC.Game/Graphics/ModuleListing/ModuleCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,13 @@ public ModuleCard(Module module)

private Colour4 calculateModuleColour()
{
return Module.ModuleType switch
return Module.Type switch
{
ModuleType.General => Colour4.White.Darken(0.15f),
ModuleType.Health => Colour4.Red,
ModuleType.Integrations => Colour4.Yellow.Darken(0.25f),
ModuleType.Accessibility => Colour4.FromHex(@"66ccff"),
ModuleType.OpenVR => Colour4.FromHex(@"04144d"),
Module.ModuleType.General => Colour4.White.Darken(0.15f),
Module.ModuleType.Health => Colour4.Red,
Module.ModuleType.Integrations => Colour4.Yellow.Darken(0.25f),
Module.ModuleType.Accessibility => Colour4.FromHex(@"66ccff"),
Module.ModuleType.OpenVR => Colour4.FromHex(@"04144d"),
_ => throw new ArgumentOutOfRangeException()
};
}
Expand Down
2 changes: 1 addition & 1 deletion VRCOSC.Game/Graphics/ModuleListing/TypeFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ private enum Group
OpenVR = 4
}

private static ModuleType? groupToType(Group group) => group == Group.All ? null : (ModuleType)(int)group;
private static Module.ModuleType? groupToType(Group group) => group == Group.All ? null : (Module.ModuleType)(int)group;
}
1 change: 0 additions & 1 deletion VRCOSC.Game/Modules/BaseWebSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Threading;
using System.Threading.Tasks;
using SuperSocket.ClientEngine;
using VRCOSC.Game.Util;
using WebSocket4Net;

// ReSharper disable MemberCanBeProtected.Global
Expand Down
13 changes: 10 additions & 3 deletions VRCOSC.Game/Modules/Module.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Logging;
using osu.Framework.Platform;
using VRCOSC.Game.Modules.Modules.OpenVR;
using VRCOSC.Game.Util;
using VRCOSC.OSC;

// ReSharper disable MemberCanBePrivate.Global
Expand Down Expand Up @@ -44,7 +42,7 @@ public abstract class Module : IOscListener
public virtual string Description => string.Empty;
public virtual string Author => string.Empty;
public virtual string Prefab => string.Empty;
public virtual ModuleType ModuleType => ModuleType.General;
public virtual ModuleType Type => ModuleType.General;
protected virtual int DeltaUpdate => int.MaxValue;
protected virtual int ChatBoxPriority => 0;

Expand Down Expand Up @@ -639,4 +637,13 @@ public enum ModuleState
Stopping,
Stopped
}

public enum ModuleType
{
General = 0,
Health = 1,
Integrations = 2,
Accessibility = 3,
OpenVR = 4
}
}
1 change: 0 additions & 1 deletion VRCOSC.Game/Modules/ModuleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
using VRCOSC.Game.Modules.Modules.Media;
using VRCOSC.Game.Modules.Modules.OpenVR;
using VRCOSC.Game.Modules.Modules.Random;
using VRCOSC.Game.Util;
using VRCOSC.OSC;

namespace VRCOSC.Game.Modules;
Expand Down
13 changes: 0 additions & 13 deletions VRCOSC.Game/Modules/ModuleType.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class ChatBoxTextModule : ChatBoxModule
public override string Title => "ChatBox Text";
public override string Description => "Display custom text in the ChatBox";
public override string Author => "VolcanicArts";
public override ModuleType ModuleType => ModuleType.General;
public override ModuleType Type => ModuleType.General;
protected override int ChatBoxPriority => 2;

protected override bool DefaultChatBoxDisplay => true;
Expand Down
2 changes: 1 addition & 1 deletion VRCOSC.Game/Modules/Modules/Clock/ClockModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public sealed class ClockModule : ChatBoxModule
public override string Description => "Sends your local time as hours, minutes, and seconds";
public override string Author => "VolcanicArts";
public override string Prefab => "VRCOSC-Watch";
public override ModuleType ModuleType => ModuleType.General;
public override ModuleType Type => ModuleType.General;
protected override int DeltaUpdate => GetSetting<bool>(ClockSetting.SmoothSecond) ? Constants.OSC_UPDATE_DELTA : 1000;

protected override bool DefaultChatBoxDisplay => true;
Expand Down
2 changes: 1 addition & 1 deletion VRCOSC.Game/Modules/Modules/Discord/DiscordModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public sealed class DiscordModule : IntegrationModule
public override string Description => "Integration with the Discord desktop app";
public override string Author => "VolcanicArts";
public override string Prefab => "VRCOSC-Discord";
public override ModuleType ModuleType => ModuleType.Integrations;
public override ModuleType Type => ModuleType.Integrations;
protected override string TargetProcess => "discord";

protected override void CreateAttributes()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public sealed class HardwareStatsModule : ChatBoxModule
public override string Title => "Hardware Stats";
public override string Description => "Sends hardware stats and displays them in the ChatBox";
public override string Author => "VolcanicArts";
public override ModuleType ModuleType => ModuleType.General;
public override ModuleType Type => ModuleType.General;
protected override int DeltaUpdate => 2000;

protected override bool DefaultChatBoxDisplay => true;
Expand Down
2 changes: 1 addition & 1 deletion VRCOSC.Game/Modules/Modules/Heartrate/HeartRateModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public abstract class HeartRateModule : ChatBoxModule

public override string Author => "VolcanicArts";
public override string Prefab => "VRCOSC-Heartrate";
public override ModuleType ModuleType => ModuleType.Health;
public override ModuleType Type => ModuleType.Health;
protected override int DeltaUpdate => 2000;
protected override int ChatBoxPriority => 1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using Newtonsoft.Json;
using VRCOSC.Game.Modules.Modules.Heartrate.HypeRate.Models;
using VRCOSC.Game.Util;

namespace VRCOSC.Game.Modules.Modules.Heartrate.HypeRate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using Newtonsoft.Json;
using VRCOSC.Game.Modules.Modules.Heartrate.Pulsoid.Models;
using VRCOSC.Game.Util;

namespace VRCOSC.Game.Modules.Modules.Heartrate.Pulsoid;

Expand Down
2 changes: 1 addition & 1 deletion VRCOSC.Game/Modules/Modules/IntegrationModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Logging;
using VRCOSC.Game.Util;
using VRCOSC.Game.Processes;

namespace VRCOSC.Game.Modules.Modules;

Expand Down
2 changes: 1 addition & 1 deletion VRCOSC.Game/Modules/Modules/Media/MediaModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public sealed class MediaModule : ChatBoxModule
public override string Author => "VolcanicArts";
public override string Prefab => "VRCOSC-Media";
protected override int DeltaUpdate => 2000;
public override ModuleType ModuleType => ModuleType.Integrations;
public override ModuleType Type => ModuleType.Integrations;
protected override int ChatBoxPriority => 2;

protected override bool DefaultChatBoxDisplay => true;
Expand Down
2 changes: 1 addition & 1 deletion VRCOSC.Game/Modules/Modules/Media/MediaProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Threading.Tasks;
using Windows.Media;
using Windows.Media.Control;
using VRCOSC.Game.Util;
using VRCOSC.Game.Processes;
using WindowsMediaController;

namespace VRCOSC.Game.Modules.Modules.Media;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class GestureExtensionsModule : Module
public override string Title => "Gesture Extensions";
public override string Description => "Detect a range of custom gestures from Index controllers";
public override string Author => "VolcanicArts";
public override ModuleType ModuleType => ModuleType.OpenVR;
public override ModuleType Type => ModuleType.OpenVR;
protected override int DeltaUpdate => Constants.OSC_UPDATE_DELTA;

private float lowerThreshold;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class OpenVRControllerStatisticsModule : Module
public override string Title => "OpenVR Controller Statistics";
public override string Description => "Gets controller statistics from your OpenVR (SteamVR) session";
public override string Author => "VolcanicArts";
public override ModuleType ModuleType => ModuleType.OpenVR;
public override ModuleType Type => ModuleType.OpenVR;
protected override int DeltaUpdate => Constants.OSC_UPDATE_DELTA;

protected override void CreateAttributes()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class OpenVRStatisticsModule : Module
public override string Title => "OpenVR Statistics";
public override string Description => "Gets statistics from your OpenVR (SteamVR) session";
public override string Author => "VolcanicArts";
public override ModuleType ModuleType => ModuleType.OpenVR;
public override ModuleType Type => ModuleType.OpenVR;
protected override int DeltaUpdate => 5000;

protected override void CreateAttributes()
Expand Down
2 changes: 1 addition & 1 deletion VRCOSC.Game/Modules/Modules/Random/RandomModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public abstract class RandomModule<T> : Module where T : struct
public override string Title => $"Random {typeof(T).ToReadableName()}";
public override string Description => $"Sends a random {typeof(T).ToReadableName().ToLowerInvariant()} over a variable time period";
public override string Author => "VolcanicArts";
public override ModuleType ModuleType => ModuleType.General;
public override ModuleType Type => ModuleType.General;
protected override int DeltaUpdate => GetSetting<int>(RandomSetting.DeltaUpdate);

private readonly System.Random random = new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Logging;

namespace VRCOSC.Game.Util;
namespace VRCOSC.Game.Modules;

public sealed class TerminalLogger
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using osu.Framework.Extensions.IEnumerableExtensions;
using VRCOSC.Game.Modules;

namespace VRCOSC.Game.Util;
namespace VRCOSC.Game.Processes;

public static class ProcessExtensions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.Runtime.InteropServices;

namespace VRCOSC.Game.Util;
namespace VRCOSC.Game.Processes;

internal static class ProcessKey
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// ReSharper disable SuspiciousTypeConversion.Global
// ReSharper disable InconsistentNaming

namespace VRCOSC.Game.Util;
namespace VRCOSC.Game.Processes;

// https://stackoverflow.com/questions/20938934/controlling-applications-volume-by-process-id
internal static class ProcessVolume
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace VRCOSC.Game.Util;
namespace VRCOSC.Game.Processes;

internal static class ProcessWindow
{
Expand Down
3 changes: 1 addition & 2 deletions VRCOSC.Game/VRCOSCGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using VRCOSC.Game.Graphics.Themes;
using VRCOSC.Game.Graphics.Updater;
using VRCOSC.Game.Modules;
using VRCOSC.Game.Modules.Modules.OpenVR;

// ReSharper disable InconsistentNaming

Expand All @@ -41,7 +40,7 @@ public abstract partial class VRCOSCGame : VRCOSCGameBase
private OpenVRInterface openVrInterface = null!;

public Bindable<string> SearchTermFilter = new(string.Empty);
public Bindable<ModuleType?> TypeFilter = new();
public Bindable<Module.ModuleType?> TypeFilter = new();

[Cached]
private Bindable<Tab> SelectedTab = new();
Expand Down

0 comments on commit c810856

Please sign in to comment.