Add note parameter

This commit is contained in:
Epicgamer2469 2024-03-20 21:55:55 -05:00
parent de2b454002
commit dfce8701b0
11 changed files with 1331 additions and 57 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4c1bba3f89a3b7d4c879e4af8403c1f1
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -23060,6 +23060,7 @@ MonoBehaviour:
gridGameSelector: {fileID: 1154875947} gridGameSelector: {fileID: 1154875947}
IntegerP: {fileID: 2061329665160180680, guid: fe16d477643f72b44b519c07a3012363, type: 3} IntegerP: {fileID: 2061329665160180680, guid: fe16d477643f72b44b519c07a3012363, type: 3}
FloatP: {fileID: 872153477128913846, guid: 59791cf2ac17a4e4989da45598fa57dc, type: 3} FloatP: {fileID: 872153477128913846, guid: 59791cf2ac17a4e4989da45598fa57dc, type: 3}
NoteP: {fileID: 6158244585233792464, guid: 4c1bba3f89a3b7d4c879e4af8403c1f1, type: 3}
ButtonP: {fileID: 161819469546819110, guid: 950cb35d8fa268649aa7dd8f2eee60ad, type: 3} ButtonP: {fileID: 161819469546819110, guid: 950cb35d8fa268649aa7dd8f2eee60ad, type: 3}
BooleanP: {fileID: 161819469546819110, guid: a105c1177b918bc4ab70c00bde16f626, type: 3} BooleanP: {fileID: 161819469546819110, guid: a105c1177b918bc4ab70c00bde16f626, type: 3}
DropdownP: {fileID: 6474185410112721777, guid: d001cda1595359b4994b07211f2bc938, type: 3} DropdownP: {fileID: 6474185410112721777, guid: d001cda1595359b4994b07211f2bc938, type: 3}

View file

@ -26,12 +26,12 @@ namespace HeavenStudio.Games.Loaders
{ {
new Param.CollapseParam((x, _) => !(bool)x, new string[] { "note1", "note2", "note3", "note4", "note5", "note6"}) new Param.CollapseParam((x, _) => !(bool)x, new string[] { "note1", "note2", "note3", "note4", "note5", "note6"})
}), }),
new Param("note1", new EntityTypes.Integer(-24, 24, 0), "1st note", "Set the number of semitones up or down this note should be pitched."), new Param("note1", new EntityTypes.Note(-24, 24, 0, 3, 4), "1st note", "Set the number of semitones up or down this note should be pitched."),
new Param("note2", new EntityTypes.Integer(-24, 24, 2), "2nd note", "Set the number of semitones up or down this note should be pitched."), new Param("note2", new EntityTypes.Note(-24, 24, 2, 3, 4), "2nd note", "Set the number of semitones up or down this note should be pitched."),
new Param("note3", new EntityTypes.Integer(-24, 24, 4), "3rd note", "Set the number of semitones up or down this note should be pitched."), new Param("note3", new EntityTypes.Note(-24, 24, 4, 3, 4), "3rd note", "Set the number of semitones up or down this note should be pitched."),
new Param("note4", new EntityTypes.Integer(-24, 24, 5), "4th note", "Set the number of semitones up or down this note should be pitched."), new Param("note4", new EntityTypes.Note(-24, 24, 5, 3, 4), "4th note", "Set the number of semitones up or down this note should be pitched."),
new Param("note5", new EntityTypes.Integer(-24, 24, 7), "5th note", "Set the number of semitones up or down this note should be pitched. This note plays together with the 6th note."), new Param("note5", new EntityTypes.Note(-24, 24, 7, 3, 4), "5th note", "Set the number of semitones up or down this note should be pitched. This note plays together with the 6th note."),
new Param("note6", new EntityTypes.Integer(-24, 24, 12), "6th note", "Set the number of semitones up or down this note should be pitched. This note plays together with the 5th note."), new Param("note6", new EntityTypes.Note(-24, 24, 12, 3, 4), "6th note", "Set the number of semitones up or down this note should be pitched. This note plays together with the 5th note."),
} }
}, },
new GameAction("play piano", "Play Note") new GameAction("play piano", "Play Note")
@ -40,7 +40,7 @@ namespace HeavenStudio.Games.Loaders
resizable = true, resizable = true,
parameters = new List<Param>() parameters = new List<Param>()
{ {
new Param("type", new EntityTypes.Integer(-24, 24, 0), "Semitones", "Set the number of semitones up or down this note should be pitched.") new Param("type", new EntityTypes.Note(-24, 24, 0, 3, 4), "Semitones", "Set the number of semitones up or down this note should be pitched.")
}, },
}, },
new GameAction("color", "Color Palette") new GameAction("color", "Color Palette")

