コード例 #1
0
        protected override void InitializeEx()
        {
            base.InitializeEx();
            _partDataDict = new Dictionary <ModelPart, string>
            {
                [ModelPart.ModelHead]   = ModelConfig.HeadArray[0],
                [ModelPart.ModelBody]   = ModelConfig.BodyArray[0],
                [ModelPart.ModelHand]   = ModelConfig.HandArray[0],
                [ModelPart.ModelFeet]   = ModelConfig.FeetArray[0],
                [ModelPart.ModelWeapon] = ModelConfig.WeaponArray[0]
            };

            _skeletonProxy = ResourceMgr.singleton.LoadAssetAsync(_skeletonPath);
            _skeletonProxy.AddLoadFinishCallBack(() =>
            {
                _skeleton = _skeletonProxy.GetInstantiateObject <GameObject>();
                OnLoaded();
            });
            _partProxyDict     = new Dictionary <ModelPart, AbsAssetProxy>();
            _tempPartProxyDict = new Dictionary <ModelPart, AbsAssetProxy>();

            foreach (var temp in _partDataDict)
            {
                var part  = temp.Key;
                var name  = temp.Value;
                var proxy = ResourceMgr.singleton.LoadAssetAsync(name);
                _partProxyDict[part] = proxy;
                proxy.AddLoadFinishCallBack(OnLoaded);
            }
        }
コード例 #2
0
        public void OverrideAnimationClip(string path)
        {
            if (_animationPath == path)
            {
                return;
            }
            _animationPath = path;
            if (_animationClipProxy != null)
            {
                _animationClipProxy.UnloadProxy();
            }
            _animationClipProxy = ResourceMgr.singleton.LoadAssetAsync(path);
            _animationClipProxy.AddLoadFinishCallBack(() =>
            {
                var clip = _animationClipProxy.GetUnityAsset <AnimationClip>();
                if (Machine.AnimatorOverrideController && clip)
                {
                    Machine.AnimatorOverrideController[StateName] = clip;
                    Machine.Animator.runtimeAnimatorController    = Machine.AnimatorOverrideController;
                    //_animator.Rebind();

                    _animationClip = clip;
                }
            });
        }
コード例 #3
0
 protected override void InitializeEx()
 {
     base.InitializeEx();
     _skeletonProxy = ResourceMgr.singleton.LoadAssetAsync(_skeletonPath);
     _skeletonProxy.AddLoadFinishCallBack(() =>
     {
         _skeleton = _skeletonProxy.GetInstantiateObject <GameObject>();
         OnLoadFinish();
     });
 }
コード例 #4
0
 public void Initialize(Animator animator, string path)
 {
     _animator             = animator;
     _runtimeAnimatorProxy = ResourceMgr.singleton.LoadAssetAsync(path);
     _runtimeAnimatorProxy.AddLoadFinishCallBack(() =>
     {
         var ctrl = _runtimeAnimatorProxy.GetUnityAsset <RuntimeAnimatorController>();
         if (ctrl)
         {
             _animator.runtimeAnimatorController = ctrl;
             _animatorOverrideController         = new AnimatorOverrideController(ctrl);
             _animator.Rebind();
         }
     });
 }
コード例 #5
0
        public void Initialize()
        {
            if (null == Entity)
            {
                return;
            }
            Animator = Entity.Animator;
            _runtimeAnimatorProxy = ResourceMgr.singleton.LoadAssetAsync(AssetPath);
            _runtimeAnimatorProxy.AddLoadFinishCallBack(() =>
            {
                var ctrl = _runtimeAnimatorProxy.GetUnityAsset <RuntimeAnimatorController>();
                if (ctrl)
                {
                    AnimatorOverrideController         = new AnimatorOverrideController(ctrl);
                    Animator.runtimeAnimatorController = AnimatorOverrideController;
                    Animator.Rebind();
                    Enable = true;
                    TransToDefault();

                    //TODO
                    foreach (var state in StateList)
                    {
                        var str = string.Empty;
                        if (state.StateName == StateNameEnum.Idle.ToString())
                        {
                            str = "Assets/Bundles/Animation/Skeleton/Idle.anim";
                        }
                        if (state.StateName == StateNameEnum.Move.ToString())
                        {
                            str = "Assets/Bundles/Animation/Skeleton/Run.anim";
                        }
                        if (state.StateName == StateNameEnum.Skill.ToString())
                        {
                            str = "Assets/Bundles/Animation/Skeleton/Attack.anim";
                        }
                        if (state.StateName == StateNameEnum.Special.ToString())
                        {
                            str = "Assets/Bundles/Animation/Skeleton/Damage.anim";
                        }
                        if (state.StateName == StateNameEnum.Dead.ToString())
                        {
                            str = "Assets/Bundles/Animation/Skeleton/Death.anim";
                        }
                        state.Initialize(str);
                    }
                }
            });
        }
コード例 #6
0
    static int AddRemoveProxy(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("Framework.ResourceMgr.AddRemoveProxy");
#endif
        try
        {
            ToLua.CheckArgsCount(L, 2);
            Framework.ResourceMgr   obj  = (Framework.ResourceMgr)ToLua.CheckObject <Framework.ResourceMgr>(L, 1);
            Framework.AbsAssetProxy arg0 = (Framework.AbsAssetProxy)ToLua.CheckObject <Framework.AbsAssetProxy>(L, 2);
            obj.AddRemoveProxy(arg0);
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #7
0
        public void OverrideAnimationClip(string name, string path, bool autoPlay = true)
        {
            _animationClipProxy = ResourceMgr.singleton.LoadAssetAsync(path);
            _animationClipProxy.AddLoadFinishCallBack(() =>
            {
                var clip = _animationClipProxy.GetUnityAsset <AnimationClip>();
                if (_animatorOverrideController && clip)
                {
                    _animatorOverrideController[name]   = clip;
                    _animator.runtimeAnimatorController = _animatorOverrideController;
                    _animationInfo[name] = clip;
                    //_animator.Rebind();

                    if (autoPlay)
                    {
                        _animator.Play(name, 0, 0f);
                    }
                }
            });
        }
コード例 #8
0
 public void AddRemoveProxy(AbsAssetProxy proxy)
 {
     _removeList.Add(proxy);
 }