コード例 #1
0
        /// <summary>
        /// Loads the file from the specified stream.
        /// </summary>
        /// <param name="stream">The stream to read from.</param>
        public override void Load(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream, Encoding.GetEncoding("EUC-KR"));

            short skeletonFileCount = reader.ReadInt16();

            for (int i = 0; i < skeletonFileCount; i++) {
                string skeletonFile = reader.ReadNullTerminatedString();

                SkeletonFiles.Add(skeletonFile);
            }

            short motionFileCount = reader.ReadInt16();

            for (int i = 0; i < motionFileCount; i++) {
                string motionFile = reader.ReadNullTerminatedString();

                MotionFiles.Add(motionFile);
            }

            short effectFileCount = reader.ReadInt16();

            for (int i = 0; i < effectFileCount; i++) {
                string effectFile = reader.ReadNullTerminatedString();

                EffectFiles.Add(effectFile);
            }

            short characterCount = reader.ReadInt16();

            for (int i = 0; i < characterCount; i++) {
                Character character = new Character();
                character.IsEnabled = reader.ReadBoolean();

                if (character.IsEnabled) {
                    character.ID = reader.ReadInt16();
                    character.Name = reader.ReadNullTerminatedString();

                    short objectCount = reader.ReadInt16();

                    for (int j = 0; j < objectCount; j++) {
                        CharacterObject @object = new CharacterObject();
                        @object.Object = reader.ReadInt16();

                        character.Objects.Add(@object);
                    }

                    short animationCount = reader.ReadInt16();

                    for (int j = 0; j < animationCount; j++) {
                        CharacterAnimation animation = new CharacterAnimation();
                        animation.Type = (AnimationType)reader.ReadInt16();
                        animation.Animation = reader.ReadInt16();

                        character.Animations.Add(animation);
                    }

                    short effectCount = reader.ReadInt16();

                    for (int j = 0; j < effectCount; j++) {
                        CharacterEffect effect = new CharacterEffect();
                        effect.Bone = reader.ReadInt16();
                        effect.Effect = reader.ReadInt16();

                        character.Effects.Add(effect);
                    }
                }

                Characters.Add(character);
            }
        }
コード例 #2
0
ファイル: CharacterFile.cs プロジェクト: jackwakefield/Revise
        /// <summary>
        /// Loads the file from the specified stream.
        /// </summary>
        /// <param name="stream">The stream to read from.</param>
        public override void Load(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream, CodePagesEncodingProvider.Instance.GetEncoding("EUC-KR"));

            short skeletonFileCount = reader.ReadInt16();

            for (int i = 0; i < skeletonFileCount; i++)
            {
                string skeletonFile = reader.ReadNullTerminatedString();

                SkeletonFiles.Add(skeletonFile);
            }

            short motionFileCount = reader.ReadInt16();

            for (int i = 0; i < motionFileCount; i++)
            {
                string motionFile = reader.ReadNullTerminatedString();

                MotionFiles.Add(motionFile);
            }

            short effectFileCount = reader.ReadInt16();

            for (int i = 0; i < effectFileCount; i++)
            {
                string effectFile = reader.ReadNullTerminatedString();

                EffectFiles.Add(effectFile);
            }

            short characterCount = reader.ReadInt16();

            for (int i = 0; i < characterCount; i++)
            {
                Character character = new Character();
                character.IsEnabled = reader.ReadBoolean();

                if (character.IsEnabled)
                {
                    character.ID   = reader.ReadInt16();
                    character.Name = reader.ReadNullTerminatedString();

                    short objectCount = reader.ReadInt16();

                    for (int j = 0; j < objectCount; j++)
                    {
                        CharacterObject @object = new CharacterObject();
                        @object.Object = reader.ReadInt16();

                        character.Objects.Add(@object);
                    }

                    short animationCount = reader.ReadInt16();

                    for (int j = 0; j < animationCount; j++)
                    {
                        CharacterAnimation animation = new CharacterAnimation();
                        animation.Type      = (AnimationType)reader.ReadInt16();
                        animation.Animation = reader.ReadInt16();

                        character.Animations.Add(animation);
                    }

                    short effectCount = reader.ReadInt16();

                    for (int j = 0; j < effectCount; j++)
                    {
                        CharacterEffect effect = new CharacterEffect();
                        effect.Bone   = reader.ReadInt16();
                        effect.Effect = reader.ReadInt16();

                        character.Effects.Add(effect);
                    }
                }

                Characters.Add(character);
            }
        }