chore: formatting

This commit is contained in:
あかニャン 2024-07-22 22:03:11 +09:00
parent 1023dee2b7
commit 0e244bc16b
4 changed files with 27 additions and 71 deletions

View File

@ -1,13 +1,7 @@
<Project ToolsVersion="Current">
<Project>
<PropertyGroup>
<AssemblyName>Assembly-CSharp.AttractVideoPlayer.mm</AssemblyName>
<Description>Control attract video</Description>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>2.0</OldToolsVersion>
<ProjectGuid>{6889330F-2E7E-4778-ADFF-70AF036F1BD5}</ProjectGuid>
</PropertyGroup>
<Import Project="..\Mu3Mods.csproj" />
</Project>

View File

@ -1,40 +1,27 @@
using MU3.Operation;
using MU3.SceneObject;
using MU3.Sequence;
using MU3.Util;
using System.Collections.ObjectModel;
using System.Collections.ObjectModel;
using UnityEngine;
namespace MU3.Operation;
class patch_OperationManager: OperationManager
{
class patch_OperationManager: OperationManager {
private static readonly string CurrentSongIndexFilePath = "BepInEx/monomod/AttractVideoPlayer.currentSongIndex.txt";
private ReadOnlyCollection<MovieData> _movieDataList;
public new MovieData movieData
{
get
{
if (_movieDataList.Count > 0)
{
public new MovieData movieData {
get {
if(_movieDataList.Count > 0) {
int currentSongIndex = 0;
try
{
try {
currentSongIndex = int.Parse(System.IO.File.ReadAllText(CurrentSongIndexFilePath));
}
catch (System.Exception)
{
} catch(System.Exception) {
saveCurrentSongIndex(0);
}
if (currentSongIndex < 0)
{
if(currentSongIndex < 0) {
currentSongIndex = _movieDataList.Count - 1;
saveCurrentSongIndex(currentSongIndex);
}
if (currentSongIndex >= _movieDataList.Count)
{
if(currentSongIndex >= _movieDataList.Count) {
currentSongIndex = 0;
saveCurrentSongIndex(currentSongIndex);
}
@ -47,8 +34,7 @@ class patch_OperationManager: OperationManager
}
}
private void saveCurrentSongIndex(int currentSongIndex)
{
private void saveCurrentSongIndex(int currentSongIndex) {
System.IO.File.WriteAllText(CurrentSongIndexFilePath, currentSongIndex.ToString());
}
}

View File

@ -1,25 +1,17 @@
using Mono.Cecil;
using MU3.AM;
using MU3.AM;
using MU3.Operation;
using MU3.SceneObject;
using MU3.Sequence;
using MU3.Util;
using UnityEngine;
namespace MU3.Sequence;
class patch_Advertise : Advertise
{
private bool checkButtonOrAime()
{
if (SingletonStateMachine<AMManager, AMManager.EState>.instance.aimeReader.advCheck())
{
class patch_Advertise: Advertise {
private bool checkButtonOrAime() {
if(SingletonStateMachine<AMManager, AMManager.EState>.instance.aimeReader.advCheck()) {
Singleton<OperationManager>.instance.loginType = OperationManager.LoginType.Aime;
return true;
}
UIInput instance = Singleton<UIInput>.instance;
if (instance.getTriggerOn(UIInput.Key.Decision) || instance.getTriggerOn(UIInput.Key.OptionBackward) || instance.getTriggerOn(UIInput.Key.OptionForward) || instance.getTriggerOn(UIInput.Key.SkipRight) || instance.getTriggerOn(UIInput.Key.MenuLeft) || instance.getTriggerOn(UIInput.Key.MenuRight))
{
if(instance.getTriggerOn(UIInput.Key.Decision) || instance.getTriggerOn(UIInput.Key.OptionBackward) || instance.getTriggerOn(UIInput.Key.OptionForward) || instance.getTriggerOn(UIInput.Key.SkipRight) || instance.getTriggerOn(UIInput.Key.MenuLeft) || instance.getTriggerOn(UIInput.Key.MenuRight)) {
Singleton<OperationManager>.instance.loginType = OperationManager.LoginType.Button;
return true;
}

View File

@ -1,14 +1,9 @@
using Mono.Cecil;
using MU3.Operation;
using MU3.SceneObject;
using MU3.Sequence;
using MU3.Util;
using MU3.Util;
using UnityEngine;
namespace MU3;
class patch_AdvManager : AdvManager
{
class patch_AdvManager: AdvManager {
private static readonly string CurrentSongIndexFilePath = "BepInEx/monomod/AttractVideoPlayer.currentSongIndex.txt";
private static readonly float DelayBetweenButtonPress = 0.5f;
private float lastButtonPressedTime = 0f;
@ -16,30 +11,22 @@ class patch_AdvManager : AdvManager
private GameObject objMovie;
private CriManaMovieMaterial movieController;
private extern bool orig_initMovie();
public new bool initMovie()
{
public new bool initMovie() {
return orig_initMovie();
}
private extern bool orig_exec();
public new bool exec()
{
if (Time.time - lastButtonPressedTime > DelayBetweenButtonPress)
{
if (Singleton<UIInput>.instance.getStateOn(UIInput.Key.Service))
{
public new bool exec() {
if(Time.time - lastButtonPressedTime > DelayBetweenButtonPress) {
if(Singleton<UIInput>.instance.getStateOn(UIInput.Key.Service)) {
lastButtonPressedTime = Time.time;
movieController?.player.Pause(!movieController.player.IsPaused());
}
else if (Singleton<UIInput>.instance.getStateOn(UIInput.Key.L2))
{
} else if(Singleton<UIInput>.instance.getStateOn(UIInput.Key.L2)) {
lastButtonPressedTime = Time.time;
addOffsetToCurrentSongIndexAndPlayMovie(-1);
}
else if (Singleton<UIInput>.instance.getStateOn(UIInput.Key.L3))
{
} else if(Singleton<UIInput>.instance.getStateOn(UIInput.Key.L3)) {
lastButtonPressedTime = Time.time;
addOffsetToCurrentSongIndexAndPlayMovie(1);
@ -48,14 +35,11 @@ class patch_AdvManager : AdvManager
return orig_exec();
}
public void addOffsetToCurrentSongIndexAndPlayMovie(int offset)
{
try
{
public void addOffsetToCurrentSongIndexAndPlayMovie(int offset) {
try {
int currentSongIndex = int.Parse(System.IO.File.ReadAllText(CurrentSongIndexFilePath)) + offset;
System.IO.File.WriteAllText(CurrentSongIndexFilePath, currentSongIndex.ToString());
}
catch (System.Exception) { }
} catch(System.Exception) { }
movieController?.Stop();
Utility.destroyGameObject(ref movieController);