Skip to content

Commit 546b535

Browse files
committed
Merge branch 'dev' into main
2 parents 7b46165 + 3cee25b commit 546b535

File tree

115 files changed

+2035
-1420
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+2035
-1420
lines changed

VRCOSC.Desktop/VRCOSC.Desktop.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<ApplicationIcon>game.ico</ApplicationIcon>
77
<ApplicationManifest>app.manifest</ApplicationManifest>
88
<Version>0.0.0</Version>
9-
<FileVersion>2022.1203.0</FileVersion>
9+
<FileVersion>2022.1211.0</FileVersion>
1010
<Title>VRCOSC</Title>
1111
<Authors>VolcanicArts</Authors>
1212
<Company>VolcanicArts</Company>
1313
<Nullable>enable</Nullable>
14-
<AssemblyVersion>2022.1203.0</AssemblyVersion>
14+
<AssemblyVersion>2022.1211.0</AssemblyVersion>
1515
</PropertyGroup>
1616
<ItemGroup Label="Project References">
1717
<ProjectReference Include="..\VRCOSC.Game\VRCOSC.Game.csproj" />
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
// Copyright (c) VolcanicArts. Licensed under the GPL-3.0 License.
2+
// See the LICENSE file in the repository root for full license text.
3+
4+
using System.Threading;
5+
using System.Threading.Tasks;
6+
using NUnit.Framework;
7+
using VRCOSC.Game.Modules;
8+
9+
namespace VRCOSC.Game.Tests.Tests;
10+
11+
public class TimedTaskTests
12+
{
13+
[Test]
14+
public void TestStart()
15+
{
16+
var actionInvoked = false;
17+
18+
Task action()
19+
{
20+
actionInvoked = true;
21+
return Task.CompletedTask;
22+
}
23+
24+
var task = new TimedTask(action, 100);
25+
task.Start().Wait();
26+
27+
Thread.Sleep(500);
28+
29+
Assert.IsTrue(actionInvoked);
30+
}
31+
32+
[Test]
33+
public void TestStop()
34+
{
35+
var actionInvoked = false;
36+
37+
Task action()
38+
{
39+
actionInvoked = true;
40+
return Task.CompletedTask;
41+
}
42+
43+
var task = new TimedTask(action, 100);
44+
task.Start().Wait();
45+
46+
Thread.Sleep(500);
47+
Assert.IsTrue(actionInvoked);
48+
49+
task.Stop().Wait();
50+
51+
actionInvoked = false;
52+
53+
Thread.Sleep(500);
54+
Assert.IsFalse(actionInvoked);
55+
}
56+
57+
[Test]
58+
public void TestExecuteOnceImmediately()
59+
{
60+
var actionInvoked = false;
61+
62+
Task action()
63+
{
64+
actionInvoked = true;
65+
return Task.CompletedTask;
66+
}
67+
68+
var task = new TimedTask(action, 100, true);
69+
task.Start().Wait();
70+
71+
Assert.IsTrue(actionInvoked);
72+
73+
Thread.Sleep(500);
74+
Assert.IsTrue(actionInvoked);
75+
}
76+
77+
[Test]
78+
public void TestStartMultipleTimes()
79+
{
80+
var actionInvoked = false;
81+
82+
Task action()
83+
{
84+
actionInvoked = true;
85+
return Task.CompletedTask;
86+
}
87+
88+
var task = new TimedTask(action, 100);
89+
task.Start().Wait();
90+
task.Start().Wait();
91+
92+
Thread.Sleep(500);
93+
94+
Assert.IsTrue(actionInvoked);
95+
}
96+
97+
[Test]
98+
public void TestStopWithoutStart()
99+
{
100+
var actionInvoked = false;
101+
102+
Task action()
103+
{
104+
actionInvoked = true;
105+
return Task.CompletedTask;
106+
}
107+
108+
var task = new TimedTask(action, 100);
109+
110+
task.Stop().Wait();
111+
112+
Thread.Sleep(500);
113+
Assert.IsFalse(actionInvoked);
114+
}
115+
}

VRCOSC.Game.Tests/VRCOSCTestBrowser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace VRCOSC.Game.Tests;
1010

