using System; using System.Collections.Generic; using UnityEngine; public class YotogiKagManager : BaseKagManager { public YotogiKagManager(TJSScript tjs, ScriptManager script_mgr) : base(tjs, script_mgr) { } public override void Initialize() { base.Initialize(); this.kag_.AddTagCallBack("talk", new KagScript.KagTagCallBack(this.TagTalk)); this.kag_.AddTagCallBack("talkaddft", new KagScript.KagTagCallBack(this.TagTalkAddFt)); this.kag_.AddTagCallBack("hitret", new KagScript.KagTagCallBack(this.TagHitRet)); this.kag_.AddTagCallBack("talkrepeat", new KagScript.KagTagCallBack(this.TagTalkRepeat)); this.kag_.AddTagCallBack("talkrepeatadd", new KagScript.KagTagCallBack(this.TagTalkRepeatAdd)); this.kag_.AddTagCallBack("talkrepeatclear", new KagScript.KagTagCallBack(this.TagTalkRepeatClear)); this.kag_.AddTagCallBack("voicewait", new KagScript.KagTagCallBack(this.TagVoiceWait)); this.kag_.AddTagCallBack("repeatvoicelock", new KagScript.KagTagCallBack(this.TagRepeatVoiceLock)); } public void SetYotogiManager(YotogiManager yotogi_mgr) { this.yotogi_mgr_ = yotogi_mgr; this.yotogi_old_mgr_ = null; } public void SetYotogiOldManager(YotogiOldManager yotogi_old_mgr) { this.yotogi_old_mgr_ = yotogi_old_mgr; this.yotogi_mgr_ = null; } public override bool TagWait(KagTagSupport tag_data) { if (!tag_data.IsValid("motion")) { return base.TagWait(tag_data); } this.exec_wait_data_.Clear(); int num = 0; MotionKagManager motionKagManager = null; if (GameMain.Instance.ScriptMgr.kag_mot_dic.ContainsKey(0)) { motionKagManager = GameMain.Instance.ScriptMgr.kag_mot_dic[0]; } Maid maidAndMan = base.GetMaidAndMan(tag_data, true); if (motionKagManager != null && maidAndMan != null && maidAndMan.body0 != null && maidAndMan.body0.m_Bones != null) { string[] array = (!maidAndMan.boMAN) ? motionKagManager.last_maid_motion_set_log : motionKagManager.last_man_motion_set_log; Animation component = maidAndMan.body0.m_Bones.GetComponent(); if (component != null && !string.IsNullOrEmpty(array[maidAndMan.ActiveSlotNo])) { string text = array[maidAndMan.ActiveSlotNo]; AnimationState animationState = component[text]; if (animationState != null) { num = (int)(animationState.length * 1000f); Debug.Log(string.Concat(new string[] { "@wait motion 再生中モーション[", text, "] 再生時間 : ", num.ToString(), "ms" })); } else { Debug.Log("@wait motionが指定されましたが最後に再生したモーション[" + text + "]が現在は再生されていません"); } } } if (num <= 0) { return false; } bool skip_possible = !tag_data.IsValid("skip") || tag_data.GetTagProperty("skip").AsBool(); base.SetWait(num, skip_possible); return true; } public bool TagTalk(KagTagSupport tag_data) { if (tag_data.IsValid("voice")) { Maid voiceTargetMaid = BaseKagManager.GetVoiceTargetMaid(tag_data); this.PlayVoice(voiceTargetMaid, tag_data.GetTagProperty("voice").AsString() + ".ogg"); if (voiceTargetMaid.AudioMan.isPlay()) { float length = voiceTargetMaid.AudioMan.GetLength(); if (this.yotogi_mgr_ != null) { this.yotogi_mgr_.play_mgr.SetMessageTextDisplayTime((int)(length * 1000f)); } } this.talkType = "talk"; } return false; } public bool TagTalkAddFt(KagTagSupport tag_data) { if (tag_data.IsValid("voice")) { Maid voiceTargetMaid = BaseKagManager.GetVoiceTargetMaid(tag_data); string value = tag_data.GetTagProperty("voice").AsString() + ".ogg"; this.backupVoiceData = new KeyValuePair(voiceTargetMaid.ActiveSlotNo, value); this.talkType = "talkaddft"; } return false; } public bool TagTalkRepeat(KagTagSupport tag_data) { int maid_no = 0; if (tag_data.IsValid("maid")) { maid_no = tag_data.GetTagProperty("maid").AsInteger(); } if (tag_data.IsValid("voice")) { if (this.yotogi_mgr_ != null) { this.yotogi_mgr_.SetRepeatVoiceFile(tag_data.GetTagProperty("voice").AsString() + ".ogg", maid_no); } else { this.yotogi_old_mgr_.SetRepeatVoiceFile(tag_data.GetTagProperty("voice").AsString() + ".ogg", maid_no); } } this.talkType = "talkrepeat"; return false; } public bool TagTalkRepeatAdd(KagTagSupport tag_data) { int maid_no = 0; if (tag_data.IsValid("maid")) { maid_no = tag_data.GetTagProperty("maid").AsInteger(); } if (tag_data.IsValid("voice")) { this.yotogi_mgr_.AddRepeatVoiceFile(tag_data.GetTagProperty("voice").AsString() + ".ogg", maid_no); } this.talkType = "talkrepeatadd"; return false; } public bool TagTalkRepeatClear(KagTagSupport tag_data) { if (this.yotogi_mgr_ != null) { if (tag_data.IsValid("maid")) { this.yotogi_mgr_.play_mgr.RemoveRepeatVoiceData(tag_data.GetTagProperty("maid").AsInteger()); } else { this.yotogi_mgr_.play_mgr.ClearRepeatVoiceData(); } } return false; } public bool TagVoiceWait(KagTagSupport tag_data) { int maid_no = 0; if (tag_data.IsValid("maid")) { maid_no = tag_data.GetTagProperty("maid").AsInteger(); } Maid maid = this.GetMaid(maid_no); float length = maid.AudioMan.GetLength(); base.SetWait((int)(length * 1000f), true); return true; } public bool TagRepeatVoiceLock(KagTagSupport tag_data) { bool lockRepeatVoiceUpdate = bool.Parse(tag_data.GetTagProperty("value").AsString()); if (this.yotogi_mgr_ != null) { this.yotogi_mgr_.play_mgr.lockRepeatVoiceUpdate = lockRepeatVoiceUpdate; } return false; } public bool TagHitRet(KagTagSupport tag_data) { if (this.yotogi_mgr_ != null) { string text = this.kag_.GetText(); if (!string.IsNullOrEmpty(text)) { string text2 = this.talkType; if (text2 != null) { if (!(text2 == "talk")) { if (!(text2 == "talkrepeat")) { if (text2 == "talkaddft") { this.yotogi_mgr_.play_mgr.SetAdditionalFtVoice(this.backupVoiceData.Value, text, this.backupVoiceData.Key); } } else { this.yotogi_mgr_.play_mgr.AddRepeatVoiceText(text); } } else { this.yotogi_mgr_.play_mgr.SetMessageText(text); } } } } this.kag_.TextClear(); this.talkType = string.Empty; return false; } public void PlayVoice(Maid maid, string file) { if (maid != null && maid.Visible) { maid.AudioMan.LoadPlay(file, 0f, false, false); } else { int voice_pitch = 50; AudioSourceMgr.Type soundType = AudioSourceMgr.Type.Voice; if (maid != null) { voice_pitch = maid.VoicePitch; soundType = maid.AudioMan.SoundType; } GameMain.Instance.SoundMgr.PlayDummyVoice(file, 0f, false, false, voice_pitch, soundType); } } public override string GetKagClassName() { return "夜伽kag"; } private YotogiManager yotogi_mgr_; private YotogiOldManager yotogi_old_mgr_; private string talkType; private KeyValuePair backupVoiceData; }