コード例 #1
0
ファイル: ActionChain.cs プロジェクト: Hengle/swc-decompiled
        public ActionChain(string firstActionUid)
        {
            this.Valid   = true;
            this.actions = new List <IStoryAction>();
            IDataController dataController = Service.Get <IDataController>();
            string          text           = firstActionUid;

            this.recursiveCounter = 0;
            bool flag = true;

            while (!string.IsNullOrEmpty(text) && this.recursiveCounter < 500)
            {
                this.recursiveCounter++;
                if (this.recursiveCounter > 500)
                {
                    Service.Get <StaRTSLogger>().ErrorFormat("Bad Metadata.  The story chain that starts with {0} has caused a loop.", new object[]
                    {
                        firstActionUid
                    });
                    this.Valid = false;
                    return;
                }
                try
                {
                    StoryActionVO vo          = dataController.Get <StoryActionVO>(text);
                    IStoryAction  storyAction = StoryActionFactory.GenerateStoryAction(vo, this);
                    this.actions.Add(storyAction);
                    text = storyAction.Reaction;
                    if (storyAction is EndChainStoryAction)
                    {
                        flag = false;
                    }
                }
                catch (KeyNotFoundException ex)
                {
                    Service.Get <StaRTSLogger>().ErrorFormat("Error in Story Chain Starting with {0}.  Could not find Action {1}. {2}", new object[]
                    {
                        firstActionUid,
                        text,
                        ex.get_Message()
                    });
                    this.Valid = false;
                    return;
                }
            }
            if (flag)
            {
                IStoryAction item = StoryActionFactory.GenerateStoryAction(new StoryActionVO
                {
                    ActionType = "EndChain",
                    Uid        = "autoEnd" + Service.Get <QuestController>().AutoIncrement()
                }, this);
                this.actions.Add(item);
            }
            this.currentActionIndex = -1;
            this.PrepareNextAction();
        }
コード例 #2
0
 public unsafe static long $Invoke0(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(StoryActionFactory.GenerateStoryAction((StoryActionVO)GCHandledObjects.GCHandleToObject(*args), (IStoryReactor)GCHandledObjects.GCHandleToObject(args[1]))));
 }