Example #1
0
 public Package(string fileName)
 {
     using (var reader = new BinaryReader(ArchiveManager.ReadFile(fileName + ".ifp")))
     {
         _package = new AnimationPackage(reader);
     }
 }
Example #2
0
        public override void StylesInitialized()
        {
            base.StylesInitialized();

            Package     = _loader.Load((string)GetStyle("animationPackage"));
            AnimationId = (string)GetStyle("animationId");
        }
Example #3
0
        /// <summary>
        /// Loads the animation package (specified by the XML file and additional graphics)
        /// </summary>
        /// <param name="packageConfigFilePath"></param>
        public void LoadPackage(string packageConfigFilePath)
        {
            // if path not changed, return
            if (_currentPackagePath == packageConfigFilePath)
            {
                return;
            }

            // remember current path
            _currentPackagePath = packageConfigFilePath;

            // remember current animation ID
            if (null != _stack.Current)
            {
                _currentAnimId = _stack.Current;
            }

            // dispose old package
            //if (null != _package)
            //    _package.Dispose();

            // load new package and cache it
            _package = _loader.Load(packageConfigFilePath);

            _cursorAnimator.Package = _package;

            // if animation playing, and there is the animation with the same ID in a new package
            // continue the same animation in another package
            if (null != _currentAnimId && null != _package.Animations[_currentAnimId])
            {
                // TODO: Totaly decouple animation descriptors and actual animations (textures), because of changing the package!!!
                _cursorAnimator.Play(_stack.Current);
            }
        }
Example #4
0
 protected override void CreateAnimationPlayer(AnimationPackage animationPackage)
 {
     if (animationPackage.SkinningData != null)
     {
         SkinClipPlayer = new SkinClipPlayer(animationPackage.SkinningData);
     }
     GameResources.ActorManager.AnimationUpdateStep += AnimationUpdateHandler;
 }
Example #5
0
        public override void StyleChanged(string styleName)
        {
            base.StyleChanged(styleName);
            switch (styleName)
            {
            case "animationPackage":
                Package = _loader.Load((string)GetStyle(styleName));
                //Debug.Log("Package changed to: " + Package);
                break;

            case "animationId":
                AnimationId = (string)GetStyle(styleName);
                //Debug.Log("AnimationId changed to: " + AnimationId);
                break;
            }
        }
Example #6
0
        protected virtual void ComponentsCreatedHandler(object sender, EventArgs e)
        {
            ModelRenderComponent modelRenderComponent = Owner.GetComponent <ModelRenderComponent>(ComponentType.Render);

            if (modelRenderComponent == null)
            {
                throw new LevelManifestException("AnimationComponents expect to be accompanied by ModelRenderComponents.");
            }

            AnimationPackage animationPackage = modelRenderComponent.VisualModel.Tag as AnimationPackage;

            if (animationPackage != null)
            {
                Animations = animationPackage.SkinningData;
                CreateAnimationPlayer(animationPackage);
            }
        }
Example #7
0
 protected abstract void CreateAnimationPlayer(AnimationPackage animationPackage);
Example #8
0
 protected override void CreateAnimationPlayer(AnimationPackage animationPackage)
 {
     AnimationStateMachine = new AnimationStateMachine(animationPackage);
     GameResources.ActorManager.AnimationUpdateStep += AnimationUpdateHandler;
 }
Example #9
0
 private void WriteAnimationPackage(AnimationPackage animationPackage)
 {
     WriteBytes(animationPackage.RawData);
 }
Example #10
0
 // Animation
 private void WriteAnimationPackageChunk(AnimationPackage animationPackage)
 {
     StartWritingChunk(animationPackage.Version, ResourceChunkType.AnimationPackage);
     WriteAnimationPackage(animationPackage);
     FinishWritingChunk();
 }