Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more customization options for notes and arrows #1

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion NoteTweaks/Configuration/PluginConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,5 +309,14 @@ [Ignore] public virtual float RightGlowOffsetY

public float OutlineBloomAmount { get; set; } = 0.1f;
public float FaceSymbolBloomAmount { get; set; } = 0.1f;

// P7eca
public virtual string NoteShape { get; set; } = "Default";

// P29e4
public virtual string ArrowShape { get; set; } = "Default";

// P7adc
public virtual string ConfigurationProfile { get; set; } = "Default";
}
}
}
22 changes: 21 additions & 1 deletion NoteTweaks/Managers/MaterialManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -376,5 +376,25 @@ private static void UpdateRenderQueues()
AccDotDepthMaterial.renderQueue = 1996;
}
}

internal static void ApplyNoteShape(Mesh noteMesh)
{
if (NoteMaterial == null)
{
return;
}

NoteMaterial.SetMesh(noteMesh);
}

internal static void ApplyArrowShape(Mesh arrowMesh)
{
if (ArrowMaterial == null)
{
return;
}

ArrowMaterial.SetMesh(arrowMesh);
}
}
}
}
54 changes: 53 additions & 1 deletion NoteTweaks/Managers/MeshManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,57 @@ public static void UpdateDefaultArrowMesh(Mesh mesh)
_defaultArrowMesh = mesh;
}
}

private static readonly Mesh DefaultNoteMesh = Utils.Meshes.GenerateFaceMesh(6);
private static readonly Mesh StarNoteMesh = Utils.Meshes.GenerateFaceMesh(10);
private static readonly Mesh HeartNoteMesh = Utils.Meshes.GenerateFaceMesh(8);
private static readonly Mesh DiamondNoteMesh = Utils.Meshes.GenerateFaceMesh(4);
private static readonly Mesh HexagonNoteMesh = Utils.Meshes.GenerateFaceMesh(6);

public static Mesh CurrentNoteMesh
{
get
{
switch (Config.NoteShape)
{
case "Star":
return StarNoteMesh;
case "Heart":
return HeartNoteMesh;
case "Diamond":
return DiamondNoteMesh;
case "Hexagon":
return HexagonNoteMesh;
default:
return DefaultNoteMesh;
}
}
}

private static readonly Mesh DefaultArrowShape = Utils.Meshes.GenerateBasicTriangleMesh();
private static readonly Mesh ArrowShape1 = Utils.Meshes.GenerateBasicLineMesh();
private static readonly Mesh ArrowShape2 = Utils.Meshes.GenerateChevronMesh();
private static readonly Mesh ArrowShape3 = Utils.Meshes.GeneratePointyMesh(new Vector2(0f, -0.0165f));
private static readonly Mesh ArrowShape4 = Utils.Meshes.GeneratePentagonMesh();

public static Mesh CurrentArrowShape
{
get
{
switch (Config.ArrowShape)
{
case "Shape1":
return ArrowShape1;
case "Shape2":
return ArrowShape2;
case "Shape3":
return ArrowShape3;
case "Shape4":
return ArrowShape4;
default:
return DefaultArrowShape;
}
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple things:

  • Note... mesh? We're not changing the shape of the notes themselves, so I'm confused what you're doing here.
  • How come the arrow shape names were replaced with, less describable names?
  • The default mesh, is the default arrow mesh. Why are we now replacing that with a triangle mesh? The default arrow is not just a triangle.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, are your changes to the GenerateFaceMesh function even in this PR? i'm not seeing them

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, are your changes to the GenerateFaceMesh function even in this PR? i'm not seeing them

Im pretty sure i didnt write that i changed GenerateFaceMesh but if i did my bad

}
}
}
25 changes: 24 additions & 1 deletion NoteTweaks/UI/BSML/Settings.bsml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
<slider-setting apply-on-change="true" value="RimScale" text="Rim Scale"
min="-10" max="10" increment="0.05" show-buttons="true"
hover-hint="Multiplicative value of rim lighting (DEFAULT: 2.00)"/>

<horizontal><text text="-----" font-size="4" color="#00000000"/></horizontal>

