Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
VolcanicArts committed Dec 11, 2022
2 parents 7b46165 + 3cee25b commit 546b535
Show file tree
Hide file tree
Showing 115 changed files with 2,035 additions and 1,420 deletions.
4 changes: 2 additions & 2 deletions VRCOSC.Desktop/VRCOSC.Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<ApplicationIcon>game.ico</ApplicationIcon>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Version>0.0.0</Version>
<FileVersion>2022.1203.0</FileVersion>
<FileVersion>2022.1211.0</FileVersion>
<Title>VRCOSC</Title>
<Authors>VolcanicArts</Authors>
<Company>VolcanicArts</Company>
<Nullable>enable</Nullable>
<AssemblyVersion>2022.1203.0</AssemblyVersion>
<AssemblyVersion>2022.1211.0</AssemblyVersion>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\VRCOSC.Game\VRCOSC.Game.csproj" />
Expand Down
115 changes: 115 additions & 0 deletions VRCOSC.Game.Tests/Tests/TimedTaskTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
// Copyright (c) VolcanicArts. Licensed under the GPL-3.0 License.
// See the LICENSE file in the repository root for full license text.

using System.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
using VRCOSC.Game.Modules;

namespace VRCOSC.Game.Tests.Tests;

public class TimedTaskTests
{
[Test]
public void TestStart()
{
var actionInvoked = false;

Task action()
{
actionInvoked = true;
return Task.CompletedTask;
}

var task = new TimedTask(action, 100);
task.Start().Wait();

Thread.Sleep(500);

Assert.IsTrue(actionInvoked);
}

[Test]
public void TestStop()
{
var actionInvoked = false;

Task action()
{
actionInvoked = true;
return Task.CompletedTask;
}

var task = new TimedTask(action, 100);
task.Start().Wait();

Thread.Sleep(500);
Assert.IsTrue(actionInvoked);

task.Stop().Wait();

actionInvoked = false;

Thread.Sleep(500);
Assert.IsFalse(actionInvoked);
}

[Test]
public void TestExecuteOnceImmediately()
{
var actionInvoked = false;

Task action()
{
actionInvoked = true;
return Task.CompletedTask;
}

var task = new TimedTask(action, 100, true);
task.Start().Wait();

Assert.IsTrue(actionInvoked);

Thread.Sleep(500);
Assert.IsTrue(actionInvoked);
}

[Test]
public void TestStartMultipleTimes()
{
var actionInvoked = false;

Task action()
{
actionInvoked = true;
return Task.CompletedTask;
}

var task = new TimedTask(action, 100);
task.Start().Wait();
task.Start().Wait();

Thread.Sleep(500);

Assert.IsTrue(actionInvoked);
}

[Test]
public void TestStopWithoutStart()
{
var actionInvoked = false;

Task action()
{
actionInvoked = true;
return Task.CompletedTask;
}

var task = new TimedTask(action, 100);

task.Stop().Wait();

Thread.Sleep(500);
Assert.IsFalse(actionInvoked);
}
}
2 changes: 1 addition & 1 deletion VRCOSC.Game.Tests/VRCOSCTestBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace VRCOSC.Game.Tests;

