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 Mar 6, 2023
2 parents 285d07b + df945e5 commit 8c25efa
Show file tree
Hide file tree
Showing 63 changed files with 1,725 additions and 535 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>2023.205.0</FileVersion>
<FileVersion>2023.306.0</FileVersion>
<Title>VRCOSC</Title>
<Authors>VolcanicArts</Authors>
<Company>VolcanicArts</Company>
<Nullable>enable</Nullable>
<AssemblyVersion>2023.205.0</AssemblyVersion>
<AssemblyVersion>2023.306.0</AssemblyVersion>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\VRCOSC.Game\VRCOSC.Game.csproj" />
Expand Down
6 changes: 5 additions & 1 deletion VRCOSC.Game/Config/VRCOSCConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ protected override void InitialiseDefaults()
SetDefault(VRCOSCSetting.Theme, ColourTheme.Dark);
SetDefault(VRCOSCSetting.ChatBoxTimeSpan, 1500);
SetDefault(VRCOSCSetting.AutoStopOpenVR, false);
SetDefault(VRCOSCSetting.AutoStartOpenVR, false);
SetDefault(VRCOSCSetting.WindowState, WindowState.Maximised);
}
}

Expand All @@ -41,5 +43,7 @@ public enum VRCOSCSetting
UpdateMode,
Theme,
ChatBoxTimeSpan,
AutoStopOpenVR
AutoStopOpenVR,
AutoStartOpenVR,
WindowState
}
7 changes: 4 additions & 3 deletions VRCOSC.Game/Graphics/ModuleEditing/AttributeFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using VRCOSC.Game.Graphics.ModuleEditing.Attributes.Slider;
using VRCOSC.Game.Graphics.ModuleEditing.Attributes.Text;
using VRCOSC.Game.Graphics.ModuleEditing.Attributes.Toggle;
using VRCOSC.Game.Graphics.UI.Text;
using VRCOSC.Game.Modules;

namespace VRCOSC.Game.Graphics.ModuleEditing;
Expand Down Expand Up @@ -102,7 +103,7 @@ private AttributeCard generateSingleCard(ModuleAttributeSingle attributeData)
switch (value)
{
case string:
return new ButtonTextAttributeCard(attributeSingleWithButton);
return new ButtonStringAttributeCard(attributeSingleWithButton);

default:
throw new ArgumentOutOfRangeException(nameof(attributeSingleWithButton), "Cannot generate button with non-text counterpart");
Expand All @@ -125,10 +126,10 @@ private AttributeCard generateSingleCard(ModuleAttributeSingle attributeData)
switch (value)
{
case string:
return new TextAttributeCard(attributeData);
return new TextAttributeCard<StringTextBox, string>(attributeData);

case int:
return new IntTextAttributeCard(attributeData);
return new TextAttributeCard<IntTextBox, int>(attributeData);

case bool:
attributeData.Attribute.BindValueChanged(_ => checkShouldDisplay());
Expand Down
20 changes: 0 additions & 20 deletions VRCOSC.Game/Graphics/ModuleEditing/Attributes/AttributeCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using osu.Framework.Graphics.Sprites;
using osuTK;
using VRCOSC.Game.Graphics.Themes;
using VRCOSC.Game.Graphics.UI;
using VRCOSC.Game.Graphics.UI.Button;
using VRCOSC.Game.Modules;

Expand Down Expand Up @@ -140,23 +139,4 @@ protected void UpdateResetToDefault(bool show)

resetToDefault.FadeTo(newAlpha, 200, Easing.OutQuart);
}

#region Graphics

protected static VRCOSCTextBox CreateTextBox()
{
return new VRCOSCTextBox
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
Height = 40,
Masking = true,
CornerRadius = 5,
BorderColour = ThemeManager.Current[ThemeAttribute.Border],
BorderThickness = 2
};
}

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
using osuTK;
using VRCOSC.Game.Graphics.Themes;
using VRCOSC.Game.Graphics.UI.Button;
using VRCOSC.Game.Graphics.UI.Text;
using VRCOSC.Game.Modules;

namespace VRCOSC.Game.Graphics.ModuleEditing.Attributes.Text;

