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
540ef035
Commit
540ef035
authored
Jan 15, 2018
by
16이상민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring class 'TrackInfo'
parent
8d2a3d7c
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1102 additions
and
174 deletions
+1102
-174
InitTestScene636511946751484252.unity
Assets/InitTestScene636511946751484252.unity
+355
-0
InitTestScene636511946751484252.unity.meta
Assets/InitTestScene636511946751484252.unity.meta
+9
-0
InitTestScene636511952132748649.unity
Assets/InitTestScene636511952132748649.unity
+355
-0
InitTestScene636511952132748649.unity.meta
Assets/InitTestScene636511952132748649.unity.meta
+9
-0
CoordinateMapperManager.cs
Assets/Script/CoordinateMapperManager.cs
+7
-1
CoordinateMapperView.cs
Assets/Script/CoordinateMapperView.cs
+4
-2
CoordinateMapperViewTests.cs
Assets/Script/Tests/CoordinateMapperViewTests.cs
+37
-35
TrackInfo.cs
Assets/Script/TrackInfo.cs
+313
-128
TrackManager.cs
Assets/Script/TrackManager.cs
+12
-7
ProjectSettings.asset
ProjectSettings/ProjectSettings.asset
+1
-1
No files found.
Assets/InitTestScene636511946751484252.unity
0 → 100644
View file @
540ef035
%YAML
1.1
%TAG
!u!
tag:unity3d.com,2011:
---
!u!29
&1
OcclusionCullingSettings
:
m_ObjectHideFlags
:
0
serializedVersion
:
2
m_OcclusionBakeSettings
:
smallestOccluder
:
5
smallestHole
:
0.25
backfaceThreshold
:
100
m_SceneGUID
:
00000000000000000000000000000000
m_OcclusionCullingData
:
{
fileID
:
0
}
---
!u!104
&2
RenderSettings
:
m_ObjectHideFlags
:
0
serializedVersion
:
8
m_Fog
:
0
m_FogColor
:
{
r
:
0.5
,
g
:
0.5
,
b
:
0.5
,
a
:
1
}
m_FogMode
:
3
m_FogDensity
:
0.01
m_LinearFogStart
:
0
m_LinearFogEnd
:
300
m_AmbientSkyColor
:
{
r
:
0.212
,
g
:
0.227
,
b
:
0.259
,
a
:
1
}
m_AmbientEquatorColor
:
{
r
:
0.114
,
g
:
0.125
,
b
:
0.133
,
a
:
1
}
m_AmbientGroundColor
:
{
r
:
0.047
,
g
:
0.043
,
b
:
0.035
,
a
:
1
}
m_AmbientIntensity
:
1
m_AmbientMode
:
0
m_SubtractiveShadowColor
:
{
r
:
0.42
,
g
:
0.478
,
b
:
0.627
,
a
:
1
}
m_SkyboxMaterial
:
{
fileID
:
10304
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
m_HaloStrength
:
0.5
m_FlareStrength
:
1
m_FlareFadeSpeed
:
3
m_HaloTexture
:
{
fileID
:
0
}
m_SpotCookie
:
{
fileID
:
10001
,
guid
:
0000000000000000e000000000000000
,
type
:
0
}
m_DefaultReflectionMode
:
0
m_DefaultReflectionResolution
:
128
m_ReflectionBounces
:
1
m_ReflectionIntensity
:
1
m_CustomReflection
:
{
fileID
:
0
}
m_Sun
:
{
fileID
:
0
}
m_IndirectSpecularColor
:
{
r
:
0
,
g
:
0
,
b
:
0
,
a
:
1
}
---
!u!157
&3
LightmapSettings
:
m_ObjectHideFlags
:
0
serializedVersion
:
11
m_GIWorkflowMode
:
1
m_GISettings
:
serializedVersion
:
2
m_BounceScale
:
1
m_IndirectOutputScale
:
1
m_AlbedoBoost
:
1
m_TemporalCoherenceThreshold
:
1
m_EnvironmentLightingMode
:
0
m_EnableBakedLightmaps
:
1
m_EnableRealtimeLightmaps
:
1
m_LightmapEditorSettings
:
serializedVersion
:
9
m_Resolution
:
2
m_BakeResolution
:
40
m_TextureWidth
:
1024
m_TextureHeight
:
1024
m_AO
:
0
m_AOMaxDistance
:
1
m_CompAOExponent
:
1
m_CompAOExponentDirect
:
0
m_Padding
:
2
m_LightmapParameters
:
{
fileID
:
0
}
m_LightmapsBakeMode
:
1
m_TextureCompression
:
1
m_FinalGather
:
0
m_FinalGatherFiltering
:
1
m_FinalGatherRayCount
:
256
m_ReflectionCompression
:
2
m_MixedBakeMode
:
2
m_BakeBackend
:
0
m_PVRSampling
:
1
m_PVRDirectSampleCount
:
32
m_PVRSampleCount
:
500
m_PVRBounces
:
2
m_PVRFilterTypeDirect
:
0
m_PVRFilterTypeIndirect
:
0
m_PVRFilterTypeAO
:
0
m_PVRFilteringMode
:
1
m_PVRCulling
:
1
m_PVRFilteringGaussRadiusDirect
:
1
m_PVRFilteringGaussRadiusIndirect
:
5
m_PVRFilteringGaussRadiusAO
:
2
m_PVRFilteringAtrousPositionSigmaDirect
:
0.5
m_PVRFilteringAtrousPositionSigmaIndirect
:
2
m_PVRFilteringAtrousPositionSigmaAO
:
1
m_ShowResolutionOverlay
:
1
m_LightingDataAsset
:
{
fileID
:
0
}
m_UseShadowmask
:
1
---
!u!196
&4
NavMeshSettings
:
serializedVersion
:
2
m_ObjectHideFlags
:
0
m_BuildSettings
:
serializedVersion
:
2
agentTypeID
:
0
agentRadius
:
0.5
agentHeight
:
2
agentSlope
:
45
agentClimb
:
0.4
ledgeDropHeight
:
0
maxJumpAcrossDistance
:
0
minRegionArea
:
2
manualCellSize
:
0
cellSize
:
0.16666667
manualTileSize
:
0
tileSize
:
256
accuratePlacement
:
0
debug
:
m_Flags
:
0
m_NavMeshData
:
{
fileID
:
0
}
---
!u!1
&16548550
GameObject
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
serializedVersion
:
5
m_Component
:
-
component
:
{
fileID
:
16548553
}
-
component
:
{
fileID
:
16548552
}
-
component
:
{
fileID
:
16548551
}
m_Layer
:
0
m_Name
:
Code-based tests runner
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!114
&16548551
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
16548550
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
1619214696
,
guid
:
53ebcfaa2e1e4e2dbc85882cd5a73fa1
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
---
!u!114
&16548552
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
16548550
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
-1751138608
,
guid
:
53ebcfaa2e1e4e2dbc85882cd5a73fa1
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
testStartedEvent
:
m_PersistentCalls
:
m_Calls
:
-
m_Target
:
{
fileID
:
16548551
}
m_MethodName
:
TestStarted
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
-
m_Target
:
{
fileID
:
589035149
}
m_MethodName
:
TestStarted
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
-
m_Target
:
{
fileID
:
1033339993
}
m_MethodName
:
TestStarted
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
m_TypeName
:
UnityEngine.TestTools.TestRunner.TestStartedEvent, UnityEngine.TestRunner,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
testFinishedEvent
:
m_PersistentCalls
:
m_Calls
:
-
m_Target
:
{
fileID
:
16548551
}
m_MethodName
:
TestFinished
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
-
m_Target
:
{
fileID
:
589035149
}
m_MethodName
:
TestFinished
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
-
m_Target
:
{
fileID
:
1033339993
}
m_MethodName
:
TestFinished
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
m_TypeName
:
UnityEngine.TestTools.TestRunner.TestFinishedEvent, UnityEngine.TestRunner,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
runStartedEvent
:
m_PersistentCalls
:
m_Calls
:
-
m_Target
:
{
fileID
:
16548551
}
m_MethodName
:
RunStarted
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
-
m_Target
:
{
fileID
:
589035149
}
m_MethodName
:
RunStarted
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
-
m_Target
:
{
fileID
:
1033339993
}
m_MethodName
:
RunStarted
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
m_TypeName
:
UnityEngine.TestTools.TestRunner.RunStartedEvent, UnityEngine.TestRunner,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
runFinishedEvent
:
m_PersistentCalls
:
m_Calls
:
-
m_Target
:
{
fileID
:
16548551
}
m_MethodName
:
RunFinished
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
-
m_Target
:
{
fileID
:
589035149
}
m_MethodName
:
RunFinished
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
-
m_Target
:
{
fileID
:
1033339993
}
m_MethodName
:
RunFinished
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
m_TypeName
:
UnityEngine.TestTools.TestRunner.RunFinishedEvent, UnityEngine.TestRunner,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
cleanupVerifier
:
m_ExistingFiles
:
[]
m_ExistingFilesScanned
:
0
settings
:
filter
:
groupNames
:
-
CoordinateMapperViewTests
categories
:
[]
testNames
:
[]
sceneBased
:
0
originalScene
:
Assets/Scene/InGame.unity
bootstrapScene
:
Assets/InitTestScene636511946751484252.unity
resultFilePath
:
isBatchModeRun
:
0
---
!u!4
&16548553
Transform
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
16548550
}
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
}
---
!u!114
&589035149
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
0
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
-1026517869
,
guid
:
4113173d5e95493ab8765d7b08371de4
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
---
!u!114
&1033339993
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
0
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
1703293177
,
guid
:
4113173d5e95493ab8765d7b08371de4
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Assets/InitTestScene636511946751484252.unity.meta
0 → 100644
View file @
540ef035
fileFormatVersion: 2
guid: 927664c416bad5248b093f481aeb9dcf
timeCreated: 1515565475
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/InitTestScene636511952132748649.unity
0 → 100644
View file @
540ef035
%YAML
1.1
%TAG
!u!
tag:unity3d.com,2011:
---
!u!29
&1
OcclusionCullingSettings
:
m_ObjectHideFlags
:
0
serializedVersion
:
2
m_OcclusionBakeSettings
:
smallestOccluder
:
5
smallestHole
:
0.25
backfaceThreshold
:
100
m_SceneGUID
:
00000000000000000000000000000000
m_OcclusionCullingData
:
{
fileID
:
0
}
---
!u!104
&2
RenderSettings
:
m_ObjectHideFlags
:
0
serializedVersion
:
8
m_Fog
:
0
m_FogColor
:
{
r
:
0.5
,
g
:
0.5
,
b
:
0.5
,
a
:
1
}
m_FogMode
:
3
m_FogDensity
:
0.01
m_LinearFogStart
:
0
m_LinearFogEnd
:
300
m_AmbientSkyColor
:
{
r
:
0.212
,
g
:
0.227
,
b
:
0.259
,
a
:
1
}
m_AmbientEquatorColor
:
{
r
:
0.114
,
g
:
0.125
,
b
:
0.133
,
a
:
1
}
m_AmbientGroundColor
:
{
r
:
0.047
,
g
:
0.043
,
b
:
0.035
,
a
:
1
}
m_AmbientIntensity
:
1
m_AmbientMode
:
0
m_SubtractiveShadowColor
:
{
r
:
0.42
,
g
:
0.478
,
b
:
0.627
,
a
:
1
}
m_SkyboxMaterial
:
{
fileID
:
10304
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
m_HaloStrength
:
0.5
m_FlareStrength
:
1
m_FlareFadeSpeed
:
3
m_HaloTexture
:
{
fileID
:
0
}
m_SpotCookie
:
{
fileID
:
10001
,
guid
:
0000000000000000e000000000000000
,
type
:
0
}
m_DefaultReflectionMode
:
0
m_DefaultReflectionResolution
:
128
m_ReflectionBounces
:
1
m_ReflectionIntensity
:
1
m_CustomReflection
:
{
fileID
:
0
}
m_Sun
:
{
fileID
:
0
}
m_IndirectSpecularColor
:
{
r
:
0
,
g
:
0
,
b
:
0
,
a
:
1
}
---
!u!157
&3
LightmapSettings
:
m_ObjectHideFlags
:
0
serializedVersion
:
11
m_GIWorkflowMode
:
1
m_GISettings
:
serializedVersion
:
2
m_BounceScale
:
1
m_IndirectOutputScale
:
1
m_AlbedoBoost
:
1
m_TemporalCoherenceThreshold
:
1
m_EnvironmentLightingMode
:
0
m_EnableBakedLightmaps
:
1
m_EnableRealtimeLightmaps
:
1
m_LightmapEditorSettings
:
serializedVersion
:
9
m_Resolution
:
2
m_BakeResolution
:
40
m_TextureWidth
:
1024
m_TextureHeight
:
1024
m_AO
:
0
m_AOMaxDistance
:
1
m_CompAOExponent
:
1
m_CompAOExponentDirect
:
0
m_Padding
:
2
m_LightmapParameters
:
{
fileID
:
0
}
m_LightmapsBakeMode
:
1
m_TextureCompression
:
1
m_FinalGather
:
0
m_FinalGatherFiltering
:
1
m_FinalGatherRayCount
:
256
m_ReflectionCompression
:
2
m_MixedBakeMode
:
2
m_BakeBackend
:
0
m_PVRSampling
:
1
m_PVRDirectSampleCount
:
32
m_PVRSampleCount
:
500
m_PVRBounces
:
2
m_PVRFilterTypeDirect
:
0
m_PVRFilterTypeIndirect
:
0
m_PVRFilterTypeAO
:
0
m_PVRFilteringMode
:
1
m_PVRCulling
:
1
m_PVRFilteringGaussRadiusDirect
:
1
m_PVRFilteringGaussRadiusIndirect
:
5
m_PVRFilteringGaussRadiusAO
:
2
m_PVRFilteringAtrousPositionSigmaDirect
:
0.5
m_PVRFilteringAtrousPositionSigmaIndirect
:
2
m_PVRFilteringAtrousPositionSigmaAO
:
1
m_ShowResolutionOverlay
:
1
m_LightingDataAsset
:
{
fileID
:
0
}
m_UseShadowmask
:
1
---
!u!196
&4
NavMeshSettings
:
serializedVersion
:
2
m_ObjectHideFlags
:
0
m_BuildSettings
:
serializedVersion
:
2
agentTypeID
:
0
agentRadius
:
0.5
agentHeight
:
2
agentSlope
:
45
agentClimb
:
0.4
ledgeDropHeight
:
0
maxJumpAcrossDistance
:
0
minRegionArea
:
2
manualCellSize
:
0
cellSize
:
0.16666667
manualTileSize
:
0
tileSize
:
256
accuratePlacement
:
0
debug
:
m_Flags
:
0
m_NavMeshData
:
{
fileID
:
0
}
---
!u!114
&812693797
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
0
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
1703293177
,
guid
:
4113173d5e95493ab8765d7b08371de4
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
---
!u!1
&1330667971
GameObject
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
serializedVersion
:
5
m_Component
:
-
component
:
{
fileID
:
1330667974
}
-
component
:
{
fileID
:
1330667973
}
-
component
:
{
fileID
:
1330667972
}
m_Layer
:
0
m_Name
:
Code-based tests runner
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!114
&1330667972
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1330667971
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
1619214696
,
guid
:
53ebcfaa2e1e4e2dbc85882cd5a73fa1
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
---
!u!114
&1330667973
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1330667971
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
-1751138608
,
guid
:
53ebcfaa2e1e4e2dbc85882cd5a73fa1
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
testStartedEvent
:
m_PersistentCalls
:
m_Calls
:
-
m_Target
:
{
fileID
:
1330667972
}
m_MethodName
:
TestStarted
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
-
m_Target
:
{
fileID
:
2079415433
}
m_MethodName
:
TestStarted
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
-
m_Target
:
{
fileID
:
812693797
}
m_MethodName
:
TestStarted
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
m_TypeName
:
UnityEngine.TestTools.TestRunner.TestStartedEvent, UnityEngine.TestRunner,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
testFinishedEvent
:
m_PersistentCalls
:
m_Calls
:
-
m_Target
:
{
fileID
:
1330667972
}
m_MethodName
:
TestFinished
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
-
m_Target
:
{
fileID
:
2079415433
}
m_MethodName
:
TestFinished
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
-
m_Target
:
{
fileID
:
812693797
}
m_MethodName
:
TestFinished
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
m_TypeName
:
UnityEngine.TestTools.TestRunner.TestFinishedEvent, UnityEngine.TestRunner,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
runStartedEvent
:
m_PersistentCalls
:
m_Calls
:
-
m_Target
:
{
fileID
:
1330667972
}
m_MethodName
:
RunStarted
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
-
m_Target
:
{
fileID
:
2079415433
}
m_MethodName
:
RunStarted
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
-
m_Target
:
{
fileID
:
812693797
}
m_MethodName
:
RunStarted
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
m_TypeName
:
UnityEngine.TestTools.TestRunner.RunStartedEvent, UnityEngine.TestRunner,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
runFinishedEvent
:
m_PersistentCalls
:
m_Calls
:
-
m_Target
:
{
fileID
:
1330667972
}
m_MethodName
:
RunFinished
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
-
m_Target
:
{
fileID
:
2079415433
}
m_MethodName
:
RunFinished
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
-
m_Target
:
{
fileID
:
812693797
}
m_MethodName
:
RunFinished
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
m_TypeName
:
UnityEngine.TestTools.TestRunner.RunFinishedEvent, UnityEngine.TestRunner,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
cleanupVerifier
:
m_ExistingFiles
:
[]
m_ExistingFilesScanned
:
0
settings
:
filter
:
groupNames
:
-
CoordinateMapperViewTests
categories
:
[]
testNames
:
[]
sceneBased
:
0
originalScene
:
Assets/InitTestScene636511946751484252.unity
bootstrapScene
:
Assets/InitTestScene636511952132748649.unity
resultFilePath
:
isBatchModeRun
:
0
---
!u!4
&1330667974
Transform
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1330667971
}
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
}
---
!u!114
&2079415433
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
0
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
-1026517869
,
guid
:
4113173d5e95493ab8765d7b08371de4
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Assets/InitTestScene636511952132748649.unity.meta
0 → 100644
View file @
540ef035
fileFormatVersion: 2
guid: a83a7fa7a4f7f6b4382c0b23b43fe313
timeCreated: 1515566013
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/Script/CoordinateMapperManager.cs
View file @
540ef035
...
...
@@ -2,7 +2,6 @@
using
Windows.Kinect
;
using
System.Runtime.InteropServices
;
using
System
;
using
System.Collections
;
using
System.Linq
;
using
System.Collections.Generic
;
...
...
@@ -20,6 +19,13 @@ public class CoordinateMapperManager : MonoBehaviour
Texture2D
_ColorRGBX
;
// In play mode, GUI for Null frame should show when Kinect cannot access.
// In play mode, GUI for FPS always show.
// In play mode, ColorTexture should not be null value.
// In play mode, BodyIndexBuffer should not be null value.
// In play mode, DepthCoordinates should not be null value.
// In play mode, BodyBuffer should not be null value.
public
Texture2D
ColorTexture
{
get
{
return
_ColorRGBX
;
}
}
public
byte
[]
BodyIndexBuffer
...
...
Assets/Script/CoordinateMapperView.cs
View file @
540ef035
...
...
@@ -9,8 +9,10 @@ public class CoordinateMapperView : MonoBehaviour
private
DepthSpacePoint
[]
DepthPoints
;
private
byte
[]
BodyIndexPoints
;
void
Start
()
// In play mode, texture of gameobject should be same as texture which made by shader when after update.
void
Start
()
{
CoordinateMapperManager
CoordinateMapperManager
=
GameObject
.
Find
(
"Managers"
).
GetComponent
<
CoordinateMapperManager
>();
...
...
Assets/Script/Tests/CoordinateMapperViewTests.cs
View file @
540ef035
...
...
@@ -6,42 +6,44 @@ using Windows.Kinect;
using
System.Runtime.InteropServices
;
using
System
;
namespace
Assets.Script.
Tests
class
CoordinateMapperView
Tests
{
class
CoordinateMapperViewTests
// A UnityTest behaves like a coroutine in PlayMode
// and allows you to yield null to skip a frame in EditMode
[
UnityTest
]
public
IEnumerator
MainTexture_Equal_Texture_Generate_By_Shader_When_After_Update
()
{
[
Test
]
public
void
CoordinateMapperViewTestsSimplePasses
()
{
// Use the Assert class to test conditions.
}
// A UnityTest behaves like a coroutine in PlayMode
// and allows you to yield null to skip a frame in EditMode
[
UnityTest
]
public
IEnumerator
CoordinateMapperViewTestsWithEnumeratorPasses
()
{
var
CoordinateMapperManager
=
GameObject
.
Find
(
"Managers"
).
GetComponent
<
CoordinateMapperManager
>();
var
tmpObj
=
GameObject
.
CreatePrimitive
(
PrimitiveType
.
Plane
);
tmpObj
.
GetComponent
<
Renderer
>().
material
=
Resources
.
Load
(
"GreenScreen/GreenScreen.mat"
,
typeof
(
Material
))
as
Material
;
tmpObj
.
GetComponent
<
Renderer
>().
material
.
SetTexture
(
"_MainTex"
,
CoordinateMapperManager
.
ColorTexture
);
var
DepthPoints
=
CoordinateMapperManager
.
DepthCoordinates
;
var
DepthBuffer
=
new
ComputeBuffer
(
DepthPoints
.
Length
,
sizeof
(
float
)
*
2
);
tmpObj
.
GetComponent
<
Renderer
>().
material
.
SetBuffer
(
"depthCoordinates"
,
DepthBuffer
);
var
BodyIndexPoints
=
CoordinateMapperManager
.
BodyIndexBuffer
;
var
BodyIndexBuffer
=
new
ComputeBuffer
(
BodyIndexPoints
.
Length
,
sizeof
(
float
));
tmpObj
.
GetComponent
<
Renderer
>().
material
.
SetBuffer
(
"bodyIndexBuffer"
,
BodyIndexBuffer
);
var
CoordinateMapperView
=
GameObject
.
Find
(
"CoordinateMapView"
);
// Use the Assert class to test conditions.
// yield to skip a frame
yield
return
null
;
Assert
.
AreEqual
(
tmpObj
.
GetComponent
<
Renderer
>().
material
.
mainTexture
,
CoordinateMapperView
.
GetComponent
<
Renderer
>().
material
.
mainTexture
,
"CoordinateMapperViewTest Failed."
);
}
yield
return
null
;
GameManager
.
Instance
.
SceneTransition
(
"InGame"
);
yield
return
null
;
var
Managers
=
GameObject
.
Find
(
"Managers"
);
var
CoordinateMapperManager
=
Managers
.
GetComponent
<
CoordinateMapperManager
>();
var
tmpObj
=
GameObject
.
CreatePrimitive
(
PrimitiveType
.
Plane
);
tmpObj
.
GetComponent
<
Renderer
>().
material
=
Resources
.
Load
(
"GreenScreen/GreenScreen.mat"
,
typeof
(
Material
))
as
Material
;
tmpObj
.
GetComponent
<
Renderer
>().
material
.
SetTexture
(
"_MainTex"
,
CoordinateMapperManager
.
ColorTexture
);
var
DepthPoints
=
CoordinateMapperManager
.
DepthCoordinates
;
var
DepthBuffer
=
new
ComputeBuffer
(
DepthPoints
.
Length
,
sizeof
(
float
)
*
2
);
tmpObj
.
GetComponent
<
Renderer
>().
material
.
SetBuffer
(
"depthCoordinates"
,
DepthBuffer
);
var
BodyIndexPoints
=
CoordinateMapperManager
.
BodyIndexBuffer
;
var
BodyIndexBuffer
=
new
ComputeBuffer
(
BodyIndexPoints
.
Length
,
sizeof
(
float
));
tmpObj
.
GetComponent
<
Renderer
>().
material
.
SetBuffer
(
"bodyIndexBuffer"
,
BodyIndexBuffer
);
var
CoordinateMapperView
=
GameObject
.
Find
(
"CoordinateMapView"
);
// Use the Assert class to test conditions.
// yield to skip a frame
yield
return
null
;
var
expected
=
tmpObj
.
GetComponent
<
Renderer
>().
material
.
mainTexture
;
var
actual
=
CoordinateMapperView
.
GetComponent
<
Renderer
>().
material
.
mainTexture
;
Assert
.
AreEqual
(
expected
,
actual
,
"texture of gameobject should be same as texture which made by shader."
);
}
}
Assets/Script/TrackInfo.cs
View file @
540ef035
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
...
...
@@ -18,17 +19,24 @@ public class TrackInfo
public
List
<
Note
>
Notes
{
get
;
private
set
;
}
public
TrackInfo
(
string
path
):
this
(
new
FileInfo
(
path
))
{
}
public
TrackInfo
(
string
path
):
this
(
new
FileInfo
(
path
))
{
}
public
TrackInfo
(
FileInfo
file
)
{
TrackList
=
new
List
<
string
>();
MultiDictionary
<
string
,
string
>
parseResult
=
ParseBPE
(
file
);
ExtractTrackHeader
(
parseResult
);
ParseBPEHeader
(
file
);
Notes
=
ParseBPENote
(
file
);
TrackNotes
notes
=
new
TrackNotes
();
notes
.
ExtractNotes
(
parseResult
,
BPM
);
Notes
=
notes
.
Notes
;
}
private
void
ParseBPEHeader
(
FileInfo
file
)
MultiDictionary
<
string
,
string
>
ParseBPE
(
FileInfo
file
)
{
MultiDictionary
<
string
,
string
>
result
=
new
MultiDictionary
<
string
,
string
>();
using
(
StreamReader
reader
=
new
StreamReader
(
new
BufferedStream
(
file
.
OpenRead
())))
{
...
...
@@ -39,147 +47,324 @@ public class TrackInfo
continue
;
string
[]
token
=
line
.
Split
(
new
char
[]
{
' '
},
2
);
string
field
=
token
[
0
];
string
value
=
token
[
1
].
Trim
();
switch
(
field
)
{
case
"#TITLE"
:
Title
=
value
;
break
;
case
"#ARTIST"
:
Artist
=
value
;
break
;
case
"#GENRE"
:
Genre
=
value
;
break
;
case
"#BPM"
:
float
outBPM
;
if
(
float
.
TryParse
(
value
,
out
outBPM
))
BPM
=
outBPM
;
else
BPM
=
0
;
break
;
case
"#PLAYLEVEL"
:
int
outLevel
;
if
(
int
.
TryParse
(
value
,
out
outLevel
))
Level
=
outLevel
;
else
Level
=
0
;
break
;
case
"#TRACKLIST"
:
TrackList
.
Add
(
value
);
break
;
case
"#WAV"
:
BGM
=
Resources
.
Load
(
value
)
as
AudioSource
;
break
;
}
result
[
token
[
0
]]
=
new
List
<
string
>
{
token
[
1
].
Trim
()
};
}
}
return
result
;
}
p
ublic
List
<
Note
>
ParseBPENote
(
FileInfo
file
)
p
rivate
void
ExtractTrackHeader
(
MultiDictionary
<
string
,
string
>
parseResult
)
{
List
<
Note
>
notes
=
new
List
<
Note
>();
float
?
tempLongBtnStart
=
null
;
float
?
tempLongMtnStart
=
null
;
TrackHeader
header
=
new
TrackHeader
();
header
.
ExtractHeader
(
parseResult
);
int
maxMeasure
=
0
;
Title
=
header
.
Title
;
Artist
=
header
.
Artist
;
Genre
=
header
.
Genre
;
BPM
=
header
.
BPM
;
Level
=
header
.
Level
;
TrackList
=
header
.
TrackList
;
BGM
=
header
.
BGM
;
}
}
using
(
StreamReader
reader
=
new
StreamReader
(
new
BufferedStream
(
file
.
OpenRead
())))
internal
class
MultiDictionary
<
TKey
,
TValue
>
:
IEnumerable
<
KeyValuePair
<
TKey
,
List
<
TValue
>>>
{
private
Dictionary
<
TKey
,
List
<
TValue
>>
dictionary
=
new
Dictionary
<
TKey
,
List
<
TValue
>>();
public
List
<
TValue
>
this
[
TKey
key
]
{
get
{
string
line
;
while
((
line
=
reader
.
ReadLine
())
!=
null
)
List
<
TValue
>
list
;
if
(!
dictionary
.
TryGetValue
(
key
,
out
list
)
)
{
if
(
line
==
""
||
line
[
0
]
!=
'#'
)
continue
;
list
=
new
List
<
TValue
>();
dictionary
[
key
]
=
list
;
}
string
[]
token
=
line
.
Split
(
new
char
[]
{
' '
},
2
);
string
field
=
token
[
0
];
string
value
=
token
[
1
].
Trim
();
return
list
;
}
set
{
List
<
TValue
>
list
;
if
(!
dictionary
.
TryGetValue
(
key
,
out
list
))
dictionary
[
key
]
=
value
;
else
dictionary
[
key
]
=
list
.
Concat
(
value
).
ToList
();
}
}
if
(
field
.
Length
!=
7
)
continue
;
public
bool
TryGetValue
(
TKey
key
,
out
List
<
TValue
>
value
)
{
return
dictionary
.
TryGetValue
(
key
,
out
value
);
}
string
[]
CHANNELS
=
{
"SBT"
,
"LBT"
,
"SMO"
,
"LMO"
};
public
IEnumerator
<
KeyValuePair
<
TKey
,
List
<
TValue
>>>
GetEnumerator
()
{
return
dictionary
.
GetEnumerator
();
}
int
measure
;
string
channel
=
field
.
Substring
(
4
,
3
);
IEnumerator
IEnumerable
.
GetEnumerator
()
{
return
GetEnumerator
();
}
if
(!
int
.
TryParse
(
field
.
Substring
(
1
,
3
),
out
measure
))
continue
;
if
(
Array
.
FindIndex
(
CHANNELS
,
x
=>
x
==
channel
)
==
-
1
)
continue
;
public
bool
Remove
(
TKey
key
)
{
return
dictionary
.
Remove
(
key
);
}
}
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
);
if
(
key
==
"00"
)
continue
;
float
timing
=
(
measure
+
(
float
)
i
/
seq
)
*
ms
;
if
(
channel
==
"SBT"
)
{
notes
.
Add
(
new
Note
(
key
,
channel
,
timing
));
}
else
if
(
channel
==
"LBT"
)
{
if
(
tempLongBtnStart
==
null
)
{
tempLongBtnStart
=
timing
;
continue
;
}
float
start
=
tempLongBtnStart
.
Value
;
notes
.
Add
(
new
Note
(
key
,
channel
,
start
,
timing
));
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
;
}
}
}
}
internal
class
TrackHeader
{
public
string
Title
{
get
;
private
set
;
}
public
string
Artist
{
get
;
private
set
;
}
public
string
Genre
{
get
;
private
set
;
}
public
float
BPM
{
get
;
private
set
;
}
public
int
Level
{
get
;
private
set
;
}
public
AudioSource
BGM
{
get
;
private
set
;
}
public
List
<
string
>
TrackList
{
get
;
private
set
;
}
public
void
ExtractHeader
(
MultiDictionary
<
string
,
string
>
parseResult
)
{
Title
=
ExtractMetaString
(
parseResult
,
"#TITLE"
);
Artist
=
ExtractMetaString
(
parseResult
,
"#ARTIST"
);
Genre
=
ExtractMetaString
(
parseResult
,
"#GENRE"
);
BPM
=
ExtractBPM
(
parseResult
);
Level
=
ExtractLevel
(
parseResult
);
TrackList
=
ExtractMetaList
(
parseResult
,
"#TRACKLIST"
);
BGM
=
Resources
.
Load
(
ExtractMetaString
(
parseResult
,
"#WAV"
))
as
AudioSource
;
}
for
(
int
i
=
0
;
i
<=
maxMeasure
;
i
++)
private
List
<
string
>
ExtractMetaList
(
MultiDictionary
<
string
,
string
>
parseResult
,
string
key
)
{
List
<
string
>
list
;
if
(
parseResult
.
TryGetValue
(
key
,
out
list
))
{
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
));
parseResult
.
Remove
(
key
);
return
list
;
}
return
notes
;
return
null
;
}
private
string
ExtractMetaString
(
MultiDictionary
<
string
,
string
>
parseResult
,
string
key
)
{
List
<
string
>
list
=
ExtractMetaList
(
parseResult
,
key
);
return
list
==
null
?
null
:
list
[
0
];
}
private
float
ExtractBPM
(
MultiDictionary
<
string
,
string
>
parseResult
)
{
string
str
=
ExtractMetaString
(
parseResult
,
"#BPM"
);
float
outBPM
;
if
(
float
.
TryParse
(
str
,
out
outBPM
))
return
outBPM
;
else
return
0
;
}
private
int
ExtractLevel
(
MultiDictionary
<
string
,
string
>
parseResult
)
{
string
str
=
ExtractMetaString
(
parseResult
,
"#PLAYLEVEL"
);
int
outLevel
;
if
(
int
.
TryParse
(
str
,
out
outLevel
))
return
outLevel
;
else
return
0
;
}
}
internal
class
TrackNotes
{
private
List
<
Note
>
notes
=
new
List
<
Note
>();
public
List
<
Note
>
Notes
{
get
{
return
notes
;
}
}
public
void
ExtractNotes
(
MultiDictionary
<
string
,
string
>
parseResult
,
float
BPM
)
{
var
validSigns
=
ExtractValidSigns
(
parseResult
);
CreateNotes
(
validSigns
,
BPM
);
CreateBeatLines
(
ExtractEnd
(
validSigns
),
BPM
);
}
IEnumerable
<
KeyValuePair
<
string
,
List
<
string
>>>
ExtractValidSigns
(
MultiDictionary
<
string
,
string
>
parseResult
)
{
return
parseResult
.
Where
(
x
=>
IsValidSignType
(
x
.
Key
));
}
bool
IsValidSignType
(
string
signType
)
{
int
measure
;
return
signType
.
Length
==
7
&&
int
.
TryParse
(
signType
.
Substring
(
1
,
3
),
out
measure
)
&&
Enumerable
.
Contains
(
new
List
<
string
>
{
"SBT"
,
"LBT"
,
"SMO"
,
"LMO"
},
signType
.
Substring
(
4
,
3
));
}
int
ExtractEnd
(
IEnumerable
<
KeyValuePair
<
string
,
List
<
string
>>>
validSigns
)
{
return
validSigns
.
Select
(
x
=>
int
.
Parse
(
x
.
Key
.
Substring
(
1
,
3
))).
Max
();
}
void
CreateBeatLines
(
int
end
,
float
BPM
)
{
Notes
.
Concat
(
Enumerable
.
Range
(
1
,
(
end
+
1
)
*
4
)
.
Select
(
x
=>
new
Note
(
NoteType
.
BeatLine
,
(
x
/
4.0f
)
*
(
4
*
60
*
1000f
/
BPM
))));
}
void
CreateNotes
(
IEnumerable
<
KeyValuePair
<
string
,
List
<
string
>>>
validSigns
,
float
BPM
)
{
notes
=
new
List
<
Note
>();
validSigns
.
ToList
().
ForEach
(
x
=>
AddNoteSign
(
x
,
4
*
60
*
1000f
/
BPM
,
new
NoteMaker
()));
}
void
AddNoteSign
(
KeyValuePair
<
string
,
List
<
string
>>
parsedItem
,
float
miliSeconds
,
NoteMaker
noteMaker
)
{
parsedItem
.
Value
.
ForEach
(
x
=>
Notes
.
Concat
(
NoteSignGenerator
.
SignToNotes
(
x
,
parsedItem
.
Key
,
miliSeconds
,
noteMaker
)));
}
}
internal
class
NoteSignGenerator
{
public
static
IEnumerable
<
Note
>
SignToNotes
(
string
sign
,
string
signType
,
float
miliSeconds
,
NoteMaker
noteMaker
)
{
return
GenerateNoteSequence
(
Enumerable
.
Range
(
0
,
sign
.
Length
/
2
),
x
=>
CurrentCode
(
x
,
sign
),
x
=>
ComputeTiming
(
int
.
Parse
(
signType
.
Substring
(
1
,
3
)),
x
,
sign
.
Length
/
2
,
miliSeconds
),
(
code
,
timing
)
=>
MakeNote
(
noteMaker
,
code
,
signType
.
Substring
(
4
,
3
),
timing
));
}
static
string
CurrentCode
(
int
location
,
string
sign
)
{
return
sign
.
Substring
(
location
*
2
,
2
);
}
static
float
ComputeTiming
(
float
measure
,
int
location
,
int
sequenceSize
,
float
miliSeconds
)
{
return
(
measure
+
(
float
)
location
/
sequenceSize
)
*
miliSeconds
;
}
static
Note
MakeNote
(
NoteMaker
noteMaker
,
string
code
,
string
type
,
float
timing
)
{
return
noteMaker
.
Make
(
code
,
type
,
timing
);
}
static
IEnumerable
<
Note
>
GenerateNoteSequence
(
IEnumerable
<
int
>
range
,
Func
<
int
,
string
>
currentCode
,
Func
<
int
,
float
>
calcTiming
,
Func
<
string
,
float
,
Note
>
concreteNote
)
{
return
DiscreteRange
(
range
,
x
=>
currentCode
(
x
))
.
Select
(
x
=>
concreteNote
(
currentCode
(
x
),
calcTiming
(
x
)))
.
Where
(
x
=>
x
!=
null
);
}
static
IEnumerable
<
int
>
DiscreteRange
(
IEnumerable
<
int
>
range
,
Func
<
int
,
string
>
currentCode
)
{
return
range
.
Where
(
x
=>
currentCode
(
x
).
Equals
(
"00"
));
}
}
internal
abstract
class
NoteMakerBase
{
protected
float
?
Timing
=
null
;
public
Note
Make
(
string
code
,
string
type
,
float
timing
)
{
if
(
NotValidType
(
type
))
return
null
;
if
(
IsShort
(
type
))
return
MakeShort
(
code
,
type
,
timing
);
if
(
IsLongEnd
(
type
))
return
MakeLong
(
code
,
type
,
timing
);
RegisterTiming
(
timing
);
return
null
;
}
bool
IsShort
(
string
type
)
{
return
type
[
0
]
==
'S'
;
}
bool
IsLongEnd
(
string
type
)
{
return
type
[
0
]
==
'L'
&&
Timing
!=
null
;
}
void
RegisterTiming
(
float
timing
)
{
Timing
=
timing
;
}
abstract
protected
bool
NotValidType
(
string
type
);
abstract
protected
Note
MakeShort
(
string
code
,
string
type
,
float
timing
);
abstract
protected
Note
MakeLong
(
string
code
,
string
type
,
float
timing
);
}
internal
class
ButtonNoteMaker
:
NoteMakerBase
{
override
protected
bool
NotValidType
(
string
type
)
{
return
type
.
Substring
(
1
)
!=
"BT"
;
}
override
protected
Note
MakeShort
(
string
code
,
string
type
,
float
timing
)
{
return
new
Note
(
code
,
type
,
timing
);
}
override
protected
Note
MakeLong
(
string
code
,
string
type
,
float
timing
)
{
float
start
=
Timing
.
Value
;
Timing
=
null
;
return
new
Note
(
code
,
type
,
start
,
timing
);
}
}
internal
class
MotionNoteMaker
:
NoteMakerBase
{
override
protected
bool
NotValidType
(
string
type
)
{
Type
motionType
;
return
type
.
Substring
(
1
)
!=
"MO"
||
!
MotionNote
.
keymap
.
TryGetValue
(
type
,
out
motionType
);
}
override
protected
Note
MakeShort
(
string
code
,
string
type
,
float
timing
)
{
return
(
MotionNote
)
Activator
.
CreateInstance
(
MotionNote
.
keymap
[
type
],
code
,
timing
);
}
override
protected
Note
MakeLong
(
string
code
,
string
type
,
float
timing
)
{
float
start
=
Timing
.
Value
;
Timing
=
null
;
return
(
MotionNote
)
Activator
.
CreateInstance
(
MotionNote
.
keymap
[
type
],
code
,
start
,
timing
);
}
}
internal
class
NoteMaker
{
ButtonNoteMaker
buttonNoteMaker
=
new
ButtonNoteMaker
();
MotionNoteMaker
motionNoteMaker
=
new
MotionNoteMaker
();
public
Note
Make
(
string
code
,
string
type
,
float
timing
)
{
return
motionNoteMaker
.
Make
(
code
,
type
,
timing
)
??
buttonNoteMaker
.
Make
(
code
,
type
,
timing
);
}
}
\ No newline at end of file
Assets/Script/TrackManager.cs
View file @
540ef035
...
...
@@ -81,13 +81,7 @@ public class TrackManager : MonoBehaviour {
void
LoadTracks
()
{
var
files
=
new
DirectoryInfo
(
"Assets/Tracks"
).
GetFiles
(
"*.bpe"
,
SearchOption
.
AllDirectories
);
List
<
TrackInfo
>
tracks
=
files
.
Select
(
s
=>
new
TrackInfo
(
s
)).
ToList
();
while
(
tracks
.
Count
()
<
5
)
tracks
.
AddRange
(
tracks
);
foreach
(
TrackInfo
track
in
tracks
)
foreach
(
TrackInfo
track
in
LoadTrackInfos
())
{
var
trackItem
=
Instantiate
(
trackItemPrefab
,
trackList
.
transform
);
...
...
@@ -95,6 +89,17 @@ public class TrackManager : MonoBehaviour {
}
}
List
<
TrackInfo
>
LoadTrackInfos
()
{
var
files
=
new
DirectoryInfo
(
"Assets/Tracks"
).
GetFiles
(
"*.bpe"
,
SearchOption
.
AllDirectories
);
var
tracks
=
files
.
Select
(
s
=>
new
TrackInfo
(
s
)).
ToList
();
while
(
tracks
.
Count
()
<
5
)
tracks
.
AddRange
(
tracks
);
return
tracks
;
}
public
void
StartTrack
()
{
// TODO: disable start button if nothing selected
...
...
ProjectSettings/ProjectSettings.asset
View file @
540ef035
...
...
@@ -67,7 +67,7 @@ PlayerSettings:
defaultIsFullScreen
:
1
defaultIsNativeResolution
:
1
macRetinaSupport
:
1
runInBackground
:
0
runInBackground
:
1
captureSingleScreen
:
0
muteOtherAudioSources
:
0
Prepare IOS For Recording
:
0
...
...
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