Esempio n. 1
0
 public DefinitionBuilder(FakeDAL dal, String name, int maxLevel)
 {
     this.dal = dal;
     game     = new GameBuild {
         Name = name, MaxLevel = maxLevel
     };
 }
Esempio n. 2
0
        public BuildDefinitionManager(FakeDAL dal, GameBuild game, Build build)
        {
            this.dal   = dal;
            this.build = build;

            var blp = dal.Get <BuildLevelParameter>().Where(x => x.Build.id == build.id);

            buildParams = dal.Get <BuildParameter>()
                          .ToList()
                          .Where(x => x.Game.id == build.Game.id)
                          .SelectMany(x => Enumerable.Range(1, game.MaxLevel).Select(i =>
            {
                // get or create the levelparameter
                var b = blp.FirstOrDefault(l => l.Parameter.id == x.id && l.Level == i);
                if (b == null)
                {
                    b = new BuildLevelParameter
                    {
                        Game      = build.Game,
                        Build     = build,
                        Parameter = x,
                        Amount    = x.Type.Minimum,
                        Level     = i
                    };
                }
                return(b);
            }))
                          .ToList();

            foreach (var b in buildParams)
            {
                dal.Save(b);
            }
        }