Esempio n. 1
0
    private void ShowSummary()
    {
        m_boardInputController.PauseInput();
        int tilesCount = m_gameplay.ImageProgress.Width * m_gameplay.ImageProgress.Height;

        int   colorsCount = m_referenceImage.Colors.Length;
        float time        = m_gameplay.Time;
        bool  record      =
            !m_gameplay.LevelProgress.IsCompleted ||
            m_gameplay.LevelProgress.BestTime > time;
        float timeFor3Stars = StarRatingCalc.RequiredTimeForStars(3, tilesCount, colorsCount);
        float timeFor2Stars = StarRatingCalc.RequiredTimeForStars(2, tilesCount, colorsCount);
        int   starsCount    = StarRatingCalc.GetStars(time, tilesCount, colorsCount);

        var imageViewData = LevelsScene.CreateImageViewData(m_referenceImage, m_gameplay.BundleId);

        if (imageViewData == null)
        {
            return;
        }

        m_hud.gameObject.SetActive(false);
        // m_summaryView.Show(imageViewData.ImageData.Name, starsCount, time, record, imageViewData.LevelProgress.BestTime, timeFor3Stars, timeFor2Stars);
        m_summaryController.Show(
            imageViewData.ImageData.Name,
            starsCount,
            time,
            record,
            imageViewData.LevelProgress.BestTime,
            timeFor3Stars,
            timeFor2Stars,
            m_gameplay.LevelProgress.GetSteps());

        AudioManager.GetInstance().SoundVictory.Play();
    }
Esempio n. 2
0
    public void SetupGameplay()
    {
        m_referenceImage = m_gameplay.ReferenceImage;
        var initialColor  = m_referenceImage.Colors[0];
        var imageProgress = m_gameplay.ImageProgress;

        m_boardInputController.BoardTileTapped += HandleBoardTileTapped;

        m_hud.Init(m_referenceImage.Colors);
        m_hud.SetPaleteButtonColor(initialColor);
        m_hud.PreviewPressed         += HandlePreviewPressed;
        m_hud.PreviewReleased        += HandlePreviewReleased;
        m_hud.PaletteClicked         += HandlePaletteClicked;
        m_hud.PauseClicked           += HandlePauseClicked;
        m_hud.CheatFillColorsClicked += HandleCheatFillColorsClicked;

        m_board.PreviewEnded += HandleBoardPreviewEnded;
        m_board.SetReferenceImage(m_referenceImage.Texture);
        m_board.SetSize(imageProgress.Width, imageProgress.Height);
        m_board.SetTiles(m_gameplay.ImageProgress.GetTiles());
        m_board.HidePreview();

        m_hud.m_palette.ColorClicked += HandleColorClicked;
        m_hud.m_palette.SetActiveColor(initialColor);
        m_hud.m_tileProgress.SetMax(m_gameplay.ImageProgress.TotalTiles);
        m_hud.m_tileProgress.SetCurrent(m_gameplay.ImageProgress.RevealedTiles);
        m_hud.m_cheatRevealImage.gameObject.SetActive(GameSettings.DevBuild);

        m_hud.m_palette.PaletteShown  += PaletteShown;
        m_hud.m_palette.PaletteClosed += PaletteClosed;

        m_pauseView.ResumeClicked     += HandlePauseViewResumeClicked;
        m_pauseView.BackToMenuClicked += HandlePauseViewBackToMenuClicked;
        m_pauseView.OptionsClicked    += HandlePauseViewOptionsClicked;
        m_pauseView.Hide();

        m_summaryView.BackToMenuClicked += HandleBackToMenuClicked;
        m_summaryView.Hide();

        m_summaryController = new SummaryController(m_board, m_summaryView, m_gameplay, m_boardInputController);

        m_bonusController = new BonusController();
        m_bonusController.Init(m_gameplay, m_bonusView, m_hud);

        m_tutorialView.Hide();
        if (m_gameplay.IsTutorialImage)
        {
            m_tutorial = new TutorialController();
            m_tutorial.Init(m_tutorialView, this);
        }

        var imageViewData = LevelsScene.CreateImageViewData(m_referenceImage, m_gameplay.BundleId);

        m_boardInputController.PauseInput();
        m_board.SetScale(Vector2.zero, m_board.MinScale);
        m_board.SetLocalPosition(Vector2.zero);
        m_levelIntroView.Finished += HandleLevelIntroViewFinished;
        m_levelIntroView.Show(imageViewData);
    }
Esempio n. 3
0
 /// <summary>
 /// 锁死所有关卡
 /// </summary>
 private void LockAllLevels()
 {
     _levelsDic.Clear();
     for (LevelsScene level = LevelsScene.DongShaCun; level < LevelsScene.FZHCRLYJZHXin;)
     {
         _levelsDic.Add(level, false);
         level = (LevelsScene)((int)level + 1);
     }
 }
Esempio n. 4
0
    private bool IsInProgress()
    {
        var imageViewData = LevelsScene.CreateImageViewData(m_referenceImage, m_gameplay.BundleId);

        if (imageViewData == null || imageViewData.LevelProgress == null)
        {
            return(false);
        }

        return(imageViewData.LevelProgress.IsInProgress);
    }
Esempio n. 5
0
    /// <summary>
    /// 解锁关卡
    /// </summary>
    /// <param name="level"></param>
    public void SetLevelUnlock(LevelsScene level)
    {
        if (!_levelsDic.ContainsKey(level))
        {
            Debug.Log("The level: " + level.ToString() + " is not exit !");
            return;
        }

        if (!_levelsDic[level])
        {
            _levelsDic[level] = true;
        }
    }