Updated Inputs for some minigames

First Contact & DJ School has their inputs methods updated
This commit is contained in:
Mytiaoga 2022-07-08 13:27:10 +08:00
parent b1a491b50a
commit 614059a4d3
37 changed files with 3083 additions and 957 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -3,5 +3,5 @@ guid: 8f935c3cf25b69746819a94756411f28
PrefabImporter:
externalObjects: {}
userData:
assetBundleName: ntrdj/common
assetBundleName:
assetBundleVariant:

View file

@ -15,10 +15,48 @@ AudioMixerGroupController:
m_Send: 00000000000000000000000000000000
m_Effects:
- {fileID: -3827691611382659438}
- {fileID: -7417416911555589299}
- {fileID: -4864457926502934139}
m_UserColorIndex: 0
m_Mute: 0
m_Solo: 0
m_BypassEffects: 0
--- !u!244 &-7417416911555589299
AudioMixerEffectController:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_EffectID: 5b8f1b47430c37f4aa6afd61b4f32eec
m_EffectName: Highpass
m_MixLevel: c5fb06afbdfde63429bee2da9ea91189
m_Parameters:
- m_ParameterName: Cutoff freq
m_GUID: 34d86eacd61c28340b115290d5f25b76
- m_ParameterName: Resonance
m_GUID: 10bb5a0f2787ab54db70b685b5d01d0b
m_SendTarget: {fileID: 0}
m_EnableWetMix: 0
m_Bypass: 0
--- !u!244 &-4864457926502934139
AudioMixerEffectController:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_EffectID: 5739ec919cbf73c429b7bfd3d5c17692
m_EffectName: Lowpass
m_MixLevel: bf479ffff7901754b93db8cd04a5b69b
m_Parameters:
- m_ParameterName: Cutoff freq
m_GUID: 89e57fda42bbd884c9b50b8cfffb46f6
- m_ParameterName: Resonance
m_GUID: 1505a38b6ed3ac044b1b27d1e026ee10
m_SendTarget: {fileID: 0}
m_EnableWetMix: 0
m_Bypass: 0
--- !u!244 &-3827691611382659438
AudioMixerEffectController:
m_ObjectHideFlags: 3
@ -104,13 +142,32 @@ AudioMixerSnapshotController:
m_SnapshotID: cbd5c1fb10b276940af4ad86481f0172
m_FloatValues:
9dd04840cf4676047b2e26e659ca4069: 1661
65da18c00dad8f642a1f04b10bc4d3fa: -9.8
2b8f30d01b6887a4a9a1c346efb59529: 0.96
152a0691009a459488775726d7da2a76: 0
b32285822a3582a46bc02ae0bb31edd0: 0
16419c92ecf0c4743a61bae82f0cd39d: 0.96
3537f1d2761ea514aad24adbde59814c: 0.5
9cca3334388db1b4cb9a564a2d81e1d9: 2909
44f9a634893e4074e976e9bbdd1798de: 2909
43b77be4dcaecc64dad266d1ce7ec63b: 0
4bc95d762bab08f4397b7609394e744d: 0
df5d5286217f286439c16cde82518c34: 0
3efb01d650e14ea499166db104c3fef0: 1661
03f31c284979509419018c8192731634: 2064
9032eb9801098ed4eaa00396d75cac0c: -9.8
5236511a7a103314ba1c738dd5b09f64: 2064
994ac19a5841d5747a8d4e85c1068fb2: 10
89e57fda42bbd884c9b50b8cfffb46f6: 22000
97da122bdf1007b4dbcb38293f8ad4ce: 6983
46ae8f9b0a8b2c94da3f936b6675c718: 4
1b5e174cdc33a544cb4195a5aba09219: 4
34d86eacd61c28340b115290d5f25b76: 10
74a2868d38bb05a40b9f820d98dfc3a9: -10000
8170201e04f44b44fa0a6811cbd98865: 0.1
7392d42e828461d4fbea16ee69eecec3: 0.06
3549d05eae7b26c42ba4beb170a39a43: 0.96
4963fceebf3ef7c499597c1c62bdc06b: 0.96
0d54293f1eb308e4f9eb23e744bae623: 1
911cb1bf4bb1b624ab3a68e1eb57ba29: 10
m_TransitionOverrides: {}
@ -124,15 +181,19 @@ AudioMixerSnapshotController:
m_AudioMixer: {fileID: 24100000}
m_SnapshotID: 63d5780e5b890af43a13ba2a5e7fd23d
m_FloatValues:
8ac1b110f403261418b718a0a6962426: -9.8
9dd04840cf4676047b2e26e659ca4069: 1661
152a0691009a459488775726d7da2a76: 0
152a0691009a459488775726d7da2a76: 16
b32285822a3582a46bc02ae0bb31edd0: 0
3537f1d2761ea514aad24adbde59814c: 0.5
1f89dac5f0e643c4ab8774d8ad05e968: 2.79
4bc95d762bab08f4397b7609394e744d: 0
3efb01d650e14ea499166db104c3fef0: 1661
994ac19a5841d5747a8d4e85c1068fb2: 1121
89e57fda42bbd884c9b50b8cfffb46f6: 2064
97da122bdf1007b4dbcb38293f8ad4ce: 6983
34d86eacd61c28340b115290d5f25b76: 2909
3890ccbecfbaacd42a9fda6a955eeab8: 4
0d54293f1eb308e4f9eb23e744bae623: 3.99
911cb1bf4bb1b624ab3a68e1eb57ba29: 7184
m_TransitionOverrides: {}

View file

