123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class BjVoiceMgr : MonoBehaviour
- {
- public static BjVoiceMgr Instance { get; private set; }
- private Maid m_TargetMaid
- {
- get
- {
- return GameMain.Instance.CharacterMgr.GetMaid(0);
- }
- }
- public bool isPlay
- {
- get
- {
- return this.m_TargetMaid.AudioMan.isPlay();
- }
- }
- private void Awake()
- {
- BjVoiceMgr.Instance = this;
- KasaiUtility.CsvReadY("bj_voice_data.nei", new Action<CsvParser, int>(this.ReadVoiceData), 1, null);
- }
- private void Start()
- {
- if (CasinoDataMgr.Instance.DealerMaid)
- {
- string label_name = string.Empty;
- if (GameMain.Instance.ScriptMgr.adv_kag.tag_backup.ContainsKey("voice_label"))
- {
- label_name = GameMain.Instance.ScriptMgr.adv_kag.tag_backup["voice_label"];
- }
- GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(label_name);
- }
- else
- {
- string file_name = ScriptManager.ReplacePersonal(this.m_TargetMaid, this.m_VoiceScript);
- GameMain.Instance.ScriptMgr.LoadAdvScenarioScript(file_name, string.Empty);
- }
- GameMain.Instance.ScriptMgr.adv_kag.Exec();
- }
- private void ReadVoiceData(CsvParser csv, int cy)
- {
- this.m_VoiceData.Add(csv.GetCellAsString(0, cy), csv.GetCellAsString(1, cy));
- }
- private IEnumerator VoiceWait(Action end_call)
- {
- yield return null;
- while (this.m_TargetMaid.AudioMan.isPlay())
- {
- yield return null;
- }
- if (end_call != null)
- {
- end_call();
- }
- yield break;
- }
- private void Recet()
- {
- this.m_TargetMaid.FaceBlend("無し");
- this.m_TargetMaid.FaceAnime("通常", 1f, 0);
- GameMain.Instance.ScriptMgr.adv_kag.ClearExecWait();
- }
- public void PlayScoreVoice(Action end_call = null, float fade_time = 0f)
- {
- if (Dealer.Instance.IsNatural21())
- {
- this.PlayVoice("ディーラーBJ", end_call, fade_time);
- }
- else if (Dealer.Instance.IsBust())
- {
- this.PlayVoice("ディーラーバースト", end_call, fade_time);
- }
- else
- {
- this.PlayVoice(Dealer.Instance.CurrentScore.ToString(), end_call, fade_time);
- }
- }
- public void PlayVoice(string voice_category, Action end_call = null, float fade_time = 0f)
- {
- if (!this.m_VoiceData.ContainsKey(voice_category))
- {
- return;
- }
- GameMain.Instance.ScriptMgr.adv_kag.ClearExecWait();
- GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_VoiceData[voice_category]);
- GameMain.Instance.ScriptMgr.adv_kag.Exec();
- if (end_call != null)
- {
- base.StartCoroutine(this.VoiceWait(end_call));
- }
- }
- public void VoiceToVoice(string first_voice, string second_voice, Action end_call, float first_fade = 0f, float second_fade = 0f)
- {
- this.PlayVoice(first_voice, delegate
- {
- this.PlayVoice(second_voice, end_call, second_fade);
- }, first_fade);
- }
- public void Stop()
- {
- this.Recet();
- base.StopAllCoroutines();
- if (this.m_TargetMaid && this.m_TargetMaid.AudioMan)
- {
- this.m_TargetMaid.AudioMan.Stop();
- }
- }
- public void VoiceEnd()
- {
- this.Recet();
- GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_EndLabel);
- GameMain.Instance.ScriptMgr.adv_kag.Exec();
- }
- private Dictionary<string, string> m_VoiceData = new Dictionary<string, string>();
- [SerializeField]
- [Header("ボイス再生用のスクリプトファイル")]
- private string m_VoiceScript = "?_casino_0001.ks";
- [SerializeField]
- [Header(" ボイス用スクリプトから抜けるときのラベル")]
- private string m_EndLabel = "*カジノうひょー";
- }
|