Files
SVSimServer/SVSim.BattleEngine/Engine/Cute/MovieManager.cs
gamer147 957af3d1ec feat(battle-engine): full Unity/VFX/god-object shims + expanded copy closure (2570 files)
Authored Unity primitive/object-model shim, VFX layer (control-flow-preserving, InstantVfx never invokes its action -- headless suppression), god-object stubs (GameMgr/EffectMgr/UIManager with faithfully-extracted nested enums), View/UI/Touch tree, LitJson+BetterList+Tuple copied, third-party stubs. Discovered Roslyn header-error masking: fixing class-header type errors unmasks body references, so the true copy closure is ~2570 files (was 782 under masking). Errors: masked-25720 -> 268; our shim files compile clean. Remaining: ~50 residual shim/external types, 24 NGUI UI-base overrides, static-type fixes, plus likely 1-2 more unmask waves.
2026-06-05 17:22:20 -04:00

218 lines
3.5 KiB
C#

using System;
using System.Collections;
using UnityEngine;
using Wizard;
namespace Cute;
public class MovieManager : MonoBehaviour, IManager
{
private string fileRootPath;
private string streamingAssetfileRootPath;
private MoviePlayer _player;
private float _volume = 1f;
private MovieSubtitles _movieSubtitles;
private IEnumerator Start()
{
Toolbox.MovieManager = this;
while (!CustomPreference.isPreferenceComplete)
{
yield return null;
}
fileRootPath = "file:///" + Application.persistentDataPath + "/";
streamingAssetfileRootPath = "file:///" + Application.streamingAssetsPath + "/";
}
private void CreateMoviePlayer()
{
GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("Prefab/Movie/MoviePlayer")) as GameObject;
gameObject.transform.parent = base.transform;
_player = gameObject.GetComponent<MoviePlayer>();
_player.SetVolume(_volume);
}
public void Load(string filename)
{
if (!_player)
{
CreateMoviePlayer();
}
_player.Load(fileRootPath + filename);
}
public void Unload()
{
if ((bool)_player)
{
UnityEngine.Object.Destroy(_player.gameObject);
}
}
public void Play()
{
if (IsReady() || IsPaused() || IsStopped())
{
_player.Play();
}
}
public void PlayWithSubtitles(string subtitlesCSV)
{
GameObject prefab = (GameObject)Resources.Load("UI/MovieSubtitles");
_movieSubtitles = NGUITools.AddChild(UIManager.GetInstance().UIManagerRoot.gameObject, prefab).GetComponent<MovieSubtitles>();
SetCallbackStart(delegate
{
_movieSubtitles.PlaySubtitles(subtitlesCSV);
});
Play();
}
public void Stop()
{
if (_movieSubtitles != null)
{
_movieSubtitles.Finish();
_movieSubtitles = null;
}
if (IsPlaying() || IsPaused())
{
_player.Stop();
}
}
public void Pause()
{
if (IsPlaying())
{
_player.Pause();
}
}
public void SetVolume(float volume)
{
_volume = volume;
if ((bool)_player)
{
_player.SetVolume(volume);
}
}
public int GetSeekPosition()
{
if (!_player)
{
return 0;
}
return _player.GetSeekPosition();
}
public int GetDuration()
{
if (!_player)
{
return 0;
}
return _player.GetDuration();
}
public int GetCurrentSeekPercent()
{
if (!_player)
{
return 0;
}
return _player.GetCurrentSeekPercent();
}
public void SeekTo(int seek)
{
if ((bool)_player)
{
_player.SeekTo(seek);
}
}
public bool IsReady()
{
if (!_player)
{
return false;
}
return _player.IsReady();
}
public bool IsPlaying()
{
if (!_player)
{
return false;
}
return _player.IsPlaying();
}
public bool IsPaused()
{
if (!_player)
{
return false;
}
return _player.IsPaused();
}
public bool IsStopped()
{
if (!_player)
{
return false;
}
return _player.IsStopped();
}
public bool IsFinished()
{
if (!_player)
{
return false;
}
return _player.IsFinished();
}
public bool IsError()
{
if (!_player)
{
return true;
}
return _player.IsError();
}
public void SetCallbackReady(Action callback)
{
if ((bool)_player)
{
_player.CallbackReady += callback;
}
}
public void SetCallbackStart(Action callback)
{
if ((bool)_player)
{
_player.CallbackStart += callback;
}
}
public void SetCallbackEnd(Action callback)
{
if ((bool)_player)
{
_player.CallbackEnd += callback;
}
}
}