public override void OnActivate(int pinID) { switch (pinID) { case 100: FlowNode_ShopVoice2.sType = this.Type; FlowNode_ShopVoice2.sDelayCueID = (string)null; this.ActivateOutputLinks(1); break; case 200: this.ActivateOutputLinks(this.Type != FlowNode_ShopVoice2.sType ? 5 : 4); break; case 500: this.ActivateOutputLinks(!MySound.Voice.IsCueSheetPlaying(FlowNode_ShopVoice2.sType.ToString()) ? 5 : 4); break; case 2001: this.mWaitingForPlayEnd = true; this.mWaitSecAfterPlayEnd = this.WaitSecAfterPlayEnd; break; case 2002: case 2003: this.DisableIdleVoice(pinID == 2002); this.ActivateOutputLinks(1); break; case 2004: MySound.Voice.StopAll(FlowNode_ShopVoice2.sType.ToString(), this.StopSec, false); break; default: if (this.mVoice == null) { this.mType = FlowNode_ShopVoice2.sType; this.mVoice = new MySound.Voice(this.mType.ToString()); } string cueID = (string)null; bool direct = false; float stopSec = this.StopSec; bool exitPlay = this.ExitCueID; switch (pinID) { case 1000: cueID = this.mType != FlowNode_ShopVoice2.EType.shop ? "action_0007" : "action_0013"; break; case 1001: cueID = this.mType != FlowNode_ShopVoice2.EType.shop ? "action_0008" : "action_0014"; exitPlay = true; break; case 1002: int hour = TimeManager.ServerTime.Hour; cueID = hour > 3 ? (hour > 7 ? (hour > 11 ? (hour > 15 ? (hour > 19 ? "time_0023" : "time_0022") : "time_0021") : "time_0020") : "time_0019") : "time_0024"; break; case 1003: cueID = FlowNode_ShopVoice2.GetEventCueID(this.mType, TimeManager.ServerTime, this.DateEventFileName); break; case 2000: cueID = this.CueID; direct = this.DirectCueID; break; } this.ActivateOutputLinks(!this.Play(cueID, direct, stopSec, exitPlay) ? 3 : 2); this.ActivateOutputLinks(1); break; } }
public static string GetEventCueID(FlowNode_ShopVoice2.EType type, DateTime dt, string fileName) { int index = (int)type; int length = 3; if (index < 0 || index >= length) { return((string)null); } if (FlowNode_ShopVoice2.sDateEvent == null) { FlowNode_ShopVoice2.sDateEvent = new List <FlowNode_ShopVoice2.DateEvent> [length]; } if (FlowNode_ShopVoice2.sDateEvent == null) { return((string)null); } if (FlowNode_ShopVoice2.sDateEvent[index] == null) { FlowNode_ShopVoice2.sDateEvent[index] = new List <FlowNode_ShopVoice2.DateEvent>(); string path = fileName; string s; if (GameUtility.Config_UseAssetBundles.Value) { s = AssetManager.LoadTextData(path); } else { TextAsset textAsset = (TextAsset)Resources.Load <TextAsset>(path); s = !Object.op_Inequality((Object)textAsset, (Object)null) ? (string)null : textAsset.get_text(); } if (string.IsNullOrEmpty(s)) { return((string)null); } using (StringReader stringReader = new StringReader(s)) { string str; while ((str = stringReader.ReadLine()) != null) { if (!string.IsNullOrEmpty(str) && !str.StartsWith(";")) { string[] strArray = str.Split('\t'); if (strArray != null && strArray.Length >= 3) { FlowNode_ShopVoice2.DateEvent dateEvent = new FlowNode_ShopVoice2.DateEvent(); if (DateTime.TryParse(strArray[0], out dateEvent.startDate) && DateTime.TryParse(strArray[1], out dateEvent.endDate)) { dateEvent.cueID = strArray[2]; FlowNode_ShopVoice2.sDateEvent[index].Add(dateEvent); } } } } } } using (List <FlowNode_ShopVoice2.DateEvent> .Enumerator enumerator = FlowNode_ShopVoice2.sDateEvent[index].GetEnumerator()) { while (enumerator.MoveNext()) { FlowNode_ShopVoice2.DateEvent current = enumerator.Current; if (current.startDate <= dt && dt <= current.endDate) { return(current.cueID); } } } return((string)null); }