feat(battle-engine): M1 auto-copy closure (782 battle-logic files)
Compile-driven bulk-copy loop (tools/engine-port/m1_copy_loop.py) pulled the precise reference closure of the battle-core roots, stopping at the classify god-object/View-VFX-UI boundary. 782 files; no re-explosion (M0 had estimated ~order 1000). Residual frontier = 52 shim-classified + 80 external (Unity/BCL) types to author next.
This commit is contained in:
182
SVSim.BattleEngine/Engine/Voice.cs
Normal file
182
SVSim.BattleEngine/Engine/Voice.cs
Normal file
@@ -0,0 +1,182 @@
|
||||
using System.Collections.Generic;
|
||||
using CriWare;
|
||||
using Cute;
|
||||
using Wizard;
|
||||
|
||||
public class Voice
|
||||
{
|
||||
private CriAtomSource m_VoiceAudioSourceA;
|
||||
|
||||
private CriAtomSource m_VoiceAudioSourceB;
|
||||
|
||||
private const string CATEGORY_NAME = "VO";
|
||||
|
||||
private float m_volume;
|
||||
|
||||
private bool m_isMuted;
|
||||
|
||||
private int _currentVoiceSourceIndex;
|
||||
|
||||
private int _voiceSourceCount;
|
||||
|
||||
private const int VoiceA = 0;
|
||||
|
||||
private const int VoiceB = 1;
|
||||
|
||||
public Voice()
|
||||
{
|
||||
m_VoiceAudioSourceA = GameMgr.GetIns().GetGameObjMgr().GetGameObj()
|
||||
.AddComponent<CriAtomSource>();
|
||||
m_VoiceAudioSourceA.loop = false;
|
||||
m_VoiceAudioSourceA.playOnStart = false;
|
||||
m_VoiceAudioSourceA.use3dPositioning = false;
|
||||
m_VoiceAudioSourceA.player.AttachFader();
|
||||
m_VoiceAudioSourceA.player.SetFadeOutTime(50);
|
||||
m_VoiceAudioSourceB = GameMgr.GetIns().GetGameObjMgr().GetGameObj()
|
||||
.AddComponent<CriAtomSource>();
|
||||
m_VoiceAudioSourceB.loop = false;
|
||||
m_VoiceAudioSourceB.playOnStart = false;
|
||||
m_VoiceAudioSourceB.use3dPositioning = false;
|
||||
m_VoiceAudioSourceB.player.AttachFader();
|
||||
m_VoiceAudioSourceB.player.SetFadeOutTime(50);
|
||||
SetVolume(PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.VOICE_VOLUME));
|
||||
Mute(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SOUND_MUTE));
|
||||
_voiceSourceCount = Toolbox.AudioManager.GetVoiceSourceCount();
|
||||
}
|
||||
|
||||
public void SetVolume(float Prm)
|
||||
{
|
||||
CriAtomExCategory.SetVolume("VO", Prm);
|
||||
m_volume = Prm;
|
||||
}
|
||||
|
||||
public float GetVolume()
|
||||
{
|
||||
return m_volume;
|
||||
}
|
||||
|
||||
public void Mute(bool isMute)
|
||||
{
|
||||
CriAtomExCategory.Mute("VO", isMute);
|
||||
m_isMuted = isMute;
|
||||
}
|
||||
|
||||
public bool IsMuted()
|
||||
{
|
||||
return m_isMuted;
|
||||
}
|
||||
|
||||
public void Play(ClassCharaPrm.EmotionType emotiontype, int classid, List<string> pathList, string voiceId = "", bool isEvolved = false)
|
||||
{
|
||||
string cueName = "";
|
||||
string cueSheet = "";
|
||||
cueName = GetEmotionCueName(emotiontype, classid, isEvolved);
|
||||
cueSheet = GetEmotionCueSheet(emotiontype, classid);
|
||||
if (voiceId != string.Empty)
|
||||
{
|
||||
cueName = "vo_" + voiceId;
|
||||
cueSheet = "v/" + cueName + ".acb";
|
||||
}
|
||||
if (string.IsNullOrEmpty(cueName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (Toolbox.AudioManager.IsAvailableCueSheet(cueSheet) || pathList == null)
|
||||
{
|
||||
Toolbox.AudioManager.PlayVoice(0, cueName, cueSheet, cueName);
|
||||
return;
|
||||
}
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetAsync(cueSheet, delegate
|
||||
{
|
||||
pathList.Add(cueSheet);
|
||||
Toolbox.AudioManager.PlayVoice(0, cueName, cueSheet, cueName);
|
||||
}));
|
||||
}
|
||||
|
||||
public static string GetEmotionCueName(ClassCharaPrm.EmotionType emotiontype, int skinId, bool isEvolved = false)
|
||||
{
|
||||
return "vo_" + GameMgr.GetIns().GetDataMgr().GetEmotionDataBySkinId(skinId.ToString())[emotiontype].GetVoiceId(isEvolved);
|
||||
}
|
||||
|
||||
public static string GetEmotionCueSheet(ClassCharaPrm.EmotionType emotiontype, int skinId)
|
||||
{
|
||||
return "v/" + GetEmotionCueName(emotiontype, skinId) + ".acb";
|
||||
}
|
||||
|
||||
public void PlayScenario(string cuename, float fadeout)
|
||||
{
|
||||
AudioManager audioManager = Toolbox.AudioManager;
|
||||
audioManager.StopVoice(_currentVoiceSourceIndex, fadeout);
|
||||
_currentVoiceSourceIndex = (_currentVoiceSourceIndex + 1) % _voiceSourceCount;
|
||||
audioManager.PlayVoice(_currentVoiceSourceIndex, cuename);
|
||||
}
|
||||
|
||||
public void StopScenario(float fadeout)
|
||||
{
|
||||
Toolbox.AudioManager.StopVoice(_currentVoiceSourceIndex, fadeout);
|
||||
}
|
||||
|
||||
public void PlayByKey(string quenameid, bool forcePlay = false)
|
||||
{
|
||||
if (!forcePlay)
|
||||
{
|
||||
if (Toolbox.AudioManager.IsPlayVoice(0))
|
||||
{
|
||||
string text = "vo_" + quenameid;
|
||||
if (UIManager.GetInstance().GetCurrentScene() != UIManager.ViewScene.Battle)
|
||||
{
|
||||
Toolbox.AudioManager.StopVoice(0);
|
||||
}
|
||||
Toolbox.AudioManager.PlayVoice(1, text, m_VoiceAudioSourceB.cueSheet, text);
|
||||
}
|
||||
else
|
||||
{
|
||||
string text2 = "vo_" + quenameid;
|
||||
if (UIManager.GetInstance().GetCurrentScene() != UIManager.ViewScene.Battle)
|
||||
{
|
||||
Toolbox.AudioManager.StopVoice(1);
|
||||
}
|
||||
Toolbox.AudioManager.PlayVoice(0, text2, m_VoiceAudioSourceA.cueSheet, text2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Toolbox.AudioManager.StopVoice(0);
|
||||
Toolbox.AudioManager.StopVoice(1);
|
||||
string text3 = "vo_" + quenameid;
|
||||
Toolbox.AudioManager.PlayVoice(0, text3, m_VoiceAudioSourceA.cueSheet, text3);
|
||||
}
|
||||
}
|
||||
|
||||
public void StopVoice(float fadeout)
|
||||
{
|
||||
if (m_VoiceAudioSourceA.status == CriAtomSource.Status.Playing)
|
||||
{
|
||||
Toolbox.AudioManager.StopVoice(0, fadeout);
|
||||
}
|
||||
else
|
||||
{
|
||||
Toolbox.AudioManager.StopVoice(1, fadeout);
|
||||
}
|
||||
}
|
||||
|
||||
public void StopAll(float fadeout)
|
||||
{
|
||||
for (int i = 0; i < _voiceSourceCount; i++)
|
||||
{
|
||||
Toolbox.AudioManager.StopVoice(i, fadeout);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsPlaying()
|
||||
{
|
||||
for (int i = 0; i < _voiceSourceCount; i++)
|
||||
{
|
||||
if (Toolbox.AudioManager.IsPlayVoice(i))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user