private void createLearnedProgress(GameObject card)
    {
        CardProgress progress = new CardProgress(card);

        progress.progress = CardProgression.Trained;
        //progress.expPoints = 120;
        PlayerCardProgress.Instance().cards.Add(card.GetComponent <CardDetails>().cardName, progress);
    }
示例#2
0
 /// <summary>
 /// Sets the type of progress inticator.
 /// The progress type can only be changed if the Card was initially built with a progress indicator.
 /// </summary>
 /// <returns>The Card itself, allows for chaining of calls</returns>
 /// <param name="progressType">A value of eIther PROGRESS_TYPE_NORMAL, PROGRESS_TYPE_LABEL or PROGRESS_TYPE_NO_PROGRESS</param>
 public Card SetProgressType(int progressType)
 {
     if (mCardProgress == null)
     {
         mCardProgress = new CardProgress();
     }
     mCardProgress.ProgressType = progressType;
     return(this);
 }
示例#3
0
            public CardProgress CreateShallowClone()
            {
                CardProgress progressClone = new CardProgress();

                progressClone.label        = label;
                progressClone.currProgress = currProgress;
                progressClone.maxValue     = maxValue;
                progressClone.progressType = progressType;
                return(progressClone);
            }
    public void addCardProg(CardProgress cardProg, bool forceRefresh)
    {
        GameObject cardProgressListItemGO = Instantiate(cardProgressListItemPrefab, cardProgressListTransform);

        cardProgressListItemGO.GetComponent <CardProgressListItem>().setCard(cardProg);
        if (forceRefresh)
        {
            LayoutRebuilder.ForceRebuildLayoutImmediate(cardProgressListTransform as RectTransform);
        }
        cardProgListItemMap.Add(cardProg.cardName, cardProgressListItemGO);
        checkIfRankUpTextShouldShow(cardProg.cardName);
    }
    public void cardExpGain(CardDetails card)
    {
        if (!cards.ContainsKey(card.cardName))
        {
            CardProgress cardProgTmp = new CardProgress(card.prefabRef);
            cards.Add(card.cardName, cardProgTmp);
            CardProgressController.Instance().addCardProg(cardProgTmp, true);
        }

        CardProgress cardProg = cards[card.cardName];

        cardProg.expPoints += (card.character == CombatCharacter.Player() ? selfCastExpGain : enemyCastExpGain);

        int expCap = 0;

        switch (cardProg.progress)
        {
        case CardProgression.Unlearned: {
            expCap = untrainedExpCap;
            break;
        }

        case CardProgression.Trained: {
            expCap = trainedExpCap;
            break;
        }

        case CardProgression.Adept: {
            expCap = adpetExpCap;
            break;
        }

        case CardProgression.Proficient: {
            expCap = proficientExpCap;
            break;
        }

        case CardProgression.Mastered: {
            expCap = masteredExpCap;
            break;
        }

        case CardProgression.Perfected: {
            expCap = 1;
            break;
        }
        }

        cardProg.expPoints = Mathf.Clamp(cardProg.expPoints, 0, expCap);
        CardProgressController.Instance().checkIfRankUpTextShouldShow(cardProg.cardName);
    }
    public void checkIfRankUpTextShouldShow(string cardName)
    {
        GameObject   cardProgressListItemGO = cardProgListItemMap[cardName];
        CardProgress prog = PlayerCardProgress.Instance().cards[cardName];

        int maxExp = 0;

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

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

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

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

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

        case CardProgression.Perfected: {
            return;
        }
        }

        if (prog.expPoints >= maxExp)
        {
            cardProgressListItemGO.GetComponent <CardProgressListItem>().rankUpText.SetActive(true);
        }
    }
示例#7
0
    public int getFocusLearnCost()
    {
        if ((character == null || character == CombatCharacter.Player()) &&
            PlayerCardProgress.Instance().cards.ContainsKey(cardName))
        {
            CardProgress prog = PlayerCardProgress.Instance().cards[cardName];
            if (prog.progress == CardProgression.Perfected)
            {
                return(Mathf.FloorToInt(((float)learnCost) * 0.8f));
            }
            else if (prog.progress == CardProgression.Proficient ||
                     prog.progress == CardProgression.Mastered)
            {
                return(Mathf.FloorToInt(((float)learnCost) * 0.9f));
            }
        }

        return(learnCost);
    }
    public void rankUpPreviewCard()
    {
        CardProgress prog = PlayerCardProgress.Instance().cards[currentPreviewedCard.GetComponent <CardDetails>().cardName];

        switch (prog.progress)
        {
        case CardProgression.Unlearned: {
            prog.progress = CardProgression.Trained;
            PlayerCardCollection.Instance().cardCollection.Add(prog.card);
            break;
        }

        case CardProgression.Trained: {
            prog.progress = CardProgression.Adept;
            PlayerCardCollection.Instance().cardCollection.Add(prog.card);
            break;
        }

        case CardProgression.Adept: {
            prog.progress = CardProgression.Proficient;
            break;
        }

        case CardProgression.Proficient: {
            prog.progress = CardProgression.Mastered;
            PlayerCardCollection.Instance().cardCollection.Add(prog.card);
            break;
        }

        case CardProgression.Mastered: {
            prog.progress = CardProgression.Perfected;
            break;
        }
        }
        prog.expPoints = 0;

        loadCardProgress();
        previewCard(prog.card);
    }
 public void setCard(CardProgress cardProg)
 {
     card = cardProg.card;
     cardNameText.text  = card.GetComponent <CardDetails>().cardName;
     focusCostText.text = card.GetComponent <CardDetails>().getFocusLearnCost().ToString();
 }
    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;
        }
    }
示例#11
0
			public CardProgress CreateShallowClone() {
				CardProgress progressClone = new CardProgress ();
				progressClone.label = label;
				progressClone.currProgress = currProgress;
				progressClone.maxValue = maxValue;
				progressClone.progressType = progressType;
				return progressClone;
			}
示例#12
0
		/// <summary>
		/// Sets the type of progress inticator.
		/// The progress type can only be changed if the Card was initially built with a progress indicator.
		/// </summary>
		/// <returns>The Card itself, allows for chaining of calls</returns>
		/// <param name="progressType">A value of eIther PROGRESS_TYPE_NORMAL, PROGRESS_TYPE_LABEL or PROGRESS_TYPE_NO_PROGRESS</param>
		public Card SetProgressType(int progressType)
		{
			if (mCardProgress == null) {
				mCardProgress = new CardProgress ();
			}
			mCardProgress.ProgressType = progressType;
			return this;
		}