public void StartReplace()
 {
     Spine.Slot       baseWQ             = skeleton.FindSlot(slot);
     Spine.Attachment originalAttachment = baseWQ.Attachment;
     Spine.Attachment newAttachment      = originalAttachment.GetRemappedClone
                                               (Img, originalAttachment.GetMaterial());
     baseWQ.Bone.ScaleY   = -thisSlotBaseData.ScaleY;
     baseWQ.Bone.Rotation = thisSlotBaseData.Rotation - 45;
     baseWQ.Bone.SetLocalPosition(new Vector2(0, -thisSlotBaseData.Y * 2));
     baseWQ.Attachment = newAttachment;
 }
 public void StartReplace2()
 {
     Spine.Slot       baseWQ             = skeleton.FindSlot(slot);
     Spine.Attachment originalAttachment = baseWQ.Attachment;
     Spine.Attachment newAttachment      = originalAttachment.GetRemappedClone
                                               (Img, originalAttachment.GetMaterial());
     baseWQ.Attachment = newAttachment;
     //
     Spine.Slot       otherWQ             = skeleton.FindSlot("R_" + slot);
     Spine.Attachment originalAttachment2 = otherWQ.Attachment;
     Spine.Attachment newAttachment2      = originalAttachment2.GetRemappedClone
                                                (Img, originalAttachment2.GetMaterial());
     otherWQ.Attachment = newAttachment2;
 }
示例#3
0
    void HeroCharacterSet()
    {
        Debug.Log("Hero_Character_Set");
        string w0 = "wuqi";
        string w1 = "R_wuqi";

        weaponBaseData  = skeleton.FindSlot(w0).Bone.Data;
        weaponBaseData2 = skeleton.FindSlot(w1).Bone.Data;
        //
        Material M = GetComponent <MeshRenderer>().material;

        if (skeleton.FindSlot(w0).Attachment != null)
        {
            M.shader = skeleton.FindSlot(w0).Attachment.GetMaterial().shader;
        }

        if (CMC.notShowWeaponSlot)
        {
            skeleton.FindSlot(w0).A = 0;
            skeleton.FindSlot(w1).A = 0;
        }
        else
        {
            skeleton.FindSlot(w0).A = 1;
            skeleton.FindSlot(w1).A = 1;
            //
            EquipItem weapon = SDDataManager.Instance.GetEquipItemById(CMC.weaponId);
            if (weapon == null)
            {
                return;
            }
            List <Sprite> allSprites = Resources.LoadAll <Sprite>("Spine/WeaponVision/").ToList();
            weaponSprite = allSprites.Find(x => x.name == weapon.ID);
            if (weaponSprite == null)
            {
                return;
            }


            Spine.Slot       baseWQ             = skeleton.FindSlot(w0);
            string           an                 = baseWQ.Data.AttachmentName;
            Spine.Attachment originalAttachment = baseWQ.Attachment;
            Spine.Attachment newAttachment      = originalAttachment.GetRemappedClone(weaponSprite, M);
            if (weapon.WeaponRace.WeaponClass == SDConstants.WeaponClass.Sharp)
            {
                Spine.Slot otherWQ   = skeleton.FindSlot(w1);
                string     newWSName = weaponSprite.name + "_2";
                weaponSprite2 = allSprites.Find(x => x.name == newWSName);
                if (weaponSprite2 != null)
                {
                    Spine.Attachment oa1    = otherWQ.Attachment;
                    Spine.Attachment newoa1 = oa1.GetRemappedClone(weaponSprite2, M);
                    otherWQ.Attachment = newoa1;
                }
            }
            else if (weapon.WeaponRace.WeaponClass == SDConstants.WeaponClass.Claymore)
            {
                baseWQ.Bone.ScaleY   = -weaponBaseData.ScaleY;
                baseWQ.Bone.Rotation = weaponBaseData.Rotation - 45;
                baseWQ.Bone.SetLocalPosition(new Vector2(0, -weaponBaseData.Y * 2));
            }
            baseWQ.Attachment = newAttachment;
        }
    }