Example #1
0
    /// <summary>
    /// 获取当前卡片提升指定进化等级后的金钱消耗需求
    /// </summary>
    /// <param name="_mainCard">主卡 </param>
    /// <param name="evoTimes">副卡的进化次数</param>
    /// <param name="evoLevel">副卡的进化等级</param>
    public long getNeedMoneyByLevel(Card _mainCard, int evoTimes, int evoLevel)
    {
//		Debug.LogError ("--->>>_mainCard=" + _mainCard.getName () + ",evoTimes=" + evoTimes + ",evoLevel=" + evoLevel);
        //主卡吃卡后对应进化等级的消耗 - max(主卡吃卡前进化等级,副卡进化等级)对应进化等级消耗
        if (isMaxEvoLevel(_mainCard))
        {
            return(0);
        }
        EvolutionSample info = getEvoInfoByType(_mainCard);

        if (info == null)
        {
            return(0);
        }
        int newLv  = _mainCard.getTempUpdateEvoLevel(evoTimes);
        int evoSid = _mainCard.getEvolveNextSid();
        int maxLv  = Mathf.Max(_mainCard.getEvoLevel(), evoLevel);

//		Debug.LogError ("--->>newLv=" + newLv + ",maxLv=" + maxLv + ",minLv=" + minLv
//		                + ",newCost=" + getCostMoney (evoSid,newLv)
//		                + ",maxCost=" + getCostMoney (evoSid,maxLv)
//		                + ",minCost=" + getCostMoney (evoSid,minLv));
        return(getCostMoney(evoSid, newLv) - getCostMoney(evoSid, maxLv));

        /*
         * //进化后的等级
         * int upLv = Mathf.Min (card.getTem      pUpdateEvoLevel (evoLv), card.getMaxEvoLevel ());
         * //进化后等级的消耗
         * int upMoney = info.getNeedMoney () [upLv - 1];
         * int downLv = Mathf.Max (card.getEvoLevel (), 0);
         * int downMoney = downLv > 0 ? info.getNeedMoney () [downLv - 1] : 0;
         * //		Debug.LogError("==========card=" + card.getName() + ",evoLv=" + (card.getEvoLevel() + evoLv) + "EvoCost,upMoney=" + upMoney + ",downMoney=" + downMoney);
         * return upMoney - downMoney;
         */
    }
Example #2
0
 private void initInfo()
 {
     mainCard = StorageManagerment.Instance.getRole(UserManager.Instance.self.mainCardUid);
     evoInfo  = EvolutionManagerment.Instance.getEvoInfoByType(mainCard);
     initButtons();
     initUI();
     MaskWindow.UnlockUI();
 }
Example #3
0
    //解析模板数据
    public override void parseSample(int sid)
    {
        EvolutionSample sample  = new EvolutionSample();
        string          dataStr = getSampleDataBySid(sid);

        sample.parse(sid, dataStr);
        samples.Add(sid, sample);
    }
Example #4
0
    /** 获取当前卡片增加的等级 */
    public int getAddLevel(Card card)
    {
        if ((card.getEvoLevel() - 1) < 0)
        {
            return(0);
        }
        EvolutionSample info = getEvoInfoByType(card);

        return(info == null ? 0 : info.getAddLevel() [card.getEvoLevel() - 1]);
    }
Example #5
0
    public int getMaxLevell(Card card)
    {
        EvolutionSample info = getEvoInfoByType(card);

        if (info == null)
        {
            return(0);
        }
        return(info.getMaxEvoLevel());
    }
