Пример #1
0
    void GeneratePrepareAreaBlock()
    {
        Dictionary <Block.ColorEnum, int> colorCount = new Dictionary <Block.ColorEnum, int> ();

        colorCount [Block.ColorEnum.Black] = 0;
        colorCount [Block.ColorEnum.White] = 0;
        foreach (var feature in featureManager.GetFeatures())
        {
            foreach (var featureBlock in feature.GetBlocks())
            {
                colorCount [featureBlock.Color]++;
            }
        }
        foreach (var prepareBlock in prepareArea.GetBlocks())
        {
            colorCount [prepareBlock.Color]--;
        }
        List <Block.ColorEnum> roulette = new List <Block.ColorEnum> ();

        foreach (var key in colorCount.Keys)
        {
            var count = colorCount [key];
            if (count <= 0)
            {
                count = 1;
            }
            for (int i = 0; i < count; i++)
            {
                roulette.Add(key);
            }
        }
        var color = roulette [UnityEngine.Random.Range(0, roulette.Count)];

        prepareArea.AddBlock(blockGenerator.GenerateBlock(color));
    }
Пример #2
0
        public async Task <List <FeatureDto> > GetFeatures(string db)
        {
            _featureManager.ConfigureConnectionString(db);
            var features = await _featureManager.GetFeatures();

            return(features.ToList());
        }
Пример #3
0
        public IActionResult Overview(string UserName, string Password)
        {
            UserCreator UserFactory = new UserCreator();

            //CurrentUser = UserFactory.LogInUser(new UserLogIn { UserName = TempData["User"].ToString(), UserPassword = TempData["Password"].ToString() });
            CurrentUser = UserFactory.LogInUser(new UserLogIn {
                UserName = HttpContext.Session.GetString(CookieKeys.USERNAME), UserPassword = HttpContext.Session.GetString(CookieKeys.PASSWORD)
            });
            //User newUser = UserFactory.CreateUser(AccountType, Name, LastName, SecondLastName, FullName, Address, EMail, Password, UserName, IdUser);
            //ViewData["UserInfo"] = CurrentUser;
            ViewData["Options"] = FeatureManager.GetFeatures(CurrentUser.Permissions);

            //ViewData["Options"] = newUser.Permissions;
            //ViewData["OptionNames"] = EnumUtils.GetOptions();
            return(View(CurrentUser));
        }