예제 #1
0
    string PreviewOne(Dictionary <int, EquipmentInfo> equipDic)
    {
        System.Text.StringBuilder   builder  = new System.Text.StringBuilder();
        Dictionary <int, ItemValue> itemList = new Dictionary <int, ItemValue>();
        int  coinNum = 0;
        bool haveHighQualityEquip = false;

        using (var e = equipDic.GetEnumerator())
        {
            while (e.MoveNext())
            {
                EquipmentInfo temp = e.Current.Value;
                if (temp == null)
                {
                    continue;
                }
                coinNum += temp.Price;
                //if(temp.Quality <= 3)continue;//蓝色及以下只有铜币
                if (temp.IsEquip)
                {
                    haveHighQualityEquip = true;//有稀有物品
                    StrengthenRef strengthenRef = ConfigMng.Instance.GetStrengthenRefByLv(temp.UpgradeLv);
                    if (strengthenRef != null)
                    {
                        for (int j = 0, maxJ = strengthenRef.decoItems.Count; j < maxJ; j++)
                        {
                            ItemValue item = strengthenRef.decoItems[j];
                            if (item.eid == 5)// 分解强化的装备也给钱
                            {
                                coinNum += item.count;
                            }
                            else
                            {
                                AddOne(itemList, item);
                            }
                        }
                    }
                    List <ItemValue> luckyItems = ConfigMng.Instance.GetEquipmentListByLuckyLv(temp.LuckyLv);
                    for (int i = 0, max = luckyItems.Count; i < max; i++)
                    {
                        ItemValue item = luckyItems[i];
                        AddOne(itemList, item);
                    }
                    List <ItemValue> qualityList = ConfigMng.Instance.GetResolveItemListByLv(temp.UseReqLevel, temp.Quality, (int)temp.Slot);
                    for (int h = 0, maxh = qualityList.Count; h < maxh; h++)
                    {
                        ItemValue item = qualityList[h];
                        AddOne(itemList, item);
                    }
                }
                else if (temp.Family == EquipmentFamily.MOUNTEQUIP)
                {
                    MountStrenConsumeRef mouuntStren = ConfigMng.Instance.GetMountStrenConsumeRef(temp.UpgradeLv);
                    if (mouuntStren != null)
                    {
                        if (mouuntStren.deco_cons != null && mouuntStren.deco_cons.eid != 0)
                        {
                            AddOne(itemList, mouuntStren.deco_cons);
                        }
                    }
                    MountEquQuailtRef quality = ConfigMng.Instance.GetMountEquipQualityRef(temp.Quality, temp.Slot);
                    if (quality != null)
                    {
                        if (quality.deco_cons != null && quality.deco_cons.eid != 0)
                        {
                            AddOne(itemList, quality.deco_cons);
                        }
                    }
                }
            }
        }
        if (labPrefabResult != null)       //预制描述
        {
            labPrefabResult.enabled = (equipDic.Count == 0);
        }
        if (labWillResult != null)       //描述
        {
            labWillResult.enabled = (equipDic.Count != 0);
        }
        builder.Append(ConfigMng.Instance.GetUItext(270));
        if (coinNum > 0)
        {
            builder.Append(ConfigMng.Instance.GetUItext(271)).Append(coinNum);
        }
        using (var e = itemList.GetEnumerator())
        {
            while (e.MoveNext())
            {
                ItemValue itemVal = e.Current.Value;
                builder.Append("  ");
                EquipmentInfo info = new EquipmentInfo(itemVal, EquipmentBelongTo.NONE);
                if (info != null)
                {
                    builder.Append(info.ItemName).Append("*").Append(itemVal.count);
                }
            }
        }
        if (haveHighQualityEquip)
        {
            builder.Append(ConfigMng.Instance.GetUItext(272));
        }
        return(builder.ToString());
    }
