public void Equip(EquipAssetExample asset)
        {
            var       equipType  = asset.equipType;
            EquipHook howToEquip = equippables.Find(x => x.type == equipType);

            var skeletonData = skeletonDataAsset.GetSkeletonData(true);
            int slotIndex    = skeletonData.FindSlotIndex(howToEquip.slot);
            var attachment   = GenerateAttachmentFromEquipAsset(asset, slotIndex, howToEquip.templateSkin, howToEquip.templateAttachment);

            target.Equip(slotIndex, howToEquip.templateAttachment, attachment);
        }
 public void EquipItemLeg(int id)
 {
     for (int i = 0; i < ItemLegAsset.Length; i++)
     {
         if (ItemLegAsset[i].idItem == id)
         {
             ItemLeg = ItemLegAsset[i];
             break;
         }
     }
 }
 public void EquipLeg(int id)
 {
     for (int i = 0; i < LegAsset.Length; i++)
     {
         if (LegAsset[i].idItem == id)
         {
             Leg = LegAsset[i];
             break;
         }
     }
 }
 public void EquipHand(int id)
 {
     for (int i = 0; i < HandAsset.Length; i++)
     {
         if (HandAsset[i].idItem == id)
         {
             Debug.Log("id :" + HandAsset[i].name);
             Hand = HandAsset[i];
             break;
         }
     }
 }
        Attachment GenerateAttachmentFromEquipAsset(EquipAssetExample asset, int slotIndex, string templateSkinName, string templateAttachmentName)
        {
            Attachment attachment;

            cachedAttachments.TryGetValue(asset, out attachment);

            if (attachment == null)
            {
                var        skeletonData       = skeletonDataAsset.GetSkeletonData(true);
                var        templateSkin       = skeletonData.FindSkin(templateSkinName);
                Attachment templateAttachment = templateSkin.GetAttachment(slotIndex, templateAttachmentName);
                attachment = templateAttachment.GetRemappedClone(asset.sprite, sourceMaterial, premultiplyAlpha: this.applyPMA);

                cachedAttachments.Add(asset, attachment);                 // Cache this value for next time this asset is used.
            }

            return(attachment);
        }
Пример #6
0
        Attachment GenerateAttachmentFromEquipAsset(EquipAssetExample asset, int slotIndex, string templateSkinName, string templateAttachmentName)
        {
            Attachment attachment;

            cachedAttachments.TryGetValue(asset, out attachment);

            if (attachment == null)
            {
                var        skeletonData       = skeletonDataAsset.GetSkeletonData(true);
                var        templateSkin       = skeletonData.FindSkin(templateSkinName);
                Attachment templateAttachment = templateSkin.GetAttachment(slotIndex, templateAttachmentName);
                attachment = templateAttachment.GetRemappedClone(asset.sprite, sourceMaterial, premultiplyAlpha: this.applyPMA);
                // Note: Each call to `GetRemappedClone()` with parameter `premultiplyAlpha` set to `true` creates
                // a cached Texture copy which can be cleared by calling AtlasUtilities.ClearCache() as shown in the method below.

                cachedAttachments.Add(asset, attachment);                 // Cache this value for next time this asset is used.
            }

            return(attachment);
        }
 public void Equip(EquipAssetExample asset)
 {
 public void EquipItemLegNull()
 {
     ItemLeg = CtrlDataGame.Ins.AssetSkin.Null_Item_Leg;
 }
 public void EquipLegNull()
 {
     Leg = CtrlDataGame.Ins.AssetSkin.Null_Leg;
 }
 public void EquipItemHandNull()
 {
     ItemHand = CtrlDataGame.Ins.AssetSkin.Null_Item_Hand;
 }
 public void EquipHandNull()
 {
     Hand = CtrlDataGame.Ins.AssetSkin.Null_Hand;
 }
 public void EquipHead(int id)
 {
     Debug.Log(id + "Errror");
     Head = HeadAsset[id];
 }
 public void EquipCharacter(int id)
 {
     Head = HeadAsset[id];
     EquipCharacter();
 }