Example #1
0
 public override void Context()
 {
     _callStack                = mock <ICallStack>();
     _pendingSpecification     = mock <IPendingSpecification>();
     _callActions              = mock <ICallActions>();
     _callSpecificationFactory = mock <ICallSpecificationFactory>();
 }
Example #2
0
        public StepTaskEntityBase GetStepEntity(ICallStack stack)
        {
            // 当前当前StepRoot为null,则说明序列已经执行结束,返回null
            if (null == _stepEntityRoot)
            {
                return(null);
            }
            StepTaskEntityBase currentStep = _stepEntityRoot;
            int currentLevel = 0;
            int stepId       = stack.StepStack[currentLevel];

            for (int i = 0; i < stepId; i++)
            {
                currentStep = currentStep.NextStep;
            }
            currentLevel++;
            while (currentLevel < stack.StepStack.Count && null != currentStep.SubStepRoot)
            {
                currentStep = currentStep.SubStepRoot;
                stepId      = stack.StepStack[currentLevel];
                for (int i = 0; i < stepId; i++)
                {
                    currentStep = currentStep.NextStep;
                }
                currentLevel++;
            }
            return(currentStep);
        }
Example #3
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;
                    }
                }
            }
        }
 public override void Context()
 {
     _callStack = mock <ICallStack>();
     _call      = mock <ICall>();
     _sequenceNumberGenerator = mock <SequenceNumberGenerator>();
     _sequenceNumberGenerator.stub(x => x.Next()).Return(42);
 }
Example #5
0
 public ExecutionEngine(CompiledModel compiledModel, IGCHeap gcHeap, ITypesHeap typesHeap, ITypeLoader typeLoader, ICallStack callStack, IILOperationSet ilOperationSet)
 {
     _compiledModel             = compiledModel;
     _callStack                 = callStack;
     _methodStateMachineFactory = new MethodStateMachineFactory(gcHeap, typesHeap, typeLoader, ilOperationSet);
     FillInterruptionResolvers();
 }
        public SubroutineCommandFactory(ICallStack callStack)
        {
            if (callStack == null)
                throw new ArgumentNullException("callStack");

            _callStack = callStack;
        }
Example #7
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);
        }
Example #9
0
        public static string GetRuntimeVariableName(string variableName, ICallStack stack)
        {
            StringBuilder runtimeVarName = new StringBuilder(50);

            return(runtimeVarName.Append(stack.SessionIndex)
                   .Append(stack.Session).Append(VarNameDelim).Append(string.Join(VarNameDelim, stack.StepStack))
                   .Append(VarNameDelim).Append(variableName).ToString());
        }
 public GetCallSpec(ICallStack callStack, IPendingSpecification pendingSpecification,
                    ICallSpecificationFactory callSpecificationFactory, ICallActions callActions)
 {
     _callStack                = callStack;
     _pendingSpecification     = pendingSpecification;
     _callSpecificationFactory = callSpecificationFactory;
     _callActions              = callActions;
 }
Example #11
0
 public GetCallSpec(ICallStack callStack, IPendingSpecification pendingSpecification,
     ICallSpecificationFactory callSpecificationFactory, ICallActions callActions)
 {
     _callStack = callStack;
     _pendingSpecification = pendingSpecification;
     _callSpecificationFactory = callSpecificationFactory;
     _callActions = callActions;
 }
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            ArgumentExpression eo = new ArgumentExpression(exp);

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

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

            jumpIndex = prevCall.index;
            //throw new NotImplementedException();
            context.ScenarioRepository.JumpToScenario(prevCall.scenarioNname);
        }
Example #14
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     if (callStack.Count > 0)
     {
         var stackItem = callStack.Pop();
         context.ScenarioRepository.JumpToScenario(stackItem.scenarioNname);
         index = stackItem.index;
     }
 }
 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);
        }
Example #17
0
 public override void Context()
 {
     _callStack       = mock <ICallStack>();
     _callResults     = mock <ICallResults>();
     _routeArguments  = new object[] { 2 };
     _substituteState = mock <ISubstituteState>();
     _substituteState.stub(x => x.FindInstanceFor(typeof(ICallStack), _routeArguments)).Return(_callStack);
     _substituteState.stub(x => x.FindInstanceFor(typeof(ICallResults), _routeArguments)).Return(_callResults);
     _substituteState.stub(x => x.FindInstanceFor(typeof(int), _routeArguments)).Return(_routeArguments[0]);
 }
