Пример #1
0
    /// <summary>
    /// 获取当前任命出战船
    /// </summary>
    /// <returns></returns>
    public IShip GetAppointWarShip()
    {
        PackageProxy m_PackageProxy = Facade.RetrieveProxy(ProxyName.PackageProxy) as PackageProxy;

        m_HeroItem = m_PackageProxy.GetHeroItem();
        if (m_HeroItem != null && m_HeroItem.Items != null && m_HeroItem.Items.Count > 0)
        {
            ItemWarShipVO itemWarShip = null;
            foreach (ItemBase item in m_HeroItem.Items.Values)
            {
                if (item is ItemWarShipVO)
                {
                    if (m_CurrentWarShip == null || m_CurrentWarShip.GetUID() != item.UID)
                    {
                        if (!m_ShipPackage.TryGetValue(item.UID, out m_CurrentWarShip))
                        {
                            itemWarShip      = item as ItemWarShipVO;
                            m_CurrentWarShip = WarShipDataFactory.BuildShipData(itemWarShip);
                            m_ShipPackage[m_CurrentWarShip.GetUID()] = m_CurrentWarShip;
                        }
                    }
                    return(m_CurrentWarShip);
                }
            }
        }
        m_CurrentWarShip = null;
        return(null);
    }
Пример #2
0
    /// <summary>
    /// 获取当前出战船
    /// </summary>
    /// <returns></returns>
    public IShip GetCurrentWarShip(ulong uid)
    {
        if (m_ShipItems.Count > 0 && m_ShipItems.ContainsKey(uid))
        {
            Dictionary <ulong, ItemContainer> items = m_ShipItems[uid];
            if (m_Ships.Count > 0 && m_Ships.ContainsKey(uid))
            {
                return(m_Ships[uid]);
            }

            ItemWarShipVO itemWarShip = null;
            foreach (ItemBase item in items.Values)
            {
                if (item is ItemWarShipVO)
                {
                    itemWarShip = item as ItemWarShipVO;
                    break;
                }
            }

            if (itemWarShip != null)
            {
                IShip currentWarShip = WarShipDataFactory.BuildShipData(itemWarShip);
                m_Ships.Add(uid, currentWarShip);
                return(currentWarShip);
            }
        }
        return(null);
    }
Пример #3
0
 public Ship(ItemWarShipVO itemShip)
 {
     m_AllItem = new Dictionary <ulong, ShipItem>();
     SetUID(itemShip.UID);
     SetTID(itemShip.TID);
     SetLv(itemShip.Lv);
     SetExp(itemShip.Exp);
     SetCraetTime(itemShip.CreateTime);
     SetWarShipType(itemShip.WarshipL1);
     SetReference(itemShip.Reference);
     SetBaseConfig(itemShip.ItemConfig);
     Convert(this, itemShip.Items);
 }
Пример #4
0
    /// <summary>
    /// 修改船数据包
    /// </summary>
    /// <param name="item"></param>
    /// <returns></returns>
    public void ChangeShipPackage(ulong id)
    {
        PackageProxy  m_PackageProxy = Facade.RetrieveProxy(ProxyName.PackageProxy) as PackageProxy;
        ItemWarShipVO itemWarShipVO  = m_PackageProxy.GetItem <ItemWarShipVO>(id);
        IShip         m_Ship         = null;

        m_Ship = WarShipDataFactory.BuildShipData(itemWarShipVO);
        m_ShipPackage.Add(m_Ship.GetUID(), m_Ship);
        IShip m_CurWarShip = GetAppointWarShip();

        if (!m_ShipPackage.ContainsKey(m_CurWarShip.GetUID()))
        {
            m_ShipPackage.Add(m_CurWarShip.GetUID(), m_CurWarShip);
        }
    }
Пример #5
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);
    }
Пример #6
0
 /// <summary>
 /// 通过船道具实例构建一艘船的数据
 /// </summary>
 /// <param name="itemShip"></param>
 /// <returns></returns>
 public static IShip BuildShipData(ItemWarShipVO itemShip)
 {
     return(new Ship(itemShip));
 }
