Commit 79dd6896 authored by 16이상민's avatar 16이상민

Fixed a problem where hold judgment is not correct in long motion note judgment

parent c11facf8
...@@ -78,7 +78,8 @@ namespace JudgeModule ...@@ -78,7 +78,8 @@ namespace JudgeModule
public static bool IsNoteEnd(Note note, float elapsedTime) public static bool IsNoteEnd(Note note, float elapsedTime)
{ {
return Mathf.Abs(elapsedTime - note.EndTiming) <= BAD.TimingRange(note); return elapsedTime - note.EndTiming <= BAD.TimingRange(note) &&
elapsedTime - note.EndTiming >= 0;
} }
public static bool IsNoteProgress(Note note, float elapsedTime, float interval) public static bool IsNoteProgress(Note note, float elapsedTime, float interval)
......
...@@ -7,7 +7,6 @@ namespace JudgeModule ...@@ -7,7 +7,6 @@ namespace JudgeModule
public class JudgeManager public class JudgeManager
{ {
private NoteCondition condition; private NoteCondition condition;
private List<Note> notes;
private NoteJudger judger; private NoteJudger judger;
private float interval; private float interval;
...@@ -30,7 +29,7 @@ namespace JudgeModule ...@@ -30,7 +29,7 @@ namespace JudgeModule
public void JudgeNote(Note note, float timing) public void JudgeNote(Note note, float timing)
{ {
if (Judge.IsPastNote(note, timing) || if (Judge.IsPastNote(note, timing) ||
note.Component.transform.position.x > appear.transform.position.x) note.Component.transform.position.x > appear.transform.position.x)
return; return;
...@@ -57,13 +56,13 @@ namespace JudgeModule ...@@ -57,13 +56,13 @@ namespace JudgeModule
void JudgeLongNote(Note note, float timing) void JudgeLongNote(Note note, float timing)
{ {
if (condition.IsLongNoteStartCorrectly(note)) if (condition.IsLongNoteStartCorrectly(note, timing))
judger.EnteredNoteProc(note, timing); judger.EnteredNoteProc(note, timing);
else if (condition.IsLongNoteFinishCorrectly(note, timing)) else if (condition.IsLongNoteFinishCorrectly(note, timing))
judger.CorrectlyStoppedNoteProc(note, timing); judger.CorrectlyStoppedNoteProc(note, timing);
else if (condition.IsLongNoteFinishIncorrectly(note, timing)) else if (condition.IsLongNoteFinishIncorrectly(note, timing))
judger.IncorrectlyStoppedNoteProc(note); judger.IncorrectlyStoppedNoteProc(note);
else if (condition.IsLongNoteHoldCorrectly(note)) else if (condition.IsLongNoteHoldCorrectly(note, timing))
judger.ContinuingNoteProc(note, timing, interval); judger.ContinuingNoteProc(note, timing, interval);
} }
......
using StatusConvert; using StatusConvert;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine;
namespace JudgeModule namespace JudgeModule
{ {
...@@ -46,29 +47,35 @@ namespace JudgeModule ...@@ -46,29 +47,35 @@ namespace JudgeModule
return JudgeInput(note)["short"] == InputStatus.Entered; return JudgeInput(note)["short"] == InputStatus.Entered;
} }
public bool IsLongNoteStartCorrectly(Note note) public bool IsLongNoteStartCorrectly(Note note, float timing)
{ {
var stat = JudgeInput(note); var stat = JudgeInput(note);
return ( return (
stat["long"] == InputStatus.Entered || stat["long"] == InputStatus.Entered ||
stat["long"] == InputStatus.Continuing stat["long"] == InputStatus.Continuing
) && ) &&
!note.Activated; !note.Activated &&
!Judge.IsNoteEnd(note, timing);
} }
public bool IsLongNoteHoldCorrectly(Note note) public bool IsLongNoteHoldCorrectly(Note note, float timing)
{ {
var stat = JudgeInput(note); var stat = JudgeInput(note);
return ( return (
stat["long"] == InputStatus.Entered || stat["long"] == InputStatus.Entered ||
stat["long"] == InputStatus.Continuing stat["long"] == InputStatus.Continuing
) && ) &&
note.Activated; note.Activated &&
!Judge.IsNoteEnd(note, timing);
} }
public bool IsLongNoteFinishCorrectly(Note note, float timing) public bool IsLongNoteFinishCorrectly(Note note, float timing)
{ {
return JudgeInput(note)["long"] == InputStatus.Stopped && var stat = JudgeInput(note);
return (
stat["long"] == InputStatus.Stopped ||
stat["long"] == InputStatus.Continuing
) &&
note.Activated && note.Activated &&
Judge.IsNoteEnd(note, timing); Judge.IsNoteEnd(note, timing);
} }
......
...@@ -10,12 +10,15 @@ namespace JudgeModule ...@@ -10,12 +10,15 @@ namespace JudgeModule
private Transform deactives; private Transform deactives;
private Action EndGame; private Action EndGame;
private GameObject judgeText; private GameObject judgeText;
private JudgeTextManager judgetextmanager;
public NoteJudger(Dictionary<string, GameObject> obj, Action endgame) public NoteJudger(Dictionary<string, GameObject> obj, Action endgame)
{ {
deactives = obj["deactives"].transform; deactives = obj["deactives"].transform;
judgeText = obj["judgetext"]; judgeText = obj["judgetext"];
EndGame = endgame; EndGame = endgame;
judgetextmanager = judgeText.GetComponent<JudgeTextManager>();
} }
public void WrongNoteProc(Note note) public void WrongNoteProc(Note note)
...@@ -32,18 +35,26 @@ namespace JudgeModule ...@@ -32,18 +35,26 @@ namespace JudgeModule
var judge = Judge.TestJudge(note, timing); var judge = Judge.TestJudge(note, timing);
SetJudge(judge, judgeText); SetJudge(judge, judgeText);
judgetextmanager.Register(note);
Debug.Log("Entered: " + timing + ", Judge: " + judge.Name);
if (note.IsLong && !judge.IsBreak) if (note.IsLong && !judge.IsBreak)
note.Activated = true; note.Activated = true;
else else
note.Component.Deactivate(deactives.transform); {
note.Component.Deactivate(deactives.transform, !note.IsLong);
judgetextmanager.UnRegister();
}
} }
public void ContinuingNoteProc(Note note, float timing, float interval) public void ContinuingNoteProc(Note note, float timing, float interval)
{ {
if (Judge.IsNoteProgress(note, timing, interval)) if (Judge.IsNoteProgress(note, timing, interval))
{ {
Debug.Log("Continuing: " + timing);
SetJudge(Judge.Perfect, judgeText); SetJudge(Judge.Perfect, judgeText);
judgetextmanager.Register(note);
++note.JudgeCount; ++note.JudgeCount;
} }
} }
...@@ -51,13 +62,17 @@ namespace JudgeModule ...@@ -51,13 +62,17 @@ namespace JudgeModule
public void CorrectlyStoppedNoteProc(Note note, float timing) public void CorrectlyStoppedNoteProc(Note note, float timing)
{ {
SetJudge(Judge.TestJudge(note, timing, true), judgeText); SetJudge(Judge.TestJudge(note, timing, true), judgeText);
judgetextmanager.Register(note);
note.Component.Deactivate(deactives.transform); note.Component.Deactivate(deactives.transform);
judgetextmanager.UnRegister();
} }
public void IncorrectlyStoppedNoteProc(Note note) public void IncorrectlyStoppedNoteProc(Note note)
{ {
SetJudge(Judge.MISS, judgeText); SetJudge(Judge.MISS, judgeText);
note.Component.Deactivate(deactives.transform); judgetextmanager.Register(note);
note.Component.Deactivate(deactives.transform, false);
judgetextmanager.UnRegister();
} }
public static void SetJudge(Judge judge, GameObject judgeText) public static void SetJudge(Judge judge, GameObject judgeText)
...@@ -71,7 +86,7 @@ namespace JudgeModule ...@@ -71,7 +86,7 @@ namespace JudgeModule
judgeText.GetComponent<Text>().text = judge.Name; judgeText.GetComponent<Text>().text = judge.Name;
judgeText.GetComponent<Text>().color = judge.Color; judgeText.GetComponent<Text>().color = judge.Color;
Debug.Log("SetJudge: " + AllSceneManager.TotalJudge); Debug.Log("SetJudge: " + AllSceneManager.TotalJudge + "(" + judge.Name + ")");
} }
} }
} }
\ No newline at end of file
...@@ -13,6 +13,8 @@ namespace JudgeModule ...@@ -13,6 +13,8 @@ namespace JudgeModule
appear, appear,
disappear, disappear,
judgetext; judgetext;
private JudgeTextManager judgetextmanager;
private Vector3 initialPos; private Vector3 initialPos;
private float BPM; private float BPM;
...@@ -101,6 +103,8 @@ namespace JudgeModule ...@@ -101,6 +103,8 @@ namespace JudgeModule
disappear = gameObjects["disappear"]; disappear = gameObjects["disappear"];
judgetext = gameObjects["judgetext"]; judgetext = gameObjects["judgetext"];
judgetextmanager = judgetext.GetComponent<JudgeTextManager>();
initialPos = offset.transform.position; initialPos = offset.transform.position;
BPM = bpm; BPM = bpm;
GetLastNote = getlastnote; GetLastNote = getlastnote;
...@@ -147,10 +151,12 @@ namespace JudgeModule ...@@ -147,10 +151,12 @@ namespace JudgeModule
var controllers = enables[name].ToArray(); var controllers = enables[name].ToArray();
foreach (var c in controllers) foreach (var c in controllers)
if (!c.Instance.Activated && if (!c.Instance.Activated &&
!judgetextmanager.IsRegistered(c.Instance) &&
initialPos.x - c.StartPosition() > Judge.BAD.TimingRange(c.Instance)) initialPos.x - c.StartPosition() > Judge.BAD.TimingRange(c.Instance))
{ {
NoteJudger.SetJudge(Judge.MISS, judgetext); NoteJudger.SetJudge(Judge.MISS, judgetext);
c.Deactivate(deactives.transform); judgetextmanager.Register(c.Instance);
c.Deactivate(deactives.transform, !c.Instance.IsLong);
} }
} }
} }
......
...@@ -2134,6 +2134,7 @@ GameObject: ...@@ -2134,6 +2134,7 @@ GameObject:
- component: {fileID: 1152155867} - component: {fileID: 1152155867}
- component: {fileID: 1152155869} - component: {fileID: 1152155869}
- component: {fileID: 1152155868} - component: {fileID: 1152155868}
- component: {fileID: 1152155870}
m_Layer: 5 m_Layer: 5
m_Name: Judge m_Name: Judge
m_TagString: Untagged m_TagString: Untagged
...@@ -2198,6 +2199,17 @@ CanvasRenderer: ...@@ -2198,6 +2199,17 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1152155866} m_GameObject: {fileID: 1152155866}
--- !u!114 &1152155870
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1152155866}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: aa358e5c99472914fa28fbbc482a704b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &1165916158 --- !u!4 &1165916158
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
...@@ -13,7 +13,7 @@ public class Controller : MonoBehaviour ...@@ -13,7 +13,7 @@ public class Controller : MonoBehaviour
private readonly float minAlpha = 0.3f; private readonly float minAlpha = 0.3f;
private readonly float maxAlpha = 0.7f; private readonly float maxAlpha = 0.7f;
public void Deactivate(Transform deactives) public void Deactivate(Transform deactives, bool isCorrectlyFinish = true)
{ {
Instance.Activated = false; Instance.Activated = false;
...@@ -25,15 +25,15 @@ public class Controller : MonoBehaviour ...@@ -25,15 +25,15 @@ public class Controller : MonoBehaviour
} }
transform.SetParent(deactives); transform.SetParent(deactives);
disables.Add(this); disables.Add(enables[0]);
enables.Remove(this); enables.RemoveAt(0);
AllSceneManager.JudgeCount[Judge.MISS] += AllSceneManager.JudgeCount[Judge.MISS] +=
(Instance.TotalCount - Instance.JudgeCount); (Instance.TotalCount - Instance.JudgeCount);
if (Instance.IsLong) if (Instance.IsLong && !isCorrectlyFinish)
++AllSceneManager.JudgeCount[Judge.MISS]; ++AllSceneManager.JudgeCount[Judge.MISS];
Debug.Log("Deactivate: " + AllSceneManager.TotalJudge); //Debug.Log("Deactivate: " + AllSceneManager.TotalJudge);
} }
public float EndPosition(float ScrollSpeed) public float EndPosition(float ScrollSpeed)
......
...@@ -16,7 +16,7 @@ public class GameManager : MonoBehaviour { ...@@ -16,7 +16,7 @@ public class GameManager : MonoBehaviour {
instance = new GameObject().AddComponent<GameManager>(); instance = new GameObject().AddComponent<GameManager>();
instance.CurrentTrack instance.CurrentTrack
= new TrackInfo("Assets/Tracks/Tutorial/temp.bpe"); = new TrackInfo("Assets/Tracks/Tutorial/temp2.bpe");
} }
return instance; return instance;
......
...@@ -3,24 +3,45 @@ using UnityEngine.UI; ...@@ -3,24 +3,45 @@ using UnityEngine.UI;
public class JudgeTextManager : MonoBehaviour public class JudgeTextManager : MonoBehaviour
{ {
private float start; private float start;
private Text text; private Text text;
private void Start() private NoteType type;
{ private float startTiming, endTiming;
text = gameObject.GetComponent<Text>();
} private void Start()
{
private void OnEnable() text = gameObject.GetComponent<Text>();
{ }
start = Time.time;
Debug.Log("Judge: " + text.text + "(" + start * 1000 + "ms)"); private void OnEnable()
} {
start = Time.time;
// Update is called once per frame }
private void Update ()
{ // Update is called once per frame
if (Time.time - start > 0.5) private void Update ()
gameObject.SetActive(false); {
} if (Time.time - start > 0.5)
gameObject.SetActive(false);
}
public void Register(Note note)
{
type = note.Type;
startTiming = note.StartTiming;
endTiming = note.EndTiming;
}
public bool IsRegistered(Note note)
{
return type == note.Type &&
startTiming == note.StartTiming &&
endTiming == note.EndTiming;
}
public void UnRegister()
{
type = NoteType.BeatLine;
}
} }
...@@ -103,7 +103,7 @@ class NoteConditionTests ...@@ -103,7 +103,7 @@ class NoteConditionTests
input.IsButtonDown = true; input.IsButtonDown = true;
var expected = true; var expected = true;
var actual = condition.IsLongNoteStartCorrectly(note); var actual = condition.IsLongNoteStartCorrectly(note, 0);
Assert.AreEqual(expected, actual, "condition should be long note start correctly when button note and short button input entered"); Assert.AreEqual(expected, actual, "condition should be long note start correctly when button note and short button input entered");
} }
...@@ -128,7 +128,7 @@ class NoteConditionTests ...@@ -128,7 +128,7 @@ class NoteConditionTests
input.CurrentMotionState = MotionState.JESUS; input.CurrentMotionState = MotionState.JESUS;
var expected = true; var expected = true;
var actual = condition.IsLongNoteStartCorrectly(note); var actual = condition.IsLongNoteStartCorrectly(note, 0);
Assert.AreEqual(expected, actual, "condition should be long note start correctly when motion note and long motion input entered"); Assert.AreEqual(expected, actual, "condition should be long note start correctly when motion note and long motion input entered");
} }
...@@ -154,7 +154,7 @@ class NoteConditionTests ...@@ -154,7 +154,7 @@ class NoteConditionTests
input.IsButtonDown = true; input.IsButtonDown = true;
var expected = true; var expected = true;
var actual = condition.IsLongNoteHoldCorrectly(note); var actual = condition.IsLongNoteHoldCorrectly(note, 0);
Assert.AreEqual(expected, actual, "condition should be long note hold correctly when button note and short button input holding"); Assert.AreEqual(expected, actual, "condition should be long note hold correctly when button note and short button input holding");
} }
...@@ -180,7 +180,7 @@ class NoteConditionTests ...@@ -180,7 +180,7 @@ class NoteConditionTests
input.CurrentMotionState = MotionState.JESUS; input.CurrentMotionState = MotionState.JESUS;
var expected = true; var expected = true;
var actual = condition.IsLongNoteHoldCorrectly(note); var actual = condition.IsLongNoteHoldCorrectly(note, 0);
Assert.AreEqual(expected, actual, "condition should be long note hold correctly when motion note and long motion input holding"); Assert.AreEqual(expected, actual, "condition should be long note hold correctly when motion note and long motion input holding");
} }
...@@ -232,7 +232,7 @@ class NoteConditionTests ...@@ -232,7 +232,7 @@ class NoteConditionTests
input.CurrentMotionState = MotionState.JESUS; input.CurrentMotionState = MotionState.JESUS;
var expected = true; var expected = true;
var actual = condition.IsLongNoteHoldCorrectly(note); var actual = condition.IsLongNoteHoldCorrectly(note, 0);
Assert.AreEqual(expected, actual, "condition should be long note hold correctly when short motion note and long motion input holding"); Assert.AreEqual(expected, actual, "condition should be long note hold correctly when short motion note and long motion input holding");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment