示例#1
0
        void Start()
        {
            var skeletonComponent = GetComponent <ISkeletonComponent>();

            if (skeletonComponent == null)
            {
                return;
            }
            var skeleton = skeletonComponent.Skeleton;

            if (skeleton == null)
            {
                return;
            }

            combinedSkin = combinedSkin ?? new Skin("combined");
            combinedSkin.Clear();
            foreach (var skinName in skinsToCombine)
            {
                var skin = skeleton.Data.FindSkin(skinName);
                if (skin != null)
                {
                    combinedSkin.AddSkin(skin);
                }
            }

            skeleton.SetSkin(combinedSkin);
            skeleton.SetToSetupPose();
            var animationStateComponent = skeletonComponent as IAnimationStateComponent;

            if (animationStateComponent != null)
            {
                animationStateComponent.AnimationState.Apply(skeleton);
            }
        }
示例#2
0
    private static void PreWarmSkin(Skin sk)
    {
        RemovePreWarmSkin(sk.nSkinID);

        if (!sk.isValid)
        {
            return;
        }
        sk.Clear(false);
        //非玩家比较简单,直接走缓存就可以了
        int skinCacheCout = sk.skinConfig.CacheCout;

        // if (sk.SkinType == ENTITY_TYPE.TYPE_PLAYER_ROLE && !sk.isStaticSkin)
        {
            skinCacheCout = 1;
        }

        for (int i = 0; i < skinCacheCout; i++)
        {
            SkinInstance go = sk.Instantiate_Main();
            if (go != null)
            {
                go.SkinObj.transform.SetPosition(Initialize.mainCam.transform.forward * 20.0f + Initialize.mainCam.transform.position);
            }
        }
    }
示例#3
0
 public void ExchangeEquipment(SkeletonAnimation skeletonAnimation, List <EquipmentItem> infos)
 {
     if (skeletonAnimation.skeleton.Skin.Name == RepackConst)
     {
         Skin repackedSkin = skeletonAnimation.skeleton.Skin;
         repackedSkin.Clear();
         repackedSkin = null;
         SetSkin(skeletonAnimation, infos[0].defaultSkinName);
     }
     ExchangeEquipmentAndMerge(skeletonAnimation, infos);
     Resources.UnloadUnusedAssets();
 }
示例#4
0
    private static void UnLoadSkinRes(ref Skin sk)
    {
        if (null == sk)
        {
            return;
        }
        int     SkinID  = sk.nSkinID;
        bool    isAsync = sk.isAsync;
        ResNode res     = sk.ResSkinObj;

        sk.Clear(true);

        if (isAsync)
        {
            AssetBundleManager.DeleteAssetsAsync(ref res, ResLoadCallBack, ImmdieateUnLoadSkin);
        }
        else
        {
            AssetBundleManager.DeleteAssets(ref res, ImmdieateUnLoadSkin);
        }

        sk = null;
    }