Example #6
0
    /// <summary>
    /// 加载天赋
    /// </summary>
    void loadTalent()
    {
        EvolutionSample sample = EvolutionManagerment.Instance.getEvoInfoByType(showCard);

        if (sample == null)
        {
            return;
        }
        string[] strs = sample.getAddTalentString();
        if (strs == null || strs.Length == 0)
        {
            return;
        }
        //			switchButton.gameObject.SetActive (true);
        CardAttrTalentItem tempTalent;

        if (talentList == null)
        {
            talentList = new List <CardAttrTalentItem> ();
        }
        else
        {
            for (int i = 0; i < talentList.Count; i++)
            {
                talentList[i].gameObject.SetActive(false);
                talentList[i].text1.text = "";
                talentList[i].text2.text = "";
            }
        }
        for (int i = 0, j = 0; i < strs.Length; i++)
        {
            //如果缓存有,就读缓存,没有就创建出来丢进缓存
            if (i >= talentList.Count)
            {
                tempTalent = NGUITools.AddChild(talentContent, talentPrefab).GetComponent <CardAttrTalentItem> ();
                tempTalent.transform.localPosition = new Vector3(0, i * -115, 0);
                tempTalent.transform.localScale    = Vector3.one;
                talentList.Add(tempTalent);
            }
            talentList[i].gameObject.SetActive(true);
            talentList[i].text2.text = strs [j];
            if (sample.getTalentNeedTimes() [j] > showCard.getEvoLevel())
            {
                talentList[i].text1.text = "[C65843]" + LanguageConfigManager.Instance.getLanguage("s0386", sample.getTalentNeedTimes() [j].ToString());
            }
            else
            {
                talentList[i].text1.text = Colors.GREEN + LanguageConfigManager.Instance.getLanguage("goddess11");
            }
            j++;
        }
        talentBg.height = 25 + 115 * strs.Length;
    }
Example #7
0
    /** 获取当前卡片的形象 */
    public int getImageSid(Card card)
    {
        EvolutionSample info = getEvoInfoByType(card);

        if (info == null || info.getIcoSid() == null || (card.getEvoLevel() - 1) < 0)
        {
            return(CardSampleManager.Instance.getRoleSampleBySid(card.sid).imageID);
        }
        else
        {
            return(info.getIcoSid() [card.getEvoLevel() - 1]);
        }
    }
Example #8
0
    /// <summary>
    /// 计算卡片回收后的奖品
    /// </summary>
    public List <PrizeSample> computeRestoreCardPrize()
    {
        List <PrizeSample> prizeList = new List <PrizeSample> ();
        int cardEvoLevel             = getEvoTimes();

        if (cardEvoLevel == 0)
        {
            return(prizeList);
        }
        PrizeSample     prize;
        EvolutionSample info = EvolutionManagerment.Instance.getEvoInfoByType(this);

        if (info == null)
        {
            return(prizeList);
        }
        long upMoney = info.getNeedMoney() [cardEvoLevel - 1];

        // 游戏币奖品
        if (upMoney > 0)
        {
            prize = new PrizeSample(PrizeType.PRIZE_MONEY, 0, upMoney);
            prizeList.Add(prize);
        }
        int debrisPrizeNum = 0;
        int debrisPrizeSid = 0;
        int cardQualityId  = getQualityId();

        if (cardQualityId == QualityType.GOOD)
        {
            debrisPrizeNum = cardEvoLevel * 1;
            debrisPrizeSid = PropManagerment.PROP_PRIPLE_DEBRIS_SID;
        }
        else if (cardQualityId == QualityType.EPIC)
        {
            debrisPrizeNum = cardEvoLevel * 10;
            debrisPrizeSid = PropManagerment.PROP_PRIPLE_DEBRIS_SID;
        }
        else if (cardQualityId == QualityType.LEGEND)
        {
            debrisPrizeNum = cardEvoLevel * 10;
            debrisPrizeSid = PropManagerment.PROP_PRIPLE_ORANGE_SID;
        }
        // 碎片奖励
        if (debrisPrizeNum > 0 && debrisPrizeSid != 0)
        {
            prize = new  PrizeSample(PrizeType.PRIZE_PROP, debrisPrizeSid, debrisPrizeNum);
            prizeList.Add(prize);
        }
        return(prizeList);
    }
Example #9
0
    private int getTalentNeedTimes(EvolutionSample sample, int index)
    {
        int loc = index;

        if (loc > sample.getTalentNeedTimes().Length - 1)
        {
            loc = sample.getTalentNeedTimes().Length - 1;
        }
        if (loc < 0)
        {
            loc = 0;
        }
        return(sample.getTalentNeedTimes()[loc]);
    }
Example #10
0
    /** 获取当前卡片的附加效果 */
    public AttrChangeSample[] getAddEffect(Card card)
    {
        if (card.getEvolveNextSid() == 0)
        {
            return(null);
        }
        if ((card.getEvoLevel() - 1) < 0)
        {
            return(null);
        }
        EvolutionSample info = getEvoInfoByType(card);

        return(info == null ? null : info.getAddEffects() [card.getEvoLevel() - 1]);
    }
