Beispiel #1
0
 /// <summary>
 /// 在A抛出事件时,结束B
 /// </summary>
 /// <param name="actionAName">Action A name.</param>
 /// <param name="actionBName">Action B name.</param>
 /// <param name="customEventId">Custom event identifier.</param>
 /// <param name="delay">Delay.</param>
 protected void FinishBWhenAEvent(string actionAName, string actionBName, int customEventId, float delay = 0)
 {
     if (!m_bBuilding)
     {
         throw new CutsceneLinkException(string.Format("FinishBWhenAFinish (B:{0}) (A:{1}) before BeginBuild or after EndBuild", actionBName, actionAName));
     }
     if (!m_RegistedActions.ContainsKey(actionAName) || !m_RegistedActions.ContainsKey(actionBName))
     {
         throw new CutsceneLinkException(string.Format("Can't find define, Finish {0} When {1} Finish faild", actionBName, actionAName));
     }
     Cutscene.ActionContainer a = m_RegistedActions[actionAName];
     Cutscene.ActionContainer b = m_RegistedActions[actionBName];
     // 判断是否按照主线规则建造
     if (b.IsMainAction)
     {
         throw new CutsceneLinkException(string.Format("Can't finish main action {0}", actionBName));
     }
     if (null == a.CustomEventHandler)
     {
         a.CustomEventHandler = new List <Cutscene.EventHandler>();
     }
     Cutscene.EventHandler newHandler = new Cutscene.EventHandler(
         b,
         delay < 0 ? 0 : delay,
         new CutsceneEvent(customEventId),
         Cutscene.EventHandler.EEventHandlerType.FinishAction);
     a.CustomEventHandler.Add(newHandler);
 }
Beispiel #2
0
 /// <summary>
 /// 在A抛出事件时,开始B
 /// </summary>
 /// <param name="actionAName">Action A name.</param>
 /// <param name="actionBName">Action B name.</param>
 /// <param name="customEventId">Custom event identifier.</param>
 /// <param name="delay">Delay.</param>
 protected void StartBWhenAEvent(string actionAName, string actionBName, int customEventId, float delay = 0)
 {
     if (!m_bBuilding)
     {
         throw new CutsceneLinkException(string.Format("StartBWhenAEvent (B:{0}) (A:{1}) before BeginBuild or after EndBuild", actionBName, actionAName));
     }
     if (!m_RegistedActions.ContainsKey(actionAName) || !m_RegistedActions.ContainsKey(actionBName))
     {
         throw new CutsceneLinkException(string.Format("Can't find define, Start {0} When {1} Event faild", actionBName, actionAName));
     }
     Cutscene.ActionContainer a = m_RegistedActions[actionAName];
     Cutscene.ActionContainer b = m_RegistedActions[actionBName];
     // 判断是否按照主线规则建造
     if (b.IsMainAction)
     {
         if (a != m_CurrentLastMainAction)
         {
             throw new CutsceneLinkException(string.Format("Start main action {0} faild, {1} is not current last main action", actionBName, actionAName));
         }
         else
         {
             m_CurrentLastMainAction = b;
         }
     }
     if (null == a.CustomEventHandler)
     {
         a.CustomEventHandler = new List <Cutscene.EventHandler>();
     }
     Cutscene.EventHandler newHandler = new Cutscene.EventHandler(
         b,
         delay < 0 ? 0 : delay,
         new CutsceneEvent(customEventId),
         Cutscene.EventHandler.EEventHandlerType.StartAction);
     a.CustomEventHandler.Add(newHandler);
 }
Beispiel #3
0
 /// <summary>
 /// Ends the build.
 /// </summary>
 protected void EndBuild()
 {
     DefineAction("End", new CutsceneActionEnd(), true);
     if (null == m_CurrentLastMainAction.FinishEventHandler)
     {
         m_CurrentLastMainAction.FinishEventHandler = new List <Cutscene.EventHandler>();
     }
     Cutscene.EventHandler newHandler = new Cutscene.EventHandler(
         m_RegistedActions["End"],
         0,
         CutsceneEvent.EmptyEvent,
         Cutscene.EventHandler.EEventHandlerType.StartAction);
     m_CurrentLastMainAction.FinishEventHandler.Add(newHandler);
     m_CurrentLastMainAction = m_RegistedActions["End"];
     m_bBuilding             = false;
 }