Esempio n. 1
0
        // Establece la velocidad del juego a partir del enum Difficult
        public static void SetDifficult(Difficult _difficult)
        {
            difficult = _difficult;
            switch (difficult)
            {
            case Game.Difficult.VERY_EASY:
                speed = 90;
                break;

            case Game.Difficult.EASY:
                speed = 80;
                break;

            case Game.Difficult.NORMAL:
                speed = 70;
                break;

            case Game.Difficult.HARD:
                speed = 60;
                break;

            case Game.Difficult.EXTREME:
                speed = 50;
                break;

            case Game.Difficult.INSANE:
                speed = 40;
                break;

            default:
                speed = 90;
                break;
            }
        }
Esempio n. 2
0
 public Game(string _username, Difficult difficult, GameMode _game_mode, SizeWindow _size_window)
 {
     Console.Clear();
     Console.CursorVisible = false;
     SetDifficult(difficult);
     movements   = 0;
     score       = 0;
     game_over   = false;
     username    = _username.ToUpper();
     game_mode   = _game_mode;
     size_window = _size_window;
     board       = new Board();
     board.RefreshScore(0);
     try
     {
         while (true)
         {
             Thread.Sleep(speed);
             board.GetSnake().Refresh();
         }
     } catch (GameOverException)
     {
         Console.ReadKey();
         punctuations.Add(new Punctuation(DateTime.Now, username, score, movements));
         Util.Save(punctuations);
     }
 }
