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.
This commit is contained in:
155
SVSim.BattleEngine/Engine/Cute/MoviePlayer.cs
Normal file
155
SVSim.BattleEngine/Engine/Cute/MoviePlayer.cs
Normal file
@@ -0,0 +1,155 @@
|
||||
using System;
|
||||
using CriWare;
|
||||
using CriWare.CriMana;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class MoviePlayer : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private CriManaMovieMaterial _movieController;
|
||||
|
||||
[SerializeField]
|
||||
private Camera _camera;
|
||||
|
||||
public event Action CallbackReady;
|
||||
|
||||
public event Action CallbackStart;
|
||||
|
||||
public event Action CallbackEnd;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_movieController.player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (_movieController.player.status)
|
||||
{
|
||||
case Player.Status.Playing:
|
||||
if (this.CallbackStart != null)
|
||||
{
|
||||
this.CallbackStart();
|
||||
this.CallbackStart = null;
|
||||
}
|
||||
break;
|
||||
case Player.Status.PlayEnd:
|
||||
Stop();
|
||||
if (this.CallbackEnd != null)
|
||||
{
|
||||
this.CallbackEnd();
|
||||
this.CallbackEnd = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void Load(string filePath)
|
||||
{
|
||||
filePath = filePath.Replace("file:///", "");
|
||||
_movieController.maxFrameDrop = CriManaMovieMaterial.MaxFrameDrop.Ten;
|
||||
_movieController.player.Stop();
|
||||
_movieController.player.SetFile(null, filePath);
|
||||
_movieController.player.Prepare();
|
||||
if (this.CallbackReady != null)
|
||||
{
|
||||
this.CallbackReady();
|
||||
this.CallbackReady = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Play()
|
||||
{
|
||||
_camera.enabled = true;
|
||||
if (IsPaused())
|
||||
{
|
||||
_movieController.player.Pause(sw: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_movieController.player.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
QualitySettings.vSyncCount = 0;
|
||||
_camera.enabled = false;
|
||||
_movieController.player.Stop();
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
_movieController.player.Pause(!_movieController.player.IsPaused());
|
||||
}
|
||||
|
||||
public void SetVolume(float volume)
|
||||
{
|
||||
_movieController.player.SetVolume(volume);
|
||||
}
|
||||
|
||||
public int GetSeekPosition()
|
||||
{
|
||||
return (int)(_movieController.player.GetTime() / 1000);
|
||||
}
|
||||
|
||||
public int GetDuration()
|
||||
{
|
||||
int totalFrames = (int)_movieController.player.movieInfo.totalFrames;
|
||||
int num = (int)(_movieController.player.movieInfo.framerateN / 1000);
|
||||
if (num == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return totalFrames / num * 1000;
|
||||
}
|
||||
|
||||
public int GetCurrentSeekPercent()
|
||||
{
|
||||
return GetSeekPosition() / GetDuration() * 100;
|
||||
}
|
||||
|
||||
public void SeekTo(int seek)
|
||||
{
|
||||
int num = (int)(_movieController.player.movieInfo.framerateN / 1000);
|
||||
int seekPosition = seek * num / 1000;
|
||||
_movieController.player.Stop();
|
||||
_movieController.player.SetSeekPosition(seekPosition);
|
||||
_movieController.player.Start();
|
||||
}
|
||||
|
||||
public bool IsReady()
|
||||
{
|
||||
return _movieController.player.status == Player.Status.Ready;
|
||||
}
|
||||
|
||||
public bool IsPlaying()
|
||||
{
|
||||
if (_movieController.player.status == Player.Status.Playing)
|
||||
{
|
||||
return !IsPaused();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsPaused()
|
||||
{
|
||||
return _movieController.player.IsPaused();
|
||||
}
|
||||
|
||||
public bool IsStopped()
|
||||
{
|
||||
return _movieController.player.status == Player.Status.Stop;
|
||||
}
|
||||
|
||||
public bool IsFinished()
|
||||
{
|
||||
return _movieController.player.status == Player.Status.PlayEnd;
|
||||
}
|
||||
|
||||
public bool IsError()
|
||||
{
|
||||
return _movieController.player.status == Player.Status.Error;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user