Пример #7
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);
        }
    }
Пример #8
0
    /// <summary>
    /// 查找可以比较的数据
    /// </summary>
    /// <param name="data">当前数据</param>
    /// <param name="compareableDatas">可参与比较的数据列表</param>
    protected override void FindCompareableData(object data, List <object> compareableDatas)
    {
        base.FindCompareableData(data, compareableDatas);

        if (data == null)
        {
            return;
        }
        if (!(data is ItemBase))
        {
            return;
        }

        ItemBase item = data as ItemBase;

        if (item.MainType != Category.Blueprint && item.MainType != Category.Warship && item.MainType != Category.Weapon && item.MainType != Category.Reformer && item.MainType != Category.Equipment)
        {
            return;
        }

        //当前角色的包
        ItemContainer container = GetPackage().GetHeroItem();

        if (container == null || container.Items == null || container.Items.Count == 0)
        {
            return;
        }

        //当前出战的飞船
        ItemWarShipVO ship = null;

        foreach (ItemBase heroItem in container.Items.Values)
        {
            if (heroItem is ItemWarShipVO)
            {
                ship = heroItem as ItemWarShipVO;
                break;
            }
        }

        //当前是飞船
        if (item.MainType == Category.Warship)
        {
            if (item != ship)
            {
                compareableDatas.Add(ship);
            }
        }
        //当前是飞船的蓝图
        else if (item.MainType == Category.Blueprint && (item as ItemDrawingVO).DrawingType == BlueprintL1.Warship)
        {
            compareableDatas.Add(ship);
        }
        else
        {
            IShip    iship         = (GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy).GetAppointWarShip();
            Category mainType      = item.MainType;
            Enum     secondaryType = null;

            if (item is ItemDrawingVO)
            {
                ItemDrawingVO blueprint = item as ItemDrawingVO;
                switch (blueprint.DrawingType)
                {
                case BlueprintL1.Weapon:
                    mainType = Category.Weapon;
                    break;

                case BlueprintL1.Reformer:
                    mainType = Category.Reformer;
                    break;

                case BlueprintL1.Equipment:
                    FoundryProxy foundryProxy = GameFacade.Instance.RetrieveProxy(ProxyName.FoundryProxy) as FoundryProxy;
                    Item         product      = foundryProxy.GetItemByProduceKey((int)blueprint.TID);
                    mainType      = Category.Equipment;
                    secondaryType = (Enum)ItemTypeUtil.GetItemType(product.Type).EnumList[2];
                    break;
                }
            }
            else if (item is ItemEquipmentVO)
            {
                ItemEquipmentVO equip = item as ItemEquipmentVO;
                mainType      = equip.MainType;
                secondaryType = equip.EquipmentType;
            }

            //武器
            if (mainType == Category.Weapon)
            {
                ItemBase[] list = new ItemBase[iship.GetWeaponContainer().GetCurrentSizeMax()];
                foreach (IWeapon weapon in iship.GetWeaponContainer().GetWeapons())
                {
                    list[weapon.GetPos()] = GetPackage().GetItem <ItemWeaponVO>(weapon.GetUID());
                }
                compareableDatas.AddRange(list);
            }
            //转化炉
            else if (mainType == Category.Reformer)
            {
                IReformer reformer = iship.GetReformerContainer().GetReformer();
                if (reformer != null)
                {
                    compareableDatas.Add(GetPackage().GetItem <ItemReformerVO>(reformer.GetUID()));
                }
                else
                {
                    compareableDatas.Add(null);
                }
            }
            //装备
            else if (mainType == Category.Equipment)
            {
                foreach (IEquipment equip in iship.GetEquipmentContainer().GetEquipments())
                {
                    ItemEquipmentVO equipVO = GetPackage().GetItem <ItemEquipmentVO>(equip.GetUID());
                    Enum            type    = equipVO.EquipmentType;
                    if (Enum.Equals(type, secondaryType))
                    {
                        compareableDatas.Add(equipVO);
                    }
                }
            }
        }
    }