示例#1
0
    private void RefreshRight(int formationID)
    {
        int          num          = 0;
        int          num2         = 0;
        int          num3         = 0;
        PetFormation petFormation = PetManager.Instance.Formation.Find((PetFormation a) => a.formationId == formationID);

        if (petFormation != null && petFormation.petFormationArr != null && petFormation.petFormationArr.Int64Array != null)
        {
            PetManager.Instance.GetFormationAddAttrValue(petFormation, out num, out num2, out num3);
            List <int> list = new List <int>();
            for (int i = 0; i < petFormation.petFormationArr.Int64Array.get_Count(); i++)
            {
                Int64IndexValue int64IndexValue = petFormation.petFormationArr.Int64Array.get_Item(i);
                PetInfo         petInfo         = PetManager.Instance.GetPetInfo(int64IndexValue.value);
                list.Add(petInfo.petId);
            }
            List <ChongWuJiBan> list2 = new List <ChongWuJiBan>();
            for (int j = 0; j < DataReader <ChongWuJiBan> .DataList.get_Count(); j++)
            {
                bool         flag         = true;
                ChongWuJiBan chongWuJiBan = DataReader <ChongWuJiBan> .DataList.get_Item(j);

                for (int k = 0; k < chongWuJiBan.linkedPetId.get_Count(); k++)
                {
                    int num4 = chongWuJiBan.linkedPetId.get_Item(k);
                    if (!list.Contains(num4))
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag)
                {
                    list2.Add(chongWuJiBan);
                }
            }
            if (list2.get_Count() > 0)
            {
                for (int l = 0; l < list2.get_Count(); l++)
                {
                    ChongWuJiBan chongWuJiBan2 = list2.get_Item(l);
                    Transform    transform     = null;
                    if (l == 0)
                    {
                        transform = this.linkedPet1;
                    }
                    if (l == 2)
                    {
                        transform = this.linkedPet2;
                    }
                    if (l == 3)
                    {
                        transform = this.linkedPet3;
                    }
                    transform.FindChild("Title").GetComponent <Text>().set_text(GameDataUtils.GetChineseContent(chongWuJiBan2.name, false));
                    string text  = string.Empty;
                    Attrs  attrs = DataReader <Attrs> .Get(chongWuJiBan2.linkedAttrId);

                    for (int m = 0; m < attrs.attrs.get_Count(); m++)
                    {
                        text += AttrUtility.GetStandardAddDesc(attrs.attrs.get_Item(m), attrs.values.get_Item(m));
                    }
                    transform.FindChild("Content").GetComponent <Text>().set_text(text);
                }
                if (list2.get_Count() == 1)
                {
                    this.linkedPet1.get_gameObject().SetActive(true);
                    this.linkedPet2.get_gameObject().SetActive(false);
                    this.linkedPet3.get_gameObject().SetActive(false);
                }
                else if (list2.get_Count() == 2)
                {
                    this.linkedPet1.get_gameObject().SetActive(true);
                    this.linkedPet2.get_gameObject().SetActive(true);
                    this.linkedPet3.get_gameObject().SetActive(false);
                }
                else if (list2.get_Count() == 3)
                {
                    this.linkedPet1.get_gameObject().SetActive(true);
                    this.linkedPet2.get_gameObject().SetActive(true);
                    this.linkedPet3.get_gameObject().SetActive(true);
                }
            }
        }
        this.Property1.FindChild("Content").GetComponent <Text>().set_text(AttrUtility.GetAttrName(GameData.AttrType.Atk) + ":");
        this.Property2.FindChild("Content").GetComponent <Text>().set_text(AttrUtility.GetAttrName(GameData.AttrType.Defence) + ":");
        this.Property3.FindChild("Content").GetComponent <Text>().set_text(AttrUtility.GetAttrName(GameData.AttrType.HpLmt) + ":");
        this.Property1.FindChild("Value").GetComponent <Text>().set_text(num.ToString());
        this.Property2.FindChild("Value").GetComponent <Text>().set_text(num2.ToString());
        this.Property3.FindChild("Value").GetComponent <Text>().set_text(num3.ToString());
    }
示例#2
0
    public void SetEquipItemData(EquipSimpleInfo equipSimpleInfo, int hasMaxMoney = 0)
    {
        if (equipSimpleInfo == null)
        {
            return;
        }
        if (!DataReader <zZhuangBeiPeiZhiBiao> .Contains(equipSimpleInfo.cfgId))
        {
            return;
        }
        zZhuangBeiPeiZhiBiao zZhuangBeiPeiZhiBiao = DataReader <zZhuangBeiPeiZhiBiao> .Get(equipSimpleInfo.cfgId);

        Image component = base.FindTransform("ItemFrame").GetComponent <Image>();

        if (component != null)
        {
            ResourceManager.SetSprite(component, GameDataUtils.GetItemFrame(equipSimpleInfo.cfgId));
        }
        Image component2 = base.FindTransform("ItemIcon").GetComponent <Image>();

        if (component2 != null)
        {
            ResourceManager.SetSprite(component2, GameDataUtils.GetItemIcon(equipSimpleInfo.cfgId));
        }
        Text component3 = base.FindTransform("ItemName").GetComponent <Text>();

        if (component3 != null)
        {
            component3.set_text(GameDataUtils.GetItemName(equipSimpleInfo.cfgId, true, 0L));
        }
        Text component4 = base.FindTransform("ItemLv").GetComponent <Text>();

        component4.set_text(zZhuangBeiPeiZhiBiao.level.ToString());
        Text   component5          = base.FindTransform("ItemCareerLimit").GetComponent <Text>();
        string equipOccupationName = EquipGlobal.GetEquipOccupationName(zZhuangBeiPeiZhiBiao.id);

        component5.set_text(equipOccupationName);
        Text component6 = base.FindTransform("ItemFightingScore").GetComponent <Text>();
        Text component7 = base.FindTransform("EquipStepText").GetComponent <Text>();

        component7.set_text(string.Format(GameDataUtils.GetChineseContent(505023, false), zZhuangBeiPeiZhiBiao.step));
        long num = (long)EquipmentManager.Instance.GetEquipFightingByExcellentAttrs(equipSimpleInfo.cfgId, equipSimpleInfo.excellentAttrs);

        if (this.fightingText != null)
        {
            this.fightingText.set_text(num + string.Empty);
        }
        Transform transform = base.FindTransform("BaseAttr");
        Attrs     attrs     = DataReader <Attrs> .Get(zZhuangBeiPeiZhiBiao.attrBaseValue);

        if (attrs != null)
        {
            for (int i = 0; i < attrs.attrs.get_Count(); i++)
            {
                if (i > 2)
                {
                    break;
                }
                long value = (long)attrs.values.get_Item(i);
                transform.FindChild("EquipItem2Text" + i).get_gameObject().SetActive(true);
                transform.FindChild("EquipItem2Text" + i).FindChild("Item2Text").GetComponent <Text>().set_text(AttrUtility.GetStandardAddDesc((GameData.AttrType)attrs.attrs.get_Item(i), value, "ff7d4b"));
            }
            for (int j = attrs.attrs.get_Count(); j < 3; j++)
            {
                transform.FindChild("EquipItem2Text" + j).get_gameObject().SetActive(false);
            }
        }
        Transform transform2 = base.FindTransform("ExcellentAttr");
        Transform transform3 = base.FindTransform("ExcellentAttrIconList");

        transform3.get_gameObject().SetActive(false);
        if (equipSimpleInfo.excellentAttrs.get_Count() > 0)
        {
            transform2.get_gameObject().SetActive(true);
            int k    = 0;
            int num2 = 0;
            while (k < equipSimpleInfo.excellentAttrs.get_Count())
            {
                if (k >= 5)
                {
                    break;
                }
                if (equipSimpleInfo.excellentAttrs.get_Item(k).attrId < 0)
                {
                    transform2.FindChild("EquipItem2Text" + k).get_gameObject().SetActive(false);
                }
                else
                {
                    string excellentTypeColor = EquipGlobal.GetExcellentTypeColor(equipSimpleInfo.excellentAttrs.get_Item(k).color);
                    string text = string.Empty;
                    text = AttrUtility.GetStandardAddDesc(equipSimpleInfo.excellentAttrs.get_Item(k).attrId, equipSimpleInfo.excellentAttrs.get_Item(k).value, excellentTypeColor, excellentTypeColor);
                    transform2.FindChild("EquipItem2Text" + k).get_gameObject().SetActive(true);
                    transform2.FindChild("EquipItem2Text" + k).FindChild("Item2Text").GetComponent <Text>().set_text(text);
                    string excellentRangeText = EquipGlobal.GetExcellentRangeText(equipSimpleInfo.cfgId, equipSimpleInfo.excellentAttrs.get_Item(k).attrId);
                    transform2.FindChild("EquipItem2Text" + k).FindChild("Item2TextRange").GetComponent <Text>().set_text(excellentRangeText);
                    if (equipSimpleInfo.excellentAttrs.get_Item(k).color >= 1f)
                    {
                        transform2.FindChild("EquipItem2Text" + k).FindChild("ItemImg").GetComponent <Image>().set_enabled(true);
                        num2++;
                    }
                    else
                    {
                        transform2.FindChild("EquipItem2Text" + k).FindChild("ItemImg").GetComponent <Image>().set_enabled(false);
                    }
                }
                k++;
            }
            for (int l = k; l < 5; l++)
            {
                transform2.FindChild("EquipItem2Text" + l).get_gameObject().SetActive(false);
            }
            if (num2 > 0)
            {
                if (!transform3.get_gameObject().get_activeSelf())
                {
                    transform3.get_gameObject().SetActive(true);
                }
                for (int m = 0; m < num2; m++)
                {
                    if (num2 >= 3)
                    {
                        break;
                    }
                    transform3.FindChild("Image" + (m + 1)).get_gameObject().SetActive(true);
                }
                for (int n = num2; n < 3; n++)
                {
                    transform3.FindChild("Image" + (n + 1)).get_gameObject().SetActive(false);
                }
            }
        }
        int num3;

        for (num3 = 0; num3 < zZhuangBeiPeiZhiBiao.starNum; num3++)
        {
            this.starTransformList.get_Item(num3).get_gameObject().SetActive(true);
            if (equipSimpleInfo.star > num3)
            {
                this.starTransformList.get_Item(num3).FindChild("OpenStar").get_gameObject().SetActive(true);
                string starLevelSpriteName = this.GetStarLevelSpriteName(equipSimpleInfo.starToMaterial.get_Item(num3));
                ResourceManager.SetSprite(this.starTransformList.get_Item(num3).FindChild("OpenStar").GetComponent <Image>(), ResourceManager.GetIconSprite(starLevelSpriteName));
            }
            else
            {
                this.starTransformList.get_Item(num3).FindChild("OpenStar").get_gameObject().SetActive(false);
            }
        }
        for (int num4 = num3; num4 < this.starTransformList.get_Count(); num4++)
        {
            this.starTransformList.get_Item(num4).get_gameObject().SetActive(false);
        }
        List <int> list = new List <int>();

        list.Add(equipSimpleInfo.cfgId);
        int    equipsTotalPoint = GuildStorageManager.Instance.GetEquipsTotalPoint(list, false);
        string text2            = "x" + equipsTotalPoint;

        if (hasMaxMoney >= equipsTotalPoint)
        {
            this.CostNumText = " " + text2;
        }
        else
        {
            this.CostNumText = " " + TextColorMgr.GetColorByID(text2, 1000007);
        }
        this.CostIconSR = GameDataUtils.GetItemIcon(19);
    }