@ -0,0 +1,91 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: TextboxSDFMaterial
m_Shader: {fileID: 4800000, guid: 777678d31f953e04e8f15812003b9c27, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _ColorMask: 15
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _OutSmoothness: 0.025
- _OutThickness: 0.9
- _Parallax: 0.02
- _SDFThreshold: 0.5
- _Smoothness: 0.025
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _Thickness: 0.8
- _UVSec: 0
- _UseUIAlphaClip: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _OutColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8bf75b500692c234daf2d17ad891f66b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -0,0 +1,135 @@
fileFormatVersion: 2
guid: 82c4853aee62f094682396664577c631
TextureImporter:
internalIDToNameTable:
- first:
213: 1280609944595656088
second: interpreterTextbox0_0
- first:
213: 3351327113491225332
second: interpreterTextbox0_1
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 0
alignment: 9
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 87, y: 197, z: 98, w: 203}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 64
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 64
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: interpreterTextbox0_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 512
height: 512
alignment: 0
pivot: {x: 0.5, y: 0.5}
border: {x: 73, y: 239, z: 186, w: 203}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 89de47ba5f3a5c110800000000000000
internalID: 1280609944595656088
vertices: []
indices:
edges: []
weights: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -5,6 +5,15 @@ TextureImporter:
- first:
213: 484124400209634000
second: interpreterTextboxes_0
- first:
213: -7876428232389808301
second: interpreterTextboxes_1
- first:
213: -2508620102671554880
second: interpreterTextboxes_2
- first:
213: 4953631840317161205
second: interpreterTextboxes_3
externalObjects: {}
serializedVersion: 11
mipmaps:
@ -99,7 +108,7 @@ TextureImporter:
serializedVersion: 2
x: 0
y: 513
width: 510
width: 511
height: 511
alignment: 0
pivot: {x: 0, y: 0}
@ -114,6 +123,48 @@ TextureImporter:
indices:
edges: []
weights: []
- serializedVersion: 2
name: interpreterTextboxes_1
rect:
serializedVersion: 2
x: 513
y: 513
width: 511
height: 511
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 35f2c85f04e41b290800000000000000
internalID: -7876428232389808301
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: interpreterTextboxes_2
rect:
serializedVersion: 2
x: 0
y: 0
width: 511
height: 511
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 0c6abdfce479f2dd0800000000000000
internalID: -2508620102671554880
vertices: []
indices:
edges: []
weights: []
outline: []
physicsShape: []
bones: []

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

View file

@ -0,0 +1,108 @@
fileFormatVersion: 2
guid: f844d9227d1dcc14399e9691e760481d
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 3
wrapV: 3
wrapW: 3
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 0
alignment: 8
spritePivot: {x: 1, y: 0}
spritePixelsToUnits: 100
spriteBorder: {x: 57, y: 0, z: 0, w: 57}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 64
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 64
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -20,6 +20,7 @@ namespace HeavenStudio
public List<Entity> entities = new List<Entity>();
public List<TempoChange> tempoChanges = new List<TempoChange>();
public List<VolumeChange> volumeChanges = new List<VolumeChange>();
public float firstBeatOffset;
[Serializable]
@ -53,6 +54,12 @@ namespace HeavenStudio
return this.MemberwiseClone();
}
public Entity DeepCopy()
{
//lol the AI generated this
return JsonConvert.DeserializeObject<Entity>(JsonConvert.SerializeObject(this));
}
public object this[string propertyName]
{
get
@ -85,5 +92,18 @@ namespace HeavenStudio
return this.MemberwiseClone();
}
}
[Serializable]
public class VolumeChange : ICloneable
{
public float beat;
public float length;
public float volume;
public object Clone()
{
return this.MemberwiseClone();
}
}
}
}

View file