<dropdown-list-setting apply-on-change="true" value="NoteShape" text="Note Shape" choices="noteShapeChoices"
hover-hint="Change the shape of the notes"/>
</scroll-view>
</vertical>
</tab>
Expand Down Expand Up @@ -348,6 +353,11 @@
<slider-setting apply-on-change="true" value="ArrowGlowScale" text="Arrow Glow Scale"
min="0.01" max="2.0" increment="0.01" show-buttons="true" formatter="PercentageFormatter"
hover-hint="Scale of glow on arrows"/>

<horizontal><text text="-----" font-size="4" color="#00000000"/></horizontal>

<dropdown-list-setting apply-on-change="true" value="ArrowShape" text="Arrow Shape" choices="arrowShapeChoices"
hover-hint="Change the shape of the arrows"/>
</scroll-view>
</vertical>
</tab>
Expand Down Expand Up @@ -440,4 +450,17 @@
</scroll-view>
</vertical>
</tab>
</vertical>

<tab tags="tabs" tab-name="Profiles">
<vertical vertical-fit="PreferredSize" pref-height="70" pref-width="100" anchored-position-x="4">
<scroll-view spacing="0" pref-height="70" child-expand-width="true">
<dropdown-list-setting apply-on-change="true" value="ConfigurationProfile" text="Configuration Profile" choices="configurationProfileChoices"
hover-hint="Select a configuration profile"/>
<button-setting text="Save Profile" click-event="SaveProfile"
hover-hint="Save the current configuration to the selected profile"/>
<button-setting text="Load Profile" click-event="LoadProfile"
hover-hint="Load the selected configuration profile"/>
</scroll-view>
</vertical>
</tab>
</vertical>
22 changes: 21 additions & 1 deletion NoteTweaks/UI/ExtraPanelViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,5 +237,25 @@ internal bool UpdateIsAvailable
return VersionManager.LatestVersion > VersionData.ModVersion;
}
}

[UIAction("save-profile")]
private void SaveProfile()
{
string profilePath = Path.Combine(UnityGame.UserDataPath, "NoteTweaks", "Profiles", Config.ConfigurationProfile + ".json");
string json = JsonConvert.SerializeObject(Config, Formatting.Indented);
File.WriteAllText(profilePath, json);
}

[UIAction("load-profile")]
private void LoadProfile()
{
string profilePath = Path.Combine(UnityGame.UserDataPath, "NoteTweaks", "Profiles", Config.ConfigurationProfile + ".json");
if (File.Exists(profilePath))
{
string json = File.ReadAllText(profilePath);
JsonConvert.PopulateObject(json, Config);
NotifyPropertyChanged(nameof(Config));
}
}
}
}
}
8 changes: 6 additions & 2 deletions NoteTweaks/UI/SettingsFlowCoordinator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,16 @@ protected override void DidActivate(bool firstActivation, bool addedToHierarchy,
NotePreviewViewController.NoteContainer.SetActive(true);
}

// ReSharper disable once ParameterHidesMember
protected override void BackButtonWasPressed(ViewController topViewController)
{
_mainFlowCoordinator.DismissFlowCoordinator(this);

_ = NotePreviewViewController.CutoutFadeOut();
}

public void UpdateConfigurationProfile()
{
_settingsViewController.NotifyPropertyChanged(nameof(SettingsViewController.ConfigurationProfile));
}
}
}
}
32 changes: 31 additions & 1 deletion NoteTweaks/UI/SettingsViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1124,5 +1124,35 @@ private List<object> LoadTextureChoices()

return choices;
}

protected string NoteShape
{
get => Config.NoteShape;
set
{
Config.NoteShape = value;
NotePreviewViewController.UpdateNoteShape();
}
}

protected string ArrowShape
{
get => Config.ArrowShape;
set
{
Config.ArrowShape = value;
NotePreviewViewController.UpdateArrowShape();
}
}

protected string ConfigurationProfile
{
get => Config.ConfigurationProfile;
set
{
Config.ConfigurationProfile = value;
NotePreviewViewController.UpdateConfigurationProfile();
}
}
}
}
}