public void ShowLevelInfo(Map map)
    {
        levelInfoBg.CrossFadeAlpha(1f, 0.2f, true);
        Image[] images = levelInfoBg.GetComponentsInChildren <Image> ();
        foreach (Image image in images)
        {
            image.CrossFadeAlpha(1f, 0.2f, true);
        }
        Text[] texts = levelInfoBg.GetComponentsInChildren <Text> ();
        foreach (Text text in texts)
        {
            text.CrossFadeAlpha(1f, 0.2f, true);
        }

        foreach (Text levelNameLabel in levelNameLabels)
        {
            levelNameLabel.text = map.title;
        }
        authorLabel.text = "by " + map.author;
        scoreLabel.text  = "Best Score: " + PlayerProgression.GetBestScore(map.name);
        timeLabel.text   = "Time Limit: " + UIHelpers.ConvertToSecondsTimeString(map.timeLimit);
        minesLabel.text  = "Mines: " + map.difficulty.ToString();

        if (PlayerProgression.HasCompletedLevel(map.name))
        {
            checkmark.enabled = true;
        }
        else
        {
            checkmark.enabled = false;
        }
    }
Exemple #2
0
    public void Init(Map map)
    {
        levelMap          = map;
        isUnlocked        = PlayerProgression.HasCompletedLevel(levelMap.keyID);
        isActive          = isUnlocked;
        lockImage.enabled = !isUnlocked;
        Sprite sprite = Resources.Load <Sprite>("Frames/" + map.frame);

        if (sprite != null)
        {
            frameImage.sprite = sprite;
        }
        transform.localScale = Vector3.one;

        sprite = Resources.Load <Sprite>("Features/" + map.name + "Small");
        if (sprite != null)
        {
            featureImage.sprite = sprite;
        }

        RectTransform trans = (RectTransform)frameImage.transform;

        switch (map.shape)
        {
        case FrameShape.Portrait:
            trans.sizeDelta = new Vector2(trans.sizeDelta.x, trans.sizeDelta.x * 10 / 8);
            break;

        case FrameShape.Square:
            trans.sizeDelta = new Vector2(trans.sizeDelta.y, trans.sizeDelta.y);
            break;

        case FrameShape.Landscape:
            trans.sizeDelta = new Vector2(trans.sizeDelta.y * 10 / 8, trans.sizeDelta.y);
            break;
        }

        int best = PlayerProgression.GetBestScore(levelMap.name);

        ribbon.SetActive(best >= levelMap.pointTarget);
    }