@ -11,7 +11,11 @@ namespace HeavenStudio.Games.Loaders
public static Minigame AddGame(EventCaller eventCaller) {
return new Minigame("djSchool", "DJ School", "008c97", false, false, new List<GameAction>()
{
new GameAction("bop", delegate { DJSchool.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 0.5f, true),
//new GameAction("bop", delegate { DJSchool.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 0.5f, true),
new GameAction("bop", delegate { DJSchool.instance.Bop(eventCaller.currentEntity.toggle); }, 0.5f, false, new List<Param>()
{
new Param("toggle", true, "Bop", "Whether both will bop to the beat or not")
}),
new GameAction("and stop ooh", delegate { var e = eventCaller.currentEntity; DJSchool.instance.AndStop(e.beat, e.toggle); }, 2.5f, false, new List<Param>()
{
new Param("toggle", true, "Ooh", "Whether or not the \"ooh\" sound should be played")
@ -25,6 +29,14 @@ namespace HeavenStudio.Games.Loaders
{
new Param("type", DJSchool.DJVoice.Standard, "Voice", "The voice line to play"),
}),
new GameAction("dj voice lines", delegate { DJSchool.instance.voiceLines(eventCaller.currentEntity.beat, eventCaller.currentEntity.type); }, 2f, false, new List<Param>()
{
new Param("type", DJSchool.DJVoiceLines.CheckItOut, "Voice Lines", "The voice line to play"),
}),
new GameAction("sound FX", delegate { DJSchool.instance.soundFX(eventCaller.currentEntity.toggle); }, .5f, false, new List<Param>()
{
new Param("toggle", false, "Radio FX", "Toggle on and off for Radio Effects")
})
},
new List<string>() {"ntr", "normal"},
"ntrdj", "en",
@ -47,16 +59,31 @@ namespace HeavenStudio.Games
Hyped
}
public enum DJVoiceLines
{
CheckItOut,
LetsGo,
OhYeah,
OhYeahAlt,
Yay
}
[Header("Components")]
[SerializeField] private Student student;
[SerializeField] private GameObject djYellow;
private Animator djYellowAnim;
[SerializeField] private SpriteRenderer headSprite;
[SerializeField] private Sprite[] headSprites;
private float lastReportedBeat = 0f;
[Header("Properties")]
public GameEvent bop = new GameEvent();
private bool djYellowHolding;
public bool andStop;
public bool goBop;
public float beatOfInstance;
public static DJSchool instance { get; private set; }
@ -65,53 +92,117 @@ namespace HeavenStudio.Games
instance = this;
djYellowAnim = djYellow.GetComponent<Animator>();
student.Init();
goBop = true;
}
private void Update()
{
var cond = Conductor.instance;
#region old script
//var cond = Conductor.instance;
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
//if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
//{
// if (cond.songPositionInBeats >= bop.startBeat && cond.songPositionInBeats < bop.startBeat + bop.length)
// {
// if (student.anim.IsAnimationNotPlaying())
// {
// if (student.isHolding)
// {
// student.anim.Play("HoldBop", 0, 0);
// }
// else
// {
// student.anim.Play("IdleBop", 0, 0);
// }
// }
// if (djYellowAnim.IsAnimationNotPlaying())
// {
// var yellowState = djYellowAnim.GetCurrentAnimatorStateInfo(0);
// if (yellowState.IsName("Hey"))
// {
// PostScratchoFace();
// }
// if (djYellowHolding)
// {
// djYellowAnim.Play("HoldBop", 0, 0);
// }
// else
// {
// // todo: split between left and right bop based on beat
// djYellowAnim.Play("IdleBop", 0, 0);
// }
// }
// }
//}
#endregion
if (Conductor.instance.ReportBeat(ref lastReportedBeat))
{
if (cond.songPositionInBeats >= bop.startBeat && cond.songPositionInBeats < bop.startBeat + bop.length)
if (goBop)
{
if (student.anim.IsAnimationNotPlaying())
if (student.isHolding)
{
if (student.isHolding)
{
student.anim.Play("HoldBop", 0, 0);
}
else
{
student.anim.Play("IdleBop", 0, 0);
}
student.anim.Play("HoldBop", 0, 0);
}
if (djYellowAnim.IsAnimationNotPlaying())
else if (!student.swiping && student.anim.IsAnimationNotPlaying())
{
var yellowState = djYellowAnim.GetCurrentAnimatorStateInfo(0);
if (yellowState.IsName("Hey"))
{
PostScratchoFace();
}
student.anim.Play("IdleBop", 0, 0);
}
if (djYellowHolding)
{
djYellowAnim.Play("HoldBop", 0, 0);
}
else
{
// todo: split between left and right bop based on beat
djYellowAnim.Play("IdleBop", 0, 0);
}
var yellowState = djYellowAnim.GetCurrentAnimatorStateInfo(0);
if (yellowState.IsName("Hey"))
{
PostScratchoFace();
}
if (!andStop && !djYellowHolding)
{
djYellowAnim.Play("IdleBop", 0, 0);
}
else if (djYellowHolding)
{
djYellowAnim.Play("HoldBop", 0, 0);
}
}
}
else if (Conductor.instance.songPositionInBeats < lastReportedBeat)
{
lastReportedBeat = Mathf.Round(Conductor.instance.songPositionInBeats);
}
if(PlayerInput.Pressed() && !IsExpectingInputNow() && !student.isHolding) //Start hold miss
{
student.OnMissHoldForPlayerInput();
student.isHolding = true;
}
else if(PlayerInput.PressedUp() && !IsExpectingInputNow() && student.isHolding) //Let go during hold
{
student.UnHold();
}
//else if(PlayerInput.PressedUp() && !IsExpectingInputNow() && !student.isHolding)
//{
// student.OnMissSwipeForPlayerInput();
//}
}
public void Bop(float beat, float length)
//public void Bop(float beat, float length)
//{
// bop.startBeat = beat;
// bop.length = length;
//}
public void Bop(bool isBopping)
{
bop.startBeat = beat;
bop.length = length;
if (isBopping)
{
goBop = true;
}
else
{
goBop = false;
}
}
public void BreakCmon(float beat, int type, bool ooh)
@ -148,19 +239,20 @@ namespace HeavenStudio.Games
BeatAction.New(djYellow, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { djYellow.GetComponent<Animator>().Play("BreakCmon", 0, 0); }),
new BeatAction.Action(beat + 1f, delegate { djYellow.GetComponent<Animator>().Play("BreakCmon", 0, 0); SetupCue(beat, false); }),
new BeatAction.Action(beat + 1f, delegate { djYellow.GetComponent<Animator>().Play("BreakCmon", 0, 0); }),
new BeatAction.Action(beat + 2f, delegate
{
djYellow.GetComponent<Animator>().Play("Hold", 0, 0);
djYellowHolding = true;
}),
});
ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, student.OnHitHold, student.OnMissHold, student.OnEmpty);
}
public void AndStop(float beat, bool ooh)
{
if (djYellowHolding) return;
var sound = new MultiSound.Sound[]
{
new MultiSound.Sound("djSchool/andStop1", beat),
@ -175,13 +267,16 @@ namespace HeavenStudio.Games
BeatAction.New(djYellow, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 0.5f, delegate { djYellow.GetComponent<Animator>().Play("BreakCmon", 0, 0); SetupCue(beat - 0.5f, false); }),
new BeatAction.Action(beat + 0.5f, delegate { djYellow.GetComponent<Animator>().Play("BreakCmon", 0, 0); }),
new BeatAction.Action(beat + 1.5f, delegate
{
djYellow.GetComponent<Animator>().Play("Hold", 0, 0);
djYellowHolding = true;
}),
});
andStop = true;
ScheduleInput(beat, 1.5f, InputType.STANDARD_DOWN, student.OnHitHold, student.OnMissHold, student.OnEmpty);
}
public void ScratchoHey(float beat, int type)
@ -213,25 +308,34 @@ namespace HeavenStudio.Games
BeatAction.New(djYellow, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { djYellow.GetComponent<Animator>().Play("Scratcho", 0, 0); }),
new BeatAction.Action(beat + 1f, delegate { djYellow.GetComponent<Animator>().Play("Scratcho2", 0, 0); SetupCue(beat, true); }),
new BeatAction.Action(beat + .5f, delegate { djYellow.GetComponent<Animator>().Play("Scratcho2", 0, 0); }),
//new BeatAction.Action(beat + 1f, delegate { djYellow.GetComponent<Animator>().Play("Scratcho", 0, 0); SetupCue(beat, true); }),
new BeatAction.Action(beat + 1f, delegate { djYellow.GetComponent<Animator>().Play("Scratcho", 0, 0); }),
new BeatAction.Action(beat + 2.05f, delegate
{
djYellow.GetComponent<Animator>().Play("Hey", 0, 0);
djYellowHolding = false;
}),
});
beatOfInstance = beat;
ScheduleInput(beat, 2f, InputType.STANDARD_UP, student.OnHitSwipe, student.OnMissSwipe, student.OnEmpty);
andStop = false;
}
void SetupCue(float beat, bool swipe)
{
if (swipe)
student.swipeBeat = beat;
else
student.holdBeat = beat;
//void SetupCue(float beat, bool swipe)
//{
// if (swipe)
// student.swipeBeat = beat;
// else
// student.holdBeat = beat;
student.eligible = true;
student.ResetState();
}
// student.eligible = true;
// student.ResetState();
//}
public void SetDJYellowHead(int type, bool resetAfterBeats = false)
{
@ -268,5 +372,67 @@ namespace HeavenStudio.Games
SetDJYellowHead(2, true);
}
}
public void soundFX(bool toggle)
{
student.soundFX = toggle;
}
public void voiceLines(float beat, int type)
{
string[] sounds;
var sound = new MultiSound.Sound[] { };
switch (type)
{
case 0:
sounds = new string[] { "djSchool/checkItOut1", "djSchool/checkItOut2", "djSchool/checkItOut3" };
sound = new MultiSound.Sound[]
{
new MultiSound.Sound(sounds[0], beat),
new MultiSound.Sound(sounds[1], beat + .25f),
new MultiSound.Sound(sounds[2], beat + .5f),
};
MultiSound.Play(sound);
break;
case 1:
sounds = new string[] { "djSchool/letsGo1", "djSchool/letsGo2" };
sound = new MultiSound.Sound[]
{
new MultiSound.Sound(sounds[0], beat),
new MultiSound.Sound(sounds[1], beat + .5f),
};
MultiSound.Play(sound);
break;
case 2:
sounds = new string[] { "djSchool/ohYeah1", "djSchool/ohYeah2" };
sound = new MultiSound.Sound[]
{
new MultiSound.Sound(sounds[0], beat),
new MultiSound.Sound(sounds[1], beat + .5f),
};
MultiSound.Play(sound);
break;
case 3:
sounds = new string[] { "djSchool/ohYeahAlt1", "djSchool/ohYeahAlt2", "djSchool/ohYeahAlt3" };
sound = new MultiSound.Sound[]
{
new MultiSound.Sound(sounds[0], beat),
new MultiSound.Sound(sounds[1], beat + .5f),
new MultiSound.Sound(sounds[2], beat + 1f),
};
MultiSound.Play(sound);
break;
case 4:
Jukebox.PlayOneShotGame("djSchool/yay");
break;
}
}
}
}

