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> <PropertyGroup>
<AssemblyName>Assembly-CSharp.AttractVideoPlayer.mm</AssemblyName> <AssemblyName>Assembly-CSharp.AttractVideoPlayer.mm</AssemblyName>
<Description>Control attract video</Description> <Description>Control attract video</Description>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>2.0</OldToolsVersion>
<ProjectGuid>{6889330F-2E7E-4778-ADFF-70AF036F1BD5}</ProjectGuid>
</PropertyGroup> </PropertyGroup>
<Import Project="..\Mu3Mods.csproj" /> <Import Project="..\Mu3Mods.csproj" />
</Project> </Project>

View File

@ -1,40 +1,27 @@
using MU3.Operation; using System.Collections.ObjectModel;
using MU3.SceneObject;
using MU3.Sequence;
using MU3.Util;
using System.Collections.ObjectModel;
using UnityEngine; using UnityEngine;
namespace MU3.Operation; namespace MU3.Operation;
class patch_OperationManager: OperationManager class patch_OperationManager: OperationManager {
{
private static readonly string CurrentSongIndexFilePath = "BepInEx/monomod/AttractVideoPlayer.currentSongIndex.txt"; private static readonly string CurrentSongIndexFilePath = "BepInEx/monomod/AttractVideoPlayer.currentSongIndex.txt";
private ReadOnlyCollection<MovieData> _movieDataList; private ReadOnlyCollection<MovieData> _movieDataList;
public new MovieData movieData public new MovieData movieData {
{ get {
get if(_movieDataList.Count > 0) {
{
if (_movieDataList.Count > 0)
{
int currentSongIndex = 0; int currentSongIndex = 0;
try try {
{
currentSongIndex = int.Parse(System.IO.File.ReadAllText(CurrentSongIndexFilePath)); currentSongIndex = int.Parse(System.IO.File.ReadAllText(CurrentSongIndexFilePath));
} } catch(System.Exception) {
catch (System.Exception)
{
saveCurrentSongIndex(0); saveCurrentSongIndex(0);
} }
if (currentSongIndex < 0) if(currentSongIndex < 0) {
{
currentSongIndex = _movieDataList.Count - 1; currentSongIndex = _movieDataList.Count - 1;
saveCurrentSongIndex(currentSongIndex); saveCurrentSongIndex(currentSongIndex);
} }
if (currentSongIndex >= _movieDataList.Count) if(currentSongIndex >= _movieDataList.Count) {
{
currentSongIndex = 0; currentSongIndex = 0;
saveCurrentSongIndex(currentSongIndex); 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()); 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.Operation;
using MU3.SceneObject;
using MU3.Sequence;
using MU3.Util; using MU3.Util;
using UnityEngine;
namespace MU3.Sequence; namespace MU3.Sequence;
class patch_Advertise : Advertise class patch_Advertise: Advertise {
{ private bool checkButtonOrAime() {
private bool checkButtonOrAime() if(SingletonStateMachine<AMManager, AMManager.EState>.instance.aimeReader.advCheck()) {
{
if (SingletonStateMachine<AMManager, AMManager.EState>.instance.aimeReader.advCheck())
{
Singleton<OperationManager>.instance.loginType = OperationManager.LoginType.Aime; Singleton<OperationManager>.instance.loginType = OperationManager.LoginType.Aime;
return true; return true;
} }
UIInput instance = Singleton<UIInput>.instance; 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; Singleton<OperationManager>.instance.loginType = OperationManager.LoginType.Button;
return true; return true;
} }

View File

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