void OnItemBought(int index, int seed)
    {
        AudioManager.Instance.Play(SFX_UI.ShardsChing);

        if (_item.data.Type != ItemType.Currency)
        {
            DataManager.Instance.allItemsList.Add(_item);
        }
        else
        {
            ItemCurrency itemCurrency = (ItemCurrency)_item.data;
            trace("You should of gained: " + itemCurrency.Reward + " " + itemCurrency.CurrencyType);
        }

        SoldOutArea.SetActive(true);
        ItemDetailsArea.SetActive(false);
    }
Ejemplo 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);
    }
Ejemplo n.º 3
0
 public ItemCurrency(ItemCurrency data) : base(data.ID, data.Identity, data.Name, ItemType.Currency, data.EquipType, data.Value, data.Description, data.Sprite, data.Tier, data.Multiplier, data.UniqueItemReference)
 {
     this.CurrencyType = data.CurrencyType;
     this.Reward       = data.Reward;
 }