Пример #1
0
    public void switchToNode(string node)
    {
        foreach (KeyValuePair <string, SubSceneNode> nodePair in SubSceneNode.getDict())
        {
            if (nodePair.Value.isActive())
            {
                nodePair.Value.setActive(false);
                previousnode = nodePair.Key;
                break;
            }
        }

        SubSceneNode.getNode(node).setActive(true);
    }
    public void previewCard(GameObject card)
    {
        currentPreviewedCard = card;
        cardProgressPreviewCard.loadCardDetails(currentPreviewedCard);
        CardProgress prog   = PlayerCardProgress.Instance().cards[currentPreviewedCard.GetComponent <CardDetails>().cardName];
        int          maxExp = 0;

        switch (prog.progress)
        {
        case CardProgression.Unlearned: {
            progressMeterBackground.sprite = untrainedBackground;
            maxExp = PlayerCardProgress.Instance().untrainedExpCap;
            break;
        }

        case CardProgression.Trained: {
            progressMeterBackground.sprite = trainedBackground;
            maxExp = PlayerCardProgress.Instance().trainedExpCap;
            break;
        }

        case CardProgression.Adept: {
            progressMeterBackground.sprite = adeptBackground;
            maxExp = PlayerCardProgress.Instance().adpetExpCap;
            break;
        }

        case CardProgression.Proficient: {
            progressMeterBackground.sprite = proficientBackground;
            maxExp = PlayerCardProgress.Instance().proficientExpCap;
            break;
        }

        case CardProgression.Mastered: {
            progressMeterBackground.sprite = masteredBackground;
            maxExp = PlayerCardProgress.Instance().masteredExpCap;
            break;
        }

        case CardProgression.Perfected: {
            progressMeterBackground.sprite = perfectedBackground;
            cardProgress.value             = 1.0f;
            zeroPercText.gameObject.SetActive(false);
            twentyfivePercText.gameObject.SetActive(false);
            fiftyPercText.gameObject.SetActive(false);
            seventyfivePercText.gameObject.SetActive(false);
            hundredPercText.gameObject.SetActive(false);
            break;
        }
        }

        progressMeterTitleText.text = prog.progress.ToString();
        if (prog.progress == CardProgression.Perfected)
        {
            cardProgress.value = 1;
        }
        else
        {
            cardProgress.value = ((float)prog.expPoints) / ((float)maxExp);
        }
        zeroPercText.text        = "0";
        twentyfivePercText.text  = (maxExp / 4).ToString();
        fiftyPercText.text       = (maxExp / 2).ToString();
        seventyfivePercText.text = ((3 * maxExp) / 4).ToString();
        hundredPercText.text     = (maxExp).ToString();

        if ((!SubSceneNode.getDict().ContainsKey("Battle") || !SubSceneNode.getDict()["Battle"].isActive()) &&
            prog.progress != CardProgression.Perfected &&
            prog.expPoints >= maxExp)
        {
            rankUpButton.interactable = true;
        }
        else
        {
            rankUpButton.interactable = false;
        }
    }