Skip to content

Commit

Permalink
I kinda give up on the whole commit naming thing. Anyway fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
0thElement committed Aug 15, 2024
1 parent 1d266ed commit c893ce5
Show file tree
Hide file tree
Showing 17 changed files with 719 additions and 185 deletions.
702 changes: 586 additions & 116 deletions Assets/Fonts/NotoSans-Regular SDF.asset

Large diffs are not rendered by default.

72 changes: 63 additions & 9 deletions Assets/Fonts/NotoSansJP-Regular SDF.asset

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Assets/Materials/Compose/Waveform.mat
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Material:
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _ToSample: 24155812
- _ToSample: 18531754
- _UVSec: 0
- _ZWrite: 1
m_Colors:
Expand Down
2 changes: 1 addition & 1 deletion Assets/Materials/Gameplay/PracticeeWaveform.mat
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Material:
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AudioLength: 11514805
- _AudioLength: 18909312
- _BumpScale: 1
- _CurrentTimingSample: 0
- _Cutoff: 0.5
Expand Down
6 changes: 3 additions & 3 deletions Assets/Scenes/Gameplay.unity
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 1
m_AdditionalShaderChannelsFlag: 25
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
Expand Down Expand Up @@ -3137,7 +3137,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 1
m_AdditionalShaderChannelsFlag: 25
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
Expand Down Expand Up @@ -7695,7 +7695,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 1
m_AdditionalShaderChannelsFlag: 25
m_SortingLayerID: 242594563
m_SortingOrder: 10
m_TargetDisplay: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ private void Analyze(string chart, string path)
{
if (ev is RawHold h)
{
if (rawTimingGroups[h.TimingGroup].NoInput)
{
continue;
}

if (h.EndTiming - h.Timing <= 1000 / 60f && !rawTimingGroups[ev.TimingGroup].NoInput)
{
faultQueue.Enqueue(new ChartFault
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/Data/ChartSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public ChartSettings Clone()
Difficulty = Difficulty,
ChartConstant = ChartConstant,
DifficultyColor = DifficultyColor,
Skin = Skin,
Colors = Colors,
Skin = Skin?.Clone(),
Colors = Colors?.Clone(),
LastWorkingTiming = LastWorkingTiming,
ChartPath = ChartPath,
AudioPath = AudioPath,
Expand Down
12 changes: 12 additions & 0 deletions Assets/Scripts/Data/ColorSettings.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;

namespace ArcCreate.Data
Expand All @@ -11,5 +12,16 @@ public class ColorSettings
public List<string> Arc { get; set; } = new List<string>();

public List<string> ArcLow { get; set; } = new List<string>();

public ColorSettings Clone()
{
return new ColorSettings
{
Trace = Trace,
Shadow = Shadow,
Arc = new List<string>(Arc),
ArcLow = new List<string>(ArcLow),
};
}
}
}
15 changes: 15 additions & 0 deletions Assets/Scripts/Data/SkinSettings.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;

namespace ArcCreate.Data
{
public class SkinSettings
Expand All @@ -13,5 +15,18 @@ public class SkinSettings
public string Accent { get; set; } = null;

public string SingleLine { get; set; } = null;

public SkinSettings Clone()
{
return new SkinSettings
{
Side = Side,
Note = Note,
Particle = Particle,
Track = Track,
Accent = Accent,
SingleLine = SingleLine,
};
}
}
}
23 changes: 18 additions & 5 deletions Assets/Scripts/Gameplay/Audio/AudioService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public int AudioTiming
}
else if (videoPlayer.enabled)
{
videoPlayer.time = Mathf.Clamp(value / 1000f, 0, (float)videoPlayer.length);
videoPlayer.time = Mathf.Clamp((value - GlobalOffset) / 1000f, 0, (float)videoPlayer.length);
videoPlayer.Play();
videoPlayer.Pause();
}
Expand Down Expand Up @@ -141,6 +141,8 @@ public AudioClip AudioClip

private int FullOffset => Values.ChartAudioOffset + Mathf.RoundToInt(Settings.GlobalAudioOffset.Value * playbackSpeed);

private int GlobalOffset => Mathf.RoundToInt(Settings.GlobalAudioOffset.Value * playbackSpeed);

