Ejemplo n.º 1
0
        /// <summary>
        /// 重置Avatar资源
        /// </summary>
        public void ResetAvatarResource(NActor ownerActor)
        {
            targetActorRef = new WeakReference(ownerActor);

            NSkeletalMeshComponent skeletalMeshMeshCmp = (NSkeletalMeshComponent)ownerActor.CreateComponent("LPC_Skeletal_Mesh", "nskeletal_mesh_component");

            skeletalMeshComponentRef = new WeakReference(skeletalMeshMeshCmp);

            try
            {
                // 初始化资源
                skeletalMeshMeshCmp.ResetResource(new NResourceLoc("content", @"/characters/XiaShi/body.skm"), true);

                // 初始化动画
                AnimPlayer = skeletalMeshMeshCmp.ResetSkeletalAnimPlayer();
                AnimPlayer.Init(NResourceManager.Instance.LoadSkeletalAnimSet(
                                    new NResourceLoc("content", @"/characters/XiaShi/base_act.animset"),
                                    EResourceIOMode.Auto,
                                    EResourceIOPriority.Normal
                                    ), true);
            }
            catch (System.Exception e)
            {
                NLogger.Instance.WriteString(LogType.Exception, "Load  Skeletal Mesh faild!" + e.ToString());
                Program.ShowException(e, "Load  Skeletal Mesh faild!");
            }
        }
Ejemplo n.º 2
0
        internal void ResetSkeletalMeshResource(NResourceSkeletalMesh mesh)
        {
            NSkeletalMeshComponent SMC = SkeletalMeshComponentPreview;

            if (SMC == null)
            {
                NLogger.Instance.WriteString(LogType.Debug, "没有创建可预览SkeletalMeshComponent...");
                return;
            }

            try
            {
                if (mesh != null)
                {
                    SMC.ResetResource(mesh, true);
                    m_actorBox = SMC.GetBoundingBox();
                }
            }
            catch (System.Exception e)
            {
                NexusEditor.Program.ShowException(e, "Skeletal Mesh Resource Reset FAILED!");
            }
        }