Esempio n. 1
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            bool result         = bool.Parse(ArgumentExpression.Calculate(MainExp));
            bool optionalResult = true;

            if (!string.IsNullOrEmpty(OptionalExp))
            {
                optionalResult = bool.Parse(ArgumentExpression.Calculate(OptionalExp));
            }

            bool resultingIf = callStack.ResultingIf;

            callStack.AddIfStack(result);
            if (!result && resultingIf && optionalResult)
            {
                nextIndex = callStack.CurrentCommandIndex + 1;
            }
            else
            {
                var currentScenario = context.ScenarioRepository.GetCurrentRunningScenario();
                for (int i = callStack.CurrentCommandIndex + 1; i < currentScenario.Commands.Count; i++)
                {
                    if (typeof(ILogicControlCommand).IsAssignableFrom(currentScenario.Commands[i].GetType()))
                    {
                        nextIndex = i;
                        break;
                    }
                }
            }
        }
Esempio n. 2
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            string val = exp;

            val = context.VariableRepository.GetString(exp);
            context.MessagePresenter.RenderMessage(val);
        }
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            Color maskColor = Color.black;

            ColorUtility.TryParseHtmlString(color, out maskColor);
            context.ScenePresenter.MaskOn(time, maskColor, wait);
        }
Esempio n. 4
0
 public void Inject(IStoryContext context)
 {
     systemSound   = context.SystemSound;
     audioPlayer   = context.AudioPlayer;
     storyPlayer   = context.StoryPlayer;
     messageLogger = context.MessageLogger;
 }
Esempio n. 5
0
        public static void Resolve(this IStoryContext context)
        {
            Type myType = context.GetType();

            PropertyInfo[]             propertyInfos  = myType.GetProperties();
            List <IStoryEventListener> eventListeners = new List <IStoryEventListener>();

            foreach (PropertyInfo propertyInfo in propertyInfos)
            {
                var propInstance = propertyInfo.GetValue(context);
                if (propInstance != null)
                {
                    Type propType = propInstance.GetType();
                    if (typeof(IStoryContextInjectable).IsAssignableFrom(propType))
                    {
                        IStoryContextInjectable injectable = (IStoryContextInjectable)propInstance;
                        injectable.Inject(context);
                    }
                    if (typeof(IStoryEventListener).IsAssignableFrom(propType))
                    {
                        eventListeners.Add((IStoryEventListener)propInstance);
                    }
                }
            }

            if (typeof(IStoryEventDispatcher).IsAssignableFrom(myType))
            {
                var methodInfo = myType.GetMethod("AddEventListener");
                methodInfo.Invoke(context, new object[] { eventListeners.ToArray() });
            }
        }
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            ArgumentExpression eo = new ArgumentExpression(exp);

            string result = ArgumentExpression.Calculate(eo.exp);

            context.VariableRepository.SetString(eo.name, result);
        }
Esempio n. 7
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            var prevCall = callStack.Pop();

            jumpIndex = prevCall.index;
            //throw new NotImplementedException();
            context.ScenarioRepository.JumpToScenario(prevCall.scenarioNname);
        }
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     context.VariableRepository.SetString(name, dname);
     context.ActorPresenter.RegisterNewActor(name, tag, asset);
     if (!string.IsNullOrEmpty(size))
     {
         context.ActorPresenter.SetSize(name, size);
     }
 }
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            string show_name = val;

            context.ActorPresenter.SetFocus(val);
            show_name = ArgumentExpression.replaceVariable(val, context.VariableRepository);
            //show_name = context.VariableRepository.GetString(val);
            context.MessagePresenter.SetTokenName(show_name);
        }
Esempio n. 10
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     if (callStack.Count > 0)
     {
         var stackItem = callStack.Pop();
         context.ScenarioRepository.JumpToScenario(stackItem.scenarioNname);
         index = stackItem.index;
     }
 }
Esempio n. 11
0
 public StoryUnitOfWork(IStoryContext context,
                        IStoryRepository stories,
                        ICommentRepository comments,
                        IHashtagRepository hashtags,
                        IGroupRepository groups
                        ) : base(context)
 {
     Stories  = stories;
     Comments = comments;
     Hashtags = hashtags;
     Groups   = groups;
 }