public sealed partial class ButtonTextAttributeCard : TextAttributeCard
public sealed partial class ButtonStringAttributeCard : TextAttributeCard<StringTextBox, string>
{
private readonly ModuleAttributeSingleWithButton attributeSingleWithButton;

public ButtonTextAttributeCard(ModuleAttributeSingleWithButton attributeData)
public ButtonStringAttributeCard(ModuleAttributeSingleWithButton attributeData)
: base(attributeData)
{
attributeSingleWithButton = attributeData;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
// See the LICENSE file in the repository root for full license text.

using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using VRCOSC.Game.Graphics.UI;
using VRCOSC.Game.Graphics.Themes;
using VRCOSC.Game.Graphics.UI.Text;
using VRCOSC.Game.Modules;

namespace VRCOSC.Game.Graphics.ModuleEditing.Attributes.Text;

public partial class TextAttributeCard : AttributeCardSingle
public partial class TextAttributeCard<TTextBox, TType> : AttributeCardSingle where TTextBox : ValidationTextBox<TType>, new()
{
protected VRCOSCTextBox TextBox = null!;
private TTextBox textBox = null!;

public TextAttributeCard(ModuleAttributeSingle attributeData)
: base(attributeData)
Expand All @@ -24,22 +24,28 @@ private void load()
ContentFlow.Add(CreateContent());
}

protected virtual Drawable CreateContent()
protected virtual Drawable CreateContent() => textBox = new TTextBox
{
return TextBox = CreateTextBox().With(t => t.Text = AttributeData.Attribute.Value.ToString());
}

protected override void SetDefault()
{
base.SetDefault();
TextBox.Current.Value = AttributeData.Attribute.Value.ToString();
}
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
Height = 40,
Masking = true,
CornerRadius = 5,
BorderColour = ThemeManager.Current[ThemeAttribute.Border],
BorderThickness = 2,
Text = AttributeData.Attribute.Value.ToString()
};

protected override void LoadComplete()
{
base.LoadComplete();
TextBox.Current.ValueChanged += OnTextBoxUpdate;
textBox.OnValidEntry += entry => UpdateAttribute(entry);
}

protected virtual void OnTextBoxUpdate(ValueChangedEvent<string> e) => UpdateAttribute(e.NewValue);
protected override void SetDefault()
{
base.SetDefault();
textBox.Current.Value = AttributeData.Attribute.Value.ToString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using osu.Framework.Bindables;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using VRCOSC.Game.Graphics.Themes;
using VRCOSC.Game.Graphics.UI.Text;
using VRCOSC.Game.Modules;

namespace VRCOSC.Game.Graphics.ModuleEditing.Attributes.Text;
Expand All @@ -31,8 +33,19 @@ protected override Bindable<object> GetDefaultItem()

private void addTextBox(Bindable<object> item)
{
var textBox = CreateTextBox().With(t => t.Text = item.Value.ToString());
textBox.Current.ValueChanged += e => item.Value = e.NewValue;
var textBox = new StringTextBox
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
Height = 40,
Masking = true,
CornerRadius = 5,
BorderColour = ThemeManager.Current[ThemeAttribute.Border],
BorderThickness = 2,
Text = item.Value.ToString()
};
textBox.OnValidEntry += e => item.Value = e;

AddContent(textBox);
}
Expand Down
1 change: 0 additions & 1 deletion VRCOSC.Game/Graphics/ModuleRun/ParameterDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public void AddEntry(string key, object value) => Schedule(() =>
{
var existingEntry = parameterDict[key];
existingEntry.Value.Value = valueStr;
existingEntry.Value.TriggerChange();
}
else
{
Expand Down
3 changes: 2 additions & 1 deletion VRCOSC.Game/Graphics/Settings/AutomationSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ public sealed partial class AutomationSection : SectionContainer

protected override void GenerateItems()
{
AddToggle("Start/Stop with VRChat", "Auto start/stop modules on VRChat start/stop", ConfigManager.GetBindable<bool>(VRCOSCSetting.AutoStartStop));
AddToggle("Start/Stop with VRChat", "Auto start/stop modules on VRChat open/close", ConfigManager.GetBindable<bool>(VRCOSCSetting.AutoStartStop));
AddToggle("Open with SteamVR", "Should VRCOSC open when SteamVR launches? Requires a manual launch when changing to true", ConfigManager.GetBindable<bool>(VRCOSCSetting.AutoStartOpenVR));
AddToggle("Close with SteamVR", "Should VRCOSC close when SteamVR closes?", ConfigManager.GetBindable<bool>(VRCOSCSetting.AutoStopOpenVR));
}
}
44 changes: 0 additions & 44 deletions VRCOSC.Game/Graphics/Settings/Cards/IntTextSettingCard.cs

This file was deleted.

31 changes: 19 additions & 12 deletions VRCOSC.Game/Graphics/Settings/Cards/TextSettingCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,41 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using VRCOSC.Game.Graphics.UI;
using VRCOSC.Game.Graphics.Themes;
using VRCOSC.Game.Graphics.UI.Text;

namespace VRCOSC.Game.Graphics.Settings.Cards;

public partial class TextSettingCard : SettingCard<string>
public partial class TextSettingCard<TTextBox, TType> : SettingCard<TType> where TTextBox : ValidationTextBox<TType>, new()
{
private VRCOSCTextBox textBox = null!;
private TTextBox textBox = null!;

public TextSettingCard(string title, string description, Bindable<string> settingBindable)
public TextSettingCard(string title, string description, Bindable<TType> settingBindable)
: base(title, description, settingBindable)
{
}

[BackgroundDependencyLoader]
private void load()
{
Add(textBox = CreateTextBox().With(t => t.Text = SettingBindable.Value));
Add(textBox = new TTextBox
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
Height = 40,
Masking = true,
CornerRadius = 5,
BorderColour = ThemeManager.Current[ThemeAttribute.Border],
BorderThickness = 2,
Text = SettingBindable.Value?.ToString(),
EmptyIsValid = false
});
}

protected override void LoadComplete()
{
base.LoadComplete();
textBox.Current.ValueChanged += e => UpdateValues(e.NewValue);
}

protected override void UpdateValues(string value)
{
base.UpdateValues(value);
textBox.Current.Value = value;
textBox.OnValidEntry += UpdateValues;
}
}
3 changes: 2 additions & 1 deletion VRCOSC.Game/Graphics/Settings/GeneralSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using VRCOSC.Game.Config;
using VRCOSC.Game.Graphics.Themes;
using VRCOSC.Game.Graphics.UI.Text;

namespace VRCOSC.Game.Graphics.Settings;

Expand All @@ -13,6 +14,6 @@ public partial class GeneralSection : SectionContainer
protected override void GenerateItems()
{
AddDropdown("Theme", "Select a theme and restart to see the effect", ConfigManager.GetBindable<ColourTheme>(VRCOSCSetting.Theme));
AddIntTextBox("ChatBox Time Span", "The delay between the ChatBox updating (milliseconds)\nIf you're experiencing ChatBox timeouts, increase this number by a few hundred milliseconds", ConfigManager.GetBindable<int>(VRCOSCSetting.ChatBoxTimeSpan));
AddTextBox<IntTextBox, int>("ChatBox Time Span", "The delay between the ChatBox updating (milliseconds)\nIf you're experiencing ChatBox timeouts, increase this number by a few hundred milliseconds", ConfigManager.GetBindable<int>(VRCOSCSetting.ChatBoxTimeSpan));
}
}
7 changes: 4 additions & 3 deletions VRCOSC.Game/Graphics/Settings/OscSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See the LICENSE file in the repository root for full license text.