public void SetAudioTimingSilent(int timing)
{
audioTiming = timing;
Expand Down Expand Up @@ -310,6 +312,11 @@ public async UniTask PrepareVideoPlayback()
private void Play(int timing = 0, int delay = 0, bool resetJudge = true)
{
delay = Mathf.Max(delay, 0);
if (videoPlayer.enabled)
{
delay = Mathf.Max(delay, 500);
}

if (timing >= AudioLength - 1)
{
timing = 0;
Expand Down Expand Up @@ -349,7 +356,7 @@ private void Play(int timing = 0, int delay = 0, bool resetJudge = true)

if (videoPlayer.enabled)
{
StartDelayedVideoPlayback(timing, delay).Forget();
StartDelayedVideoPlayback(timing - GlobalOffset, delay).Forget();
}

SetEnableAutorotation(false);
Expand All @@ -358,11 +365,17 @@ private void Play(int timing = 0, int delay = 0, bool resetJudge = true)

private async UniTask StartDelayedVideoPlayback(int timing, int delay)
{
DateTime startTime = DateTime.Now;
videoPlayer.Pause();
if (timing < 0)
{
delay += -timing;
timing = 0;
}

videoPlayer.time = Mathf.Clamp(timing / 1000f, 0, (float)videoPlayer.length);
videoPlayer.Prepare();
await UniTask.WhenAll(UniTask.Delay(delay), UniTask.WaitUntil(() => videoPlayer.isPrepared));
await UniTask.Delay(delay);
videoPlayer.Play();
videoPlayer.time = Mathf.Clamp(((timing - delay) / 1000f) + (DateTime.Now - startTime).Seconds, 0, (float)videoPlayer.length);
}

private void Awake()
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Gameplay/Data/Events/Arc.Rendering.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public void UpdateRender(int currentTiming, double currentFloorPosition, GroupPr
alpha = Values.FlashArcAlphaScalar;
}

if (currentTiming <= EndTiming)
if (currentTiming >= Timing && currentTiming <= EndTiming)
{
Services.Camera.AddTiltToCamera(WorldXAt(currentTiming));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using ArcCreate.Utility.Extension;
using EmmySharp;
using MoonSharp.Interpreter;

Expand All @@ -21,10 +20,6 @@ public KeyChannel()
keys = keySearch.List;
}

public bool IntroExtrapolation { get; set; } = false;

public bool OuttroExtrapolation { get; set; } = false;

public int KeyCount => keys.Count;

[EmmyDoc("Sets the default easing to assign to keyframe for any subsequent keys added to this channel that does not have any easing defined")]
Expand Down Expand Up @@ -57,20 +52,6 @@ public KeyChannel SetDefaultEasing(
return this;
}

[EmmyDoc("Sets whether or not to extrapolate value for timing values before the first key")]
public KeyChannel SetIntroExtrapolation(bool extrapolation)
{
IntroExtrapolation = extrapolation;
return this;
}

[EmmyDoc("Sets whether or not to extrapolate value for timing values after the last key")]
public KeyChannel SetOuttroExtrapolation(bool extrapolation)
{
OuttroExtrapolation = extrapolation;
return this;
}

public override float ValueAt(int timing)
{
if (keys.Count == 0)
Expand All @@ -86,28 +67,12 @@ public override float ValueAt(int timing)
// Extrapolate
if (timing <= keys[0].Timing)
{
if (IntroExtrapolation)
{
float extrapolatedP = (float)(timing - keys[0].Timing) / (keys[1].Timing - keys[0].Timing);
return keys[0].Easing(keys[0].Value, keys[1].Value, extrapolatedP);
}
else
{
return keys[0].Value;
}
return keys[0].Value;
}

if (timing >= keys[keys.Count - 1].Timing)
{
if (OuttroExtrapolation)
{
float extrapolatedP = (float)(timing - keys[keys.Count - 2].Timing) / (keys[keys.Count - 1].Timing - keys[keys.Count - 2].Timing);
return keys[keys.Count - 2].Easing(keys[keys.Count - 2].Value, keys[keys.Count - 1].Value, extrapolatedP);
}
else
{
return keys[keys.Count - 1].Value;
}
return keys[keys.Count - 1].Value;
}

int index = keySearch.Search(timing);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public ScenecontrolVersioning(EnabledFeatures features)

public void DeserializeProperties(List<object> properties, EnabledFeatures features, ScenecontrolDeserialization deserialization)
{
features = (EnabledFeatures)(long)properties[0];
this.features = (EnabledFeatures)(long)properties[0];
}

public List<object> SerializeProperties(ScenecontrolSerialization serialization)
Expand Down
6 changes: 0 additions & 6 deletions Assets/Scripts/Storage/Loader/GameplayLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using ArcCreate.Utility.Extension;
using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.Networking;

namespace ArcCreate.Storage
{
Expand Down Expand Up @@ -86,11 +85,6 @@ private void LoadChart(LevelStorage level, ChartSettings chart)

private void LoadMetadata(LevelStorage level, ChartSettings chart)
{
gameplayData.BaseBpm.Value = chart.BaseBpm;
gameplayData.Title.Value = chart.Title;
gameplayData.Composer.Value = chart.Composer;
gameplayData.DifficultyName.Value = chart.Difficulty;

gameplayControl.Skin.AlignmentSkin = chart.Skin?.Side ?? string.Empty;
gameplayControl.Skin.AccentSkin = chart.Skin?.Accent ?? string.Empty;
gameplayControl.Skin.NoteSkin = chart.Skin?.Note ?? string.Empty;
Expand Down
8 changes: 8 additions & 0 deletions Assets/Scripts/Storage/StorageData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,14 @@ public void SwitchToPlayScene((LevelStorage level, ChartSettings chart) selectio
SceneTransitionManager.Instance.SetTransition(sequence);
IGameplayControl gameplay = null;
OnSwitchToGameplayScene?.Invoke();

// Set the values first to avoid some scencontrol object only reading these values
// once on awake.
// Hacky but I'm too tired.
gameplayData.BaseBpm.Value = chart.BaseBpm;
gameplayData.Title.Value = chart.Title;
gameplayData.Composer.Value = chart.Composer;
gameplayData.DifficultyName.Value = chart.Difficulty;
SceneTransitionManager.Instance.SwitchScene(
SceneNames.GameplayScene,
async (rep) =>
Expand Down
2 changes: 1 addition & 1 deletion Assets/Shaders/Scenecontrol/PatternOverlaySC.shader
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Shader "Sprites/PatternOverlaySC"
Cull Off
Lighting Off
ZWrite Off
ZTest Off
ZTest Always
Blend SrcAlpha OneMinusSrcAlpha

Pass
Expand Down
2 changes: 0 additions & 2 deletions Assets/Tests/Scenecontrol/KeyChannelTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ public void KeyChannel_MultipleKeysOverlap()
public void KeyChannel_Extrapolate()
{
KeyChannel channel = new KeyChannel()
.SetIntroExtrapolation(true)
.SetOuttroExtrapolation(true)
.AddKey(0, 0)
.AddKey(1, 1);

Expand Down

0 comments on commit c893ce5

Please sign in to comment.