Esempio n. 12
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     if (!string.IsNullOrEmpty(face))
     {
         context.ActorPresenter.SetActorFace(name, face);
     }
     if (!string.IsNullOrEmpty(size))
     {
         context.ActorPresenter.SetSize(name, size, time);
     }
     context.ActorPresenter.SetRegion(name, region);
     context.ActorPresenter.ShowActor(name, time, wait);
 }
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            nextIndex = callStack.Push();
            var macro = context.ScenarioMacroRepository.GetMacro(name);

            if (macro != null)
            {
                nextIndex = macro.index;
                context.ScenarioRepository.JumpToScenario(macro.file_name);
            }
            else
            {
                nextIndex += 1;
            }
        }
Esempio n. 14
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            bool useExternalSource = string.IsNullOrEmpty(source);

            if (string.IsNullOrEmpty(name))
            {
                name = useExternalSource ? source : asset;
            }
            if (string.IsNullOrEmpty(tag))
            {
                tag = name;
            }

            context.ScenePresenter.RegisterImageFromAssetSource(name, tag, asset);
        }
Esempio n. 15
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            int      currentIndex    = callStack.CurrentCommandIndex;
            Scenario currentScenario = context.ScenarioRepository.GetCurrentRunningScenario();
            Macro    macro           = new Macro(name, currentScenario.name, currentIndex);

            context.ScenarioMacroRepository.RecordMacro(macro);
            for (int i = currentIndex; i < currentScenario.Commands.Count; i++)
            {
                ICommand command = currentScenario.Commands[i];
                if (command is EndmacroCommand)
                {
                    endIndex = i;
                }
            }
        }
Esempio n. 16
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            FontOverrideData fontOverrideData = FontOverrideData.Default;

            if (!string.IsNullOrEmpty(color))
            {
                fontOverrideData.ColorCode = color;
            }
            if (size > float.Epsilon)
            {
                fontOverrideData.Size = size;
            }
            fontOverrideData.Bold    = bold;
            fontOverrideData.Italics = italics;
            context.MessagePresenter.SetFont(fontOverrideData);
        }
Esempio n. 17
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            callStack.ClearIfStack();
            if (string.IsNullOrEmpty(file))
            {
                file = context.ScenarioRepository.GetCurrentRunningScenario().name;
            }
            file = ArgumentExpression.replaceVariable(file, context.VariableRepository);

            context.ScenarioRepository.JumpToScenario(file);

            target = ArgumentExpression.replaceVariable(target, context.VariableRepository);

            if (index < 0)
            {
                index = context.ScenarioRepository.GetScenario(file).getIndex(target);
            }
        }
Esempio n. 18
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            bool useExternalSource = string.IsNullOrEmpty(source);

            if (string.IsNullOrEmpty(name))
            {
                name = useExternalSource ? source : asset;
            }
            if (string.IsNullOrEmpty(tag))
            {
                tag = name;
            }
            if (useExternalSource)
            {
                context.ScenePresenter.RegisterBackgroundFromAssetSource(name, tag, asset);
            }
            else
            {
                context.ScenePresenter.RegisterBackgroundFromExternalSource(name, tag, source);
            }
            //context.ScenePresenter.ShowBackground(tag);
        }
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     context.ActorPresenter.HideActor(name, time, wait);
 }
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     context.SelectionPresenter.ShowSelections();
 }
Esempio n. 21
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
 }
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            string tagToUse = string.IsNullOrEmpty(tag) ? name : tag;

            context.ScenePresenter.ShowImage(tagToUse);
        }
Esempio n. 23
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     throw new NotImplementedException();
 }
Esempio n. 24
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     context.MessagePresenter.ShowMessage(0f);
 }
Esempio n. 25
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     context.AssetSource.AddTag(source, tag);
 }
Esempio n. 26
0
 public void Inject(IStoryContext context)
 {
     this.context = context;
     callStack    = new CallStack(context);
 }
Esempio n. 27
0
 public HashtagRepository(IStoryContext storyDbContext) : base(storyDbContext)
 {
 }
Esempio n. 28
0
 public void Inject(IStoryContext context)
 {
     this.assetSource = context.AssetSource;
 }
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     context.ActorPresenter.RegisterActorFace(name, face, asset);
 }
Esempio n. 30
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     context.MessagePresenter.Interactable = false;
 }