Example #11
0
    /** 获取当前卡片的金钱消耗需求 */
    public long getCostMoney(Card card)
    {
        EvolutionSample info = getEvoInfoByType(card);

        if (info == null)
        {
            return(0);
        }
        if (card.getEvoLevel() == 0)
        {
            return(0);
        }
        int index = Mathf.Clamp(card.getEvoLevel() - 1, 0, info.getNeedMoney().Length - 1);

        return(info.getNeedMoney() [index]);
    }
Example #12
0
    /** 获取当前卡片进化到下一级的消耗需求 */
    public EvolutionCondition[] getEvoCon(Card card)
    {
        if (isMaxEvoLevel(card))
        {
            return(null);
        }
        EvolutionSample info = getEvoInfoByType(card);

        if (info != null && info.getConditions() != null)
        {
            return(info.getConditions() [card.getEvoLevel()]);
        }
        else
        {
            return(null);
        }
    }
Example #13
0
    /** 获取进化极限次数 */
    public int getMaxLevel(Card card)
    {
        EvolutionSample info = getEvoInfoByType(card);

        if (info == null)
        {
            return(0);
        }
        if (card.isMainCard())
        {
            return(info.getMaxEvoLevel());
        }
        long[] exp = EXPSampleManager.Instance.getEXPSampleBySid(79).getExps();
        return((int)exp[info.getMaxEvoLevel() - 1 >= exp.Length ? exp.Length - 1 : info.getMaxEvoLevel() - 1]);
        //else
        //
    }
Example #14
0
    /** 获取指定sid和进化等级的金钱消耗需求 */
    public long getCostMoney(int sid, int lv)
    {
        EvolutionSample info = getEvoInfoByType(sid);

        if (info == null)
        {
            return(0);
        }
        if (lv == 0)
        {
            return(0);
        }
        int index = Mathf.Clamp(lv - 1, 0, info.getNeedMoney().Length - 1);

//		Debug.LogError ("--->>>sid=" + sid + ",lv=" + lv + ",index=" + index);
        return(info.getNeedMoney() [index]);
    }
Example #15
0
    void UpdateTalent()
    {
        Utils.DestoryChilds(roadItemRoot);
        HeroRoad heroRoad = heroRoadItem.heroRoad;

        MissionSample[] missions = heroRoad.getMissionsByChapter();
        if (missions == null)
        {
            return;
        }
        EvolutionSample sample = EvolutionManagerment.Instance.getEvoInfoByType(heroRoad.sample.sid);

        if (sample == null)
        {
            return;
        }
        int[] awakeInfo = heroRoad.getAwakeInfo();
        for (int i = 0, j = 0; i < awakeInfo.Length; i++)
        {
            if (awakeInfo [i] == -1)
            {
                continue;
            }
            int                state         = awakeInfo [i];
            GameObject         talentitemObj = Instantiate(talentitem) as GameObject;
            CardAttrTalentItem talentItem    = talentitemObj.GetComponent <CardAttrTalentItem>();
            talentItem.text2.text = missions[i].other[3];
            talentItem.gameObject.SetActive(true);
            talentItem.transform.parent        = roadItemRoot.transform;
            talentItem.transform.localPosition = new Vector3(0, -115 + (j * -100), 0);
            talentItem.transform.localScale    = new Vector3(0.8f, 0.8f, 1);
            if (heroRoad.activeCount < (i + 1))
            {
                talentItem.text2.color = Color.gray;
            }
            else
            {
                talentItem.text2.color = Color.white;
            }
            talentItem.text1.gameObject.SetActive(true);
            talentItem.text1.text = string.Format(LanguageConfigManager.Instance.getLanguage("s0445"), i + 1, getTalentNeedTimes(sample, j));
            j++;
        }
    }
Example #16
0
    /** 是否已进化到极限次数 */
    public bool isMaxEvoLevel(Card card)
    {
        EvolutionSample info = getEvoInfoByType(card);

        if (info == null)
        {
            return(true);
        }
        if (card.isMainCard())
        {
            return(card.getEvoTimes() >= info.getMaxEvoLevel());
        }
        long[] exps  = EXPSampleManager.Instance.getEXPSampleBySid(79).getExps();
        int    index = card.getEvoTimes();

        for (int i = 0; i < exps.Length - 1; i++)
        {
            if (exps[i] <= card.getEvoTimes() && exps[i + 1] > card.getEvoTimes())
            {
                index = i + 1;
            }
        }
        return(index >= info.getMaxEvoLevel());
    }
