123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- using System;
- using UnityEngine;
- public class YotogiKagManager : BaseKagManager
- {
- public YotogiKagManager(TJSScript tjs, ScriptManager script_mgr) : base(tjs, script_mgr)
- {
- this.pickUpText = (this.repeatStackText = false);
- }
- public override void Initialize()
- {
- base.Initialize();
- this.kag_.AddTagCallBack("talk", new KagScript.KagTagCallBack(this.TagTalk));
- 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<Animation>();
- 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.pickUpText = true;
- this.repeatStackText = false;
- }
- 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.pickUpText = true;
- this.repeatStackText = true;
- 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.pickUpText = (this.repeatStackText = false);
- 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.pickUpText && this.yotogi_mgr_ != null)
- {
- string text = this.kag_.GetText();
- if (!string.IsNullOrEmpty(text))
- {
- if (this.repeatStackText)
- {
- this.yotogi_mgr_.play_mgr.AddRepeatVoiceText(text);
- }
- else
- {
- this.yotogi_mgr_.play_mgr.SetMessageText(text);
- }
- }
- }
- this.kag_.TextClear();
- this.pickUpText = (this.repeatStackText = false);
- return false;
- }
- private 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 bool pickUpText;
- private bool repeatStackText;
- }
|