View file

@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;
using DG.Tweening;
using HeavenStudio.Util;
@ -19,6 +20,8 @@ namespace HeavenStudio.Games.Scripts_DJSchool
public bool shouldBeHolding;
public bool eligible;
public bool missed;
public bool swiping;
public bool soundFX;
[Header("Components")]
[SerializeField] private SpriteRenderer flash;
@ -26,6 +29,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
[SerializeField] private GameObject flashFXInverse;
[SerializeField] private GameObject TurnTable;
[SerializeField] private GameObject slamFX;
AudioMixerGroup mixer;
private Animator tableAnim;
@ -37,103 +41,91 @@ namespace HeavenStudio.Games.Scripts_DJSchool
anim = GetComponent<Animator>();
tableAnim = TurnTable.GetComponent<Animator>();
tableAnim.speed = 0;
mixer = Resources.Load<AudioMixer>("MainMixer").FindMatchingGroups("Music")[0];
mixer.audioMixer.FindSnapshot("Main").TransitionTo(.01f);
}
private void Update()
{
float beatToUse = shouldBeHolding ? swipeBeat : holdBeat;
float normalizedBeat = Conductor.instance.GetPositionFromMargin(beatToUse + 2, 1);
if (eligible)
{
StateCheck(normalizedBeat);
if (normalizedBeat > Minigame.LateTime())
{
eligible = false;
missed = true;
if (shouldBeHolding)
{
shouldBeHolding = false;
}
else
{
shouldBeHolding = true;
game.SetDJYellowHead(3);
}
}
}
if (!isHolding)
{
if (PlayerInput.Pressed())
{
if (!shouldBeHolding && state.perfect && eligible)
{
Hold(true);
eligible = false;
}
else
{
if (!shouldBeHolding)
eligible = false;
Hold(false);
missed = true;
game.SetDJYellowHead(3, true);
}
}
}
else
{
if (PlayerInput.PressedUp())
{
if (shouldBeHolding && state.perfect && eligible)
{
Swipe(true);
eligible = false;
}
else
{
if (shouldBeHolding)
{
Swipe(false);
eligible = false;
}
else
{
UnHold();
}
missed = true;
game.SetDJYellowHead(3);
}
}
}
}
public void Hold(bool ace)
#region old hold
//public void Hold(bool ace)
//{
// isHolding = true;
// if (ace)
// {
// missed = false;
// shouldBeHolding = true;
// game.SetDJYellowHead(1);
// }
// Jukebox.PlayOneShotGame("djSchool/recordStop");
// anim.Play("Hold", 0, 0);
// tableAnim.Play("Student_Turntable_Hold", 0, 0);
// if (ace)
// {
// if (soundFX)
// {
// Conductor.instance.djSchoolHold.TransitionTo(.01f);
// }
// FlashFX(true);
// }
// // Settings.GetMusicMixer().audioMixer.FindSnapshot("DJSchool_Hold").TransitionTo(0.15f);
//}
#endregion
#region onHold
public void OnHitHold(PlayerActionEvent caller, float beat)
{
isHolding = true;
if (ace)
{
missed = false;
shouldBeHolding = true;
game.SetDJYellowHead(1);
}
missed = false;
shouldBeHolding = true;
game.SetDJYellowHead(1);
Jukebox.PlayOneShotGame("djSchool/recordStop");
anim.Play("Hold", 0, 0);
//tableAnim.Play("Student_Turntable_Hold", 0, 0);
if (ace)
if (soundFX)
{
FlashFX(true);
mixer.audioMixer.FindSnapshot("DJSchool_Hold").TransitionTo(.01f);
}
FlashFX(true);
}
// Settings.GetMusicMixer().audioMixer.FindSnapshot("DJSchool_Hold").TransitionTo(0.15f);
public void OnMissHold(PlayerActionEvent caller)
{
//isHolding = true;
missed = true;
game.SetDJYellowHead(3, true);
}
public void OnMissHoldForPlayerInput()
{
isHolding = true;
missed = true;
game.SetDJYellowHead(3, true);
Jukebox.PlayOneShotGame("djSchool/recordStop");
anim.Play("Hold", 0, 0);
//tableAnim.Play("Student_Turntable_Hold", 0, 0);
}
#endregion
public void OnEmpty(PlayerActionEvent caller)
{
//empty
}
public void UnHold()
@ -141,50 +133,125 @@ namespace HeavenStudio.Games.Scripts_DJSchool
isHolding = false;
anim.Play("Unhold", 0, 0);
// Settings.GetMusicMixer().audioMixer.FindSnapshot("Main").TransitionTo(0.15f);
missed = true;
mixer.audioMixer.FindSnapshot("Main").TransitionTo(.01f);
}
public void Swipe(bool ace)
#region onSwipe
public void OnHitSwipe(PlayerActionEvent caller, float beat)
{
isHolding = false;
if (ace)
if (!missed)
{
isHolding = false;
missed = false;
shouldBeHolding = false;
Jukebox.PlayOneShotGame("djSchool/recordSwipe");
FlashFX(false);
swiping = true;
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { anim.Play("Swipe", 0, 0); }),
new BeatAction.Action(beat + 4f, delegate { swiping = false; }),
});
//anim.Play("Swipe", 0, 0);
tableAnim.speed = 1;
tableAnim.Play("Student_Turntable_Swipe", 0, 0);
Instantiate(slamFX).SetActive(true);
mixer.audioMixer.FindSnapshot("Main").TransitionTo(.01f);
}
else
{
// Missed record swipe sound should play here.
OnMissSwipeForPlayerInput();
Jukebox.PlayOneShotGame("djSchool/recordSwipe");
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { anim.Play("Swipe", 0, 0); }),
new BeatAction.Action(beat + 4f, delegate { swiping = false; }),
});
//anim.Play("Swipe", 0, 0);
tableAnim.speed = 1;
tableAnim.Play("Student_Turntable_Swipe", 0, 0);
Instantiate(slamFX).SetActive(true);
mixer.audioMixer.FindSnapshot("Main").TransitionTo(.01f);
}
anim.Play("Swipe", 0, 0);
tableAnim.speed = 1;
tableAnim.Play("Student_Turntable_Swipe", 0, 0);
Instantiate(slamFX).SetActive(true);
// Settings.GetMusicMixer().audioMixer.FindSnapshot("Main").TransitionTo(0.15f);
}
public override void OnAce()
public void OnMissSwipe(PlayerActionEvent caller)
{
if (!shouldBeHolding)
{
Hold(true);
}
else
{
Swipe(true);
}
eligible = false;
isHolding = false;
//swiping = false;
missed = true;
game.SetDJYellowHead(3);
mixer.audioMixer.FindSnapshot("Main").TransitionTo(.01f);
}
public void OnMissSwipeForPlayerInput()
{
isHolding = false;
missed = true;
game.SetDJYellowHead(3);
//swiping = false;
mixer.audioMixer.FindSnapshot("Main").TransitionTo(.01f);
}
#endregion
#region old swipe
//public void Swipe(bool ace)
//{
// isHolding = false;
// if (ace)
// {
// missed = false;
// shouldBeHolding = false;
// Jukebox.PlayOneShotGame("djSchool/recordSwipe");
// FlashFX(false);
// swiping = true;
// }
// else
// {
// // Missed record swipe sound should play here.
// }
// anim.Play("Swipe", 0, 0);
// tableAnim.speed = 1;
// tableAnim.Play("Student_Turntable_Swipe", 0, 0);
// Instantiate(slamFX).SetActive(true);
// Conductor.instance.normal.TransitionTo(.01f);
// // Settings.GetMusicMixer().audioMixer.FindSnapshot("Main").TransitionTo(0.15f);
// swiping = false;
//}
//public override void OnAce()
//{
// if (!shouldBeHolding)
// {
// //Hold(true);
// }
// else
// {
// Conductor.instance.normal.TransitionTo(.01f);
// //Swipe(true);
// }
// eligible = false;
//}
#endregion
private void FlashFX(bool inverse)
{
GameObject prefab = flashFX;
@ -194,11 +261,10 @@ namespace HeavenStudio.Games.Scripts_DJSchool
GameObject flashFX_ = Instantiate(prefab, this.transform.parent);
flashFX_.SetActive(true);
Destroy(flashFX_, 0.5f);
flash.color = "D0FBFF".Hex2RGB();
flash.color = new Color(flash.color.r, flash.color.g, flash.color.b, 0.85f);
flash.DOColor(new Color(flash.color.r, flash.color.g, flash.color.b, 0), 0.15f);
Destroy(flashFX_, 0.5f);
}
public void TransitionBackToIdle()
@ -210,5 +276,12 @@ namespace HeavenStudio.Games.Scripts_DJSchool
anim.Play("Idle", 0, 0);
}
}
//Not sure but will do?
private void OnDestroy()
{
mixer.audioMixer.FindSnapshot("Main").TransitionTo(.01f);
}
}
}

