Exemplo 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;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            string val = exp;

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

            ColorUtility.TryParseHtmlString(color, out maskColor);
            context.ScenePresenter.MaskOn(time, maskColor, wait);
        }
Exemplo n.º 4
0
 public void Inject(IStoryContext context)
 {
     systemSound   = context.SystemSound;
     audioPlayer   = context.AudioPlayer;
     storyPlayer   = context.StoryPlayer;
     messageLogger = context.MessageLogger;
 }
Exemplo 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() });
            }
        }
Exemplo n.º 6
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            ArgumentExpression eo = new ArgumentExpression(exp);

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

            context.VariableRepository.SetString(eo.name, result);
        }
Exemplo 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);
        }
Exemplo 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;
     }
 }
Exemplo 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;
 }
Exemplo 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;
            }
        }
Exemplo 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);
        }
Exemplo 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;
                }
            }
        }
Exemplo 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);
        }
Exemplo 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);
            }
        }
Exemplo 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();
 }
Exemplo 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);
        }
Exemplo n.º 23
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 24
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     context.MessagePresenter.ShowMessage(0f);
 }
Exemplo n.º 25
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     context.AssetSource.AddTag(source, tag);
 }
Exemplo n.º 26
0
 public void Inject(IStoryContext context)
 {
     this.context = context;
     callStack    = new CallStack(context);
 }
Exemplo n.º 27
0
 public HashtagRepository(IStoryContext storyDbContext) : base(storyDbContext)
 {
 }
Exemplo 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);
 }
Exemplo n.º 30
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     context.MessagePresenter.Interactable = false;
 }