Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
ButtonPusher
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Button Pusher
ButtonPusher
Commits
ea1802aa
Commit
ea1802aa
authored
Jan 18, 2018
by
16이상민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring
parent
3958d258
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
39 deletions
+40
-39
Judge.cs
Assets/Script/Judge.cs
+7
-16
JudgeManager.cs
Assets/Script/JudgeManager.cs
+33
-23
No files found.
Assets/Script/Judge.cs
View file @
ea1802aa
using
System
;
using
System.Collections.Generic
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
UnityEngine
;
using
UnityEngine
;
...
@@ -14,16 +12,15 @@ public class Judge
...
@@ -14,16 +12,15 @@ public class Judge
new
Judge
(
"MISS"
)
{
Color
=
Color
.
red
,
IsBreak
=
true
}
new
Judge
(
"MISS"
)
{
Color
=
Color
.
red
,
IsBreak
=
true
}
};
};
private
Judge
()
internal
Judge
()
{
{
ButtonTimingRange
=
0f
;
ButtonTimingRange
=
0f
;
ButtonTimingRange
=
0f
;
Score
=
0
;
Score
=
0
;
IsBreak
=
false
;
IsBreak
=
false
;
Color
=
Color
.
black
;
Color
=
Color
.
black
;
}
}
private
Judge
(
string
name
)
:
this
()
{
Name
=
name
;
}
internal
Judge
(
string
name
)
:
this
()
{
Name
=
name
;
}
public
string
Name
{
get
;
private
set
;
}
public
string
Name
{
get
;
private
set
;
}
...
@@ -39,20 +36,14 @@ public class Judge
...
@@ -39,20 +36,14 @@ public class Judge
public
static
Judge
TestJudge
(
Note
note
,
float
elapsedTime
,
bool
end
=
false
,
bool
test
=
false
)
public
static
Judge
TestJudge
(
Note
note
,
float
elapsedTime
,
bool
end
=
false
,
bool
test
=
false
)
{
{
float
timing
=
end
?
note
.
EndTiming
:
note
.
StartTiming
;
float
timing
=
end
?
note
.
EndTiming
:
note
.
StartTiming
;
float
difference
=
Mathf
.
Abs
(
elapsedTime
-
timing
)
;
float
difference
=
elapsedTime
-
timing
;
if
(
test
)
if
(
test
)
Debug
.
Log
(
elapsedTime
-
timing
);
Debug
.
Log
(
difference
);
foreach
(
Judge
judge
in
JudgeList
)
var
result
=
JudgeList
.
Where
(
x
=>
Mathf
.
Abs
(
difference
)
<
x
.
ButtonTimingRange
).
ToList
();
{
if
(
difference
<
judge
.
ButtonTimingRange
)
{
return
judge
;
}
}
return
JudgeList
.
Last
()
;
return
result
.
Count
==
0
?
JudgeList
.
Last
()
:
result
[
0
]
;
}
}
public
static
bool
IsNonEmptyMiss
(
Note
note
,
float
elapsedTime
,
bool
end
=
false
)
public
static
bool
IsNonEmptyMiss
(
Note
note
,
float
elapsedTime
,
bool
end
=
false
)
...
...
Assets/Script/JudgeManager.cs
View file @
ea1802aa
...
@@ -95,7 +95,7 @@ public class JudgeManager : MonoBehaviour
...
@@ -95,7 +95,7 @@ public class JudgeManager : MonoBehaviour
judgeText
.
SetActive
(
false
);
judgeText
.
SetActive
(
false
);
MotionGuageReset
();
MotionGuageReset
();
LoadNotes
(
GameManager
.
Instance
.
CurrentTrack
.
Notes
);
LoadNotes
();
Instantiate
(
GameManager
.
Instance
.
defaultSound
);
Instantiate
(
GameManager
.
Instance
.
defaultSound
);
}
}
...
@@ -271,8 +271,10 @@ public class JudgeManager : MonoBehaviour
...
@@ -271,8 +271,10 @@ public class JudgeManager : MonoBehaviour
judgeText
.
GetComponent
<
Text
>().
color
=
judge
.
Color
;
judgeText
.
GetComponent
<
Text
>().
color
=
judge
.
Color
;
}
}
private
void
LoadNotes
(
List
<
Note
>
notes
)
private
void
LoadNotes
()
{
{
var
notes
=
GameManager
.
Instance
.
CurrentTrack
.
Notes
;
foreach
(
Note
note
in
notes
)
foreach
(
Note
note
in
notes
)
{
{
GameObject
obj
=
Instantiate
(
GameObject
obj
=
Instantiate
(
...
@@ -280,14 +282,29 @@ public class JudgeManager : MonoBehaviour
...
@@ -280,14 +282,29 @@ public class JudgeManager : MonoBehaviour
noteobj
.
transform
)
noteobj
.
transform
)
as
GameObject
;
as
GameObject
;
SetNoteParent
(
note
,
obj
);
if
(
note
.
IsLong
)
StretchLongNote
(
note
,
obj
);
obj
.
transform
.
position
+=
initialPos
+
(
Vector3
.
right
*
(
note
.
StartTiming
*
ScrollSpeed
));
obj
.
AddComponent
<
Note
.
Controller
>().
Instance
=
note
;
}
}
void
SetNoteParent
(
Note
note
,
GameObject
obj
)
{
if
(
note
is
MotionNote
&&
!
note
.
IsLong
)
if
(
note
is
MotionNote
&&
!
note
.
IsLong
)
obj
.
transform
.
SetParent
(
smobj
.
transform
);
obj
.
transform
.
SetParent
(
smobj
.
transform
);
else
if
(
note
is
MotionNote
&&
note
.
IsLong
)
else
if
(
note
is
MotionNote
&&
note
.
IsLong
)
obj
.
transform
.
SetParent
(
lmobj
.
transform
);
obj
.
transform
.
SetParent
(
lmobj
.
transform
);
else
if
(
note
.
Type
==
NoteType
.
MeasureLine
||
note
.
Type
==
NoteType
.
BeatLine
)
else
if
(
note
.
Type
==
NoteType
.
MeasureLine
||
note
.
Type
==
NoteType
.
BeatLine
)
obj
.
transform
.
SetParent
(
offset
.
transform
);
obj
.
transform
.
SetParent
(
offset
.
transform
);
}
if
(
note
.
IsLong
)
void
StretchLongNote
(
Note
note
,
GameObject
obj
)
{
{
float
length
=
note
.
Length
*
ScrollSpeed
;
float
length
=
note
.
Length
*
ScrollSpeed
;
...
@@ -302,13 +319,6 @@ public class JudgeManager : MonoBehaviour
...
@@ -302,13 +319,6 @@ public class JudgeManager : MonoBehaviour
endTransform
.
position
+=
new
Vector3
(
length
,
0
,
0
);
endTransform
.
position
+=
new
Vector3
(
length
,
0
,
0
);
}
}
obj
.
transform
.
position
+=
initialPos
+
new
Vector3
(
note
.
StartTiming
*
ScrollSpeed
,
0
,
0
);
obj
.
AddComponent
<
Note
.
Controller
>().
Instance
=
note
;
}
}
private
bool
onResult
=
false
;
private
bool
onResult
=
false
;
private
void
ShowResult
()
private
void
ShowResult
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment