public IEnumerator Wait(string t, string[] a) { // wait 0.5 // process 0.2 // wait 0.3 // process 0.7 // wait -0.2 skip // process float i; if (!float.TryParse(NovelHelper.CombineAll(a), out i)) { throw new NRuntimeException("不正な数値です."); } if (!source.isPlaying) { yield return(Novel.Runtime.Wait(t, a)); waitCache = 0; } else { if (waitCache != 0) { var wt = i - (source.time - waitCache) + waitQueue; var time = source.time; Debug.Log($"wt:{wt}\nwaitCache:{waitCache}\nsource.time:{source.time}\nwaitQueue:{waitQueue}"); waitQueue = 0; if (wt < 0) { waitQueue = wt; waitCache = source.time; } else { var prevTime = source.time; while (source.time - prevTime < wt) { yield return(new WaitForEndOfFrame()); } waitCache = prevTime + wt; } } else { Debug.Log("waitCache == 0"); var prevTime = source.time; while (source.time - prevTime < i) { yield return(new WaitForEndOfFrame()); } waitCache = prevTime + i; } } }
public IEnumerator Stop(string t, string[] a) { if (a.Length == 0) { Stop(); } else { float i = NovelHelper.TryParse(NovelHelper.CombineAll(a)); yield return(Stop(i)); } }
public IEnumerator Say(string sprite, params string[] args) { var messageSource = I18n[NovelHelper.CombineAll(args)]; var voice = "system.saying"; // 話者がいる場合は表示 // hack 今後もっとUIをよくする buffer = string.IsNullOrEmpty(sprite) ? "" : sprite + " : "; messageSource = TextUtility.RemoveTags(messageSource); TextElement[] mes; try { mes = new TextComponent(messageSource).Elements; } catch (FormatException ex) { mes = new TextComponent(string.Format(I18n["fts.error"], TextUtility.ToSafeString(ex.Message))).Elements; } foreach (var c in mes) { if (c.WaitTime > 0) { yield return(new WaitForSeconds(c.WaitTime)); } if (c.Nod) { yield return(Nod()); } if (!string.IsNullOrWhiteSpace(c.Voice)) { voice = c.Voice; } buffer += c.ToString(); if (!quickEnabled && c.Speed != 0) { Sfx.Play(voice); // タッチ時は早くする yield return(new WaitForSeconds(speed / Mathf.Abs(c.Speed) / (IsTouched ? 2 : 1))); } } yield return(Nod()); buffer = ""; }
public IEnumerator Play(string t, string[] a) { Play(NovelHelper.CombineAll(a)); yield break; }
public IEnumerator Change(string t, string[] a) { Change(NovelHelper.CombineAll(a)); yield break; }
public IEnumerator Move(string _, params string[] args) { Move(NovelHelper.CombineAll(args)); yield break; }