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 double nextSectionBeat;
public double SectionProgress { get; private set; }
public float MarkerWeight { get; private set; }
public int MarkerCategory { get; private set; }
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;
totalPlayerAccuracy += Math.Abs(accuracy) * weight;
totalInputs += weight * MarkerWeight;
totalPlayerAccuracy += Math.Abs(accuracy) * weight * MarkerWeight;
judgementInfo.inputs.Add(new JudgementManager.InputInfo
{
beat = beat,
accuracyState = accuracy,
timeOffset = time,
weight = weight,
category = category
weight = weight * MarkerWeight,
category = MarkerCategory
});
}
@ -514,18 +516,43 @@ namespace HeavenStudio
{
if (cond.songPositionInBeatsAsDouble >= sectionBeats[currentSectionEvent])
{
Debug.Log("Section " + Beatmap.SectionMarkers[currentSectionEvent]["sectionName"] + " started");
lastSection = currentSection;
if (currentSectionEvent < Beatmap.SectionMarkers.Count)
currentSection = Beatmap.SectionMarkers[currentSectionEvent];
else
currentSection = null;
currentSectionEvent++;
if (currentSectionEvent < Beatmap.SectionMarkers.Count)
nextSectionBeat = Beatmap.SectionMarkers[currentSectionEvent].beat;
else
RiqEntity marker = Beatmap.SectionMarkers[currentSectionEvent];
if (!string.IsNullOrEmpty(marker["sectionName"]))
{
Debug.Log("Section " + marker["sectionName"] + " started");
lastSection = currentSection;
if (currentSectionEvent < Beatmap.SectionMarkers.Count)
currentSection = marker;
else
currentSection = null;
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>()
};
MarkerWeight = 1;
MarkerCategory = 0;
if (playMode && delay > 0)
{
GlobalGameManager.ForceFade(0, delay * 0.5f, delay * 0.5f);

View file

@ -434,10 +434,10 @@ namespace HeavenStudio.Games
return null;
}
public void ScoreMiss(float weight = 1f, int category = 0)
public void ScoreMiss(float weight = 1f)
{
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)
{
GoForAPerfect.instance.Miss();
@ -447,7 +447,6 @@ namespace HeavenStudio.Games
public void ToggleSplitColoursDisplay(bool on)
{
}
#region Bop

View file

@ -26,7 +26,6 @@ namespace HeavenStudio.Games
public double startBeat;
public double timer;
public int category;
public float weight = 1f;
public bool isEligible = true;
@ -271,7 +270,7 @@ namespace HeavenStudio.Games
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)
{
GoForAPerfect.instance.Miss();
@ -345,7 +344,7 @@ namespace HeavenStudio.Games
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();
SectionMedalsManager.instance.MakeIneligible();
}

View file

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -13,17 +14,26 @@ public class SectionDialog : Dialog
SectionTimelineObj sectionObj;
[SerializeField] TMP_InputField sectionName;
[SerializeField] Toggle challengeEnable;
[SerializeField] Slider markerWeight;
[SerializeField] TMP_InputField markerWeightManual;
public void SwitchSectionDialog()
{
if(dialog.activeSelf) {
if (dialog.activeSelf)
{
sectionObj = null;
dialog.SetActive(false);
Editor.instance.inAuthorativeMenu = false;
} else {
}
else
{
Editor.instance.inAuthorativeMenu = true;
ResetAllDialogs();
dialog.SetActive(true);
markerWeight.maxValue = 8;
markerWeight.minValue = 0;
markerWeight.wholeNumbers = true;
}
}
@ -32,11 +42,17 @@ public class SectionDialog : Dialog
this.sectionObj = sectionObj;
sectionName.text = sectionObj.chartEntity["sectionName"];
challengeEnable.isOn = sectionObj.chartEntity["startPerfect"];
markerWeight.value = sectionObj.chartEntity["weight"];
markerWeight.maxValue = 8;
markerWeight.minValue = 0;
markerWeight.wholeNumbers = true;
}
public void DeleteSection()
{
if(dialog.activeSelf) {
if (dialog.activeSelf)
{
dialog.SetActive(false);
Editor.instance.inAuthorativeMenu = false;
}
@ -47,6 +63,7 @@ public class SectionDialog : Dialog
public void ChangeSectionName(string name)
{
if (sectionObj == null) return;
if (string.IsNullOrWhiteSpace(name)) name = string.Empty;
sectionObj.chartEntity["sectionName"] = name;
sectionObj.UpdateLabel();
}
@ -56,4 +73,18 @@ public class SectionDialog : Dialog
if (sectionObj == null) return;
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");
sectionC.CreateProperty("startPerfect", false);
sectionC.CreateProperty("weight", 1f);
sectionC.CreateProperty("category", 0);
sectionTimelineObj.chartEntity = sectionC;
GameManager.instance.Beatmap.SectionMarkers.Add(sectionC);
CommandManager.Instance.AddCommand(new Commands.AddMarker(sectionC, sectionC.guid, HoveringTypes.SectionChange));

View file

@ -29,7 +29,10 @@ namespace HeavenStudio.Editor.Track
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)
SetX(chartEntity);
}
@ -88,7 +91,7 @@ namespace HeavenStudio.Editor.Track
}
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(TempoChangeBTN.gameObject, "Tool: Tempo Change <color=#adadad>[2]</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(StartingTempoSpecialTempo.gameObject, "Starting Tempo (BPM)");

View file

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

View file

@ -43,13 +43,6 @@ namespace HeavenStudio.Common
gameObject.SetActive(true);
SectionText.text = newSection["sectionName"];
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",
"jillejr.newtonsoft.json-for-unity.converters": "1.5.1"
},
"hash": "a1a30e76446c87ec9780a8006a0b425bbcced84b"
"hash": "03264e671d2c1761f3e5ce57c982e75c6d556a60"
},
"com.sr4dev.unity-spriteassist": {
"version": "https://github.com/sr4dev/Unity-SpriteAssist.git?path=Assets/SpriteAssist",