View file

@ -26,17 +26,17 @@ namespace HeavenStudio.Games.Loaders
resizable = true, resizable = true,
parameters = new List<Param>() parameters = new List<Param>()
{ {
new Param("semiTones", new EntityTypes.Integer(-24, 24, -5), "Semitones", "Set the number of semitones up or down this note should be pitched."), new Param("semiTones", new EntityTypes.Note(-24, 24, -5, 4, 5), "Semitones", "Set the number of semitones up or down this note should be pitched."),
new Param("semiTones1", new EntityTypes.Integer(-24, 24, -1), "Semitones (Next)", "Set the number of semitones up or down this note should be pitched."), new Param("semiTones1", new EntityTypes.Note(-24, 24, -1, 4, 5), "Semitones (Next)", "Set the number of semitones up or down this note should be pitched."),
new Param("semiTonesPlayer", new EntityTypes.Integer(-24, 24, 2), "Semitones (Player)", "Set the number of semitones up or down this note should be pitched."), new Param("semiTonesPlayer", new EntityTypes.Note(-24, 24, 2, 4, 5), "Semitones (Player)", "Set the number of semitones up or down this note should be pitched."),
new Param("close", GleeClub.MouthOpenClose.Both, "Close/Open Mouth", "Choose if the chorus kids should close or open their mouth."), new Param("close", GleeClub.MouthOpenClose.Both, "Close/Open Mouth", "Choose if the chorus kids should close or open their mouth."),
new Param("repeat", false, "Repeating", "Toggle if the left and middle chorus kid should repeat this singing cue.", new List<Param.CollapseParam>() new Param("repeat", false, "Repeating", "Toggle if the left and middle chorus kid should repeat this singing cue.", new List<Param.CollapseParam>()
{ {
new Param.CollapseParam((x, _) => (bool)x, new string[] { "semiTonesLeft2", "semiTonesLeft3", "semiTonesMiddle2" }) new Param.CollapseParam((x, _) => (bool)x, new string[] { "semiTonesLeft2", "semiTonesLeft3", "semiTonesMiddle2" })
}), }),
new Param("semiTonesLeft2", new EntityTypes.Integer(-24, 24, 0), "Semitones (Repeat Left First)", "Set the number of semitones up or down this note should be pitched."), new Param("semiTonesLeft2", new EntityTypes.Note(-24, 24, 0, 4, 5), "Semitones (Repeat Left First)", "Set the number of semitones up or down this note should be pitched."),
new Param("semiTonesLeft3", new EntityTypes.Integer(-24, 24, 0), "Semitones (Repeat Left Last)", "Set the number of semitones up or down this note should be pitched."), new Param("semiTonesLeft3", new EntityTypes.Note(-24, 24, 0, 4, 5), "Semitones (Repeat Left Last)", "Set the number of semitones up or down this note should be pitched."),
new Param("semiTonesMiddle2", new EntityTypes.Integer(-24, 24, 0), "Semitones (Repeat Middle)", "Set the number of semitones up or down this note should be pitched."), new Param("semiTonesMiddle2", new EntityTypes.Note(-24, 24, 0, 4, 5), "Semitones (Repeat Middle)", "Set the number of semitones up or down this note should be pitched."),
} }
}, },
new GameAction("baton", "Baton") new GameAction("baton", "Baton")
@ -50,9 +50,9 @@ namespace HeavenStudio.Games.Loaders
defaultLength = 4f, defaultLength = 4f,
parameters = new List<Param>() parameters = new List<Param>()
{ {
new Param("semiTones", new EntityTypes.Integer(-24, 24, -1), "Semitones", "Set the number of semitones up or down this note should be pitched."), new Param("semiTones", new EntityTypes.Note(-24, 24, -1, 4, 5), "Semitones", "Set the number of semitones up or down this note should be pitched."),
new Param("semiTones1", new EntityTypes.Integer(-24, 24, 4), "Semitones (Next)", "Set the number of semitones up or down this note should be pitched."), new Param("semiTones1", new EntityTypes.Note(-24, 24, 4, 4, 5), "Semitones (Next)", "Set the number of semitones up or down this note should be pitched."),
new Param("semiTonesPlayer", new EntityTypes.Integer(-24, 24, 10), "Semitones (Player)", "Set the number of semitones up or down this note should be pitched."), new Param("semiTonesPlayer", new EntityTypes.Note(-24, 24, 10, 4, 5), "Semitones (Player)", "Set the number of semitones up or down this note should be pitched."),
new Param("pitch", new EntityTypes.Float(0f, 5f, 1f), "Conductor Voice Pitch", "Choose the pitch of the conductor's voice. 1 is normal pitch.") new Param("pitch", new EntityTypes.Float(0f, 5f, 1f), "Conductor Voice Pitch", "Choose the pitch of the conductor's voice. 1 is normal pitch.")
} }
}, },
@ -62,9 +62,9 @@ namespace HeavenStudio.Games.Loaders
defaultLength = 0.5f, defaultLength = 0.5f,
parameters = new List<Param>() parameters = new List<Param>()
{ {
new Param("semiTones", new EntityTypes.Integer(-24, 24, 0), "Semitones", "Set the number of semitones up or down this note should be pitched."), new Param("semiTones", new EntityTypes.Note(-24, 24, 0, 4, 5), "Semitones", "Set the number of semitones up or down this note should be pitched."),
new Param("semiTones1", new EntityTypes.Integer(-24, 24, 0), "Semitones (Next)", "Set the number of semitones up or down this note should be pitched."), new Param("semiTones1", new EntityTypes.Note(-24, 24, 0, 4, 5), "Semitones (Next)", "Set the number of semitones up or down this note should be pitched."),
new Param("semiTonesPlayer", new EntityTypes.Integer(-24, 24, 0), "Semitones (Player)", "Set the number of semitones up or down this note should be pitched."), new Param("semiTonesPlayer", new EntityTypes.Note(-24, 24, 0, 4, 5), "Semitones (Player)", "Set the number of semitones up or down this note should be pitched."),
} }
}, },
new GameAction("presence", "Toggle Chorus Kids") new GameAction("presence", "Toggle Chorus Kids")

View file

@ -20,10 +20,10 @@ namespace HeavenStudio.Games.Loaders
parameters = new List<Param>() parameters = new List<Param>()
{ {
new Param("offset", new EntityTypes.Float(-1, 2, -1), "Spawn Offset", "Set when the rocket should rise up."), new Param("offset", new EntityTypes.Float(-1, 2, -1), "Spawn Offset", "Set when the rocket should rise up."),
new Param("note1", new EntityTypes.Integer(-24, 24, 2), "1st Note", "Set the number of semitones up or down this note should be pitched."), new Param("note1", new EntityTypes.Note(-24, 24, 2, 0, 4), "1st Note", "Set the number of semitones up or down this note should be pitched."),
new Param("note2", new EntityTypes.Integer(-24, 24, 4), "2nd Note", "Set the number of semitones up or down this note should be pitched."), new Param("note2", new EntityTypes.Note(-24, 24, 4, 0, 4), "2nd Note", "Set the number of semitones up or down this note should be pitched."),
new Param("note3", new EntityTypes.Integer(-24, 24, 5), "3rd Note", "Set the number of semitones up or down this note should be pitched."), new Param("note3", new EntityTypes.Note(-24, 24, 5, 0, 4), "3rd Note", "Set the number of semitones up or down this note should be pitched."),
new Param("note4", new EntityTypes.Integer(-24, 24, 7), "4th Note", "Set the number of semitones up or down this note should be pitched.") new Param("note4", new EntityTypes.Note(-24, 24, 7, 0, 4), "4th Note", "Set the number of semitones up or down this note should be pitched.")
} }
}, },
new GameAction("partyCracker", "Party-Popper") new GameAction("partyCracker", "Party-Popper")
@ -33,12 +33,12 @@ namespace HeavenStudio.Games.Loaders
parameters = new List<Param>() parameters = new List<Param>()
{ {
new Param("offset", new EntityTypes.Float(-1, 1, -1), "Spawn Offset", "Set when the rocket should rise up."), new Param("offset", new EntityTypes.Float(-1, 1, -1), "Spawn Offset", "Set when the rocket should rise up."),
new Param("note1", new EntityTypes.Integer(-24, 24, 4), "1st Note", "Set the number of semitones up or down this note should be pitched."), new Param("note1", new EntityTypes.Note(-24, 24, 4, 0, 4), "1st Note", "Set the number of semitones up or down this note should be pitched."),
new Param("note2", new EntityTypes.Integer(-24, 24, 5), "2nd Note", "Set the number of semitones up or down this note should be pitched."), new Param("note2", new EntityTypes.Note(-24, 24, 5, 0, 4), "2nd Note", "Set the number of semitones up or down this note should be pitched."),
new Param("note3", new EntityTypes.Integer(-24, 24, 7), "3rd Note", "Set the number of semitones up or down this note should be pitched."), new Param("note3", new EntityTypes.Note(-24, 24, 7, 0, 4), "3rd Note", "Set the number of semitones up or down this note should be pitched."),
new Param("note4", new EntityTypes.Integer(-24, 24, 9), "4th Note", "Set the number of semitones up or down this note should be pitched."), new Param("note4", new EntityTypes.Note(-24, 24, 9, 0, 4), "4th Note", "Set the number of semitones up or down this note should be pitched."),
new Param("note5", new EntityTypes.Integer(-24, 24, 11), "5th Note", "Set the number of semitones up or down this note should be pitched."), new Param("note5", new EntityTypes.Note(-24, 24, 11, 0, 4), "5th Note", "Set the number of semitones up or down this note should be pitched."),
new Param("note6", new EntityTypes.Integer(-24, 24, 12), "6th Note", "Set the number of semitones up or down this note should be pitched.") new Param("note6", new EntityTypes.Note(-24, 24, 12, 0, 4), "6th Note", "Set the number of semitones up or down this note should be pitched.")
} }
}, },
new GameAction("bell", "Bell") new GameAction("bell", "Bell")
@ -49,15 +49,15 @@ namespace HeavenStudio.Games.Loaders
parameters = new List<Param>() parameters = new List<Param>()
{ {
new Param("offset", new EntityTypes.Float(-1, 1, -1), "Spawn Offset", "Set when the rocket should rise up."), new Param("offset", new EntityTypes.Float(-1, 1, -1), "Spawn Offset", "Set when the rocket should rise up."),
new Param("note1", new EntityTypes.Integer(-24, 24, 0), "1st Note", "Set the number of semitones up or down this note should be pitched."), new Param("note1", new EntityTypes.Note(-24, 24, 0, 0, 4), "1st Note", "Set the number of semitones up or down this note should be pitched."),
new Param("note2", new EntityTypes.Integer(-24, 24, 2), "2nd Note", "Set the number of semitones up or down this note should be pitched."), new Param("note2", new EntityTypes.Note(-24, 24, 2, 0, 4), "2nd Note", "Set the number of semitones up or down this note should be pitched."),
new Param("note3", new EntityTypes.Integer(-24, 24, 4), "3rd Note", "Set the number of semitones up or down this note should be pitched."), new Param("note3", new EntityTypes.Note(-24, 24, 4, 0, 4), "3rd Note", "Set the number of semitones up or down this note should be pitched."),
new Param("note4", new EntityTypes.Integer(-24, 24, 5), "4th Note", "Set the number of semitones up or down this note should be pitched."), new Param("note4", new EntityTypes.Note(-24, 24, 5, 0, 4), "4th Note", "Set the number of semitones up or down this note should be pitched."),
new Param("note5", new EntityTypes.Integer(-24, 24, 7), "5th Note", "Set the number of semitones up or down this note should be pitched."), new Param("note5", new EntityTypes.Note(-24, 24, 7, 0, 4), "5th Note", "Set the number of semitones up or down this note should be pitched."),
new Param("note6", new EntityTypes.Integer(-24, 24, 9), "6th Note", "Set the number of semitones up or down this note should be pitched."), new Param("note6", new EntityTypes.Note(-24, 24, 9, 0, 4), "6th Note", "Set the number of semitones up or down this note should be pitched."),
new Param("note7", new EntityTypes.Integer(-24, 24, 11), "7th Note", "Set the number of semitones up or down this note should be pitched."), new Param("note7", new EntityTypes.Note(-24, 24, 11, 0, 4), "7th Note", "Set the number of semitones up or down this note should be pitched."),
new Param("note8", new EntityTypes.Integer(-24, 24, 12), "8th Note", "Set the number of semitones up or down this note should be pitched."), new Param("note8", new EntityTypes.Note(-24, 24, 12, 0, 4), "8th Note", "Set the number of semitones up or down this note should be pitched."),
new Param("note9", new EntityTypes.Integer(-24, 24, 0), "9th Note (Launch)", "Set the number of semitones up or down this note should be pitched."), new Param("note9", new EntityTypes.Note(-24, 24, 0, 0, 4), "9th Note (Launch)", "Set the number of semitones up or down this note should be pitched."),
} }
}, },
new GameAction("bowlingPin", "Bowling Pin") new GameAction("bowlingPin", "Bowling Pin")
@ -68,21 +68,21 @@ namespace HeavenStudio.Games.Loaders
parameters = new List<Param>() parameters = new List<Param>()
{ {
new Param("offset", new EntityTypes.Float(-1, 1, -1), "Spawn Offset", "Set when the rocket should rise up."), new Param("offset", new EntityTypes.Float(-1, 1, -1), "Spawn Offset", "Set when the rocket should rise up."),
new Param("note1", new EntityTypes.Integer(-24, 24, 5), "1st Note", "Set the number of semitones up or down this note should be pitched."), new Param("note1", new EntityTypes.Note(-24, 24, 5, 0, 4), "1st Note", "Set the number of semitones up or down this note should be pitched."),
new Param("note2", new EntityTypes.Integer(-24, 24, -1), "2nd Note (Flute)", "Set the number of semitones up or down this note should be pitched."), new Param("note2", new EntityTypes.Note(-24, 24, -1, 0, 4), "2nd Note (Flute)", "Set the number of semitones up or down this note should be pitched."),
new Param("note3", new EntityTypes.Integer(-24, 24, 0), "3rd Note (Flute)", "Set the number of semitones up or down this note should be pitched."), new Param("note3", new EntityTypes.Note(-24, 24, 0, 0, 4), "3rd Note (Flute)", "Set the number of semitones up or down this note should be pitched."),
new Param("note4", new EntityTypes.Integer(-24, 24, -1), "4th Note (Flute)", "Set the number of semitones up or down this note should be pitched."), new Param("note4", new EntityTypes.Note(-24, 24, -1, 0, 4), "4th Note (Flute)", "Set the number of semitones up or down this note should be pitched."),
new Param("note5", new EntityTypes.Integer(-24, 24, 0), "5th Note (Flute)", "Set the number of semitones up or down this note should be pitched."), new Param("note5", new EntityTypes.Note(-24, 24, 0, 0, 4), "5th Note (Flute)", "Set the number of semitones up or down this note should be pitched."),
new Param("note6", new EntityTypes.Integer(-24, 24, -1), "6th Note (Flute)", "Set the number of semitones up or down this note should be pitched."), new Param("note6", new EntityTypes.Note(-24, 24, -1, 0, 4), "6th Note (Flute)", "Set the number of semitones up or down this note should be pitched."),
new Param("note7", new EntityTypes.Integer(-24, 24, 0), "7th Note (Flute)", "Set the number of semitones up or down this note should be pitched."), new Param("note7", new EntityTypes.Note(-24, 24, 0, 0, 4), "7th Note (Flute)", "Set the number of semitones up or down this note should be pitched."),
new Param("note8", new EntityTypes.Integer(-24, 24, -1), "8th Note (Flute)", "Set the number of semitones up or down this note should be pitched."), new Param("note8", new EntityTypes.Note(-24, 24, -1, 0, 4), "8th Note (Flute)", "Set the number of semitones up or down this note should be pitched."),
new Param("note9", new EntityTypes.Integer(-24, 24, 0), "9th Note (Flute)", "Set the number of semitones up or down this note should be pitched."), new Param("note9", new EntityTypes.Note(-24, 24, 0, 0, 4), "9th Note (Flute)", "Set the number of semitones up or down this note should be pitched."),
new Param("note10", new EntityTypes.Integer(-24, 24, -1), "10th Note (Flute)", "Set the number of semitones up or down this note should be pitched."), new Param("note10", new EntityTypes.Note(-24, 24, -1, 0, 4), "10th Note (Flute)", "Set the number of semitones up or down this note should be pitched."),
new Param("note11", new EntityTypes.Integer(-24, 24, 0), "11th Note (Flute)", "Set the number of semitones up or down this note should be pitched."), new Param("note11", new EntityTypes.Note(-24, 24, 0, 0, 4), "11th Note (Flute)", "Set the number of semitones up or down this note should be pitched."),
new Param("note12", new EntityTypes.Integer(-24, 24, -1), "12th Note (Flute)", "Set the number of semitones up or down this note should be pitched."), new Param("note12", new EntityTypes.Note(-24, 24, -1, 0, 4), "12th Note (Flute)", "Set the number of semitones up or down this note should be pitched."),
new Param("note13", new EntityTypes.Integer(-24, 24, 0), "13th Note (Flute)", "Set the number of semitones up or down this note should be pitched."), new Param("note13", new EntityTypes.Note(-24, 24, 0, 0, 4), "13th Note (Flute)", "Set the number of semitones up or down this note should be pitched."),
new Param("note14", new EntityTypes.Integer(-24, 24, 7), "14th Note (Flute)", "Set the number of semitones up or down this note should be pitched."), new Param("note14", new EntityTypes.Note(-24, 24, 7, 0, 4), "14th Note (Flute)", "Set the number of semitones up or down this note should be pitched."),
new Param("note15", new EntityTypes.Integer(-24, 24, 7), "15th Note", "The number of semitones up or down this note should be pitched") new Param("note15", new EntityTypes.Note(-24, 24, 7, 0, 4), "15th Note", "The number of semitones up or down this note should be pitched")
} }
}, },
new GameAction("posMove", "Change Launch Pad Position") new GameAction("posMove", "Change Launch Pad Position")

View file

@ -19,6 +19,7 @@ namespace HeavenStudio.Editor
[Header("Property Prefabs")] [Header("Property Prefabs")]
[SerializeField] private GameObject IntegerP; [SerializeField] private GameObject IntegerP;
[SerializeField] private GameObject FloatP; [SerializeField] private GameObject FloatP;
[SerializeField] private GameObject NoteP;
[SerializeField] private GameObject ButtonP; [SerializeField] private GameObject ButtonP;
[SerializeField] private GameObject BooleanP; [SerializeField] private GameObject BooleanP;
[SerializeField] private GameObject DropdownP; [SerializeField] private GameObject DropdownP;
@ -44,6 +45,7 @@ namespace HeavenStudio.Editor
PropertyPrefabs = new() { PropertyPrefabs = new() {
{ typeof(Integer), IntegerP }, { typeof(Integer), IntegerP },
{ typeof(Float), FloatP }, { typeof(Float), FloatP },
{ typeof(Note), NoteP },
{ typeof(Dropdown), DropdownP }, { typeof(Dropdown), DropdownP },
{ typeof(Button), ButtonP }, { typeof(Button), ButtonP },
{ typeof(Color), ColorP }, { typeof(Color), ColorP },

View file

@ -15,6 +15,8 @@ namespace HeavenStudio.Editor
public Slider slider; public Slider slider;
public TMP_InputField inputField; public TMP_InputField inputField;
public TMP_Text noteLabel;
private float _defaultValue; private float _defaultValue;
public override void SetProperties(string propertyName, object type, string caption) public override void SetProperties(string propertyName, object type, string caption)
@ -71,6 +73,60 @@ namespace HeavenStudio.Editor
); );
break; break;
case EntityTypes.Note note:
slider.minValue = note.min;
slider.maxValue = note.max;
_defaultValue = note.val;
slider.wholeNumbers = true;
slider.value = Convert.ToSingle(parameterManager.entity[propertyName]);
inputField.text = slider.value.ToString();
noteLabel.text = GetNoteText(note, (int) slider.value);
slider.onValueChanged.AddListener(
_ =>
{
inputField.text = slider.value.ToString();
parameterManager.entity[propertyName] = (int) slider.value;
if (slider.value != _defaultValue)
{
this.caption.text = _captionText + "*";
}
else
{
this.caption.text = _captionText;
}
noteLabel.text = GetNoteText(note, (int) slider.value);
}
);
inputField.onSelect.AddListener(
_ =>
Editor.instance.editingInputField = true
);
inputField.onEndEdit.AddListener(
_ =>
{
slider.value = Convert.ToSingle(inputField.text);
parameterManager.entity[propertyName] = (int) slider.value;
Editor.instance.editingInputField = false;
if (slider.value != _defaultValue)
{
this.caption.text = _captionText + "*";
}
else
{
this.caption.text = _captionText;
}
noteLabel.text = GetNoteText(note, (int) slider.value);
}
);
break;
case EntityTypes.Float fl: case EntityTypes.Float fl:
slider.minValue = fl.min; slider.minValue = fl.min;
slider.maxValue = fl.max; slider.maxValue = fl.max;
@ -135,7 +191,7 @@ namespace HeavenStudio.Editor
{ {
switch (type) switch (type)
{ {
case EntityTypes.Integer integer: case EntityTypes.Integer or EntityTypes.Note:
slider.onValueChanged.AddListener(_ => UpdateCollapse((int)slider.value)); slider.onValueChanged.AddListener(_ => UpdateCollapse((int)slider.value));
inputField.onEndEdit.AddListener(_ => UpdateCollapse((int)slider.value)); inputField.onEndEdit.AddListener(_ => UpdateCollapse((int)slider.value));
@ -143,7 +199,7 @@ namespace HeavenStudio.Editor
break; break;
case EntityTypes.Float fl: case EntityTypes.Float:
slider.onValueChanged.AddListener(newVal => UpdateCollapse((float)Math.Round(newVal, 4))); slider.onValueChanged.AddListener(newVal => UpdateCollapse((float)Math.Round(newVal, 4)));
inputField.onEndEdit.AddListener(_ => UpdateCollapse(slider.value)); inputField.onEndEdit.AddListener(_ => UpdateCollapse(slider.value));
@ -157,6 +213,28 @@ namespace HeavenStudio.Editor
} }
} }
private static readonly string[] notes = {
"A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"
};
private static string GetNoteText(EntityTypes.Note note, int newSemitones)
{
int noteIndex = (note.sampleNote + newSemitones) % 12;
if (noteIndex < 0) {
noteIndex += 12;
}
int octaveOffset = (note.sampleNote + newSemitones) / 12;
int octave = note.sampleOctave + octaveOffset;
if ((note.sampleNote + newSemitones) % 12 < 0)
{
octave--;
}
return notes[noteIndex] + octave;
}
private void Update() private void Update()
{ {
} }