public class VRCOSCTestBrowser : VRCOSCGameBase
public partial class VRCOSCTestBrowser : VRCOSCGameBase
{
protected override void LoadComplete()
{
Expand Down
83 changes: 0 additions & 83 deletions VRCOSC.Game.Tests/Visual/TestNotifications.cs

This file was deleted.

2 changes: 1 addition & 1 deletion VRCOSC.Game.Tests/Visual/VRCOSCGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace VRCOSC.Game.Tests.Visual;

public class VRCOSCGame : VRCOSCTestScene
public partial class VRCOSCGame : VRCOSCTestScene
{
[SetUp]
public void SetUp()
Expand Down
4 changes: 2 additions & 2 deletions VRCOSC.Game.Tests/Visual/VRCOSCTestScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

namespace VRCOSC.Game.Tests.Visual;

public class VRCOSCTestScene : TestScene
public partial class VRCOSCTestScene : TestScene
{
protected override ITestSceneTestRunner CreateRunner()
{
return new VRCOSCTestSceneTestRunner();
}

private class VRCOSCTestSceneTestRunner : VRCOSCGameBase, ITestSceneTestRunner
private partial class VRCOSCTestSceneTestRunner : VRCOSCGameBase, ITestSceneTestRunner
{
private TestSceneTestRunner.TestRunner runner = null!;

Expand Down
7 changes: 6 additions & 1 deletion VRCOSC.Game/Config/VRCOSCConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using osu.Framework.Configuration;
using osu.Framework.Platform;
using VRCOSC.Game.Graphics.Settings;
using VRCOSC.Game.Graphics.Themes;

namespace VRCOSC.Game.Config;

Expand All @@ -25,6 +26,8 @@ protected override void InitialiseDefaults()
SetDefault(VRCOSCSetting.ReceivePort, 9001);
SetDefault(VRCOSCSetting.UpdateMode, UpdateMode.Auto);
SetDefault(VRCOSCSetting.UpdateRepo, @"https://github.com/VolcanicArts/VRCOSC");
SetDefault(VRCOSCSetting.Theme, ColourTheme.Dark);
SetDefault(VRCOSCSetting.ChatBoxTimeSpan, 1500);
}
}

Expand All @@ -36,5 +39,7 @@ public enum VRCOSCSetting
SendPort,
ReceivePort,
UpdateMode,
UpdateRepo
UpdateRepo,
Theme,
ChatBoxTimeSpan
}
17 changes: 17 additions & 0 deletions VRCOSC.Game/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) VolcanicArts. Licensed under the GPL-3.0 License.
// See the LICENSE file in the repository root for full license text.

// ReSharper disable MemberCanBePrivate.Global

namespace VRCOSC.Game;

public static class Constants
{
public const string OSC_ADDRESS_AVATAR_PARAMETERS_PREFIX = @"/avatar/parameters/";
public const string OSC_ADDRESS_AVATAR_CHANGE = @"/avatar/change";
public const string OSC_ADDRESS_CHATBOX_INPUT = @"/chatbox/input";
public const string OSC_ADDRESS_CHATBOX_TYPING = @"/chatbox/typing";

public const int OSC_UPDATE_FREQUENCY = 20;
public const int OSC_UPDATE_DELTA = (int)(1f / OSC_UPDATE_FREQUENCY * 1000f);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@

using System;

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

public static class EnumExtensions
{
public static string ToLookup(this Enum key) => key.ToString().ToLowerInvariant();
}

public static class TypeExtensions
{
public static string ToReadableName(this Type type)
{
if (type.IsSubclassOf(typeof(Enum)))
return "Enum";

var typeCode = Type.GetTypeCode(type);
if (type.IsSubclassOf(typeof(Enum))) return "Enum";

return typeCode switch
return Type.GetTypeCode(type) switch
{
TypeCode.Empty => "Null",
TypeCode.Object => "Object",
Expand Down
5 changes: 3 additions & 2 deletions VRCOSC.Game/Graphics/About/AboutScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using osu.Framework.Platform;
using osuTK;
using VRCOSC.Game.Config;
using VRCOSC.Game.Graphics.Themes;
using VRCOSC.Game.Graphics.UI.Button;

namespace VRCOSC.Game.Graphics.About;
Expand All @@ -36,7 +37,7 @@ public AboutScreen()
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = VRCOSCColour.Gray5
Colour = ThemeManager.Current[ThemeAttribute.Light]
},
new Container
{
Expand All @@ -53,7 +54,7 @@ public AboutScreen()
Direction = FillDirection.Full,
Spacing = new Vector2(5)
},
text = new TextFlowContainer
text = new TextFlowContainer(t => t.Colour = ThemeManager.Current[ThemeAttribute.Text])
{
RelativeSizeAxes = Axes.Both,
TextAnchor = Anchor.BottomCentre
Expand Down
3 changes: 2 additions & 1 deletion VRCOSC.Game/Graphics/LineSeparator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osuTK;
using VRCOSC.Game.Graphics.Themes;

namespace VRCOSC.Game.Graphics;

Expand All @@ -20,7 +21,7 @@ public LineSeparator()
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Colour = VRCOSCColour.Gray2
Colour = ThemeManager.Current[ThemeAttribute.Darker]
};
}
}
2 changes: 1 addition & 1 deletion VRCOSC.Game/Graphics/MainContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private void load()
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.Absolute, 75),
new Dimension(),
new Dimension()
},
Content = new[]
{
Expand Down
Loading

0 comments on commit 546b535

Please sign in to comment.