Example #18
0
 public ResultSetter(ICallStack callStack, IPendingSpecification pendingSpecification,
                     ICallResults configuredResults, ICallSpecificationFactory callSpecificationFactory,
                     ICallActions callActions)
 {
     _callStack                = callStack;
     _pendingSpecification     = pendingSpecification;
     _configuredResults        = configuredResults;
     _callSpecificationFactory = callSpecificationFactory;
     _callActions              = callActions;
 }
        public CallSubroutineCommand(int address, int operationCode, ICallStack callStack)
            : base(address, operationCode)
        {
            if (FirstOperationCodeHalfByte != 0x2)
                throw new ArgumentOutOfRangeException("operationCode");
            if (callStack == null)
                throw new ArgumentNullException("callStack");

            _callStack = callStack;
        }
Example #20
0
            public override void Context()
            {
                _callStack                = mock <ICallStack>();
                _pendingSpecification     = mock <IPendingSpecification>();
                _configuredResults        = mock <ICallResults>();
                _callActions              = mock <ICallActions>();
                _callSpecificationFactory = mock <ICallSpecificationFactory>();

                _returnValue = mock <IReturn>();
            }
Example #21
0
 public ResultSetter(ICallStack callStack, IPendingSpecification pendingSpecification,
     ICallResults configuredResults, ICallSpecificationFactory callSpecificationFactory,
     ICallActions callActions)
 {
     _callStack = callStack;
     _pendingSpecification = pendingSpecification;
     _configuredResults = configuredResults;
     _callSpecificationFactory = callSpecificationFactory;
     _callActions = callActions;
 }
Example #22
0
        //to do: check valid steps
        public ISequenceStep GetSequenceStep(ICallStack stack)
        {
            ISequence     sequence = Context.SequenceGroup.Sequences[stack.Sequence];
            ISequenceStep step     = sequence.Steps[stack.StepStack[0]];

            for (int n = 1; n < stack.StepStack.Count; n++)
            {
                step = step.SubSteps[stack.StepStack[n]];
            }
            return(step);
        }
        public ReturnFromSubroutineCommand(int address, int operationCode, ICallStack callStack)
            : base(address, operationCode)
        {
            if (operationCode != 0x00EE)
                throw new ArgumentOutOfRangeException("operationCode");
            if (callStack == null)
                throw new ArgumentNullException("callStack");

            _callStack = callStack;
            _initialTopOfStack = callStack.Peek();
        }
Example #24
0
        /// <summary>
        /// 通过Stack获取Step
        /// </summary>
        public static ISequenceStep GetStepFromStack(ISequenceGroup sequenceGroup, ICallStack callStack)
        {
            if (callStack.StepStack.Count <= 0)
            {
                return(null);
            }
            int       sessionId     = callStack.Session;
            int       sequenceIndex = callStack.Sequence;
            ISequence sequence      = GetSequence(sequenceGroup, sessionId, sequenceIndex);

            return(GetStepFromStack(sequence, callStack.StepStack, callStack.ToString()));
        }
Example #25
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;
            }
        }
Example #27
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);
        }
Example #28
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;
                }
            }
        }
Example #29
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);
        }
        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);
            }
        }
Example #31
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);
 }
Example #33
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);
        }
 private static CallSubroutineCommand CreateCallSubroutineCommand(int operationCode = 0x2001,
     ICallStack callStack = null)
 {
     return new CallSubroutineCommand(0, operationCode, callStack ?? Substitute.For<ICallStack>());
 }
 public RecordCallHandler(ICallStack callStack)
 {
     _callStack = callStack;
 }
 internal static SubroutineCommandFactory CreateSubroutineCommandFactory(ICallStack callStack = null)
 {
     return new SubroutineCommandFactory(callStack ?? Substitute.For<ICallStack>());
 }
 public RecordCallHandler(ICallStack callStack, SequenceNumberGenerator generator)
 {
     _callStack = callStack;
     _generator = generator;
 }
Example #39
0
 public ResultSetter(ICallStack callStack, ICallResults configuredResults, ICallSpecificationFactory callSpecificationFactory)
 {
     _callStack = callStack;
     _configuredResults = configuredResults;
     _callSpecificationFactory = callSpecificationFactory;
 }
Example #40
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     throw new NotImplementedException();
 }
 public CheckReceivedCallHandler(ICallStack callStack, ICallResults configuredResults, ICallSpecificationFactory callSpecificationFactory)
 {
     _callStack = callStack;
     _configuredResults = configuredResults;
     _callSpecificationFactory = callSpecificationFactory;
 }