View file

@ -5,7 +5,6 @@ using HeavenStudio.Util;
namespace HeavenStudio.Games.Loaders
{
using static Minigames;
public static class CtrFirstContact
{
public static Minigame AddGame(EventCaller eventCaller)
@ -13,7 +12,10 @@ namespace HeavenStudio.Games.Loaders
return new Minigame("firstContact", "First Contact", "008c97", false, false, new List<GameAction>()
{
new GameAction("beat intervals", delegate { FirstContact.instance.SetIntervalStart(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 4f, true),
new GameAction("alien speak", delegate { FirstContact.instance.alienSpeak(eventCaller.currentEntity.beat); }, 0.5f, false),
new GameAction("alien speak", delegate { FirstContact.instance.alienSpeak(eventCaller.currentEntity.beat, eventCaller.currentEntity.valA); }, 0.5f, false, new List<Param>()
{
new Param("valA", new EntityTypes.Float(.8f, 1.5f, 1f), "Pitch")
}),
new GameAction("alien turnover", delegate { FirstContact.instance.alienTurnOver(eventCaller.currentEntity.beat); }, 0.5f, false),
new GameAction("alien success", delegate { FirstContact.instance.alienSuccess(eventCaller.currentEntity.beat); }, 1f, false),
new GameAction("mission control", delegate { FirstContact.instance.missionControlDisplay(eventCaller.currentEntity.beat, eventCaller.currentEntity.toggle); }, 1f, false, new List<Param>
@ -30,7 +32,7 @@ namespace HeavenStudio.Games.Loaders
//{
// new Param("type", FirstContact.VersionOfContact.FirstContact, "Version", "Version of First Contact to play"),
//}),
});
});
}
}
}
@ -103,7 +105,6 @@ namespace HeavenStudio.Games
beatInterval = interval;
}
private void Update()
{
//This is taken from the conductor script
@ -116,7 +117,7 @@ namespace HeavenStudio.Games
lastReportedBeat = Mathf.Round(Conductor.instance.songPositionInBeats);
}
if(PlayerInput.Pressed() && !IsExpectingInputNow() && !noHitOnce && !isSpeaking)
if (PlayerInput.Pressed() && !IsExpectingInputNow() && !noHitOnce && !isSpeaking)
{
Jukebox.PlayOneShotGame("firstContact/" + randomizerLines());
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
@ -124,7 +125,7 @@ namespace HeavenStudio.Games
new BeatAction.Action(.5f, delegate { translator.GetComponent<Animator>().Play("translator_speak", 0, 0);}),
});
}
if((PlayerInput.Pressed() && !IsExpectingInputNow() && isSpeaking))
if ((PlayerInput.Pressed() && !IsExpectingInputNow() && isSpeaking))
{
hasMissed = true;
}
@ -159,14 +160,14 @@ namespace HeavenStudio.Games
}
public void alienSpeak(float beat)
public void alienSpeak(float beat, float pitch)
{
//if (!intervalStarted)
//{
// SetIntervalStart(beat, beatInterval);
//}
//missionControl.SetActive(false);
Jukebox.PlayOneShotGame("firstContact/alien");
Jukebox.PlayOneShotGame("firstContact/alien", beat, pitch);
++alienSpeakCount;
var random = Random.Range(0, 2);
string textToPut = "";
@ -184,7 +185,13 @@ namespace HeavenStudio.Games
BeatAction.New(alien, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { alien.GetComponent<Animator>().Play("alien_talk", 0, 0); }),
new BeatAction.Action(beat, delegate { translator.GetComponent<Animator>().Play(textToPut, 0, 0); }),
new BeatAction.Action(beat, delegate
{
if (!isSpeaking)
{
translator.GetComponent<Animator>().Play(textToPut, 0, 0);
}
}),
});
}
@ -206,7 +213,14 @@ namespace HeavenStudio.Games
{
new BeatAction.Action(beat, delegate { alien.GetComponent<Animator>().Play("alien_point", 0, 0); }),
new BeatAction.Action(beat + .5f, delegate { alien.GetComponent<Animator>().Play("alien_idle", 0, 0); }),
new BeatAction.Action(beat + .5f, delegate { translator.GetComponent<Animator>().Play("translator_idle", 0, 0); })
new BeatAction.Action(beat + .5f,
delegate
{
if (!isSpeaking)
{
translator.GetComponent<Animator>().Play("translator_idle", 0, 0);
}
})
});
isSpeaking = true;
@ -234,7 +248,7 @@ namespace HeavenStudio.Games
BeatAction.New(translator.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { translator.GetComponent<Animator>().Play("translator_idle", 0, 0); }),
new BeatAction.Action(beat + .5f, delegate { translator.GetComponent<Animator>().Play("translator_idle", 0, 0); }),
});
}
else if (alienSpeakCount != translatorSpeakCount)
@ -256,7 +270,7 @@ namespace HeavenStudio.Games
BeatAction.New(translator.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { translator.GetComponent<Animator>().Play("translator_idle", 0, 0); }),
new BeatAction.Action(beat + .5f, delegate { translator.GetComponent<Animator>().Play("translator_idle", 0, 0); }),
});
}

