PrivateMaidTouchKagManager.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using System;
  2. using System.Collections.Generic;
  3. public class PrivateMaidTouchKagManager : BaseKagManager
  4. {
  5. public PrivateMaidTouchKagManager(TJSScript tjs, ScriptManager scriptMgr) : base(tjs, scriptMgr)
  6. {
  7. }
  8. public override void Initialize()
  9. {
  10. base.Initialize();
  11. this.kag_.AddTagCallBack("talk", new KagScript.KagTagCallBack(this.TagTalk));
  12. this.kag_.AddTagCallBack("rc_talk", new KagScript.KagTagCallBack(this.TagRcTalk));
  13. this.kag_.AddTagCallBack("talkrepeat", new KagScript.KagTagCallBack(this.TagTalkRepeat));
  14. this.kag_.AddTagCallBack("hitret", new KagScript.KagTagCallBack(this.TagHitRet));
  15. }
  16. public void LoadScript(Maid maid, string fileName, string labelName = "")
  17. {
  18. base.enabled = true;
  19. if (maid != null)
  20. {
  21. fileName = ScriptManager.ReplacePersonal(maid, fileName);
  22. }
  23. this.LoadScriptFile(fileName, labelName);
  24. this.Exec();
  25. }
  26. public bool TagTalk(KagTagSupport tag_data)
  27. {
  28. this.talkDataDictionary.Clear();
  29. base.CheckAbsolutelyNecessaryTag(tag_data, "voice", new string[0]);
  30. if (PrivateMaidTouchManager.instance == null)
  31. {
  32. return false;
  33. }
  34. this.talkDataDictionary.Add("tag", "talk");
  35. this.talkDataDictionary.Add("voice", tag_data.GetTagProperty("voice").AsString() + ".ogg");
  36. Maid voiceTargetMaid = BaseKagManager.GetVoiceTargetMaid(tag_data);
  37. this.talkDataDictionary.Add("maidguid", (!(voiceTargetMaid != null)) ? string.Empty : voiceTargetMaid.status.guid);
  38. return false;
  39. }
  40. private bool TagRcTalk(KagTagSupport tag_data)
  41. {
  42. this.talkDataDictionary.Clear();
  43. base.CheckAbsolutelyNecessaryTag(tag_data, "voice", new string[0]);
  44. if (PrivateMaidTouchManager.instance == null)
  45. {
  46. return false;
  47. }
  48. this.talkDataDictionary.Add("tag", "rc_talk");
  49. this.talkDataDictionary.Add("voice", tag_data.GetTagProperty("voice").AsString() + ".ogg");
  50. Maid voiceTargetMaid = BaseKagManager.GetVoiceTargetMaid(tag_data);
  51. this.talkDataDictionary.Add("maidguid", (!(voiceTargetMaid != null)) ? string.Empty : voiceTargetMaid.status.guid);
  52. return false;
  53. }
  54. private bool TagTalkRepeat(KagTagSupport tag_data)
  55. {
  56. this.talkDataDictionary.Clear();
  57. base.CheckAbsolutelyNecessaryTag(tag_data, "voice", new string[0]);
  58. if (PrivateMaidTouchManager.instance == null)
  59. {
  60. return false;
  61. }
  62. this.talkDataDictionary.Add("tag", "talkrepeat");
  63. this.talkDataDictionary.Add("voice", tag_data.GetTagProperty("voice").AsString() + ".ogg");
  64. Maid voiceTargetMaid = BaseKagManager.GetVoiceTargetMaid(tag_data);
  65. this.talkDataDictionary.Add("maidguid", (!(voiceTargetMaid != null)) ? string.Empty : voiceTargetMaid.status.guid);
  66. return false;
  67. }
  68. public bool TagHitRet(KagTagSupport tag_data)
  69. {
  70. string text = this.kag_.GetText();
  71. this.kag_.TextClear();
  72. string text2;
  73. this.talkDataDictionary.TryGetValue("tag", out text2);
  74. string maidGuid;
  75. this.talkDataDictionary.TryGetValue("maidguid", out maidGuid);
  76. string voiceFileName;
  77. this.talkDataDictionary.TryGetValue("voice", out voiceFileName);
  78. this.talkDataDictionary.Clear();
  79. PrivateMaidTouchManager.VoiceData voiceData = new PrivateMaidTouchManager.VoiceData
  80. {
  81. maidGuid = maidGuid,
  82. voiceFileName = voiceFileName,
  83. text = text
  84. };
  85. if (text2 != null)
  86. {
  87. if (!(text2 == "talk"))
  88. {
  89. if (!(text2 == "rc_talk"))
  90. {
  91. if (text2 == "talkrepeat")
  92. {
  93. PrivateMaidTouchManager.instance.SetRepeatVoice(voiceData);
  94. }
  95. }
  96. else
  97. {
  98. PrivateMaidTouchManager.instance.AddRcVoiceData(voiceData);
  99. }
  100. }
  101. else
  102. {
  103. PrivateMaidTouchManager.instance.SetSingleVoice(voiceData);
  104. }
  105. }
  106. return false;
  107. }
  108. public override string GetKagClassName()
  109. {
  110. return "プライベートお触りモードkag";
  111. }
  112. private Dictionary<string, string> talkDataDictionary = new Dictionary<string, string>();
  113. }