Пример #1
0
    void Calculate()
    {
        for (int i = 0; i < 5; i++)
        {
            materialCardItems[i] = null;
            //matIDArray[i] = -1;
        }

        if (heroCardItem != null)
        {
            //Ñ¡ÔñµÄÓ¢ÐÛµÄÀàÐÍID
            int temp_id = heroCardItem.templateID;

            //»ñµÃÓ¢ÐÛÐÇŒ¶

            int star = TableManager.GetCardByID(temp_id).Star;

            int nEvolveID = 0;
            //СÓÚ6µÄÇé¿öžúÎåÐÐÎÞ¹Ø
            if (star < 6)
            {
                nEvolveID = star;
            }
            else//ÐÇŒ¶Îª6µÄ¿šÅÆÉýµœ7ÐÇÒªžùŸÝÎåÐÐÀŽÅжÏ(ÐÇŒ¶+ÎåÐÐID)
            {
                nEvolveID += (star + heroCardItem.GetAttributeID());
            }

            for (int i = 0; i < 5; i++)
            {
                matIDArray[i] = TableManager.GetEvolveByID(nEvolveID).GetCardIDbyIndex(i);

                int  ncardNum = 0;
                bool bFind    = false;
                foreach (UserCardItem item in Obj_MyselfPlayer.GetMe().cardBagList)
                {
                    //±»±£»€µÄ¿šÅƲ»Äܱ»ÍÌ
                    if (!item.isProtected && !item.IsInFightArray() && item.templateID == matIDArray[i])
                    {
                        ncardNum++;

                        if (!bFind)
                        {
                            materialCardItems[i] = item;
                            bFind = true;
                        }

                        /*
                         * bool isUsed = false;
                         * for (int j = 0; j < 5; j++)
                         * {
                         * if (materialCardItems[j] != null &&
                         * materialCardItems[j].cardID == item.cardID)
                         * {
                         * isUsed = true;
                         * }
                         * }
                         * if (!isUsed)
                         * {
                         * materialCardItems[i] = item;
                         * }
                         */
                    }
                }


                if (ncardNum > 0)
                {
                    materialNum[i].color = Color.green;
                }
                else
                {
                    materialNum[i].color = Color.red;
                }
                materialNum[i].text = ncardNum + "/1";
            }



            Obj_MyselfPlayer.GetMe().evolutionMaterialItems = materialCardItems;
            isMatEnough = true;
            for (int i = 0; i < 5; i++)
            {
                //ȱ²ÄÁϵÄÇé¿ö
                if (matIDArray[i] > 0 && materialCardItems[i] == null)
                {
                    isMatEnough = false;
                    break;
                }
            }
            isCanEvo = isMatEnough & heroCardItem.IsFullLevel();
        }
        else
        {
            isCanEvo = false;
        }
    }