Exemplo n.º 1
0
        /// <summary>
        /// See managed variant.
        /// </summary>
        /// <param name="Buffer">Referenced pointer to Animation start</param>
        /// <returns>Typed animation class instance or NULL</returns>
        public static unsafe Animation ExtractAnimation(ref byte *Buffer)
        {
            Animation returnValue = null;

            // try to parse the animation
            switch ((AnimationType)Buffer[0])
            {
            case AnimationType.NONE:
                returnValue = new AnimationNone(ref Buffer);
                break;

            case AnimationType.CYCLE:
                returnValue = new AnimationCycle(ref Buffer);
                break;

            case AnimationType.ONCE:
                returnValue = new AnimationOnce(ref Buffer);
                break;
            }

            return(returnValue);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Extracts an animation from Buffer,
        /// if the 1. read byte signals a known animation type.
        /// </summary>
        /// <param name="Buffer">Buffer to extract from</param>
        /// <param name="StartIndex">Index to start reading</param>
        /// <returns>Typed animation class instance or NULL</returns>
        public static Animation ExtractAnimation(byte[] Buffer, int StartIndex)
        {
            Animation returnValue = null;

            // try to parse the animation
            switch ((AnimationType)Buffer[StartIndex])
            {
            case AnimationType.NONE:
                returnValue = new AnimationNone(Buffer, StartIndex);
                break;

            case AnimationType.CYCLE:
                returnValue = new AnimationCycle(Buffer, StartIndex);
                break;

            case AnimationType.ONCE:
                returnValue = new AnimationOnce(Buffer, StartIndex);
                break;
            }

            return(returnValue);
        }
Exemplo n.º 3
0
        /// <summary>
        /// See managed variant.
        /// </summary>
        /// <param name="Buffer">Referenced pointer to Animation start</param>
        /// <returns>Typed animation class instance or NULL</returns>
        public static unsafe Animation ExtractAnimation(ref byte* Buffer)
        {
            Animation returnValue = null;

            // try to parse the animation
            switch ((AnimationType)Buffer[0])
            {
                case AnimationType.NONE:
                    returnValue = new AnimationNone(ref Buffer);
                    break;

                case AnimationType.CYCLE:
                    returnValue = new AnimationCycle(ref Buffer);
                    break;

                case AnimationType.ONCE:
                    returnValue = new AnimationOnce(ref Buffer);
                    break;
            }

            return returnValue;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Extracts an animation from Buffer, 
        /// if the 1. read byte signals a known animation type.
        /// </summary>
        /// <param name="Buffer">Buffer to extract from</param>
        /// <param name="StartIndex">Index to start reading</param>
        /// <returns>Typed animation class instance or NULL</returns>
        public static Animation ExtractAnimation(byte[] Buffer, int StartIndex)
        {
            Animation returnValue = null;

            // try to parse the animation
            switch ((AnimationType)Buffer[StartIndex])
            {
                case AnimationType.NONE:
                    returnValue = new AnimationNone(Buffer, StartIndex);
                    break;

                case AnimationType.CYCLE:
                    returnValue = new AnimationCycle(Buffer, StartIndex);
                    break;

                case AnimationType.ONCE:
                    returnValue = new AnimationOnce(Buffer, StartIndex);
                    break;
            }

            return returnValue;
        }
Exemplo n.º 5
0
        public void SetAnimation()
        {

            ushort group = (cbGroup.SelectedItem == null) ? (ushort)1 : (ushort)((int)cbGroup.SelectedItem);
            ushort low = (cbLow.SelectedItem == null) ? (ushort)1 : (ushort)((int)cbLow.SelectedItem);
            ushort high = (cbHigh.SelectedItem == null) ? (ushort)1 : (ushort)((int)cbHigh.SelectedItem);
            ushort final = (cbFinal.SelectedItem == null) ? (ushort)1 : (ushort)((int)cbFinal.SelectedItem);
            uint period = Convert.ToUInt32(numInterval.Value);
            int groupmax = Program.CurrentFile.FrameSets.Count;

            Animation anim;

            switch (cbType.SelectedIndex)
            {
                // cycle
                case 1:
                    anim = new AnimationCycle(period, low, high);
                    anim.GroupMax = groupmax;
                    break;

                // once
                case 2:
                    anim = new AnimationOnce(period, low, high, final);
                    anim.GroupMax = groupmax;
                    break;

                // none (and others)
                default:
                    anim = new AnimationNone(group);
                    anim.GroupMax = groupmax;
                    break;
            }

            // set color
            Program.RoomObject.FirstAnimationType = AnimationType.TRANSLATION;
            Program.RoomObject.ColorTranslation = Convert.ToByte(cbPalette.SelectedIndex);

            // set cycle anim
            Program.RoomObject.Animation = anim;
        }