예제 #2
0
    void RefreshWnd()
    {
        lackEquipList.Clear();
        enough        = true;
        enoughPerfect = true;
        ResetWnd();
        if (GameCenter.equipmentTrainingMng.CurSelectEquipmentInfo == null)
        {
            return;
        }
        EquipmentInfo curEquip = new EquipmentInfo(GameCenter.equipmentTrainingMng.CurSelectEquipmentInfo, EquipmentBelongTo.PREVIEW);

        if (curEquip != null)
        {
            bool isMaxLv = curEquip.MaxPowerLvValue <= curEquip.UpgradeLv;
            RefreshGemSlots(curEquip.UpgradeLv);
            if (curUpgradeLv != null)
            {
                curUpgradeLv.text = "+" + curEquip.UpgradeLv.ToString();
            }
            if (labAddUpgradeLv != null)
            {
                labAddUpgradeLv.enabled = !isMaxLv;
            }
            if (strengthLvDes != null)
            {
                strengthLvDes.text = ConfigMng.Instance.GetStrengthenLvDesfByLv(curEquip.UpgradeLv).Replace("\\n", "\n");
            }
            ;
            if (labPerfectNum != null)
            {
                labPerfectNum.text = curEquip.StrengthExp.ToString() + "%";
            }
            if (perfectNum != null)
            {
                perfectNum.value = (float)curEquip.StrengthExp / 100f;
            }
            if (curEquipmentUI != null)
            {
                curEquipmentUI.FillInfo(curEquip);
            }
            if (curAttrNum != null)
            {
                curAttrNum.text = GameHelper.GetAttributeNameAndValue(curEquip.StrengthValue);
            }
            if (isMaxLvGo != null)
            {
                isMaxLvGo.SetActive(isMaxLv);
            }
            if (notMaxLvGo != null)
            {
                notMaxLvGo.SetActive(!isMaxLv);
            }
            if (!isMaxLv)
            {
                if (btnStrengthen != null)
                {
                    CancelInvoke("SetStrengthenActive");
                    Invoke("SetStrengthenActive", 0.1f);
                    //btnStrengthen.isEnabled = true;
                }
                if (btnOneKeyStrengthen != null)
                {
                    CancelInvoke("SetOneKeyStrengthenActive");
                    Invoke("SetOneKeyStrengthenActive", 0.1f);
                    //btnOneKeyStrengthen.isEnabled = true;
                }
                if (btnPerfectStrengthen != null)
                {
                    btnPerfectStrengthen.isEnabled = true;
                }
            }
            else
            {
                if (perfectGo != null)
                {
                    perfectGo.SetActive(true);                   //强化满的时候也显示金锤子
                }
            }
            EquipmentInfo nextEquip = (!isMaxLv ? new EquipmentInfo(curEquip) : null);
            if (nextEquip != null)
            {
                if (curAttrNum != null)
                {
                    curAttrNum.text = GameHelper.GetAttributeNameAndValue(curEquip.StrengthValue, nextEquip.StrengthValue);
                }
                if (consumeGo != null)
                {
                    consumeGo.SetActive(true);
                }
                if (perfectConsumeGo != null)
                {
                    perfectConsumeGo.SetActive(true);
                }
            }
            StrengthenRef strengthenRef = ConfigMng.Instance.GetStrengthenRefByLv(curEquip.UpgradeLv + 1);
            if (strengthenRef != null)
            {
                EquipmentInfo lackEquip = null;
                StringBuilder builder   = new StringBuilder();
                for (int i = 0, max = strengthenRef.items.Count; i < max; i++)
                {
                    ItemValue item = strengthenRef.items[i];
                    builder.Append(GameHelper.GetStringWithBagNumber(item, out enough, out lackEquip));
                    if (i < max - 1)
                    {
                        builder.Append("\n");
                    }
                    if (lackEquip != null)
                    {
                        lackEquipList.Add(lackEquip);
                    }
                }
                if (labStoneNum != null)
                {
                    labStoneNum.text = builder.ToString();
                }
                if (labCoin != null)
                {
                    labCoin.text = GameHelper.GetStringWithBagNumber(5, (ulong)strengthenRef.coin);
                }
                if (labPerfectCoin != null)
                {
                    labPerfectCoin.text = GameHelper.GetStringWithBagNumber(5, (ulong)strengthenRef.coin);
                }
                if (strengthenRef.perfectItems.Count > 0)
                {
                    ItemValue item = strengthenRef.perfectItems[0];
                    if (item.eid == 0)
                    {
                        if (normalStrengthToggle != null)
                        {
                            normalStrengthToggle.value = true;
                        }
                        if (perfectGo != null)
                        {
                            perfectGo.SetActive(false);
                        }
                    }
                    else
                    {
                        if (perfectGo != null)
                        {
                            perfectGo.SetActive(true);
                        }
                        if (labSpecialThing != null)
                        {
                            labSpecialThing.text = GameHelper.GetStringWithBagNumber(item, out enoughPerfect);
                        }
                    }
                }
                else
                {
                    if (perfectGo != null)
                    {
                        perfectGo.SetActive(false);
                    }
                }
            }
            GameCenter.equipmentTrainingMng.quickBuyList = lackEquipList;
        }
    }