Skip to content

Commit 37ccdd2

Browse files
author
sepffuzzball
committed
Updated Assembly / Plugin version to v1.3
Removed some unused vars Moved _timeSinceSceneStarted inside OnUpdate to fix not transitioning to menu properly Added ToString override for currentCameraData Changed default TransitionTime to 2s when writing a fresh config Updated song-specific filename check to ignore everything before the songhash
1 parent 47bf9db commit 37ccdd2

File tree

4 files changed

+34
-25
lines changed

4 files changed

+34
-25
lines changed

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@
2525
// You can specify all the values or you can default the Build and Revision Numbers
2626
// by using the '*' as shown below:
2727
// [assembly: AssemblyVersion("1.0.*")]
28-
[assembly: AssemblyVersion("1.2.0.0")]
29-
[assembly: AssemblyFileVersion("1.2.0.0")]
28+
[assembly: AssemblyVersion("1.3.0.0")]
29+
[assembly: AssemblyFileVersion("1.3.0.0")]

Src/Camera/CameraData.cs

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ Vector3 EvaluateBinding(PluginCameraHelper helper, string binding)
6161
default: return Vector3.zero;
6262
}
6363
}
64+
65+
public override string ToString()
66+
{
67+
return "Camera: " + this.Name + ", Type: " + this.Type.ToString() + ", PositionBinding: " + this.PositionBinding + ", PositionOffset: "
68+
+ this.PositionOffset.ToString() + ", LookAt: " + this.LookAt.ToString() + ", MinTime: " + this.MinTime.ToString() + ", MaxTime: "
69+
+ this.MaxTime.ToString() + ", TransitionTime: " + this.TransitionTime.ToString() + ", TransitionCurve: " + this.TransitionCurve.ToString();
70+
}
6471
}
6572

