Skip to content
This repository was archived by the owner on Sep 30, 2019. It is now read-only.

Commit c7d1453

Browse files
committed
Increased max playback speed to 500%. Cleaned up some code.
1 parent c209a32 commit c7d1453

5 files changed

Lines changed: 35 additions & 25 deletions

File tree

PracticePlugin/LooperUI.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ public void Init(SongSeeker songSeeker)
7373
_startCursor = startCursorImage.gameObject.AddComponent<LooperCursor>();
7474
_startCursor.BeginDragEvent += CursorOnBeginDragEvent;
7575
_startCursor.EndDragEvent += CursorOnEndDragEvent;
76-
Console.WriteLine("Set position to " + _prevStartTime);
7776
_startCursor.Position = Mathf.Lerp(0, SongSeeker.SeekBarSize.x, _prevStartTime);
7877

7978
var endCursorImage = new GameObject("End Cursor").AddComponent<Image>();
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace PracticePlugin
77
{
8-
public static class NoteHitPitchChanger
8+
public static class NoteCutSoundReplacer
99
{
1010
private static CustomNoteCutSoundEffect _noteCutSoundEffect;
1111

PracticePlugin/Plugin.cs

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ public string Version
2121
get { return "v3.0"; }
2222
}
2323

24-
public const float MaxSize = 5f;
24+
public const float MaxSize = 5.05f;
2525
public const float StepSize = 0.05f;
2626

27-
public static GameObject SettingsObject;
27+
public static GameObject SettingsObject { get; private set; }
2828

2929
public static float TimeScale
3030
{
3131
get { return _timeScale; }
32-
set
32+
private set
3333
{
3434
_timeScale = value;
3535
if (!IsEqualToOne(_timeScale))
@@ -92,23 +92,31 @@ private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
9292
{
9393
var resultsViewController =
9494
Resources.FindObjectsOfTypeAll<ResultsViewController>().FirstOrDefault();
95-
resultsViewController.continueButtonPressedEvent += ResultsViewControllerOnContinueButtonPressedEvent;
95+
if (resultsViewController != null)
96+
resultsViewController.continueButtonPressedEvent +=
97+
ResultsViewControllerOnContinueButtonPressedEvent;
9698
}
99+
100+
if (SettingsObject != null) return;
97101

98-
if (SettingsObject == null)
99-
{
100-
var volumeSettings = Resources.FindObjectsOfTypeAll<VolumeSettingsController>().FirstOrDefault();
101-
volumeSettings.gameObject.SetActive(false);
102-
SettingsObject = Object.Instantiate(volumeSettings.gameObject);
103-
SettingsObject.SetActive(false);
104-
volumeSettings.gameObject.SetActive(true);
105-
var volume = SettingsObject.GetComponent<VolumeSettingsController>();
106-
ReflectionUtil.CopyComponent(volume, typeof(IncDecSettingsController),
107-
typeof(SpeedSettingsController), SettingsObject);
108-
Object.DestroyImmediate(volume);
109-
SettingsObject.GetComponentInChildren<TMP_Text>().text = "SPEED";
110-
Object.DontDestroyOnLoad(SettingsObject);
111-
}
102+
var volumeSettings = Resources.FindObjectsOfTypeAll<VolumeSettingsController>().FirstOrDefault();
103+
104+
if (volumeSettings == null) return;
105+
106+
volumeSettings.gameObject.SetActive(false);
107+
SettingsObject = Object.Instantiate(volumeSettings.gameObject);
108+
SettingsObject.SetActive(false);
109+
volumeSettings.gameObject.SetActive(true);
110+
111+
if (SettingsObject == null) return;
112+
113+
var volume = SettingsObject.GetComponent<VolumeSettingsController>();
114+
ReflectionUtil.CopyComponent(volume, typeof(IncDecSettingsController),
115+
typeof(SpeedSettingsController), SettingsObject);
116+
Object.DestroyImmediate(volume);
117+
118+
SettingsObject.GetComponentInChildren<TMP_Text>().text = "SPEED";
119+
Object.DontDestroyOnLoad(SettingsObject);
112120
}
113121
else
114122
{
@@ -153,11 +161,14 @@ private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
153161
TimeScale = Mathf.Clamp(TimeScale, 1, MaxSize);
154162
}
155163

156-
NoteHitPitchChanger.ReplacePrefab();
164+
NoteCutSoundReplacer.ReplacePrefab();
157165

158166
var canvas = Resources.FindObjectsOfTypeAll<HorizontalLayoutGroup>()
159167
.FirstOrDefault(x => x.name == "Buttons")
160-
.transform.parent;
168+
?.transform.parent;
169+
170+
if (canvas == null) return;
171+
161172
_uiElementsCreator = canvas.gameObject.AddComponent<UIElementsCreator>();
162173
_uiElementsCreator.ValueChangedEvent += UIElementsCreatorOnValueChangedEvent;
163174
_uiElementsCreator.Init();

PracticePlugin/PracticePlugin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
<Compile Include="LooperCursor.cs" />
7272
<Compile Include="LooperUI.cs" />
7373
<Compile Include="NoFailGameEnergy.cs" />
74-
<Compile Include="NoteHitPitchChanger.cs" />
74+
<Compile Include="NoteCutSoundReplacer.cs" />
7575
<Compile Include="Plugin.cs" />
7676
<Compile Include="Properties\AssemblyInfo.cs" />
7777
<Compile Include="ReflectionUtil.cs" />

PracticePlugin/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("2.1")]
35-
[assembly: AssemblyFileVersion("2.1")]
34+
[assembly: AssemblyVersion("3.0")]
35+
[assembly: AssemblyFileVersion("3.0")]

0 commit comments

Comments
 (0)