View file

@ -23,7 +23,7 @@ public class WhiteLines : MonoBehaviour
}
}
void Update()
void FixedUpdate()
{
if(transform.position.y > endAt && !isRandomLineMiddle)
{

View file

@ -48,12 +48,13 @@ namespace HeavenStudio.Editor
[SerializeField] private Button UndoBTN;
[SerializeField] private Button RedoBTN;
[SerializeField] private Button MusicSelectBTN;
[SerializeField] private Button EditorSettingsBTN;
[SerializeField] private Button EditorThemeBTN;
[SerializeField] private Button FullScreenBTN;
[SerializeField] private Button TempoFinderBTN;
[SerializeField] private Button SnapDiagBTN;
[SerializeField] private Button EditorThemeBTN;
[SerializeField] private Button EditorSettingsBTN;
[Header("Tooltip")]
public TMP_Text tooltipText;
@ -102,12 +103,12 @@ namespace HeavenStudio.Editor
Tooltip.AddTooltip(UndoBTN.gameObject, "Undo <color=#adadad>[Ctrl+Z]</color>");
Tooltip.AddTooltip(RedoBTN.gameObject, "Redo <color=#adadad>[Ctrl+Y or Ctrl+Shift+Z]</color>");
Tooltip.AddTooltip(MusicSelectBTN.gameObject, "Music Select");
Tooltip.AddTooltip(EditorSettingsBTN.gameObject, "Editor Settings <color=#adadad>[Ctrl+Shift+O]</color>");
Tooltip.AddTooltip(EditorThemeBTN.gameObject, "Editor Theme");
Tooltip.AddTooltip(FullScreenBTN.gameObject, "Preview <color=#adadad>[Tab]</color>");
Tooltip.AddTooltip(TempoFinderBTN.gameObject, "Tempo Finder");
Tooltip.AddTooltip(SnapDiagBTN.gameObject, "Snap Settings");
Tooltip.AddTooltip(EditorSettingsBTN.gameObject, "Editor Settings <color=#adadad>[Ctrl+Shift+O]</color>");
UpdateEditorStatus(true);
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 907f7d1eb5d90af408aa531ea366e63e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Editor.Track;
using TMPro;
namespace HeavenStudio.Editor
{
public class SettingsDialog : MonoBehaviour
{
[SerializeField] private GameObject settingsMenu;
private void Start() {}
public void SwitchSettingsDialog()
{
if(settingsMenu.activeSelf) {
settingsMenu.SetActive(false);
} else {
settingsMenu.SetActive(true);
}
}
private void Update() {}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d82cc04699de2e54483ca0e0468d9ed2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 537580972fcefa548bd9ee5e8254cbfc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace HeavenStudio.Editor
{
public class SnapChangeButton : Button, IPointerDownHandler
{
public SnapDialog SnapDialog;
public bool isDown;
public override void OnPointerDown(PointerEventData eventData)
{
if (eventData.button == PointerEventData.InputButton.Left)
{
SnapDialog.ChangeCommon(isDown);
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7e0cac45de7228a4c8f7bc6adb0751a2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,52 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Editor.Track;
using TMPro;
namespace HeavenStudio.Editor
{
public class SnapDialog : MonoBehaviour
{
[SerializeField] private GameObject snapSetter;
[SerializeField] private TMP_Text snapText;
private Timeline timeline;
private static float[] CommonDenominators = { 1, 2, 3, 4, 6, 8, 12, 16};
private int currentCommon = 3;
private void Start()
{
timeline = Timeline.instance;
}
public void SwitchSnapDialog()
{
if(snapSetter.activeSelf) {
snapSetter.SetActive(false);
} else {
snapSetter.SetActive(true);
}
}
public void ChangeCommon(bool down = false)
{
if(down) {
currentCommon--;
} else {
currentCommon++;
}
if(currentCommon < 0) {
currentCommon = 0;
} else if(currentCommon >= CommonDenominators.Length) {
currentCommon = CommonDenominators.Length - 1;
}
timeline.SetSnap(1f / CommonDenominators[currentCommon]);
}
private void Update()
{
snapText.text = $"1/{CommonDenominators[currentCommon]}";
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f32d53b1d58c64e41b71bd7520435169
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 36b14c8563ea37442aa7a2f0342549b5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,43 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace HeavenStudio.Editor
{
public class TempoFinder : MonoBehaviour
{
[SerializeField] private GameObject tempoFinder;
private bool pressed;
private float timePressed;
[SerializeField] private BPMText bpmText;
private void Awake()
{
pressed = false;
timePressed = 0f;
}
public void SwitchTempoDialog()
{
if(tempoFinder.activeSelf) {
tempoFinder.SetActive(false);
timePressed = 0;
bpmText.ResetText();
} else {
tempoFinder.SetActive(true);
}
}
public void TapBPM()
{
pressed = true;
}
private void Update()
{
timePressed += Time.deltaTime;
if(pressed)
{
pressed = false;
bpmText.ChangeText(timePressed);
timePressed = 0;
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1b489f3aef16a65499f9596abda39c35
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace HeavenStudio.Editor
{
public class TempoFinderButton : Button, IPointerDownHandler
{
public TempoFinder tempoFinder;
public override void OnPointerDown(PointerEventData eventData)
{
if (eventData.button == PointerEventData.InputButton.Left)
{
tempoFinder.TapBPM();
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9557e460670800e458d7bb141135de55
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -131,7 +131,16 @@ namespace HeavenStudio.Editor.Track
UpdateOffsetText();
}
private void AddTempoChange(bool create, Beatmap.TempoChange tempoChange_ = null)
public void ClearTempoTimeline()
{
foreach (TempoTimelineObj tempoTimelineObj in tempoTimelineObjs)
{
Destroy(tempoTimelineObj.gameObject);
}
tempoTimelineObjs.Clear();
}
public void AddTempoChange(bool create, Beatmap.TempoChange tempoChange_ = null)
{
GameObject tempoChange = Instantiate(RefTempoChange.gameObject, this.transform);

View file

@ -30,6 +30,8 @@ namespace HeavenStudio.Editor.Track
public static float SnapInterval() { return instance.snapInterval; }
public void SetSnap(float snap) { snapInterval = snap; }
public class CurrentTimelineState
{
public bool selected;
@ -101,6 +103,7 @@ namespace HeavenStudio.Editor.Track
public void LoadRemix()
{
// beatmap entities
for (int i = 0; i < eventObjs.Count; i++)
{
Destroy(eventObjs[i].gameObject);
@ -109,11 +112,21 @@ namespace HeavenStudio.Editor.Track
for (int i = 0; i < GameManager.instance.Beatmap.entities.Count; i++)
{
var entity = GameManager.instance.Beatmap.entities[i];
var e = GameManager.instance.Beatmap.entities[i];
AddEventObject(e.datamodel, false, new Vector3(e.beat, -e.track * LayerHeight()), e, false, RandomID());
}
//tempo changes
TempoInfo.ClearTempoTimeline();
for (int i = 0; i < GameManager.instance.Beatmap.tempoChanges.Count; i++)
{
var t = GameManager.instance.Beatmap.tempoChanges[i];
TempoInfo.AddTempoChange(false, t);
}
//volume changes
}
public void Init()
@ -559,36 +572,36 @@ namespace HeavenStudio.Editor.Track
GameManager.instance.SortEventsList();
tempEntity = en;
// default param value
var game = EventCaller.instance.GetMinigame(eventName.Split(0));
var ep = EventCaller.instance.GetGameAction(game, eventName.Split(1)).parameters;
if (ep != null)
{
for (int i = 0; i < ep.Count; i++)
{
object returnVal = ep[i].parameter;
var propertyType = returnVal.GetType();
if (propertyType == typeof(EntityTypes.Integer))
{
returnVal = ((EntityTypes.Integer)ep[i].parameter).val;
}
else if (propertyType == typeof(EntityTypes.Float))
{
returnVal = ((EntityTypes.Float)ep[i].parameter).val;
}
tempEntity[ep[i].propertyName] = returnVal;
}
}
}
else
{
GameManager.instance.Beatmap.entities.Add(entity);
GameManager.instance.SortEventsList();
}
// default param value
var game = EventCaller.instance.GetMinigame(eventName.Split(0));
var ep = EventCaller.instance.GetGameAction(game, eventName.Split(1)).parameters;
if (ep != null)
{
for (int i = 0; i < ep.Count; i++)
{
object returnVal = ep[i].parameter;
var propertyType = returnVal.GetType();
if (propertyType == typeof(EntityTypes.Integer))
{
returnVal = ((EntityTypes.Integer)ep[i].parameter).val;
}
else if (propertyType == typeof(EntityTypes.Float))
{
returnVal = ((EntityTypes.Float)ep[i].parameter).val;
}
tempEntity[ep[i].propertyName] = returnVal;
}
}
}
eventObjs.Add(eventObj);
@ -598,6 +611,14 @@ namespace HeavenStudio.Editor.Track
return eventObj;
}
public TimelineEventObj CopyEventObject(Beatmap.Entity e)
{
Beatmap.Entity clone = e.DeepCopy();
TimelineEventObj dup = AddEventObject(clone.datamodel, false, new Vector3(clone.beat, -clone.track * Timeline.instance.LayerHeight()), clone, true, RandomID());
return dup;
}
public void DestroyEventObject(Beatmap.Entity entity)
{
if (EventParameterManager.instance.entity == entity)

View file

@ -41,6 +41,7 @@ namespace HeavenStudio.Editor.Track
private bool resizingLeft;
private bool resizingRight;
private bool inResizeRegion;
private bool wasDuplicated;
public Vector2 lastMovePos;
public bool isCreating;
public string eventObjID;
@ -167,6 +168,13 @@ namespace HeavenStudio.Editor.Track
if (Timeline.instance.eventObjs.FindAll(c => c.moving).Count > 0 && selected)
{
//duplicate the entity if holding alt or r-click
if ((!wasDuplicated) && (Input.GetKey(KeyCode.LeftAlt) || Input.GetMouseButton(1)))
{
wasDuplicated = true;
var te = Timeline.instance.CopyEventObject(entity);
}
Vector3 mousePos = Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition);
lastPos_ = transform.localPosition;
@ -291,6 +299,7 @@ namespace HeavenStudio.Editor.Track
}
moving = false;
wasDuplicated = false;
Cancel();
if (isCreating == true)

View file

@ -16,6 +16,8 @@ namespace HeavenStudio.Editor.Track
public TMP_InputField StartingVolume;
private RectTransform StartingVolumeRect;
public List<VolumeTimelineObj> volumeTimelineObjs = new List<VolumeTimelineObj>();
private bool firstUpdate;
void Start()
@ -74,8 +76,8 @@ namespace HeavenStudio.Editor.Track
}
else if (newVol < 0)
{
StartingVolume.text = "1";
newVol = 1;
StartingVolume.text = "0";
newVol = 0;
}
GameManager.instance.Beatmap.musicVolume = newVol;

View file

@ -0,0 +1,105 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using DG.Tweening;
namespace HeavenStudio.Editor.Track
{
public class VolumeTimelineObj : MonoBehaviour
{
[Header("Components")]
[SerializeField] private RectTransform rectTransform;
[SerializeField] private TMP_Text volumeTXT;
[SerializeField] private RectTransform raycastRect;
public Beatmap.VolumeChange volumeChange;
private float startPosX;
private bool moving = false;
public bool hovering;
private float lastPosX;
private void Start()
{
rectTransform = GetComponent<RectTransform>();
volumeTXT = transform.GetChild(2).GetComponent<TMP_Text>();
UpdateVolume();
}
private void Update()
{
if (Timeline.instance.timelineState.musicVolume && !Conductor.instance.NotStopped())
{
if (RectTransformUtility.RectangleContainsScreenPoint(raycastRect, Input.mousePosition, Editor.instance.EditorCamera))
{
float newVolume = Input.mouseScrollDelta.y;
if (Input.GetKey(KeyCode.LeftShift))
newVolume *= 5f;
if (Input.GetKey(KeyCode.LeftControl))
newVolume /= 100f;
volumeChange.volume += newVolume;
//make sure volume is positive
volumeChange.volume = Mathf.Clamp(volumeChange.volume, 0, 100);
if (Input.GetMouseButtonDown(0))
{
Vector3 mousePos = Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition);
startPosX = mousePos.x - transform.position.x;
moving = true;
lastPosX = transform.localPosition.x;
}
else if (Input.GetMouseButtonDown(1))
{
GameManager.instance.Beatmap.volumeChanges.Remove(volumeChange);
transform.parent.GetComponent<VolumeTimeline>().volumeTimelineObjs.Remove(this);
Destroy(this.gameObject);
}
hovering = true;
}
else
{
hovering = false;
}
if (moving)
{
Vector3 mousePos = Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition);
transform.position = new Vector3(mousePos.x - startPosX, transform.position.y, 0);
transform.localPosition = new Vector3(Mathf.Clamp(Starpelly.Mathp.Round2Nearest(transform.localPosition.x, Timeline.SnapInterval()), 0, Mathf.Infinity), transform.localPosition.y);
}
if (Input.GetMouseButtonUp(0))
{
if (transform.parent.GetComponent<VolumeTimeline>().volumeTimelineObjs.Find(c => c.gameObject.transform.localPosition.x == this.transform.localPosition.x && c != this) != null)
{
transform.localPosition = new Vector3(lastPosX, transform.localPosition.y);
}
else
{
volumeChange.beat = transform.localPosition.x;
}
moving = false;
lastPosX = transform.localPosition.x;
}
UpdateVolume();
}
}
private void UpdateVolume()
{
volumeTXT.text = $"{volumeChange.volume}%";
Timeline.instance.FitToSong();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 86bb8f2f290876a4387f1ea6fedf332b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: