Esempio n. 1
0
    public void SetData(ItemModVO Vo)
    {
        Initialize();
        m_Empty.gameObject.SetActive(Vo.TID == 0);
        m_Content.gameObject.SetActive(Vo.TID != 0);
        if (Vo.TID == 0)
        {
            return;
        }
        UIUtil.SetIconImage(m_IconImage, TableUtil.GetItemIconBundle(Vo.TID), TableUtil.GetItemIconImage(Vo.TID));
        m_OverlyingIcon.sprite = m_IconImage.sprite;
        m_NameLabel.text       = TableUtil.GetItemName((int)Vo.TID);
        m_Quality.color        = ColorUtil.GetColorByItemQuality(Vo.ItemConfig.Quality);
        m_TypeLabel.text       = TableUtil.GetLanguageString(Vo.ModType1);
        m_Used.gameObject.SetActive(Vo.Replicas != null && Vo.Replicas.Count > 0);
        int index = 0;

        char[] charArray = Vo.Lv.ToString().PadLeft(3, '0').ToCharArray();
        for (int i = 0; i < charArray.Length; i++)
        {
            char cc = charArray[i];
            if (cc != '0')
            {
                index = i;
                break;
            }
        }
        string sstr = Vo.Lv.ToString().PadLeft(3, '0');

        if (index != 0)
        {
            sstr = sstr.Insert(index, "</color>");
            sstr = sstr.Insert(0, "<color=#808080>");
        }
        m_LvLabel.text = sstr;
    }
Esempio n. 2
0
    public ItemContainer CreateItem(ulong uid, uint tid, ulong parentUid, int pos, long count, uint capacity, ulong reference, ulong createTime)
    {
        ItemContainer item;
        Item          itemCfg  = m_CfgEternityProxy.GetItemByKey(tid);
        ItemType      itemType = ItemTypeUtil.GetItemType(itemCfg.Type);

        switch (itemType.MainType)
        {
        case Category.Blueprint:    //1 蓝图
            item = new ItemDrawingVO();
            ItemTypeUtil.SetSubType(ref (item as ItemDrawingVO).DrawingType, itemType);
            break;

        case Category.Weapon:    //2 武器
            item = new ItemWeaponVO();
            (item as ItemWeaponVO).Config = itemCfg.ItemUnion <Weapon>().Value;
            ItemTypeUtil.SetSubType(ref (item as ItemWeaponVO).WeaponType1, itemType);
            ItemTypeUtil.SetSubType(ref (item as ItemWeaponVO).WeaponType2, itemType);
            break;

        case Category.Reformer:    //3 转化炉
            item = new ItemReformerVO();
            break;

        case Category.Equipment:    //4 装备
            item = new ItemEquipmentVO();
            (item as ItemEquipmentVO).Config = itemCfg.ItemUnion <Equip>().Value;
            ItemTypeUtil.SetSubType(ref (item as ItemEquipmentVO).EquipmentType, itemType);
            break;

        case Category.EquipmentMod:    //5 mod
            item = new ItemModVO();
            (item as ItemModVO).Config = itemCfg.ItemUnion <Mod>().Value;
            ItemTypeUtil.SetSubType(ref (item as ItemModVO).ModType1, itemType);
            ItemTypeUtil.SetSubType(ref (item as ItemModVO).ModType2, itemType);
            break;

        case Category.Material:    //6 材料
            item = new ItemMaterialVO();
            ItemTypeUtil.SetSubType(ref (item as ItemMaterialVO).MaterialType, itemType);
            break;

        case Category.Expendable:    //消耗品
            item = new ItemExpendableVO();
            ItemTypeUtil.SetSubType(ref (item as ItemExpendableVO).ExpendableType, itemType);
            break;

        //case Category.TaskItem://7 任务道具
        //	item = new ItemMissionVO();
        //	break;
        case Category.Warship:    //8 船
            item = new ItemWarShipVO();
            (item as ItemWarShipVO).Config = itemCfg.ItemUnion <Warship>().Value;
            ItemTypeUtil.SetSubType(ref (item as ItemWarShipVO).WarshipL1, itemType);
            break;

        case Category.Skill:    //技能
            item = new ItemSkillVO();
            break;

        case Category.Package:    //包
            item = new ItemContainer();
            (item as ItemContainer).ContainerType  = ItemTypeUtil.GetContainerType(itemCfg);
            (item as ItemContainer).CurrentSizeMax = capacity;
            break;

        case Category.Currency:    //货币
            item = new ItemCurrency();
            break;

        case Category.Hero:             //人形态和出战船的父节点
        case Category.Player:           //玩家各种包的父节点
        case Category.WarehousePackage: //空间站仓库
        default:
            item = new ItemContainer();
            break;
        }


        item.RootType   = itemType.RootType;
        item.MainType   = itemType.MainType;
        item.ItemConfig = itemCfg;
        item.UID        = uid;
        item.TID        = tid;
        item.ParentUID  = parentUid;
        item.Position   = pos;
        item.Count      = count;
        item.Reference  = reference;
        item.CreateTime = createTime;

        if (reference != 0)
        {
            if (m_Items.TryGetValue(reference, out ItemContainer value))
            {
                value.Replicas.Add(uid);
            }
        }

        return(item);
    }
Esempio n. 3
0
    /// <summary>
    /// 布局Tip
    /// </summary>
    /// <param name="view">视图</param>
    /// <param name="data">数据</param>
    protected void LayoutItemTip(GameObject view, ItemBase data, ItemBase compareData)
    {
        RectTransform root = FindComponent <RectTransform>(view.transform, "TipsScrollView/Viewport/Content/Content");
        //品质部分
        Transform qualityNode = FindComponent <Transform>(view.transform, "TipsScrollView/Viewport/Content/Quality");

        //名称部分
        TMP_Text nameField = FindComponent <TMP_Text>(root, "NameType/Label_Name");

        TMP_Text tnField = FindComponent <TMP_Text>(root, "NameType/Label_T");

        Transform typeNode  = FindComponent <Transform>(root, "NameType/Type");
        TMP_Text  typeField = FindComponent <TMP_Text>(typeNode, "Label_Type");
        Image     typeIcon  = FindComponent <Image>(typeNode, "Image_IconType");

        Transform levelNode  = FindComponent <Transform>(root, "NameType/Level");
        TMP_Text  levelField = FindComponent <TMP_Text>(levelNode, "Label_Score_Num");

        //限制部分
        Transform limitNode = FindComponent <Transform>(root, "Limit");
        TMP_Text  limitText = FindComponent <TMP_Text>(limitNode, "Label");

        //材料部分
        Transform materialNode = FindComponent <Transform>(root, "Materials");

        //描述部分
        Transform descriptionNode  = FindComponent <Transform>(root, "Describe");
        TMP_Text  descriptionField = FindComponent <TMP_Text>(descriptionNode, "Label_Describe");

        //属性部分
        Transform attributeNode = FindComponent <Transform>(root, "Attribute");
        //属性部分A
        Transform attributeANode = FindComponent <Transform>(root, "Attribute/Top");
        //属性部分B
        Transform attributeBNode = FindComponent <Transform>(root, "Attribute/Temp");
        //属性部分C
        Transform attributeCNode = FindComponent <Transform>(root, "Attribute/DFD");
        //属性部分D
        Transform attributeDNode = FindComponent <Transform>(root, "Attribute/Repair");

        //属性部分Nature 容器
        Transform attributeNature = FindComponent <Transform>(root, "Attribute/nature");
        //属性部分Extra容器
        Transform attributeExtra = FindComponent <Transform>(root, "Attribute/Extra");

        //属性部分Nature 单体
        Transform attributeNatureSingle = FindComponent <Transform>(root, "Attribute/nature/content1");
        //属性部分Extra 单体
        Transform attributeExtraSingle = FindComponent <Transform>(root, "Attribute/Extra/content1");


        //技能部分
        Transform skillNode = FindComponent <Transform>(root, "Attribute/Skill");

        //随机属性部分
        Transform randomNode = FindComponent <Transform>(root, "Random");

        //模组部分
        Transform modNode = FindComponent <Transform>(root, "MOD");

        //关掉所有
        tnField.text = string.Empty;
        typeNode.gameObject.SetActive(false);
        levelNode.gameObject.SetActive(false);
        limitNode.gameObject.SetActive(false);
        materialNode.gameObject.SetActive(false);
        attributeNode.gameObject.SetActive(false);
        attributeANode.gameObject.SetActive(false);
        attributeBNode.gameObject.SetActive(false);
        attributeCNode.gameObject.SetActive(false);
        attributeDNode.gameObject.SetActive(false);
        skillNode.gameObject.SetActive(false);
        randomNode.gameObject.SetActive(false);
        modNode.gameObject.SetActive(false);

        attributeNature.gameObject.SetActive(false);
        attributeExtra.gameObject.SetActive(false);
        //名称
        nameField.text = TableUtil.GetItemName(data.TID);
        //描述
        descriptionField.text = TableUtil.GetItemDescribe(data.TID);
        //品质
        int quality = data.ItemConfig.Quality;

        //data.ItemConfig
        for (int i = 0; i < qualityNode.childCount; i++)
        {
            qualityNode.GetChild(i).gameObject.SetActive((i + 1) == quality);
        }

        //蓝图
        if (data.MainType == Category.Blueprint)
        {
            ItemDrawingVO blueprint = data as ItemDrawingVO;

            //类型
            typeNode.gameObject.SetActive(true);
            typeField.text = TableUtil.GetLanguageString(blueprint.DrawingType);
            switch (blueprint.DrawingType)
            {
            case BlueprintL1.Warship: UIUtil.SetIconImage(typeIcon, 31005); break;

            case BlueprintL1.Weapon: UIUtil.SetIconImage(typeIcon, 31006); break;

            case BlueprintL1.Reformer: UIUtil.SetIconImage(typeIcon, 31007); break;

            case BlueprintL1.EquipmentMod: UIUtil.SetIconImage(typeIcon, 31008); break;

            case BlueprintL1.Equipment: UIUtil.SetIconImage(typeIcon, 31009); break;

            case BlueprintL1.Material: UIUtil.SetIconImage(typeIcon, 31010); break;

            default: typeIcon.sprite = null; break;
            }

            //材料
            materialNode.gameObject.SetActive(true);
            LayoutBlueprintMaterial(blueprint.TID, materialNode);

            //飞船蓝图
            if (blueprint.DrawingType == BlueprintL1.Warship)
            {
                attributeNode.gameObject.SetActive(true);
                attributeANode.gameObject.SetActive(true);
                attributeBNode.gameObject.SetActive(true);
                attributeCNode.gameObject.SetActive(true);
                attributeDNode.gameObject.SetActive(true);
                skillNode.gameObject.SetActive(true);

                modNode.gameObject.SetActive(true);
                LayoutBlueprintModList(blueprint.TID, modNode);
            }
            //武器蓝图
            else if (blueprint.DrawingType == BlueprintL1.Weapon)
            {
                attributeNode.gameObject.SetActive(true);
                attributeANode.gameObject.SetActive(true);
                attributeBNode.gameObject.SetActive(true);
                randomNode.gameObject.SetActive(true);

                modNode.gameObject.SetActive(true);
                LayoutBlueprintModList(blueprint.TID, modNode);
            }
            //转化炉蓝图
            else if (blueprint.DrawingType == BlueprintL1.Reformer)
            {
                attributeNode.gameObject.SetActive(true);
                attributeANode.gameObject.SetActive(true);
                attributeBNode.gameObject.SetActive(true);
                randomNode.gameObject.SetActive(true);
            }
            //装备蓝图
            else if (blueprint.DrawingType == BlueprintL1.Equipment)
            {
                attributeNode.gameObject.SetActive(true);
                attributeANode.gameObject.SetActive(true);
                attributeBNode.gameObject.SetActive(true);
                randomNode.gameObject.SetActive(true);
            }
            //装备模组蓝图
            else if (blueprint.DrawingType == BlueprintL1.EquipmentMod)
            {
                attributeNode.gameObject.SetActive(true);
                randomNode.gameObject.SetActive(true);
            }
            //材料蓝图
            else if (blueprint.DrawingType == BlueprintL1.Material)
            {
            }
        }
        //飞船
        else if (data.MainType == Category.Warship)
        {
            ItemWarShipVO ship = data as ItemWarShipVO;

            typeNode.gameObject.SetActive(true);
            typeField.text = TableUtil.GetLanguageString(ship.WarshipL1);
            UIUtil.SetIconImage(typeIcon, 31005);

            attributeNode.gameObject.SetActive(true);
            attributeANode.gameObject.SetActive(true);
            attributeBNode.gameObject.SetActive(true);
            attributeCNode.gameObject.SetActive(true);
            attributeDNode.gameObject.SetActive(true);
            skillNode.gameObject.SetActive(true);

            modNode.gameObject.SetActive(true);
            LayoutShipOrWeaponModList(ship, EquipmentModL1.WarshipMod, modNode);
        }
        //武器
        else if (data.MainType == Category.Weapon)
        {
            ItemWeaponVO weapon = data as ItemWeaponVO;

            typeNode.gameObject.SetActive(true);
            typeField.text = TableUtil.GetLanguageString(weapon.WeaponType2);
            UIUtil.SetIconImage(typeIcon, 31006);

            tnField.text = "T" + weapon.ItemConfig.Grade;

            attributeNode.gameObject.SetActive(true);
            attributeANode.gameObject.SetActive(true);
            attributeBNode.gameObject.SetActive(true);
            randomNode.gameObject.SetActive(true);

            modNode.gameObject.SetActive(true);
            LayoutShipOrWeaponModList(weapon, EquipmentModL1.WeaponMod, modNode);
        }
        //转化炉
        else if (data.MainType == Category.Reformer)
        {
            ItemReformerVO reformer = data as ItemReformerVO;

            typeNode.gameObject.SetActive(true);
            typeField.text = TableUtil.GetLanguageString(Category.Reformer);
            UIUtil.SetIconImage(typeIcon, 31007);

            tnField.text = "T" + reformer.ItemConfig.Grade;

            attributeNode.gameObject.SetActive(true);
            attributeANode.gameObject.SetActive(true);
            attributeBNode.gameObject.SetActive(true);
            randomNode.gameObject.SetActive(true);
        }
        //装备
        else if (data.MainType == Category.Equipment)
        {
            ItemEquipmentVO equip = data as ItemEquipmentVO;

            typeNode.gameObject.SetActive(true);

            typeField.text = TableUtil.GetLanguageString(equip.EquipmentType);
            UIUtil.SetIconImage(typeIcon, 31009);

            tnField.text = "T" + equip.ItemConfig.Grade;

            attributeNode.gameObject.SetActive(true);
            attributeANode.gameObject.SetActive(true);
            attributeBNode.gameObject.SetActive(true);
            randomNode.gameObject.SetActive(true);
        }
        //MOD
        else if (data.MainType == Category.EquipmentMod)
        {
            ItemModVO mod = data as ItemModVO;

            typeNode.gameObject.SetActive(true);
            typeField.text = TableUtil.GetLanguageString(mod.ModType1);
            UIUtil.SetIconImage(typeIcon, 31008);

            attributeNode.gameObject.SetActive(true);
            randomNode.gameObject.SetActive(true);
        }
        //材料
        else if (data.MainType == Category.Material)
        {
            ItemMaterialVO itemMaterial = data as ItemMaterialVO;

            typeNode.gameObject.SetActive(true);
            typeField.text = TableUtil.GetLanguageString(itemMaterial.MaterialType);
            UIUtil.SetIconImage(typeIcon, 31010);
        }
        //消耗品
        else if (data.MainType == Category.Expendable)
        {
            ItemExpendableVO itemExpendable = data as ItemExpendableVO;

            typeNode.gameObject.SetActive(true);
            typeField.text = TableUtil.GetLanguageString(itemExpendable.ExpendableType);
            UIUtil.SetIconImage(typeIcon, 51027);
        }
    }