11-
public class VRCOSCTestBrowser : VRCOSCGameBase
11+
public partial class VRCOSCTestBrowser : VRCOSCGameBase
1212
{
1313
protected override void LoadComplete()
1414
{

VRCOSC.Game.Tests/Visual/TestNotifications.cs

Lines changed: 0 additions & 83 deletions
This file was deleted.

VRCOSC.Game.Tests/Visual/VRCOSCGame.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace VRCOSC.Game.Tests.Visual;
88

9-
public class VRCOSCGame : VRCOSCTestScene
9+
public partial class VRCOSCGame : VRCOSCTestScene
1010
{
1111
[SetUp]
1212
public void SetUp()

VRCOSC.Game.Tests/Visual/VRCOSCTestScene.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66
namespace VRCOSC.Game.Tests.Visual;
77

8-
public class VRCOSCTestScene : TestScene
8+
public partial class VRCOSCTestScene : TestScene
99
{
1010
protected override ITestSceneTestRunner CreateRunner()
1111
{
1212
return new VRCOSCTestSceneTestRunner();
1313
}
1414

15-
private class VRCOSCTestSceneTestRunner : VRCOSCGameBase, ITestSceneTestRunner
15+
private partial class VRCOSCTestSceneTestRunner : VRCOSCGameBase, ITestSceneTestRunner
1616
{
1717
private TestSceneTestRunner.TestRunner runner = null!;
1818

VRCOSC.Game/Config/VRCOSCConfigManager.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using osu.Framework.Configuration;
55
using osu.Framework.Platform;
66
using VRCOSC.Game.Graphics.Settings;
7+
using VRCOSC.Game.Graphics.Themes;
78

89
namespace VRCOSC.Game.Config;
910

@@ -25,6 +26,8 @@ protected override void InitialiseDefaults()
2526
SetDefault(VRCOSCSetting.ReceivePort, 9001);
2627
SetDefault(VRCOSCSetting.UpdateMode, UpdateMode.Auto);
2728
SetDefault(VRCOSCSetting.UpdateRepo, @"https://github.com/VolcanicArts/VRCOSC");
29+
SetDefault(VRCOSCSetting.Theme, ColourTheme.Dark);
30+
SetDefault(VRCOSCSetting.ChatBoxTimeSpan, 1500);
2831
}
2932
}
3033

@@ -36,5 +39,7 @@ public enum VRCOSCSetting
3639
SendPort,
3740
ReceivePort,
3841
UpdateMode,
39-
UpdateRepo
42+
UpdateRepo,
43+
Theme,
44+
ChatBoxTimeSpan
4045
}

VRCOSC.Game/Constants.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) VolcanicArts. Licensed under the GPL-3.0 License.
2+
// See the LICENSE file in the repository root for full license text.
3+
4+
// ReSharper disable MemberCanBePrivate.Global
5+
6+
namespace VRCOSC.Game;
7+
8+
public static class Constants
9+
{
10+
public const string OSC_ADDRESS_AVATAR_PARAMETERS_PREFIX = @"/avatar/parameters/";
11+
public const string OSC_ADDRESS_AVATAR_CHANGE = @"/avatar/change";
12+
public const string OSC_ADDRESS_CHATBOX_INPUT = @"/chatbox/input";
13+
public const string OSC_ADDRESS_CHATBOX_TYPING = @"/chatbox/typing";
14+
15+
public const int OSC_UPDATE_FREQUENCY = 20;
16+
public const int OSC_UPDATE_DELTA = (int)(1f / OSC_UPDATE_FREQUENCY * 1000f);
17+
}

VRCOSC.Game/Modules/Util/TypeExtensions.cs renamed to VRCOSC.Game/Extensions.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33

44
using System;
55

6-
namespace VRCOSC.Game.Modules.Util;
6+
namespace VRCOSC.Game;
7+
8+
public static class EnumExtensions
9+
{
10+
public static string ToLookup(this Enum key) => key.ToString().ToLowerInvariant();
11+
}
712

813
public static class TypeExtensions
914
{
1015
public static string ToReadableName(this Type type)
1116
{
12-
if (type.IsSubclassOf(typeof(Enum)))
13-
return "Enum";
14-
15-
var typeCode = Type.GetTypeCode(type);
17+
if (type.IsSubclassOf(typeof(Enum))) return "Enum";
1618

17-
return typeCode switch
19+
return Type.GetTypeCode(type) switch
1820
{
1921
TypeCode.Empty => "Null",
2022
TypeCode.Object => "Object",

VRCOSC.Game/Graphics/About/AboutScreen.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using osu.Framework.Platform;
1212
using osuTK;
1313
using VRCOSC.Game.Config;
14+
using VRCOSC.Game.Graphics.Themes;
1415
using VRCOSC.Game.Graphics.UI.Button;
1516

1617
namespace VRCOSC.Game.Graphics.About;
@@ -36,7 +37,7 @@ public AboutScreen()
3637
new Box
3738
{
3839
RelativeSizeAxes = Axes.Both,
39-
Colour = VRCOSCColour.Gray5
40+
Colour = ThemeManager.Current[ThemeAttribute.Light]
4041
},
4142
new Container
4243
{
@@ -53,7 +54,7 @@ public AboutScreen()
5354
Direction = FillDirection.Full,
5455
Spacing = new Vector2(5)
5556
},
56-
text = new TextFlowContainer
57+
text = new TextFlowContainer(t => t.Colour = ThemeManager.Current[ThemeAttribute.Text])
5758
{
5859
RelativeSizeAxes = Axes.Both,
5960
TextAnchor = Anchor.BottomCentre

VRCOSC.Game/Graphics/LineSeparator.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using osu.Framework.Graphics.Containers;
66
using osu.Framework.Graphics.Shapes;
77
using osuTK;
8+
using VRCOSC.Game.Graphics.Themes;
89

910
namespace VRCOSC.Game.Graphics;
1011

@@ -20,7 +21,7 @@ public LineSeparator()
2021
Anchor = Anchor.Centre,
2122
Origin = Anchor.Centre,
2223
RelativeSizeAxes = Axes.Both,
23-
Colour = VRCOSCColour.Gray2
24+
Colour = ThemeManager.Current[ThemeAttribute.Darker]
2425
};
2526
}
2627
}

VRCOSC.Game/Graphics/MainContent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ private void load()
3333
ColumnDimensions = new[]
3434
{
3535
new Dimension(GridSizeMode.Absolute, 75),
36-
new Dimension(),
36+
new Dimension()
3737
},
3838
Content = new[]
3939
{

0 commit comments

Comments
 (0)