Exemplo n.º 1
0
 public AbstractStoryTrigger(StoryTriggerVO vo, ITriggerReactor parent)
 {
     this.vo       = vo;
     this.parent   = parent;
     this.Reaction = vo.Reaction;
     if (!string.IsNullOrEmpty(vo.PrepareString))
     {
         this.prepareArgs = vo.PrepareString.Split(new char[]
         {
             '|'
         });
     }
     else
     {
         this.prepareArgs = new string[0];
     }
     if (!string.IsNullOrEmpty(vo.UpdateAction))
     {
         IDataController dataController = Service.Get <IDataController>();
         try
         {
             StoryActionVO storyActionVO = dataController.Get <StoryActionVO>(vo.UpdateAction);
             this.updateAction = StoryActionFactory.GenerateStoryAction(storyActionVO, this);
             if (!string.IsNullOrEmpty(this.updateAction.VO.Reaction))
             {
                 Service.Get <StaRTSLogger>().ErrorFormat("Story chaining is not currently supported for UIActions. {0}, {1}", new object[]
                 {
                     vo.Uid,
                     vo.UpdateAction
                 });
             }
         }
         catch (KeyNotFoundException ex)
         {
             Service.Get <StaRTSLogger>().ErrorFormat("Error in StoryTrigger {0}.  Could not find UiAction {1}.", new object[]
             {
                 vo.Uid,
                 vo.UpdateAction
             });
             throw ex;
         }
     }
 }
Exemplo n.º 2
0
        public override void Prepare()
        {
            base.VerifyArgumentCount(1);
            bool flag  = false;
            bool flag2 = false;

            this.children = new Dictionary <IStoryAction, int>();
            StaticDataController staticDataController = Service.StaticDataController;

            string[] array = this.prepareArgs[0].Split(new char[]
            {
                ','
            });
            IStoryAction[] array2 = new IStoryAction[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                StoryActionVO storyActionVO;
                try
                {
                    storyActionVO = staticDataController.Get <StoryActionVO>(array[i].Trim());
                }
                catch (KeyNotFoundException ex)
                {
                    Service.Logger.ErrorFormat("Error in Story Action {0}.  Could not find Action {1}.", new object[]
                    {
                        this.vo.Uid,
                        array[i]
                    });
                    throw ex;
                }
                if (storyActionVO.Uid == this.vo.Uid)
                {
                    Service.Logger.ErrorFormat("Error in Story Action {0}.  ClusterAND cannot contain itself as a child.", new object[]
                    {
                        this.vo.Uid
                    });
                    return;
                }
                if (storyActionVO.ActionType == "ShowHolo")
                {
                    flag = true;
                }
                else if (storyActionVO.ActionType == "PlayHoloAnim")
                {
                    flag2 = true;
                }
                IStoryAction storyAction = StoryActionFactory.GenerateStoryAction(storyActionVO, this);
                this.children.Add(storyAction, 0);
                array2[i] = storyAction;
            }
            if (flag && flag2)
            {
                Service.Logger.ErrorFormat("ClusterAND {0} contains both ShowHolo and AnimateHolo. {1}", new object[]
                {
                    this.vo.Uid,
                    "Please only animate holograms AFTER ShowHolo is complete"
                });
                return;
            }
            for (int j = 0; j < array2.Length; j++)
            {
                array2[j].Prepare();
            }
        }