6673
public static class CameraPluginSettings
@@ -95,7 +102,7 @@ public static void LoadSettings()
95102
ws.WriteLine(" PositionBinding='playerWaist'");
96103
ws.WriteLine(" PositionOffset={x='2.0', y='1.0', z='-3.0'} ");
97104
ws.WriteLine(" LookAt={x='-2.0', y='0.0', z='5.0'} ");
98-
ws.WriteLine(" TransitionTime='1.0'");
105+
ws.WriteLine(" TransitionTime='2.0'");
99106
ws.WriteLine("}");
100107
ws.WriteLine("Camera={");
101108
ws.WriteLine(" Name='TopRight'");
@@ -105,7 +112,7 @@ public static void LoadSettings()
105112
ws.WriteLine(" LookAt={x='0.0', y='-0.5', z='1.0'} ");
106113
ws.WriteLine(" MinTime='4.0' ");
107114
ws.WriteLine(" MaxTime='8.0' ");
108-
ws.WriteLine(" TransitionTime='1.0'");
115+
ws.WriteLine(" TransitionTime='2.0'");
109116
ws.WriteLine("}");
110117
ws.WriteLine("Camera={");
111118
ws.WriteLine(" Name='Top'");
@@ -115,7 +122,7 @@ public static void LoadSettings()
115122
ws.WriteLine(" LookAt={x='0.0', y='-0.5', z='1.0'} ");
116123
ws.WriteLine(" MinTime='4.0' ");
117124
ws.WriteLine(" MaxTime='8.0' ");
118-
ws.WriteLine(" TransitionTime='1.0'");
125+
ws.WriteLine(" TransitionTime='2.0'");
119126
ws.WriteLine("}");
120127
ws.WriteLine("Camera={");
121128
ws.WriteLine(" Name='TopLeft'");
@@ -125,7 +132,7 @@ public static void LoadSettings()
125132
ws.WriteLine(" LookAt={x='0.0', y='-0.5', z='1.0'} ");
126133
ws.WriteLine(" MinTime='4.0' ");
127134
ws.WriteLine(" MaxTime='8.0' ");
128-
ws.WriteLine(" TransitionTime='1.0'");
135+
ws.WriteLine(" TransitionTime='2.0'");
129136
ws.WriteLine("}");
130137
ws.WriteLine("Camera={");
131138
ws.WriteLine(" Name='BottomRight'");
@@ -135,7 +142,7 @@ public static void LoadSettings()
135142
ws.WriteLine(" LookAt={x='0.0', y='0.0', z='1.0'} ");
136143
ws.WriteLine(" MinTime='4.0' ");
137144
ws.WriteLine(" MaxTime='8.0' ");
138-
ws.WriteLine(" TransitionTime='1.0'");
145+
ws.WriteLine(" TransitionTime='2.0'");
139146
ws.WriteLine("}");
140147
ws.WriteLine("Camera={");
141148
ws.WriteLine(" Name='BottomLeft'");
@@ -145,7 +152,7 @@ public static void LoadSettings()
145152
ws.WriteLine(" LookAt={x='0.0', y='0.0', z='1.0'} ");
146153
ws.WriteLine(" MinTime='4.0' ");
147154
ws.WriteLine(" MaxTime='8.0' ");
148-
ws.WriteLine(" TransitionTime='1.0'");
155+
ws.WriteLine(" TransitionTime='2.0'");
149156
ws.WriteLine("}");
150157
ws.WriteLine("Camera={");
151158
ws.WriteLine(" Name='Orbital1'");
@@ -158,8 +165,8 @@ public static void LoadSettings()
158165
ws.WriteLine(" LookAt={x='0.0', y='0.0', z='0.0'} ");
159166
ws.WriteLine(" MinTime='8.0' ");
160167
ws.WriteLine(" MaxTime='8.0' ");
161-
ws.WriteLine(" TransitionTime='1.0'");
162-
ws.WriteLine(" ReleaseBehindPlayer='true'");
168+
ws.WriteLine(" TransitionTime='2.0'");
169+
ws.WriteLine(" ReleaseBehindPlayer='true'");
163170
ws.WriteLine("}");
164171
ws.WriteLine("Camera={");
165172
ws.WriteLine(" Name='Orbital2'");
@@ -172,8 +179,8 @@ public static void LoadSettings()
172179
ws.WriteLine(" LookAt={x='0.0', y='0.0', z='0.0'} ");
173180
ws.WriteLine(" MinTime='8.0' ");
174181
ws.WriteLine(" MaxTime='8.0' ");
175-
ws.WriteLine(" TransitionTime='1.0'");
176-
ws.WriteLine(" ReleaseBehindPlayer='true'");
182+
ws.WriteLine(" TransitionTime='2.0'");
183+
ws.WriteLine(" ReleaseBehindPlayer='true'");
177184
ws.WriteLine("}");
178185
ws.WriteLine("Camera={");
179186
ws.WriteLine(" Name='Orbital3'");
@@ -186,8 +193,8 @@ public static void LoadSettings()
186193
ws.WriteLine(" LookAt={x='0.0', y='0.0', z='0.0'} ");
187194
ws.WriteLine(" MinTime='8.0' ");
188195
ws.WriteLine(" MaxTime='8.0' ");
189-
ws.WriteLine(" TransitionTime='1.0'");
190-
ws.WriteLine(" ReleaseBehindPlayer='true'");
196+
ws.WriteLine(" TransitionTime='2.0'");
197+
ws.WriteLine(" ReleaseBehindPlayer='true'");
191198
ws.WriteLine("}");
192199
}
193200
}
@@ -201,20 +208,20 @@ public static void LoadSettings()
201208
/// <summary>
202209
/// Loads a Specfic Settings File
203210
/// </summary>
204-
/// <param name="settingsFile">Designed for song-specific settings</param>
211+
/// <param name="settingsFile">Designed for song-specific settings - only checks the latter portion of the filename</param>
205212
public static void LoadSettings(string settingsFile)
206213
{
207214
string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
208215
string settingLoc = Path.Combine(docPath, @"LIV\Plugins\CameraBehaviours\FriesBSCam\");
209216

210-
settingLoc = Path.Combine(settingLoc, settingsFile);
217+
string[] files = Directory.GetFiles(settingLoc, "*" + settingsFile, SearchOption.TopDirectoryOnly);
211218

212219
// Check to see if the file exists.
213-
if (File.Exists(@settingLoc))
220+
if (files.Length > 0)
214221
{
215222
MenuCamera = new CameraData();
216223
CameraDataList = new List<CameraData>();
217-
ParseSettingsFile(@settingLoc);
224+
ParseSettingsFile(files[0]);
218225
SongSpecific = true;
219226
}
220227
}
@@ -252,6 +259,8 @@ public static void ParseSettingsFile(string fileName)
252259
MenuCamera.PositionBinding = "playerWaist";
253260
MenuCamera.PositionOffset = new Vector3(2.0f, 1.0f, -3.0f);
254261
MenuCamera.LookAt = new Vector3(-2.0f, 0.0f, 5.0f);
262+
MenuCamera.TransitionTime = 2.0f;
263+
MenuCamera.TransitionCurve = CameraTransitionCurve.Linear;
255264
}
256265

