Ejemplo n.º 1
0
    public void HitExit()
    {
        //win level
        //Записывать данные об уровне.
        bool medal  = false;
        bool secret = false;

        AudioManager._instance.PlaySoundEffect(hitExitSound);
        stopTimer = true;

        gameParam.currentLevel.isLevelComplete = true;//Возможно стоит добавлять прогресс главы тут, а не потом делать 3 цикла.
        //gameParam.currentChapter.progress++;

        if (!gameParam.currentLevel.medalS && isSecretFind)
        {
            awardsController.SetAward("FIRST SECRET");
            awardsController.SetAward("SPEED");
            gameParam.currentLevel.medalS = true;
            secret = true;
            gameParam.playerMoney += 4;
            //gameParam.currentChapter.progress++;
        }
        if (!gameParam.currentLevel.medalM && currentTime <= gameParam.currentLevel.forMedalTime)
        {
            awardsController.SetAward("FIRST MEDAL");
            awardsController.SetAward("EXPLORER");
            gameParam.currentLevel.medalM = true;
            //gameParam.currentChapter.progress++;
        }

        medal = currentTime <= gameParam.currentLevel.forMedalTime;

        gameParam.currentLevel.currentTime = currentTime;
        //gameParam.currentLevel.attempts = attempt;

        if (!nextlevel.boss)
        {
            nextlevel.isLevelLock = false;
        }

        levelUI.gameObject.SetActive(false);
        levelCompleteMenu.gameObject.SetActive(true);//
        levelCompleteMenu.LevelComplete(medal, secret);
        //levelUI.LevelComplete();

        DataSaver.SaveData(gameParam, gameParam.name);
        DataSaver.SaveData(gameParam.currentLevel, gameParam.currentLevel.levelName);
    }
    void GetAwards()
    {
        new LogEventRequest()
        .SetEventKey("Awards")
        .Send((response) => {
            if (!response.HasErrors && response.ScriptData != null)
            {
                _awards = response.ScriptData.GetGSData("data");

                if (_awards != null)
                {
                    JSONObject json = JSONObject.Parse(_awards.JSON);

                    DialogInstance _awardsDialog = DialogManager.Instance.Show("AwardDialog");

                    AwardsController controller = _awardsDialog.GetComponent <AwardsController>();

                    controller.SetAward(json);
                }
            }
        });
    }