using VRCOSC.Game.Config;
using VRCOSC.Game.Graphics.UI.Text;

namespace VRCOSC.Game.Graphics.Settings;

Expand All @@ -11,8 +12,8 @@ public sealed partial class OscSection : SectionContainer

protected override void GenerateItems()
{
AddTextBox("IP Address", "The IP address to send and receive OSC values to and from", ConfigManager.GetBindable<string>(VRCOSCSetting.IPAddress));
AddIntTextBox("Outgoing Port", "The port with which to send OSC values to", ConfigManager.GetBindable<int>(VRCOSCSetting.SendPort));
AddIntTextBox("Incoming Port", "The port with which to receive OSC values from", ConfigManager.GetBindable<int>(VRCOSCSetting.ReceivePort));
AddTextBox<IPTextBox, string>("IP Address", "The IP address to send and receive OSC values to and from", ConfigManager.GetBindable<string>(VRCOSCSetting.IPAddress));
AddTextBox<PortTextBox, int>("Outgoing Port", "The port with which to send OSC values to", ConfigManager.GetBindable<int>(VRCOSCSetting.SendPort));
AddTextBox<PortTextBox, int>("Incoming Port", "The port with which to receive OSC values from", ConfigManager.GetBindable<int>(VRCOSCSetting.ReceivePort));
}
}
Loading

0 comments on commit 8c25efa

Please sign in to comment.