markers upgrade

This commit is contained in:
minenice55 2023-12-10 22:42:53 -05:00
parent 4435ec4a26
commit 67255bfee1
11 changed files with 1440 additions and 117 deletions

File diff suppressed because it is too large Load diff

View file

@ -53,6 +53,8 @@ namespace HeavenStudio
[NonSerialized] public RiqEntity lastSection, currentSection; [NonSerialized] public RiqEntity lastSection, currentSection;
[NonSerialized] public double nextSectionBeat; [NonSerialized] public double nextSectionBeat;
public double SectionProgress { get; private set; } public double SectionProgress { get; private set; }
public float MarkerWeight { get; private set; }
public int MarkerCategory { get; private set; }
public bool GameHasSplitColours public bool GameHasSplitColours
{ {
@ -332,20 +334,20 @@ namespace HeavenStudio
} }
} }
public void ScoreInputAccuracy(double beat, double accuracy, bool late, double time, float weight = 1, bool doDisplay = true, int category = 0) public void ScoreInputAccuracy(double beat, double accuracy, bool late, double time, float weight = 1, bool doDisplay = true)
{ {
if (weight > 0) if (weight > 0 && MarkerWeight > 0)
{ {
totalInputs += weight; totalInputs += weight * MarkerWeight;
totalPlayerAccuracy += Math.Abs(accuracy) * weight; totalPlayerAccuracy += Math.Abs(accuracy) * weight * MarkerWeight;
judgementInfo.inputs.Add(new JudgementManager.InputInfo judgementInfo.inputs.Add(new JudgementManager.InputInfo
{ {
beat = beat, beat = beat,
accuracyState = accuracy, accuracyState = accuracy,
timeOffset = time, timeOffset = time,
weight = weight, weight = weight * MarkerWeight,
category = category category = MarkerCategory
}); });
} }
@ -514,18 +516,43 @@ namespace HeavenStudio
{ {
if (cond.songPositionInBeatsAsDouble >= sectionBeats[currentSectionEvent]) if (cond.songPositionInBeatsAsDouble >= sectionBeats[currentSectionEvent])
{ {
Debug.Log("Section " + Beatmap.SectionMarkers[currentSectionEvent]["sectionName"] + " started"); RiqEntity marker = Beatmap.SectionMarkers[currentSectionEvent];
lastSection = currentSection; if (!string.IsNullOrEmpty(marker["sectionName"]))
if (currentSectionEvent < Beatmap.SectionMarkers.Count) {
currentSection = Beatmap.SectionMarkers[currentSectionEvent]; Debug.Log("Section " + marker["sectionName"] + " started");
else lastSection = currentSection;
currentSection = null; if (currentSectionEvent < Beatmap.SectionMarkers.Count)
currentSectionEvent++; currentSection = marker;
if (currentSectionEvent < Beatmap.SectionMarkers.Count) else
nextSectionBeat = Beatmap.SectionMarkers[currentSectionEvent].beat; currentSection = null;
else
nextSectionBeat = endBeat; nextSectionBeat = endBeat;
onSectionChange?.Invoke(currentSection, lastSection); foreach (RiqEntity futureSection in Beatmap.SectionMarkers)
{
if (futureSection.beat < marker.beat) continue;
if (futureSection == marker) continue;
if (!string.IsNullOrEmpty(futureSection["sectionName"]))
{
nextSectionBeat = futureSection.beat;
break;
}
}
onSectionChange?.Invoke(currentSection, lastSection);
}
if (OverlaysManager.OverlaysEnabled)
{
if (PersistentDataManager.gameSettings.perfectChallengeType != PersistentDataManager.PerfectChallengeType.Off)
{
if (marker["startPerfect"] && GoForAPerfect.instance != null && GoForAPerfect.instance.perfect && !GoForAPerfect.instance.gameObject.activeSelf)
{
GoForAPerfect.instance.Enable(marker.beat);
}
}
}
MarkerWeight = marker["weight"];
MarkerCategory = marker["category"];
currentSectionEvent++;
} }
} }
@ -654,6 +681,9 @@ namespace HeavenStudio
medals = new List<JudgementManager.MedalInfo>() medals = new List<JudgementManager.MedalInfo>()
}; };
MarkerWeight = 1;
MarkerCategory = 0;
if (playMode && delay > 0) if (playMode && delay > 0)
{ {
GlobalGameManager.ForceFade(0, delay * 0.5f, delay * 0.5f); GlobalGameManager.ForceFade(0, delay * 0.5f, delay * 0.5f);

View file

@ -434,10 +434,10 @@ namespace HeavenStudio.Games
return null; return null;
} }
public void ScoreMiss(float weight = 1f, int category = 0) public void ScoreMiss(float weight = 1f)
{ {
double beat = Conductor.instance?.songPositionInBeatsAsDouble ?? -1; double beat = Conductor.instance?.songPositionInBeatsAsDouble ?? -1;
GameManager.instance.ScoreInputAccuracy(beat, 0, true, NgLateTime(), weight, false, category); GameManager.instance.ScoreInputAccuracy(beat, 0, true, NgLateTime(), weight, false);
if (weight > 0) if (weight > 0)
{ {
GoForAPerfect.instance.Miss(); GoForAPerfect.instance.Miss();
@ -447,7 +447,6 @@ namespace HeavenStudio.Games
public void ToggleSplitColoursDisplay(bool on) public void ToggleSplitColoursDisplay(bool on)
{ {
} }
#region Bop #region Bop

View file

@ -26,7 +26,6 @@ namespace HeavenStudio.Games
public double startBeat; public double startBeat;
public double timer; public double timer;
public int category;
public float weight = 1f; public float weight = 1f;
public bool isEligible = true; public bool isEligible = true;
@ -271,7 +270,7 @@ namespace HeavenStudio.Games
if (countsForAccuracy && !(noAutoplay || autoplayOnly) && isEligible) if (countsForAccuracy && !(noAutoplay || autoplayOnly) && isEligible)
{ {
GameManager.instance.ScoreInputAccuracy(startBeat + timer, TimeToAccuracy(time), time > 1.0, time, weight, true, category); GameManager.instance.ScoreInputAccuracy(startBeat + timer, TimeToAccuracy(time), time > 1.0, time, weight, true);
if (state >= 1f || state <= -1f) if (state >= 1f || state <= -1f)
{ {
GoForAPerfect.instance.Miss(); GoForAPerfect.instance.Miss();
@ -345,7 +344,7 @@ namespace HeavenStudio.Games
if (countsForAccuracy && !(noAutoplay || autoplayOnly)) if (countsForAccuracy && !(noAutoplay || autoplayOnly))
{ {
GameManager.instance.ScoreInputAccuracy(startBeat + timer, 0, true, 2.0, weight, false, category); GameManager.instance.ScoreInputAccuracy(startBeat + timer, 0, true, 2.0, weight, false);
GoForAPerfect.instance.Miss(); GoForAPerfect.instance.Miss();
SectionMedalsManager.instance.MakeIneligible(); SectionMedalsManager.instance.MakeIneligible();
} }

View file

@ -1,3 +1,4 @@
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
@ -13,17 +14,26 @@ public class SectionDialog : Dialog
SectionTimelineObj sectionObj; SectionTimelineObj sectionObj;
[SerializeField] TMP_InputField sectionName; [SerializeField] TMP_InputField sectionName;
[SerializeField] Toggle challengeEnable; [SerializeField] Toggle challengeEnable;
[SerializeField] Slider markerWeight;
[SerializeField] TMP_InputField markerWeightManual;
public void SwitchSectionDialog() public void SwitchSectionDialog()
{ {
if(dialog.activeSelf) { if (dialog.activeSelf)
{
sectionObj = null; sectionObj = null;
dialog.SetActive(false); dialog.SetActive(false);
Editor.instance.inAuthorativeMenu = false; Editor.instance.inAuthorativeMenu = false;
} else { }
else
{
Editor.instance.inAuthorativeMenu = true; Editor.instance.inAuthorativeMenu = true;
ResetAllDialogs(); ResetAllDialogs();
dialog.SetActive(true); dialog.SetActive(true);
markerWeight.maxValue = 8;
markerWeight.minValue = 0;
markerWeight.wholeNumbers = true;
} }
} }
@ -32,11 +42,17 @@ public class SectionDialog : Dialog
this.sectionObj = sectionObj; this.sectionObj = sectionObj;
sectionName.text = sectionObj.chartEntity["sectionName"]; sectionName.text = sectionObj.chartEntity["sectionName"];
challengeEnable.isOn = sectionObj.chartEntity["startPerfect"]; challengeEnable.isOn = sectionObj.chartEntity["startPerfect"];
markerWeight.value = sectionObj.chartEntity["weight"];
markerWeight.maxValue = 8;
markerWeight.minValue = 0;
markerWeight.wholeNumbers = true;
} }
public void DeleteSection() public void DeleteSection()
{ {
if(dialog.activeSelf) { if (dialog.activeSelf)
{
dialog.SetActive(false); dialog.SetActive(false);
Editor.instance.inAuthorativeMenu = false; Editor.instance.inAuthorativeMenu = false;
} }
@ -47,6 +63,7 @@ public class SectionDialog : Dialog
public void ChangeSectionName(string name) public void ChangeSectionName(string name)
{ {
if (sectionObj == null) return; if (sectionObj == null) return;
if (string.IsNullOrWhiteSpace(name)) name = string.Empty;
sectionObj.chartEntity["sectionName"] = name; sectionObj.chartEntity["sectionName"] = name;
sectionObj.UpdateLabel(); sectionObj.UpdateLabel();
} }
@ -56,4 +73,18 @@ public class SectionDialog : Dialog
if (sectionObj == null) return; if (sectionObj == null) return;
sectionObj.chartEntity["startPerfect"] = challengeEnable.isOn; sectionObj.chartEntity["startPerfect"] = challengeEnable.isOn;
} }
public void SetSectionWeight()
{
if (sectionObj == null) return;
sectionObj.chartEntity["weight"] = markerWeight.value;
markerWeightManual.text = ((float) sectionObj.chartEntity["weight"]).ToString("G");
}
public void SetSectionWeightManual()
{
if (sectionObj == null) return;
sectionObj.chartEntity["weight"] = (float) Math.Round(Convert.ToSingle(markerWeightManual.text), 2);
markerWeight.value = sectionObj.chartEntity["weight"];
}
} }

View file

@ -240,6 +240,10 @@ namespace HeavenStudio.Editor.Track
{ {
RiqEntity sectionC = GameManager.instance.Beatmap.AddNewSectionMarker(Timeline.instance.MousePos2BeatSnap, "New Section"); RiqEntity sectionC = GameManager.instance.Beatmap.AddNewSectionMarker(Timeline.instance.MousePos2BeatSnap, "New Section");
sectionC.CreateProperty("startPerfect", false);
sectionC.CreateProperty("weight", 1f);
sectionC.CreateProperty("category", 0);
sectionTimelineObj.chartEntity = sectionC; sectionTimelineObj.chartEntity = sectionC;
GameManager.instance.Beatmap.SectionMarkers.Add(sectionC); GameManager.instance.Beatmap.SectionMarkers.Add(sectionC);
CommandManager.Instance.AddCommand(new Commands.AddMarker(sectionC, sectionC.guid, HoveringTypes.SectionChange)); CommandManager.Instance.AddCommand(new Commands.AddMarker(sectionC, sectionC.guid, HoveringTypes.SectionChange));

View file

@ -29,7 +29,10 @@ namespace HeavenStudio.Editor.Track
public void UpdateLabel() public void UpdateLabel()
{ {
sectionLabel.text = chartEntity["sectionName"]; if (string.IsNullOrEmpty(chartEntity["sectionName"]))
sectionLabel.text = $"x{chartEntity["weight"]:0}";
else
sectionLabel.text = $"x{chartEntity["weight"]:0} | {chartEntity["sectionName"]}";
if (!moving) if (!moving)
SetX(chartEntity); SetX(chartEntity);
} }
@ -88,7 +91,7 @@ namespace HeavenStudio.Editor.Track
} }
else else
{ {
gameObject.SetActive(false); gameObject.SetActive(false);
} }
} }

View file

@ -324,7 +324,7 @@ namespace HeavenStudio.Editor.Track
Tooltip.AddTooltip(SelectionsBTN.gameObject, "Tool: Selection <color=#adadad>[1]</color>"); Tooltip.AddTooltip(SelectionsBTN.gameObject, "Tool: Selection <color=#adadad>[1]</color>");
Tooltip.AddTooltip(TempoChangeBTN.gameObject, "Tool: Tempo Change <color=#adadad>[2]</color>"); Tooltip.AddTooltip(TempoChangeBTN.gameObject, "Tool: Tempo Change <color=#adadad>[2]</color>");
Tooltip.AddTooltip(MusicVolumeBTN.gameObject, "Tool: Music Volume <color=#adadad>[3]</color>"); Tooltip.AddTooltip(MusicVolumeBTN.gameObject, "Tool: Music Volume <color=#adadad>[3]</color>");
Tooltip.AddTooltip(ChartSectionBTN.gameObject, "Tool: Beatmap Sections <color=#adadad>[4]</color>"); Tooltip.AddTooltip(ChartSectionBTN.gameObject, "Tool: Markers <color=#adadad>[4]</color>");
Tooltip.AddTooltip(StartingTempoSpecialAll.gameObject, "Starting Tempo (BPM)"); Tooltip.AddTooltip(StartingTempoSpecialAll.gameObject, "Starting Tempo (BPM)");
Tooltip.AddTooltip(StartingTempoSpecialTempo.gameObject, "Starting Tempo (BPM)"); Tooltip.AddTooltip(StartingTempoSpecialTempo.gameObject, "Starting Tempo (BPM)");

View file

@ -43,53 +43,52 @@ namespace HeavenStudio
////// CATEGORY 1: SONG INFO ////// CATEGORY 1: SONG INFO
// general chart info // general chart info
{"remixtitle", "New Remix"}, // chart name {"remixtitle", "New Remix"}, // chart name
{"remixauthor", "Your Name"}, // charter's name {"remixauthor", "Your Name"}, // charter's name
{"remixdesc", "Remix Description"}, // chart description {"remixdesc", "Remix Description"}, // chart description
{"remixlevel", 1}, // chart difficulty (maybe offer a suggestion but still have the mapper determine it) {"remixlevel", 1}, // chart difficulty (maybe offer a suggestion but still have the mapper determine it)
{"remixtempo", 120f}, // avg. chart tempo {"remixtempo", 120f}, // avg. chart tempo
{"remixtags", ""}, // chart tags {"remixtags", ""}, // chart tags
{"icontype", 0}, // chart icon (presets, custom - future) {"icontype", 0}, // chart icon (presets, custom - future)
{"iconurl", ""}, // custom icon location (future) {"iconres", new EntityTypes.Resource(EntityTypes.Resource.ResourceType.Image, "Images/Select/", "Icon")}, // custom icon location (future)
{"challengetype", 0}, // perfect challenge type {"challengetype", 0}, // perfect challenge type
{"playstyle", RecommendedControlStyle.Any}, // recommended control style {"playstyle", RecommendedControlStyle.Any}, // recommended control style
// chart song info // chart song info
{"idolgenre", "Song Genre"}, // song genre {"idolgenre", "Song Genre"}, // song genre
{"idolsong", "Song Name"}, // song name {"idolsong", "Song Name"}, // song name
{"idolcredit", "Artist"}, // song artist {"idolcredit", "Artist"}, // song artist
////// CATEGORY 2: PROLOGUE AND EPILOGUE ////// CATEGORY 2: PROLOGUE AND EPILOGUE
// chart prologue // chart prologue
{"prologuetype", 0}, // prologue card animation (future) {"prologuetype", 0}, // prologue card animation (future)
{"prologuecaption", "Remix"}, // prologue card sub-title (future) {"prologuecaption", "Remix"}, // prologue card sub-title (future)
// chart results screen messages // chart results screen messages
{"resultcaption", "Rhythm League Notes"}, // result screen header {"resultcaption", "Rhythm League Notes"}, // result screen header
{"resultcommon_hi", "Good rhythm."}, // generic "Superb" message (one-liner, or second line for single-type) {"resultcommon_hi", "Good rhythm."}, // generic "Superb" message (one-liner)
{"resultcommon_ok", "Eh. Passable."}, // generic "OK" message (one-liner, or second line for single-type) {"resultcommon_ok", "Eh. Passable."}, // generic "OK" message (one-liner)
{"resultcommon_ng", "Try harder next time."}, // generic "Try Again" message (one-liner, or second line for single-type) {"resultcommon_ng", "Try harder next time."}, // generic "Try Again" message (one-liner)
// the following are shown / hidden in-editor depending on the tags of the games used {"resultcat0_hi", "You show strong fundamentals."}, // "Superb" message for input category 0 "normal" (two-liner)
{"resultnormal_hi", "You show strong fundamentals."}, // "Superb" message for normal games (two-liner) {"resultcat0_ng", "Work on your fundamentals."}, // "Try Again" message for input category 0 "normal" (two-liner)
{"resultnormal_ng", "Work on your fundamentals."}, // "Try Again" message for normal games (two-liner)
{"resultkeep_hi", "You kept the beat well."}, // "Superb" message for keep-the-beat games (two-liner) {"resultcat1_hi", "You kept the beat well."}, // "Superb" message for input category 1 "keep" (two-liner)
{"resultkeep_ng", "You had trouble keeping the beat."}, // "Try Again" message for keep-the-beat games (two-liner) {"resultcat1_ng", "You had trouble keeping the beat."}, // "Try Again" message for input category 1 "keep" (two-liner)
{"resultaim_hi", "You had great aim."}, // "Superb" message for aim games (two-liner) {"resultcat2_hi", "You had great aim."}, // "Superb" message for input category 2 "aim" (two-liner)
{"resultaim_ng", "Your aim was a little shaky."}, // "Try Again" message for aim games (two-liner) {"resultcat2_ng", "Your aim was a little shaky."}, // "Try Again" message for input category 2 "aim" (two-liner)
{"resultcat3_hi", "You followed the example well."}, // "Superb" message for input category 3 "repeat" (two-liner)
{"resultcat3_ng", "Next time, follow the example better."}, // "Try Again" message for input category 3 "repeat" (two-liner)
{"resultrepeat_hi", "You followed the example well."}, // "Superb" message for call-and-response games (two-liner) {"epilogue_hi", "Superb picture"}, // epilogue "Superb" message
{"resultrepeat_ng", "Next time, follow the example better."}, // "Try Again" message for call-and-response games (two-liner) {"epilogue_ok", "OK picture"}, // epilogue "OK" message
{"epilogue_ng", "Try Again picture"}, // epilogue "Try Again" message
{"epilogue_hi", "Superb picture"}, // epilogue "Superb" message {"epilogue_hi_res", new EntityTypes.Resource(EntityTypes.Resource.ResourceType.Image, "Images/Epilogue/", "Hi")}, // epilogue "Superb" image resource path
{"epilogue_ok", "OK picture"}, // epilogue "OK" message {"epilogue_ok_res", new EntityTypes.Resource(EntityTypes.Resource.ResourceType.Image, "Images/Epilogue/", "Ok")}, // epilogue "OK" image resource path
{"epilogue_ng", "Try Again picture"}, // epilogue "Try Again" message {"epilogue_ng_res", new EntityTypes.Resource(EntityTypes.Resource.ResourceType.Image, "Images/Epilogue/", "Ng")}, // epilogue "Try Again" image resource path
{"epilogue_hi_res", new EntityTypes.Resource(EntityTypes.Resource.ResourceType.Image, "Images/Epilogue/", "Hi")}, // epilogue "Superb" image resource path
{"epilogue_ok_res", new EntityTypes.Resource(EntityTypes.Resource.ResourceType.Image, "Images/Epilogue/", "Ok")}, // epilogue "OK" image resource path
{"epilogue_ng_res", new EntityTypes.Resource(EntityTypes.Resource.ResourceType.Image, "Images/Epilogue/", "Ng")}, // epilogue "Try Again" image resource path
}; };
static Dictionary<string, object> tempoChangeModel = new() static Dictionary<string, object> tempoChangeModel = new()
@ -108,11 +107,9 @@ namespace HeavenStudio
static Dictionary<string, object> sectionMarkModel = new() static Dictionary<string, object> sectionMarkModel = new()
{ {
{"sectionName", ""}, {"sectionName", ""},
{"isCheckpoint", false},
{"startPerfect", false}, {"startPerfect", false},
{"breakSection", false}, {"weight", 1f},
{"extendsPrevious", false}, {"category", 0},
{"sectionWeight", 1f},
}; };
static void PreProcessSpecialEntity(RiqEntity e, Dictionary<string, object> model) static void PreProcessSpecialEntity(RiqEntity e, Dictionary<string, object> model)
@ -499,7 +496,7 @@ namespace HeavenStudio
localeLoaded = false; localeLoaded = false;
localePreloaded = false; localePreloaded = false;
} }
if (!hasLocales) return; if (!hasLocales) return;
if (localePreloaded) return; if (localePreloaded) return;
localePreloaded = true; localePreloaded = true;