257266
var camera = root.GetChild("Camera");

Src/Camera/CameraTransition.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ override public string ToString()
5454
{
5555
return
5656
"--- Camera Transition--- " + "\n\n" +
57-
"Origional Position: " + originPosition.ToString() + "\n" +
58-
"Origional Rotation: " + originRotation.ToString() + "\n" +
57+
"Original Position: " + originPosition.ToString() + "\n" +
58+
"Original Rotation: " + originRotation.ToString() + "\n" +
5959
"Target Position: " + targetPosition.ToString() + "\n" +
6060
"Target Rotation: " + targetRotation.ToString() + "\n" +
6161
"transitionDuration: " + transitionDuration.ToString() + "\n" +

Src/MyCameraPlugin.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public class MyCameraPlugin : IPluginCameraBehaviour
5151
float _elapsedTime = 0.0f;
5252
float _timeSinceSceneStarted = 0.0f;
5353
float nextChangeTimer = 0.0f;
54-
float transitionTime = 0.0f;
5554
bool useHttpStatus = false;
5655
bool inMenu = false;
5756
bool inGame = false;
@@ -207,7 +206,7 @@ public void UpdateCameraChange()
207206

208207
// We need to check to see if there is a song-specific settings file, and if so, load that instead
209208
Log("Checking to see if there are song-specific Settings");
210-
CameraPluginSettings.LoadSettings("settings." + beatSaberStatus.songHash + ".txt");
209+
CameraPluginSettings.LoadSettings(beatSaberStatus.songHash + ".txt");
211210

212211
if (CameraPluginSettings.SongSpecific)
213212
{
@@ -269,17 +268,18 @@ public void OnUpdate()
269268
if (beatSaberStatus.score > 0 && !beatSaberStatus.paused)
270269
{
271270
_elapsedTime += Time.deltaTime;
272-
_timeSinceSceneStarted += Time.deltaTime;
273271
}
274272
}
275273
}
276274
else
277275
{
278276
// No HTTPStatus available so always increment the timer
279277
_elapsedTime += Time.deltaTime;
280-
_timeSinceSceneStarted += Time.deltaTime;
281278
}
282279

280+
// Moving _timeSinceSceneStarted out here to always update, as opposed to only updating when either inGame or when HTTPStatus isn't used
281+
// As otherwise it seems to break transitioning into the menu
282+
_timeSinceSceneStarted += Time.deltaTime;
283283
UpdateCameraPose();
284284
}
285285

@@ -385,6 +385,7 @@ private void transitionToNextCamera(bool transitionToMenu)
385385
currentCameraIndex = -1;
386386
currentCameraData = CameraPluginSettings.MenuCamera;
387387
currentCameraType = currentCameraData.Type;
388+
Log(currentCameraData.ToString());
388389
}
389390
else
390391
{
@@ -443,7 +444,6 @@ private void transitionToNextCamera(bool transitionToMenu)
443444
if (CameraPluginSettings.SongSpecific)
444445
{
445446
nextChangeTimer = _elapsedTime + currentCameraData.ActualTime;
446-
transitionTime = currentCameraData.TransitionTime;
447447
}
448448
else
449449
{

0 commit comments

Comments
 (0)