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
0acaeb94
Commit
0acaeb94
authored
Aug 24, 2017
by
16서원빈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working InGame
parent
4b5563af
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1510 additions
and
144 deletions
+1510
-144
BeatLine.prefab
Assets/Resources/BeatLine.prefab
+81
-0
BeatLine.prefab.meta
Assets/Resources/BeatLine.prefab.meta
+9
-0
LBT.prefab
Assets/Resources/LBT.prefab
+1
-1
LMO.prefab
Assets/Resources/LMO.prefab
+36
-1
MeasureLine.prefab
Assets/Resources/MeasureLine.prefab
+81
-0
MeasureLine.prefab.meta
Assets/Resources/MeasureLine.prefab.meta
+9
-0
SMO.prefab
Assets/Resources/SMO.prefab
+2
-2
InGame.unity
Assets/Scene/InGame.unity
+1112
-60
JudgeManager.cs
Assets/Script/JudgeManager.cs
+80
-43
MotionNote.cs
Assets/Script/MotionNote.cs
+50
-1
ClapNote.cs
Assets/Script/MotionNotes/ClapNote.cs
+0
-22
Note.cs
Assets/Script/Note.cs
+1
-1
TrackInfo.cs
Assets/Script/TrackInfo.cs
+48
-13
No files found.
Assets/Resources/BeatLine.prefab
0 → 100644
View file @
0acaeb94
%YAML
1.1
%TAG
!u!
tag:unity3d.com,2011:
---
!u!1001
&100100000
Prefab
:
m_ObjectHideFlags
:
1
serializedVersion
:
2
m_Modification
:
m_TransformParent
:
{
fileID
:
0
}
m_Modifications
:
[]
m_RemovedComponents
:
[]
m_ParentPrefab
:
{
fileID
:
0
}
m_RootGameObject
:
{
fileID
:
1839526890916058
}
m_IsPrefabParent
:
1
---
!u!1
&1839526890916058
GameObject
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
serializedVersion
:
5
m_Component
:
-
component
:
{
fileID
:
224491764761756372
}
-
component
:
{
fileID
:
222572614339470256
}
-
component
:
{
fileID
:
114048093616581902
}
m_Layer
:
5
m_Name
:
Beat Line
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!114
&114048093616581902
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1839526890916058
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
-765806418
,
guid
:
f70555f144d8491a825f0804e09c671c
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
m_Material
:
{
fileID
:
0
}
m_Color
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
0.627451
}
m_RaycastTarget
:
1
m_OnCullStateChanged
:
m_PersistentCalls
:
m_Calls
:
[]
m_TypeName
:
UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite
:
{
fileID
:
0
}
m_Type
:
0
m_PreserveAspect
:
0
m_FillCenter
:
1
m_FillMethod
:
4
m_FillAmount
:
1
m_FillClockwise
:
1
m_FillOrigin
:
0
---
!u!222
&222572614339470256
CanvasRenderer
:
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1839526890916058
}
---
!u!224
&224491764761756372
RectTransform
:
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1839526890916058
}
m_LocalRotation
:
{
x
:
-0
,
y
:
-0
,
z
:
-0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0.5
,
y
:
0
}
m_AnchorMax
:
{
x
:
0.5
,
y
:
1
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
1
,
y
:
0
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
Assets/
Script/MotionNotes
.meta
→
Assets/
Resources/BeatLine.prefab
.meta
View file @
0acaeb94
fileFormatVersion: 2
guid: 4efccb64927c7ca42b4e8f01d7d25773
folderAsset: yes
timeCreated: 1502962628
guid: be34e1eacae80114c90c2aedee0d6408
timeCreated: 1503573417
licenseType: Free
DefaultImporter:
NativeFormatImporter:
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
Assets/Resources/LBT.prefab
View file @
0acaeb94
...
...
@@ -231,7 +231,7 @@ RectTransform:
m_AnchorMin
:
{
x
:
0.5
,
y
:
0
}
m_AnchorMax
:
{
x
:
0.5
,
y
:
1
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
3
,
y
:
0
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!224
&224219039990227194
RectTransform
:
...
...
Assets/Resources/LMO.prefab
View file @
0acaeb94
...
...
@@ -53,6 +53,8 @@ GameObject:
serializedVersion
:
5
m_Component
:
-
component
:
{
fileID
:
224011200304410306
}
-
component
:
{
fileID
:
222613705641654236
}
-
component
:
{
fileID
:
114973331513533902
}
m_Layer
:
5
m_Name
:
LMO
m_TagString
:
Untagged
...
...
@@ -158,6 +160,33 @@ MonoBehaviour:
m_FillAmount
:
1
m_FillClockwise
:
1
m_FillOrigin
:
0
---
!u!114
&114973331513533902
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1869947549572880
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
-765806418
,
guid
:
f70555f144d8491a825f0804e09c671c
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
m_Material
:
{
fileID
:
0
}
m_Color
:
{
r
:
1
,
g
:
0
,
b
:
0
,
a
:
1
}
m_RaycastTarget
:
1
m_OnCullStateChanged
:
m_PersistentCalls
:
m_Calls
:
[]
m_TypeName
:
UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite
:
{
fileID
:
0
}
m_Type
:
0
m_PreserveAspect
:
0
m_FillCenter
:
1
m_FillMethod
:
4
m_FillAmount
:
1
m_FillClockwise
:
1
m_FillOrigin
:
0
---
!u!222
&222375019058029532
CanvasRenderer
:
m_ObjectHideFlags
:
1
...
...
@@ -170,6 +199,12 @@ CanvasRenderer:
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1422421716557948
}
---
!u!222
&222613705641654236
CanvasRenderer
:
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1869947549572880
}
---
!u!222
&222950832735418152
CanvasRenderer
:
m_ObjectHideFlags
:
1
...
...
@@ -195,7 +230,7 @@ RectTransform:
m_AnchorMin
:
{
x
:
0.5
,
y
:
0
}
m_AnchorMax
:
{
x
:
0.5
,
y
:
1
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
3
,
y
:
0
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!224
&224106473661142190
RectTransform
:
...
...
Assets/Resources/MeasureLine.prefab
0 → 100644
View file @
0acaeb94
%YAML
1.1
%TAG
!u!
tag:unity3d.com,2011:
---
!u!1001
&100100000
Prefab
:
m_ObjectHideFlags
:
1
serializedVersion
:
2
m_Modification
:
m_TransformParent
:
{
fileID
:
0
}
m_Modifications
:
[]
m_RemovedComponents
:
[]
m_ParentPrefab
:
{
fileID
:
0
}
m_RootGameObject
:
{
fileID
:
1839526890916058
}
m_IsPrefabParent
:
1
---
!u!1
&1839526890916058
GameObject
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
serializedVersion
:
5
m_Component
:
-
component
:
{
fileID
:
224491764761756372
}
-
component
:
{
fileID
:
222572614339470256
}
-
component
:
{
fileID
:
114048093616581902
}
m_Layer
:
5
m_Name
:
Measure Line
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!114
&114048093616581902
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1839526890916058
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
-765806418
,
guid
:
f70555f144d8491a825f0804e09c671c
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
m_Material
:
{
fileID
:
0
}
m_Color
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
0.627451
}
m_RaycastTarget
:
1
m_OnCullStateChanged
:
m_PersistentCalls
:
m_Calls
:
[]
m_TypeName
:
UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite
:
{
fileID
:
0
}
m_Type
:
0
m_PreserveAspect
:
0
m_FillCenter
:
1
m_FillMethod
:
4
m_FillAmount
:
1
m_FillClockwise
:
1
m_FillOrigin
:
0
---
!u!222
&222572614339470256
CanvasRenderer
:
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1839526890916058
}
---
!u!224
&224491764761756372
RectTransform
:
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1839526890916058
}
m_LocalRotation
:
{
x
:
-0
,
y
:
-0
,
z
:
-0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0.5
,
y
:
0
}
m_AnchorMax
:
{
x
:
0.5
,
y
:
1
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
2
,
y
:
0
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
Assets/
Script/MotionNotes/ClapNote.cs
.meta
→
Assets/
Resources/MeasureLine.prefab
.meta
View file @
0acaeb94
fileFormatVersion: 2
guid:
1a97249d2381dcc4492c416a96fde813
timeCreated: 150
2962628
guid:
350ca22a121fc3b40947c48a2bedea2c
timeCreated: 150
3573417
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
NativeFormatImporter:
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
Assets/Resources/SMO.prefab
View file @
0acaeb94
...
...
@@ -74,8 +74,8 @@ RectTransform:
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0
,
y
:
0
}
m_AnchorMax
:
{
x
:
0
,
y
:
1
}
m_AnchorMin
:
{
x
:
0
.5
,
y
:
0
}
m_AnchorMax
:
{
x
:
0
.5
,
y
:
1
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
3
,
y
:
0
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
Assets/Scene/InGame.unity
View file @
0acaeb94
This diff is collapsed.
Click to expand it.
Assets/Script/JudgeManager.cs
View file @
0acaeb94
...
...
@@ -24,7 +24,8 @@ public class JudgeManager : MonoBehaviour
float
latency
=
225f
;
float
scrollMultiplier
=
1.0f
;
private
GameObject
offset
,
noteobj
;
private
GameObject
offset
;
private
GameObject
noteobj
,
smobj
,
lmobj
;
private
GameObject
motionGuage
;
private
GameObject
judgeText
;
...
...
@@ -53,6 +54,8 @@ public class JudgeManager : MonoBehaviour
{
offset
=
GameObject
.
Find
(
"Offset"
);
noteobj
=
GameObject
.
Find
(
"Noteobj"
);
smobj
=
GameObject
.
Find
(
"SMobj"
);
lmobj
=
GameObject
.
Find
(
"LMobj"
);
judgeText
=
GameObject
.
Find
(
"Judge"
);
motionGuage
=
GameObject
.
Find
(
"Motion Guage"
);
...
...
@@ -72,66 +75,92 @@ public class JudgeManager : MonoBehaviour
offset
.
transform
.
position
=
new
Vector3
(
-
timing
*
ScrollSpeed
,
0
,
0
);
if
(
noteobj
.
transform
.
childCount
<=
0
)
return
;
GameObject
obj
=
noteobj
.
transform
.
GetChild
(
0
).
gameObject
;
Note
note
=
obj
.
GetComponent
<
Note
.
Controller
>().
Instance
;
if
(
note
.
IsLong
&&
note
.
Activated
)
new
Action
(()
=>
{
if
(
InputManager
.
Instance
.
IsButtonHolding
)
if
(
noteobj
.
transform
.
childCount
<=
0
)
return
;
GameObject
obj
=
noteobj
.
transform
.
GetChild
(
0
).
gameObject
;
Note
note
=
obj
.
GetComponent
<
Note
.
Controller
>().
Instance
;
if
(
note
.
IsLong
&&
note
.
Activated
)
{
if
(
Judge
.
IsNonEmptyMiss
(
note
,
timing
,
true
)
)
if
(
InputManager
.
Instance
.
IsButtonHolding
)
{
SetJudge
(
Judge
.
MISS
);
if
(
Judge
.
IsNonEmptyMiss
(
note
,
timing
,
true
))
{
SetJudge
(
Judge
.
MISS
);
DeactivateNote
(
note
);
}
return
;
}
if
(
InputManager
.
Instance
.
IsButtonReleased
)
{
SetJudge
(
Judge
.
TestJudge
(
note
,
timing
,
true
));
DeactivateNote
(
note
);
return
;
}
return
;
}
if
(
InputManager
.
Instance
.
IsButtonReleased
)
Judge
judge
=
Judge
.
TestJudge
(
note
,
timing
);
if
(
Judge
.
IsNonEmptyMiss
(
note
,
timing
))
{
SetJudge
(
Judge
.
TestJudge
(
note
,
timing
,
true
)
);
SetJudge
(
judge
);
DeactivateNote
(
note
);
return
;
}
}
if
(
note
is
MotionNote
)
if
(
InputManager
.
Instance
.
IsButtonPressed
)
{
SetJudge
(
judge
);
if
(
judge
==
Judge
.
MISS
)
// Empty Miss
{
return
;
}
if
(
note
.
IsLong
)
note
.
Activated
=
true
;
else
DeactivateNote
(
note
);
}
})();
new
Action
(()
=>
{
((
MotionNote
)
note
).
Checkpoint
();
if
(
smobj
.
transform
.
childCount
<=
0
)
return
;
GameObject
smo
=
smobj
.
transform
.
GetChild
(
0
).
gameObject
;
MotionNote
smnote
=
(
MotionNote
)
smo
.
GetComponent
<
Note
.
Controller
>().
Instance
;
if
(
note
.
Activated
)
smnote
.
Checkpoint
();
if
(
smnote
.
Activated
)
{
SetJudge
(
Judge
.
TestJudge
(
note
,
timing
));
DeactivateNote
(
note
);
SetJudge
(
Judge
.
TestJudge
(
sm
note
,
timing
));
DeactivateNote
(
sm
note
);
}
})();
return
;
}
new
Action
(()
=>
{
if
(
lmobj
.
transform
.
childCount
<=
0
)
return
;
Judge
judge
=
Judge
.
TestJudge
(
note
,
timing
);
GameObject
lmo
=
lmobj
.
transform
.
GetChild
(
0
).
gameObject
;
MotionNote
lmnote
=
(
MotionNote
)
lmo
.
GetComponent
<
Note
.
Controller
>().
Instance
;
if
(
Judge
.
IsNonEmptyMiss
(
note
,
timing
))
{
SetJudge
(
judge
);
DeactivateNote
(
note
);
}
lmnote
.
Checkpoint
();
if
(
InputManager
.
Instance
.
IsButtonPressed
)
{
SetJudge
(
judge
);
if
(
judge
==
Judge
.
MISS
)
// Empty Miss
if
(
lmnote
.
Activated
)
{
return
;
SetJudge
(
Judge
.
TestJudge
(
lmnote
,
timing
));
DeactivateNote
(
lmnote
);
}
if
(
note
.
IsLong
)
note
.
Activated
=
true
;
else
DeactivateNote
(
note
);
}
return
;
})();
}
private
void
DeactivateNote
(
Note
note
)
...
...
@@ -141,13 +170,13 @@ public class JudgeManager : MonoBehaviour
note
.
Component
.
Deactivate
();
}
private
void
SetJudge
(
Judge
judge
)
private
void
SetJudge
(
Judge
judge
,
bool
isMotion
=
false
)
{
if
(!
judge
.
IsBreak
)
GameManager
.
Instance
.
Combo
++;
GameManager
.
Instance
.
Score
+=
judge
.
Score
;
Debug
.
Log
(
judge
.
Name
);
Debug
.
Log
(
judge
.
Name
+
(
isMotion
?
" Motion"
:
" Note"
)
);
judgeText
.
SetActive
(
true
);
judgeText
.
GetComponent
<
Text
>().
text
=
judge
.
Name
;
...
...
@@ -156,12 +185,20 @@ public class JudgeManager : MonoBehaviour
private
void
LoadNotes
(
List
<
Note
>
notes
)
{
foreach
(
Note
note
in
notes
)
{
foreach
(
Note
note
in
notes
)
{
GameObject
obj
=
Instantiate
(
Resources
.
Load
(
note
.
Type
.
ToString
(),
typeof
(
GameObject
)),
noteobj
.
transform
)
as
GameObject
;
if
(
note
is
MotionNote
&&
!
note
.
IsLong
)
obj
.
transform
.
SetParent
(
smobj
.
transform
);
else
if
(
note
is
MotionNote
&&
note
.
IsLong
)
obj
.
transform
.
SetParent
(
lmobj
.
transform
);
else
if
(
note
.
Type
==
NoteType
.
MeasureLine
||
note
.
Type
==
NoteType
.
BeatLine
)
obj
.
transform
.
SetParent
(
offset
.
transform
);
if
(
note
.
IsLong
)
{
float
length
=
note
.
Length
*
ScrollSpeed
;
...
...
Assets/Script/MotionNote.cs
View file @
0acaeb94
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
UnityEngine
;
public
abstract
class
MotionNote
:
Note
{
public
MotionNote
(
float
start
,
float
end
=
0f
)
:
base
(
start
,
end
)
{}
public
abstract
Sprite
Image
{
get
;
}
public
MotionNote
(
float
start
,
float
end
=
0f
)
:
base
(
start
==
end
?
NoteType
.
SMO
:
NoteType
.
LMO
,
start
,
end
)
{
}
public
MotionNote
(
string
key
,
float
start
,
float
end
=
0f
)
:
this
(
start
,
end
)
{
}
public
abstract
IEnumerable
<
bool
>
Checkpoint
();
public
static
readonly
Dictionary
<
string
,
Type
>
keymap
=
new
Dictionary
<
string
,
Type
>
{
{
"CP"
,
typeof
(
Clap
)
},
{
"JP"
,
typeof
(
Jump
)
},
{
"BP"
,
typeof
(
PushUp
)
},
{
"LP"
,
typeof
(
PushUp
)
},
{
"RP"
,
typeof
(
PushUp
)
},
{
"BI"
,
typeof
(
Piano
)
},
{
"LI"
,
typeof
(
Piano
)
},
{
"RI"
,
typeof
(
Piano
)
},
{
"BG"
,
typeof
(
Guard
)
},
{
"LG"
,
typeof
(
Guard
)
},
{
"RG"
,
typeof
(
Guard
)
},
};
protected
static
Sprite
LoadNewSprite
(
string
FilePath
,
float
PixelsPerUnit
=
100.0f
)
{
Sprite
NewSprite
=
new
Sprite
();
Texture2D
SpriteTexture
=
LoadTexture
(
FilePath
);
NewSprite
=
Sprite
.
Create
(
SpriteTexture
,
new
Rect
(
0
,
0
,
SpriteTexture
.
width
,
SpriteTexture
.
height
),
new
Vector2
(
0
,
0
),
PixelsPerUnit
);
return
NewSprite
;
}
private
static
Texture2D
LoadTexture
(
string
FilePath
)
{
Texture2D
Tex2D
;
byte
[]
FileData
;
if
(
File
.
Exists
(
FilePath
))
{
FileData
=
File
.
ReadAllBytes
(
FilePath
);
Tex2D
=
new
Texture2D
(
2
,
2
);
if
(
Tex2D
.
LoadImage
(
FileData
))
return
Tex2D
;
}
return
null
;
}
}
\ No newline at end of file
Assets/Script/MotionNotes/ClapNote.cs
deleted
100644 → 0
View file @
4b5563af
using
System
;
using
System.Collections.Generic
;
public
class
ClapNote
:
MotionNote
{
public
ClapNote
(
float
timing
)
:
base
(
timing
)
{
}
public
override
IEnumerable
<
bool
>
Checkpoint
()
{
var
motionState
=
InputManager
.
Instance
.
CurrentMotionState
;
var
motion
=
motionState
;
while
(
motion
!=
MotionState
.
CLAP_PREPARE
)
yield
return
false
;
Activated
=
true
;
yield
break
;
}
}
Assets/Script/Note.cs
View file @
0acaeb94
...
...
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using
UnityEngine
;
using
UnityEngine.UI
;
public
enum
NoteType
{
SBT
,
LBT
,
SMO
,
LMO
}
public
enum
NoteType
{
SBT
,
LBT
,
SMO
,
LMO
,
BeatLine
,
MeasureLine
}
public
class
Note
{
...
...
Assets/Script/TrackInfo.cs
View file @
0acaeb94
...
...
@@ -69,7 +69,10 @@ public class TrackInfo
public
List
<
Note
>
ParseBPENote
(
FileInfo
file
)
{
List
<
Note
>
notes
=
new
List
<
Note
>();
float
?
tempLongStart
=
null
;
float
?
tempLongBtnStart
=
null
;
float
?
tempLongMtnStart
=
null
;
int
maxMeasure
=
0
;
using
(
StreamReader
reader
=
new
StreamReader
(
new
BufferedStream
(
file
.
OpenRead
())))
...
...
@@ -97,42 +100,74 @@ public class TrackInfo
if
(
Array
.
FindIndex
(
CHANNELS
,
x
=>
x
==
channel
)
==
-
1
)
continue
;
if
(
measure
>
maxMeasure
)
maxMeasure
=
measure
;
int
seq
=
value
.
Length
/
2
;
float
ms
=
4
*
60
*
1000f
/
BPM
;
for
(
int
i
=
0
;
i
<
seq
;
i
++)
{
string
key
=
value
.
Substring
(
i
*
2
,
2
);
string
key
=
value
.
Substring
(
i
*
2
,
2
);
if
(
key
==
"00"
)
continue
;
float
timing
=
(
measure
+
(
float
)
i
/
seq
)
*
ms
;
if
(
channel
==
"SMO"
)
{
notes
.
Add
(
new
ClapNote
(
timing
));
}
else
if
(
channel
[
0
]
==
'S'
)
if
(
channel
==
"SBT"
)
{
notes
.
Add
(
new
Note
(
key
,
channel
,
timing
));
}
else
if
(
channel
[
0
]
==
'L'
)
else
if
(
channel
==
"LBT"
)
{
if
(
tempLongStart
==
null
)
if
(
tempLong
Btn
Start
==
null
)
{
tempLongStart
=
timing
;
tempLong
Btn
Start
=
timing
;
continue
;
}
float
start
=
tempLongStart
.
Value
;
float
start
=
tempLong
Btn
Start
.
Value
;
notes
.
Add
(
new
Note
(
key
,
channel
,
start
,
timing
));
tempLongStart
=
null
;
tempLongBtnStart
=
null
;
}
Type
motionType
;
if
(!
MotionNote
.
keymap
.
TryGetValue
(
key
,
out
motionType
))
continue
;
if
(
channel
==
"SMO"
)
{
notes
.
Add
((
MotionNote
)
Activator
.
CreateInstance
(
motionType
,
key
,
timing
));
}
else
if
(
channel
==
"LMO"
)
{
if
(
tempLongMtnStart
==
null
)
{
tempLongMtnStart
=
timing
;
continue
;
}
float
start
=
tempLongMtnStart
.
Value
;
notes
.
Add
((
MotionNote
)
Activator
.
CreateInstance
(
motionType
,
key
,
start
,
timing
));
tempLongMtnStart
=
null
;
}
}
}
}
for
(
int
i
=
0
;
i
<=
maxMeasure
;
i
++)
{
for
(
int
j
=
1
;
j
<
4
;
j
++)
{
notes
.
Add
(
new
Note
(
NoteType
.
BeatLine
,
(
i
+
(
float
)
j
/
4
)
*
4
*
60
*
1000f
/
BPM
));
}
notes
.
Add
(
new
Note
(
NoteType
.
BeatLine
,
(
i
+
1
)
*
4
*
60
*
1000f
/
BPM
));
}
return
notes
;
}
}
\ No newline at end of file
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