View file

@ -43,13 +43,6 @@ namespace HeavenStudio.Common
gameObject.SetActive(true); gameObject.SetActive(true);
SectionText.text = newSection["sectionName"]; SectionText.text = newSection["sectionName"];
SectionProgress.value = (float) GameManager.instance.SectionProgress; SectionProgress.value = (float) GameManager.instance.SectionProgress;
if (PersistentDataManager.gameSettings.perfectChallengeType == PersistentDataManager.PerfectChallengeType.Off) return;
if (!OverlaysManager.OverlaysEnabled) return;
if (newSection["startPerfect"] && GoForAPerfect.instance != null && GoForAPerfect.instance.perfect && !GoForAPerfect.instance.gameObject.activeSelf)
{
GoForAPerfect.instance.Enable(newSection.beat);
}
} }
} }
} }

View file

@ -22,7 +22,7 @@
"com.unity.nuget.newtonsoft-json": "3.2.1", "com.unity.nuget.newtonsoft-json": "3.2.1",
"jillejr.newtonsoft.json-for-unity.converters": "1.5.1" "jillejr.newtonsoft.json-for-unity.converters": "1.5.1"
}, },
"hash": "a1a30e76446c87ec9780a8006a0b425bbcced84b" "hash": "03264e671d2c1761f3e5ce57c982e75c6d556a60"
}, },
"com.sr4dev.unity-spriteassist": { "com.sr4dev.unity-spriteassist": {
"version": "https://github.com/sr4dev/Unity-SpriteAssist.git?path=Assets/SpriteAssist", "version": "https://github.com/sr4dev/Unity-SpriteAssist.git?path=Assets/SpriteAssist",