Example #17
0
    /** 获得卡片进化价值 */
    public int getEvoValue(Card _card)
    {
        EvolutionSample info = getEvoInfoByType(_card);

        return(info.getEvoValue());
    }
Example #18
0
    /** 获取当前卡片天赋开启需要进化次数需求列表 */
    public int[] getTalentNeedTimes(Card card)
    {
        EvolutionSample info = getEvoInfoByType(card);

        return(info == null ? null : info.getTalentNeedTimes());
    }
Example #19
0
    /** 获取当前卡片所有天赋描述 */
    public string[] getAddTalentString(Card card)
    {
        EvolutionSample info = getEvoInfoByType(card);

        return(info == null ? null : info.getAddTalentString());
    }
Example #20
0
    public override void copy(object destObj)
    {
        base.copy(destObj);
        EvolutionSample dest = destObj as EvolutionSample;

        if (this.icoSid != null)
        {
            dest.icoSid = new int[this.icoSid.Length];
            for (int i = 0; i < this.icoSid.Length; i++)
            {
                dest.icoSid [i] = this.icoSid [i];
            }
        }
        if (this.cardLevel != null)
        {
            dest.cardLevel = new int[this.cardLevel.Length];
            for (int i = 0; i < this.cardLevel.Length; i++)
            {
                dest.cardLevel [i] = this.cardLevel [i];
            }
        }
        if (this.playerLevel != null)
        {
            dest.playerLevel = new int[this.playerLevel.Length];
            for (int i = 0; i < this.playerLevel.Length; i++)
            {
                dest.playerLevel [i] = this.playerLevel [i];
            }
        }
        if (this.needMoney != null)
        {
            dest.needMoney = new long[this.needMoney.Length];
            for (int i = 0; i < this.needMoney.Length; i++)
            {
                dest.needMoney [i] = this.needMoney [i];
            }
        }
        if (this.conditions != null)
        {
            dest.conditions = new EvolutionCondition[this.conditions.Length][];
            EvolutionCondition[] temp;
            for (int i = 0; i < this.conditions.Length; i++)
            {
                temp = conditions [i];
                if (temp != null)
                {
                    dest.conditions [i] = new EvolutionCondition[temp.Length];
                    for (int j = 0; j < temp.Length; j++)
                    {
                        dest.conditions [i] [j] = temp [j].Clone() as EvolutionCondition;
                    }
                }
            }
        }
        if (this.addLevel != null)
        {
            dest.addLevel = new int[this.addLevel.Length];
            for (int i = 0; i < this.addLevel.Length; i++)
            {
                dest.addLevel [i] = this.addLevel [i];
            }
        }
        if (this.addEffects != null)
        {
            dest.addEffects = new AttrChangeSample[this.addEffects.Length][];
            AttrChangeSample[] temp;
            for (int i = 0; i < this.addEffects.Length; i++)
            {
                temp = addEffects [i];
                if (temp != null)
                {
                    dest.addEffects [i] = new AttrChangeSample[temp.Length];
                    for (int j = 0; j < temp.Length; j++)
                    {
                        dest.addEffects [i] [j] = temp [j].Clone() as AttrChangeSample;
                    }
                }
            }
        }
        if (this.addTalentString != null)
        {
            dest.addTalentString = new string[this.addTalentString.Length];
            for (int i = 0; i < this.addTalentString.Length; i++)
            {
                dest.addTalentString [i] = this.addTalentString [i];
            }
        }
        if (this.talentNeedTimes != null)
        {
            dest.talentNeedTimes = new int[this.talentNeedTimes.Length];
            for (int i = 0; i < this.talentNeedTimes.Length; i++)
            {
                dest.talentNeedTimes [i] = this.talentNeedTimes [i];
            }
        }
    }
Example #21
0
    /** 获取当前卡片进化到下一级的玩家等级需求 */
    public int getPlayerLevel(Card card)
    {
        EvolutionSample info = getEvoInfoByType(card);

        return(info == null ? 0 : (isMaxEvoLevel(card) ? info.getPlayerLevel() [card.getEvoLevel() - 1] : info.getPlayerLevel() [card.getEvoLevel()]));
    }