123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- using UnityInjector;
- using UnityInjector.Attributes;
- namespace COM3D2.MeidoPhotoStudio.Plugin
- {
- [PluginName("Meido Photo Studio"), PluginVersion("0.0.0")]
- public class MeidoPhotoStudio : PluginBase
- {
- private static MonoBehaviour instance;
- private WindowManager windowManager;
- private MeidoManager meidoManager;
- private EnvironmentManager environmentManager;
- private Constants.Scene currentScene;
- private bool initialized = false;
- private bool isActive = false;
- private MeidoPhotoStudio()
- {
- MeidoPhotoStudio.instance = this;
- }
- private void Awake()
- {
- DontDestroyOnLoad(this);
- Translation.Initialize("en");
- Constants.Initialize();
- }
- private void Start()
- {
- SceneManager.sceneLoaded += OnSceneLoaded;
- }
- private void Update()
- {
- if (currentScene == Constants.Scene.Daily)
- {
- if (Input.GetKeyDown(KeyCode.F6))
- {
- if (!initialized)
- {
- Initialize();
- windowManager.Visible = true;
- }
- else
- {
- ReturnToMenu();
- }
- }
- if (isActive)
- {
- meidoManager.Update();
- windowManager.Update();
- }
- }
- }
- private void OnGUI()
- {
- if (isActive)
- {
- windowManager.OnGUI();
- }
- }
- private void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode)
- {
- currentScene = (Constants.Scene)scene.buildIndex;
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- private void ReturnToMenu()
- {
- if (meidoManager.IsBusy) return;
- meidoManager.DeactivateMeidos();
- isActive = false;
- initialized = false;
- windowManager.Visible = false;
- GameMain.Instance.SoundMgr.PlayBGM("bgm009.ogg", 1f, true);
- GameObject go = GameObject.Find("UI Root").transform.Find("DailyPanel").gameObject;
- go.SetActive(true);
- bool isNight = GameMain.Instance.CharacterMgr.status.GetFlag("時間帯") == 3;
- if (isNight)
- {
- GameMain.Instance.BgMgr.ChangeBg("ShinShitsumu_ChairRot_Night");
- }
- else
- {
- GameMain.Instance.BgMgr.ChangeBg("ShinShitsumu_ChairRot");
- }
- GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
- GameMain.Instance.MainCamera.SetTargetPos(new Vector3(0.5609447f, 1.380762f, -1.382336f), true);
- GameMain.Instance.MainCamera.SetDistance(1.6f, true);
- GameMain.Instance.MainCamera.SetAroundAngle(new Vector2(245.5691f, 6.273283f), true);
- }
- private void Initialize()
- {
- initialized = true;
- meidoManager = new MeidoManager();
- environmentManager = new EnvironmentManager();
- windowManager = new WindowManager(meidoManager, environmentManager);
- environmentManager.Initialize();
- isActive = true;
- #region maid stuff
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #endregion
- GameObject dailyPanel = GameObject.Find("UI Root").transform.Find("DailyPanel").gameObject;
- dailyPanel.SetActive(false);
- }
- }
- }
|