From 0e244bc16bdb2e7d90cc11ef39f09448157a6d10 Mon Sep 17 00:00:00 2001 From: akanyan Date: Mon, 22 Jul 2024 22:03:11 +0900 Subject: [PATCH] chore: formatting --- AttractVideoPlayer/AttractVideoPlayer.csproj | 8 +--- .../patch_OperationManager.cs | 34 +++++------------ .../MU3.Sequence/patch_Advertise.cs | 18 +++------ AttractVideoPlayer/MU3/patch_AdvManager.cs | 38 ++++++------------- 4 files changed, 27 insertions(+), 71 deletions(-) diff --git a/AttractVideoPlayer/AttractVideoPlayer.csproj b/AttractVideoPlayer/AttractVideoPlayer.csproj index 579a70e..8343204 100644 --- a/AttractVideoPlayer/AttractVideoPlayer.csproj +++ b/AttractVideoPlayer/AttractVideoPlayer.csproj @@ -1,13 +1,7 @@ - + Assembly-CSharp.AttractVideoPlayer.mm Control attract video - - - - - 2.0 - {6889330F-2E7E-4778-ADFF-70AF036F1BD5} \ No newline at end of file diff --git a/AttractVideoPlayer/MU3.OperationManager/patch_OperationManager.cs b/AttractVideoPlayer/MU3.OperationManager/patch_OperationManager.cs index 4864ed1..4c1a075 100644 --- a/AttractVideoPlayer/MU3.OperationManager/patch_OperationManager.cs +++ b/AttractVideoPlayer/MU3.OperationManager/patch_OperationManager.cs @@ -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 _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()); } } \ No newline at end of file diff --git a/AttractVideoPlayer/MU3.Sequence/patch_Advertise.cs b/AttractVideoPlayer/MU3.Sequence/patch_Advertise.cs index cdac034..e01e722 100644 --- a/AttractVideoPlayer/MU3.Sequence/patch_Advertise.cs +++ b/AttractVideoPlayer/MU3.Sequence/patch_Advertise.cs @@ -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.instance.aimeReader.advCheck()) - { +class patch_Advertise: Advertise { + private bool checkButtonOrAime() { + if(SingletonStateMachine.instance.aimeReader.advCheck()) { Singleton.instance.loginType = OperationManager.LoginType.Aime; return true; } UIInput instance = Singleton.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.instance.loginType = OperationManager.LoginType.Button; return true; } diff --git a/AttractVideoPlayer/MU3/patch_AdvManager.cs b/AttractVideoPlayer/MU3/patch_AdvManager.cs index c2a5fe6..0f30463 100644 --- a/AttractVideoPlayer/MU3/patch_AdvManager.cs +++ b/AttractVideoPlayer/MU3/patch_AdvManager.cs @@ -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.instance.getStateOn(UIInput.Key.Service)) - { + public new bool exec() { + if(Time.time - lastButtonPressedTime > DelayBetweenButtonPress) { + if(Singleton.instance.getStateOn(UIInput.Key.Service)) { lastButtonPressedTime = Time.time; movieController?.player.Pause(!movieController.player.IsPaused()); - } - else if (Singleton.instance.getStateOn(UIInput.Key.L2)) - { + } else if(Singleton.instance.getStateOn(UIInput.Key.L2)) { lastButtonPressedTime = Time.time; addOffsetToCurrentSongIndexAndPlayMovie(-1); - } - else if (Singleton.instance.getStateOn(UIInput.Key.L3)) - { + } else if(Singleton.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);