View file

@ -890,6 +890,7 @@ namespace HeavenStudio.Editor.Track
{ {
object returnVal = ep[i].parameter switch { object returnVal = ep[i].parameter switch {
EntityTypes.Integer intVal => intVal.val, EntityTypes.Integer intVal => intVal.val,
EntityTypes.Note noteVal => noteVal.val,
EntityTypes.Float floatVal => floatVal.val, EntityTypes.Float floatVal => floatVal.val,
EntityTypes.Button buttonVal => buttonVal.defaultLabel, EntityTypes.Button buttonVal => buttonVal.defaultLabel,
EntityTypes.Dropdown ddVal => new EntityTypes.DropdownObj(ddVal), EntityTypes.Dropdown ddVal => new EntityTypes.DropdownObj(ddVal),

View file

@ -252,6 +252,8 @@ namespace HeavenStudio
e.dynamicData.Add(param.propertyName, ((EntityTypes.Integer)param.parameter).val); e.dynamicData.Add(param.propertyName, ((EntityTypes.Integer)param.parameter).val);
else if (type == typeof(EntityTypes.Float)) else if (type == typeof(EntityTypes.Float))
e.dynamicData.Add(param.propertyName, ((EntityTypes.Float)param.parameter).val); e.dynamicData.Add(param.propertyName, ((EntityTypes.Float)param.parameter).val);
else if (type == typeof(EntityTypes.Note))
e.dynamicData.Add(param.propertyName, ((EntityTypes.Note)param.parameter).val);
else if (type.IsEnum) else if (type.IsEnum)
e.dynamicData.Add(param.propertyName, (int)param.parameter); e.dynamicData.Add(param.propertyName, (int)param.parameter);
else else
@ -263,7 +265,7 @@ namespace HeavenStudio
{ {
try try
{ {
if (type == typeof(EntityTypes.Integer)) if (type == typeof(EntityTypes.Integer) || type == typeof(EntityTypes.Note))
e.dynamicData[param.propertyName] = (int)e[param.propertyName]; e.dynamicData[param.propertyName] = (int)e[param.propertyName];
else if (type == typeof(EntityTypes.Float)) else if (type == typeof(EntityTypes.Float))
e.dynamicData[param.propertyName] = (float)e[param.propertyName]; e.dynamicData[param.propertyName] = (float)e[param.propertyName];
@ -295,6 +297,8 @@ namespace HeavenStudio
// use default value // use default value
if (type == typeof(EntityTypes.Integer)) if (type == typeof(EntityTypes.Integer))
e.dynamicData[param.propertyName] = ((EntityTypes.Integer)param.parameter).val; e.dynamicData[param.propertyName] = ((EntityTypes.Integer)param.parameter).val;
else if (type == typeof(EntityTypes.Note))
e.dynamicData[param.propertyName] = ((EntityTypes.Note)param.parameter).val;
else if (type == typeof(EntityTypes.Float)) else if (type == typeof(EntityTypes.Float))
e.dynamicData[param.propertyName] = ((EntityTypes.Float)param.parameter).val; e.dynamicData[param.propertyName] = ((EntityTypes.Float)param.parameter).val;
else if (type.IsEnum && param.propertyName != "ease") else if (type.IsEnum && param.propertyName != "ease")

View file

@ -23,6 +23,25 @@ namespace HeavenStudio
} }
} }
public struct Note
{
public int min;
public int val;
public int max;
public int sampleNote;
public int sampleOctave;
public Note(int min, int max, int val = 0, int sampleNote = 0, int sampleOctave = 0)
{
this.min = min;
this.val = val;
this.max = max;
this.sampleNote = sampleNote;
this.sampleOctave = sampleOctave;
}
}
public struct Float public struct Float
{ {
public float min; public float min;