/// <summary> /// 开始一段旁白 /// isPause=暂停 /// isUnPauseOnEndTalk=对话结束后取消暂停 /// </summary> /// <param name="id"></param> public virtual NarrationFragment Start(string id) { CurData = TDLuaMgr.Get <TData>(id); if (CurData == null) { CLog.Error($"没有找到这个Plot:{id}"); return(null); } //如果剧情只显示一次,则返回 if (CurData.IsShowOnce && Showed.Contains(id)) { return(null); } CurNarrationIndex = 0; if (IsHave()) { Showed.Add(id); var ret = CurData.Fragments[CurNarrationIndex]; Callback_OnStartNarration?.Invoke(CurData, ret); Callback_OnChangeNarration?.Invoke(CurData); IsStartNarration = true; if (!PauseFlag) { BattleMgr.LockBattleStartFlow(true); PlotMgr?.SetPlotPause(true); } PauseFlag = true; return(ret); } return(null); }
public virtual void Stop() { var ret = CurNarrationFragment(); IsStartNarration = false; Callback_OnEndNarration?.Invoke(CurData, ret); Callback_OnChangeNarration?.Invoke(CurData); if (IsStartNarration) { return; } if (PauseFlag) { BattleMgr.LockBattleStartFlow(false); PlotMgr?.SetPlotPause(false); } //重置状态 PauseFlag = false; }
/// <summary> /// 下一段旁白 /// </summary> public virtual NarrationFragment Next() { if (!IsStartNarration) { return(null); } CurNarrationIndex++; if (IsHave()) { var ret = CurNarrationFragment(); Callback_OnNextNarration?.Invoke(CurData, ret, CurNarrationIndex); Callback_OnChangeNarration?.Invoke(CurData); return(ret); } else { Stop(); return(null); } }