Exemple #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);
 }
Exemple #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);
 }
Exemple #3
0
 /// <summary>
 /// Begins the build.
 /// </summary>
 protected void BeginBuild()
 {
     m_Product   = new Cutscene();
     m_bBuilding = true;
     DefineAction("Begin", new CutsceneActionBegin(), true);
     m_Product.SetRootActionContainer(m_RegistedActions["Begin"]);
     m_CurrentLastMainAction = m_RegistedActions["Begin"];
 }
Exemple #4
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;
 }
Exemple #5
0
        /// <summary>
        /// 定义一个Action
        /// </summary>
        /// <param name="actionName">Action name.</param>
        /// <param name="action">Action.</param>
        protected void DefineAction(string actionName, CutsceneActionBase action, bool isMainAction = false)
        {
            if (null == action)
            {
                throw new CutsceneLinkException(string.Format("DefineAction {0} before create action instance", actionName));
            }
            if (!m_bBuilding)
            {
                throw new CutsceneLinkException(string.Format("DefineAction {0}:{1} before BeginBuild or after EndBuild", actionName, action.GetType().Name));
            }

            if (m_RegistedActions.ContainsKey(actionName))
            {
                return;
            }
            Cutscene.ActionContainer newContainer = new Cutscene.ActionContainer();
            newContainer.Action       = action;
            newContainer.IsMainAction = isMainAction;
            newContainer.ID           = m_nGUIDAllocator++;
            m_RegistedActions.Add(actionName, newContainer);
        }