Esempio n. 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Name,Description,IsDeleted,DeletedOn,Id,CreatedOn,ModifiedOn")] Difficult difficult)
        {
            if (id != difficult.Id)
            {
                return(this.NotFound());
            }

            if (this.ModelState.IsValid)
            {
                try
                {
                    this._context.Update(difficult);
                    await this._context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!this.DifficultExists(difficult.Id))
                    {
                        return(this.NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(this.RedirectToAction(nameof(this.Index)));
            }
            return(this.View(difficult));
        }
Esempio n. 4
0
        static void Delete(byte[,] table, int size, Difficult difficult)
        {
            int numberOfEmpty = 0;
            var look          = new byte[size, size];

            switch (difficult)
            {
            case Difficult.Easy: numberOfEmpty = rand.Next(40, 45); break;

            case Difficult.Medium: numberOfEmpty = rand.Next(45, 50); break;

            case Difficult.Hard: numberOfEmpty = rand.Next(50, 55); break;
            }
            while (numberOfEmpty > 0)
            {
                int i = rand.Next(size);
                int j = rand.Next(size);
                if (look[i, j] == 0)
                {
                    table[i, j] = 0;
                    look[i, j]  = 1;
                    numberOfEmpty--;
                }
            }
        }
Esempio n. 5
0
            /// <summary>
            /// 写入INI
            /// </summary>
            public static void IniW()
            {
                IniW RA2CA = new IniW(AppDomain.CurrentDomain.BaseDirectory + "ra2ca.ini");

                if (IsWindow)
                {
                    RA2CA.IniWriteValue("Video", "Video.Windowed", "1");
                }
                else
                {
                    RA2CA.IniWriteValue("Video", "Video.Windowed", "0");
                }

                if (NoFrame)
                {
                    RA2CA.IniWriteValue("Video", "NoWindowFrame", "1");
                }
                else
                {
                    RA2CA.IniWriteValue("Video", "NoWindowFrame", "0");
                }

                RA2CA.IniWriteValue("Options", "Difficulty", Difficult.ToString());

                RA2CA.IniWriteValue("Audio", "SoundVolume", BGM.ToString());
                RA2CA.IniWriteValue("Audio", "VoiceVolume", VOX.ToString());
                RA2CA.IniWriteValue("Audio", "ScoreVolume", SEM.ToString());

                RA2CA.IniWriteValue("Video", "ScreenWidth", Width.ToString());
                RA2CA.IniWriteValue("Video", "ScreenHeight", Height.ToString());
            }
Esempio n. 6
0
        private void SaveUserLvl(Test test, double percent)
        {
            var user = (from u in db.User
                        where u.UserId == UserId
                        select u).First();
            string result = user.ObjectiveLevel;

            if (test.Name == "Загальний рівень знань" && !user.Tested)
            {
                if (percent <= 10)
                {
                    result = Enum.Format(typeof(Difficult), Difficult.Beginner, "G");
                }
                else if (percent > 10 && percent <= 28)
                {
                    result = Enum.Format(typeof(Difficult), Difficult.Elementary, "G");                                     //nameof(Difficult.Elementary)
                }
                else if (percent > 28 && percent <= 46)
                {
                    result = Enum.Format(typeof(Difficult), Difficult.Intermediate, "G");
                }
                else if (percent > 46 && percent <= 64)
                {
                    result = Enum.Format(typeof(Difficult), Difficult.Upper_Intermediate, "G");
                }
                else if (percent > 64 && percent <= 82)
                {
                    result = Enum.Format(typeof(Difficult), Difficult.Advanced, "G");
                }
                else if (percent > 82 && percent <= 100)
                {
                    result = Enum.Format(typeof(Difficult), Difficult.Proficient, "G");
                }
                user.Tested = true;
            }
            else
            {
                if (percent >= GetMinSuccessPercent(test.Name))
                {
                    Difficult userLvl = (Difficult)Enum.Parse(typeof(Difficult), user.ObjectiveLevel.Replace('-', '_'));
                    foreach (Difficult el in Enum.GetValues(typeof(Difficult)))
                    {
                        string name  = Enum.Format(typeof(Difficult), el, "G");
                        int    value = (int)el;
                        if (test.Name == "Рівень " + name)
                        {
                            if (value > (int)userLvl)
                            {
                                result = name;
                            }
                        }
                    }
                }
            }
            result = result.Replace('_', '-');
            TempData["LevelChanged"] = (result == user.ObjectiveLevel ? false : true);
            user.ObjectiveLevel      = result;
            db.SaveChanges();
            TempData["UserLevel"] = result;
        }
Esempio n. 7
0
 private void SaveListeningLvl(Test test, double percent)
 {
     if (test.Name.StartsWith("Рівень сприйняття на слух: ") && percent >= GetMinSuccessPercent(test.Name))
     {
         var user = (from u in db.User
                     where u.UserId == UserId
                     select u).First();
         string    result  = user.ObjLvlListening;
         Difficult userLvl = (Difficult)Enum.Parse(typeof(Difficult), user.ObjLvlListening.Replace('-', '_'));
         foreach (Difficult el in Enum.GetValues(typeof(Difficult)))
         {
             string name  = Enum.Format(typeof(Difficult), el, "G");
             int    value = (int)el;
             if (test.Name == "Рівень сприйняття на слух: " + name)
             {
                 if (value > (int)userLvl)
                 {
                     result = name;
                 }
             }
         }
         result = result.Replace('_', '-');
         TempData["LevelChanged"] = (result == user.ObjLvlListening ? false : true);
         user.ObjLvlListening     = result;
         TempData["UserLevel"]    = result;
     }
 }
 private void SaveUserLvl(TextTask text)
 {
     if (text.Name.StartsWith("Текст на рівень знань: "))
     {
         var       identity = User.Identity.GetUserId();
         var       user     = db.User.Where(x => x.IdentityId == identity).First();
         string    result   = user.ObjLvlReading;
         Difficult userLvl  = (Difficult)Enum.Parse(typeof(Difficult), user.ObjLvlReading.Replace('-', '_'));
         foreach (Difficult el in Enum.GetValues(typeof(Difficult)))
         {
             string name  = Enum.Format(typeof(Difficult), el, "G");
             int    value = (int)el;
             if (text.Name == "Текст на рівень знань: " + name)
             {
                 if (value > (int)userLvl)
                 {
                     result = name;
                 }
             }
         }
         result             = result.Replace('_', '-');
         user.ObjLvlReading = result;
         db.SaveChanges();
     }
 }
Esempio n. 9
0
        private void SaveUserLvl(string grpName, double percent)
        {
            string userIdentity = User.Identity.GetUserId();
            var    user         = (from u in db.User
                                   where u.IdentityId == userIdentity
                                   select u).First();
            string result = user.ObjLvlListening;

            if (percent >= 80)
            {
                Difficult userLvl = (Difficult)Enum.Parse(typeof(Difficult), user.ObjLvlListening.Replace('-', '_'));
                foreach (Difficult el in Enum.GetValues(typeof(Difficult)))
                {
                    string name  = el.ToString();
                    int    value = (int)el;
                    if (grpName == "Рівень " + name)
                    {
                        if (value > (int)userLvl)
                        {
                            result = name;
                        }
                    }
                }
            }
            result = result.Replace('_', '-');
            user.ObjLvlListening = result;
            db.SaveChanges();
        }
    // Продумать хорошую механику бота
    /* Нужна проработка покупки апгрейдов и пушек, нужна проработка заказа юнитов, нужна проработка апгрейда замка */


    private void Awake()
    {
        float trainingMultiplayer = 0f;

        difficultBot = (Difficult)PlayerPrefs.GetInt("Dufficult");

        switch (difficultBot)
        {
        case Difficult.Easy:
            trainingMultiplayer = 1f;
            break;

        case Difficult.Normal:
            trainingMultiplayer = 0.75f;
            break;

        case Difficult.Hard:
            trainingMultiplayer = 0.5f;
            botStackTrainUnits[3].trainingCost = 300;     // стоимость суперюнита на сложнов уровне
            break;
        }

        foreach (BotStackTrainUnit botStack in botStackTrainUnits)
        {
            botStack.trainTime *= trainingMultiplayer;
        }
    }
Esempio n. 11
0
 // Please override this method and must call base.Update();
 protected virtual void Update()
 {
     difficult = GameManager.instance.G_difficult;
     if (Time.time > limitTime)
     {
         GameManager.instance.SendResult(gameObject.scene.name, isCleared);
     }
 }
Esempio n. 12
0
 //Init Vars  if player press retry and load Main scene
 private void Init()
 {
     lifePoint   = INIT_LIFE_POINT;
     G_score     = 0;
     gameState   = GameState.START;
     G_difficult = Difficult.EASY;
     SceneManager.LoadScene("Main");
 }
Esempio n. 13
0
 public override string ToString()
 {
     return((PreviousBlockHash != null ? Base58.Bitcoin.Encode(new Span <Byte>(PreviousBlockHash)) : "")
            + Difficult.ToString()
            + (MerkleRoot != null ? Base58.Bitcoin.Encode(new Span <Byte>(MerkleRoot)) : "")
            + TimeStampTicks
            + Depth
            + Nonce);
 }
Esempio n. 14
0
    public void SetupGenerator(int level)
    {
        if (level >= 0)
        {
            difficult = Difficult.dummy;
        }
        if (level >= 5)
        {
            difficult = Difficult.easy;
        }
        if (level >= 10)
        {
            difficult = Difficult.medium;
        }
        if (level >= 15)
        {
            difficult = Difficult.hard;
        }
        if (level >= 20)
        {
            difficult = Difficult.hardest;
        }

        totalPlanets += level * 2;

        switch (difficult)
        {
        case Difficult.dummy:
            SetOffsets(2.25f, 2.75f, -0.5f, 0.5f);
            leftSpawnPos  = -3.75f;
            rightSpawnPos = 3.75f;
            break;

        case Difficult.easy:
            leftSpawnPos  = -3.5f;
            rightSpawnPos = 3.5f;
            SetOffsets(1.75f, 2.25f, -1f, 1f);
            break;

        case Difficult.medium:
            leftSpawnPos  = -3.25f;
            rightSpawnPos = 3.25f;
            SetOffsets(1.5f, 1.75f, -1.5f, 1.5f);
            break;

        case Difficult.hard:
            SetOffsets(1.25f, 1.5f, -1.5f, 1.5f);
            break;

        case Difficult.hardest:
            asteroidsOn = true;
            SetOffsets(0.75f, 1.25f, -2f, 2f);
            break;
        }

        GenerateLevel(totalPlanets);
    }
Esempio n. 15
0
        public GameBoard(Difficult difficult, GameObject colliderEasy, GameObject colliderMiddle, GameObject colliderHard, GameObject meshEasy, GameObject meshMiddle, GameObject meshHard)
        {
            _fieldSize = new Vector2(
                _boardSize.x - _borderThickness * 2,
                _boardSize.y / 2 - _borderThickness);

            _crossbar   = new Crossbar(difficult, colliderEasy, colliderMiddle, colliderHard, meshEasy, meshMiddle, meshHard);
            _puck       = new Puck();
            _rubberRope = new RubberRope(_fieldSize.x);
        }
Esempio n. 16
0
        public async Task <IActionResult> Create([Bind("Name,Description,IsDeleted,DeletedOn,Id,CreatedOn,ModifiedOn")] Difficult difficult)
        {
            if (this.ModelState.IsValid)
            {
                this._context.Add(difficult);
                await this._context.SaveChangesAsync();

                return(this.RedirectToAction(nameof(this.Index)));
            }
            return(this.View(difficult));
        }
Esempio n. 17
0
        public Crossbar(Difficult difficult, GameObject colliderEasy, GameObject colliderMiddle, GameObject colliderHard, GameObject meshEasy, GameObject meshMiddle, GameObject meshHard)
        {
            _colliderEasy   = colliderEasy;
            _colliderMiddle = colliderMiddle;
            _colliderHard   = colliderHard;

            _meshEasy   = meshEasy;
            _meshMiddle = meshMiddle;
            _meshHard   = meshHard;

            SwitchDifficult(difficult);
        }
        public ActionResult TestUserReading(int id)
        {
            var userLvl = (from u in db.User
                           where u.UserId == id
                           select u.ObjLvlReading).First().Replace('-', '_');
            Difficult current = (Difficult)Enum.Parse(typeof(Difficult), userLvl);
            int       index   = (int)current + 1;
            string    nextLvl = "Текст на рівень знань: ";

            if (Enum.IsDefined(typeof(Difficult), index))
            {
                nextLvl += ((Difficult)index).ToString();
            }
            return(RedirectToAction("Index", "TextTask", new { area = "", taskName = nextLvl }));
        }
        public ActionResult TestUserWriting(int id)
        {
            var userLvl = (from u in db.User
                           where u.UserId == id
                           select u.ObjLvlWriting).First().Replace('-', '_');
            Difficult current = (Difficult)Enum.Parse(typeof(Difficult), userLvl);
            int       index   = (int)current + 1;
            string    nextLvl = "Рівень ";

            if (Enum.IsDefined(typeof(Difficult), index))
            {
                nextLvl += ((Difficult)index).ToString();
            }
            return(RedirectToAction("Listening", "Grammar", new { area = "", number = 10, name = nextLvl }));
        }
Esempio n. 20
0
        public static Resources GetComputerStartResources(Difficult difficult)
        {
            var startResources = new Dictionary <Difficult, Resources>(5);

            startResources.Add(Difficult.King, new Resources(30000, 30, 30, 15, 15, 15, 15));

            startResources.Add(Difficult.Queen, new Resources(20000, 20, 20, 10, 10, 10, 10));

            startResources.Add(Difficult.Rook, new Resources(15000, 15, 15, 7, 7, 7, 7));

            startResources.Add(Difficult.Knight, new Resources(10000, 10, 10, 4, 4, 4, 4));

            startResources.Add(Difficult.Pawn, new Resources(0, 0, 0, 0, 0, 0, 0));

            return(startResources[difficult]);
        }
        public ActionResult TestUserListening(int id)
        {
            var userLvl = (from u in db.User
                           where u.UserId == id
                           select u.ObjLvlListening).First().Replace('-', '_');
            Difficult current = (Difficult)Enum.Parse(typeof(Difficult), userLvl);
            int       index   = (int)current + 1;
            string    nextLvl = "Рівень сприйняття на слух: ";

            if (Enum.IsDefined(typeof(Difficult), index))
            {
                nextLvl += ((Difficult)index).ToString();
            }
            int testId = db.Test.Where(x => x.Name == nextLvl).Select(x => x.TestId).First();

            return(RedirectToAction("Test", "Test", new { area = "", id = testId }));
        }
Esempio n. 22
0
        public void SwitchDifficult(Difficult difficult)
        {
            switch (difficult)
            {
            case Difficult.Middle:
                _width = _widthMiddle;

                _colliderEasy.SetActive(false);
                _colliderMiddle.SetActive(true);
                _colliderHard.SetActive(false);

                _meshEasy.SetActive(false);
                _meshMiddle.SetActive(true);
                _meshHard.SetActive(false);

                break;

            case Difficult.Hard:
                _width = _widthHard;

                _colliderEasy.SetActive(false);
                _colliderMiddle.SetActive(false);
                _colliderHard.SetActive(true);

                _meshEasy.SetActive(false);
                _meshMiddle.SetActive(false);
                _meshHard.SetActive(true);

                break;

            case Difficult.Easy:
            default:
                _width = _widthEasy;

                _colliderEasy.SetActive(true);
                _colliderMiddle.SetActive(false);
                _colliderHard.SetActive(false);

                _meshEasy.SetActive(true);
                _meshMiddle.SetActive(false);
                _meshHard.SetActive(false);

                break;
            }
        }
        public ActionResult TestUserGrammar(int id)
        {
            var userLvl = (from u in db.User
                           where u.UserId == id
                           select u.ObjectiveLevel).First().Replace('-', '_');
            Difficult current = (Difficult)Enum.Parse(typeof(Difficult), userLvl);
            int       index   = (int)current + 1;
            string    nextLvl = "Рівень ";

            if (Enum.IsDefined(typeof(Difficult), index))
            {
                nextLvl += ((Difficult)index).ToString();
            }
            var testId = (from t in db.Test
                          where t.Name == nextLvl
                          select t.TestId).First();

            return(RedirectToAction("Test", "Test", new { area = "", id = testId }));
        }
Esempio n. 24
0
        /// <summary>
        /// Intersecting difficulty level constraints
        /// </summary>
        /// <param name="cells">cells</param>
        /// <param name="level">difficult</param>
        /// <returns>All rith if it's true, otherwise - false</returns>
        public static bool IntersectingConstarint(this List <Cell> cells, Difficult level)
        {
            var intersectIsOk = false;

            switch (level)
            {
            case Difficult.Easy:
                intersectIsOk = cells.Any(cell => !(cell.Words.Count > COMMON_MIN_CONTRAINT_INTERSECT && cell.Words.Count <= EASY_CONSTRAINT_INTERSECT));
                break;

            case Difficult.Medium:
                intersectIsOk = cells.Any(cell => !(cell.Words.Count > COMMON_MIN_CONTRAINT_INTERSECT && cell.Words.Count <= MEDIUM_CONTRAINT_INTERSECT));
                break;

            case Difficult.Hard:
                intersectIsOk = cells.Any(cell => !(cell.Words.Count > COMMON_MIN_CONTRAINT_INTERSECT));
                break;
            }
            return(intersectIsOk);
        }
Esempio n. 25
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        if (UIMANAGER.instance.getDificuldade() == 2)
        {
            level = Difficult.hard;
        }
        if (UIMANAGER.instance.getDificuldade() == 3)
        {
            level = Difficult.normal;
        }
        if (UIMANAGER.instance.getDificuldade() == 4)
        {
            level = Difficult.pvpLocal;
        }
        if (UIMANAGER.instance.getDificuldade() == 5)
        {
            level = Difficult.pvpOn;
        }

        _tabuleiro = new Simbolos[BoardSize, BoardSize];
        _spots     = new Spot[BoardSize, BoardSize];

        var allSpots = GetComponentsInChildren <Spot>();

        foreach (var spot in allSpots)
        {
            _spots[spot.Linha, spot.Coluna] = spot;
        }

        SimboloInicial = getSimboloInicial();
    }
        public static string GetString(Difficult difficult)
        {
            switch (difficult)
            {
            case Difficult.EZ:
                return("-ez");

            case Difficult.NM:
                return("");

            case Difficult.HD:
                return("-hd");

            case Difficult.SHD:
                return("-shd");

            case Difficult.EX:
                return("-ex");

            case Difficult.DJMAX_EZ:
                return("_ez");

            case Difficult.DJMAX_NM:
                return("_nm");

            case Difficult.DJMAX_HD:
                return("_hd");

            case Difficult.DJMAX_MX:
                return("_mx");

            case Difficult.DJMAX_SC:
                return("_sc");

            default:
                return(null);
            }
        }
        public static string GetFullName(Difficult difficult)
        {
            switch (difficult)
            {
            case Difficult.EZ:
                return("Easy mix");

            case Difficult.NM:
                return("Normal mix");

            case Difficult.HD:
                return("Hard mix");

            case Difficult.SHD:
                return("SuperHard mix");

            case Difficult.EX:
                return("Extreme mix");

            case Difficult.DJMAX_EZ:
                return("Easy mode");

            case Difficult.DJMAX_NM:
                return("Normal mode");

            case Difficult.DJMAX_HD:
                return("Hard mode");

            case Difficult.DJMAX_MX:
                return("Maximum mode");

            case Difficult.DJMAX_SC:
                return("SuperCrazy mode");

            default:
                return(null);
            }
        }
Esempio n. 28
0
    public void DifficultSwitchRight()
    {
        switch (difficult)
        {
        case Difficult.Easy:
            difficult          = Difficult.Normal;
            difficultText.text = Application.systemLanguage == SystemLanguage.Russian ? "НОРМАЛЬНО" : "NORMAL";
            PlayerPrefs.SetInt("Dufficult", (int)difficult);
            break;

        case Difficult.Normal:
            difficult          = Difficult.Hard;
            difficultText.text = Application.systemLanguage == SystemLanguage.Russian ? "СЛОЖНО" : "HARD";
            PlayerPrefs.SetInt("Dufficult", (int)difficult);
            break;

        case Difficult.Hard:
            difficult          = Difficult.Easy;
            difficultText.text = Application.systemLanguage == SystemLanguage.Russian ? "ПРОСТО" : "SIMPLE";
            PlayerPrefs.SetInt("Dufficult", (int)difficult);
            break;
        }
    }
Esempio n. 29
0
        public void OnAwake()
        {
            dataPlayer = actor.GetData <DataPlayer>();
            foreach (var item in dataPlayer.squad)
            {
                coundowns.Add(item, 0.0f);
            }

            dataPlayer.manaMax    = dataPlayer.startMaxMana;
            dataPlayer.mana.Value = 0;

            manager      = Toolbox.Get <GameManager>();
            managerUnits = Toolbox.Get <ManagerUnits>();
            if (dataPlayer.side == Side.left)
            {
                enemyUnits = managerUnits.right;
            }
            else
            {
                enemyUnits = managerUnits.left;
            }

            difficult = actor.GetData <DataAi>().difficult;

            if (difficult == Difficult.easy)
            {
                timeToAction = 5f;
            }
            else if (difficult == Difficult.normal)
            {
                timeToAction = 3f;
            }
            else
            {
                timeToAction = 0f;
            }
        }
    private void CheckWinAchivment()
    {
        AchivmentsController.instance.AggressiveCapture();
        switch (gameMode)
        {
        case GameMode.Standart:
            AchivmentsController.instance.Duelist();
            break;

        case GameMode.CuptureTower:
            AchivmentsController.instance.Invader();
            break;

        case GameMode.Custom:
            AchivmentsController.instance.InsaneBattle();
            break;
        }

        if (gameMode != GameMode.Custom)
        {
            Difficult difficult = FindObjectOfType <BotController>().difficultBot;
            switch (difficult)
            {
            case Difficult.Easy:
                AchivmentsController.instance.Captain();
                break;

            case Difficult.Normal:
                AchivmentsController.instance.Colonel();
                break;

            case Difficult.Hard:
                AchivmentsController.instance.Marshal();
                break;
            }
        }
    }