コード例 #1
0
ファイル: StoryManager.cs プロジェクト: Wouyoshi/projects
        /// <summary>The get problem.</summary>
        /// <param name="currentProblem">The current problem.</param>
        /// <param name="options">The options.</param>
        /// <param name="currentOption">The current option.</param>
        /// <returns>The <see cref="Problem"/>.</returns>
        private Problem GetProblem(Model.Problem currentProblem, IList <int> options, int currentOption)
        {
            Option option = currentProblem.Options.First(opt => opt.Number == options[currentOption]);

            // Todo: Check for conditions here.
            Route route = option.Routes.First();

            Model.Problem nextProblem = route.NextProblem;
            currentOption = currentOption + 1;
            if (currentOption >= options.Count)
            {
                var problem = Mapper.Map <Problem>(nextProblem);
                return(problem);
            }

            return(this.GetProblem(nextProblem, options, currentOption));
        }
コード例 #2
0
 public void OptionValidatorTest()
 {
     var optionValidator = new OptionValidator();
     var option = new Option();
     ValidationResults result = optionValidator.Validate(option);
 }
コード例 #3
0
        /// <summary>The make example step 1 problem 1 option 1.</summary>
        /// <param name="nextProblem">The next problem.</param>
        /// <returns>The <see cref="Option"/>.</returns>
        private static Option MakeExampleStep1Problem1Option1(Problem nextProblem)
        {
            var option = new Option { Number = 1, Text = "Grab the knife." };
            var routes = MakeExampleStep1Problem1Option1Routes(nextProblem);
            foreach (var route in routes)
            {
                option.Routes.Add(route);
            }

            return option;
        }
コード例 #4
0
        /// <summary>The make example step 2 problem 2 option 2.</summary>
        /// <param name="nextProblem">The next problem.</param>
        /// <returns>The <see cref="Option"/>.</returns>
        private static Option MakeExampleStep2Problem2Option2(Problem nextProblem)
        {
            var option = new Option
            {
                Number = 2,
                Text = "Call for help."
            };

            var routes = MakeExampleStep2Problem2Option2Routes(nextProblem);
            foreach (var route in routes)
            {
                option.Routes.Add(route);
            }

            return option;
        }
コード例 #5
0
        /// <summary>The make example step 2 problem 2 option 1.</summary>
        /// <param name="nextProblem">The next problem.</param>
        /// <returns>The <see cref="Option"/>.</returns>
        private static Option MakeExampleStep2Problem2Option1(Problem nextProblem)
        {
            var option = new Option
                       {
                           Number = 1,
                           Text = "Throw the knife at the man."
                       };

            var routes = MakeExampleStep2Problem2Option1Routes(nextProblem);
            foreach (var route in routes)
            {
                option.Routes.Add(route);
            }

            return option;
        }
コード例 #6
0
        /// <summary>The make example step 1 problem 1 option 2.</summary>
        /// <param name="nextProblem">The next problem.</param>
        /// <returns>The <see cref="Option"/>.</returns>
        private static Option MakeExampleStep1Problem1Option2(Problem nextProblem)
        {
            var option = new Option { Number = 2, Text = "Hide behind the crates." };
            var routes = MakeExampleStep1Problem1Option2Routes(nextProblem);
            foreach (var route in routes)
            {
                option.Routes.Add(route);
            }

            return option;
        }