Пример #1
0
        internal Movie( Movie movie )
            : base(movie.Name, movie.resourceName, Vector2.Zero, movie.order)
        {
            this.Width = movie.Width;
            this.Height = movie.Height;
            this.renderWidth = movie.renderWidth;
            this.renderHeight = movie.renderHeight;
            this.rate = movie.rate;
            this.currentRate = movie.currentRate;
            this.currentFrameCount = movie.currentFrameCount;
            this.CurrentSequenceName = movie.CurrentSequenceName;

            foreach ( MovieSequence sequence in movie.sequences.Values )
                this.sequences.Add ( sequence.Name, MovieSequence.Clone ( sequence ) );

            this.rotation = movie.rotation;
            this.rotationLocation = movie.rotationLocation;
            this.frameRectangle = movie.frameRectangle;
            this.sequenceNames.AddRange ( movie.sequenceNames );
            this.isVisible = movie.isVisible;

            this.location = movie.location;
            this.Texture = movie.Texture;

            Movie.Play ( this, this.CurrentSequenceName, true );
        }
Пример #2
0
        internal SceneT9( )
            : base(Vector2.Zero, GestureType.Tap | GestureType.DoubleTap,
			new Resource[] {
				new Resource ( "bird2.image", ResourceType.Image, @"image\bird2" ),
				new Resource ( "click.s", ResourceType.Sound, @"sound\click" ),
				new Resource ( "peg", ResourceType.Font, @"font\myfont" ),
			},
			new Making[] {
				new Movie ( "bird2.m", "bird2.image", new Vector2 ( 200, 200 ), 80, 80, 3, 0, "live",
					new MovieSequence ( "live", true, new Point ( 1, 1 ), new Point ( 2, 1 ) ),
					new MovieSequence ( "dead", 30, false, new Point ( 3, 1 ), new Point ( 4, 1 ) )
				),
				new Label ( "l1", "Hello windows phone!", 2f, Color.LightGreen, 0f )
			})
        {
            this.l1 = this.makings[ "l1" ] as Label;
            this.bird2 = this.makings[ "bird2.m" ] as Movie;
        }
Пример #3
0
        protected Spirit( IPlayScene scene, int type, Vector2 location, string movieName, string extendMovieName, float speed, int angle, HitArea hitArea, int width, int height, double destroySecond, bool isMovieRotable, bool isAreaLimited, bool isAreaEntered, double areaSecond )
        {
            if ( null == scene || string.IsNullOrEmpty ( movieName ) )
                throw new ArgumentNullException ( "scene, movieName", "scene, movieName can't be null" );

            this.destroyFrameCount = World.ToFrameCount ( destroySecond );

            this.scene = scene;
            this.world = scene.World;
            this.audioManager = scene.AudioManager;

            this.isMovieRotable = isMovieRotable;
            this.isAreaLimited = isAreaLimited;
            this.isAreaEntered = isAreaEntered;

            this.areaFrameCount = World.ToFrameCount ( areaSecond );

            this.Location = location;

            this.movie = Movie.Clone ( this.scene.Makings[movieName] as Movie );
            this.movie.Ended += this.movieEnded;

            this.movieName = movieName;

            if ( !string.IsNullOrEmpty ( extendMovieName ) )
            {
                this.extendMovie = Movie.Clone ( this.scene.Makings[extendMovieName] as Movie );
                this.extendMovieName = extendMovieName;
            }

            this.Width = width;
            this.Height = height;
            this.halfSize = new Vector2 ( width / 2, height / 2 );

            this.Type = type;

            this.Speed = speed;
            this.Angle = angle;
            this.HitArea = hitArea;

            if ( null != this.HitArea )
                this.HitArea.Locate ( this.getHitAreaLocation ( ) );
        }
Пример #4
0
        internal static void Play( Movie movie, string sequenceName, bool isRecord, bool isReplay )
        {
            if ( !isReplay && movie.CurrentSequenceName == sequenceName )
                return;

            movie.CurrentSequenceName = sequenceName;
            if ( isRecord )
                movie.sequenceNames.Add ( sequenceName );

            if ( string.IsNullOrEmpty ( sequenceName ) || !movie.sequences.ContainsKey ( sequenceName ) )
            {
                movie.isVisible = false;
                return;
            }

            movie.isVisible = true;
            movie.currentSequence = movie.sequences[sequenceName];
            movie.currentRate = movie.currentSequence.Rate == 0 ? movie.rate : movie.currentSequence.Rate;
            movie.currentFrameCount = movie.currentRate;
            MovieSequence.Reset ( movie.currentSequence );

            movie.frameRectangle = new Rectangle ( ( int ) ( ( movie.currentSequence.CurrentFrame.X - 1 ) * movie.renderWidth ), ( int ) ( ( movie.currentSequence.CurrentFrame.Y - 1 ) * movie.renderHeight ), ( int ) movie.renderWidth, ( int ) movie.renderHeight );
        }
Пример #5
0
 internal static void Play( Movie movie, string sequenceName, bool isRecord )
 {
     Play ( movie, sequenceName, isRecord, true );
 }
Пример #6
0
 internal static void Play( Movie movie, string sequenceName )
 {
     Play ( movie, sequenceName, false, true );
 }
Пример #7
0
        internal static void NextFrame( Movie movie, bool isForce )
        {
            if ( !movie.isVisible || ( !isForce && --movie.currentFrameCount > 0 ) )
                return;

            if ( movie.currentSequence.FrameCount <= 1 )
            {

                if ( null != movie.Ended )
                    movie.Ended ( movie, new MovieEventArgs ( movie ) );

                return;
            }

            movie.currentFrameCount = movie.currentRate;

            if ( MovieSequence.Next ( movie.currentSequence ) )
                if ( null != movie.Ended )
                    movie.Ended ( movie, new MovieEventArgs ( movie ) );

            movie.frameRectangle = new Rectangle ( ( int ) ( ( movie.currentSequence.CurrentFrame.X - 1 ) * movie.renderWidth ), ( int ) ( ( movie.currentSequence.CurrentFrame.Y - 1 ) * movie.renderHeight ), ( int ) ( movie.renderWidth ), ( int ) ( movie.renderHeight ) );
        }
Пример #8
0
 internal static void NextFrame( Movie movie )
 {
     NextFrame ( movie, false );
 }
Пример #9
0
        internal static void Draw( Movie movie, GameTime time, SpriteBatch batch )
        {
            if ( !movie.isVisible )
                return;

            if ( movie.rotation == 0 )
                batch.Draw ( movie.Texture, movie.location * World.Scale, movie.frameRectangle, Color.White, 0, Vector2.Zero, World.TextureScale, SpriteEffects.None, movie.order );
            else
                batch.Draw ( movie.Texture, ( movie.location + movie.rotationLocation ) * World.Scale, movie.frameRectangle, Color.White, movie.rotation, movie.rotationLocation * World.Scale, World.TextureScale, SpriteEffects.None, movie.order );
        }
Пример #10
0
 internal static Movie Clone( Movie movie )
 {
     return new Movie ( movie );
 }
Пример #11
0
        internal static void Back( Movie movie, string sequenceName )
        {
            int count = movie.sequenceNames.Count;

            if ( count <= 1 )
                return;

            if ( sequenceName == movie.sequenceNames[count - 1] )
            {
                movie.sequenceNames.RemoveAt ( count - 1 );
                Play ( movie, movie.sequenceNames[count - 2] );
            }
            else
                movie.sequenceNames.Remove ( sequenceName );
        }
Пример #12
0
 internal MovieEventArgs( Movie movie )
 {
     this.SequenceName = movie.CurrentSequenceName;
 }
Пример #13
0
        internal Button( string name, string resourceName, string command, Vector2 location, int width, int height, bool isSole, Point upFrameIndex, Point downFrameIndex, Point disableFrameIndex, params MovieSequence[] movieSequences )
            : base(name, resourceName)
        {
            this.command = command;
            this.IsSole = isSole;

            this.Width = width;
            this.Height = height;

            List<MovieSequence> sequences = new List<MovieSequence> ( );
            sequences.Add ( new MovieSequence ( this.upMovieSequenceName, upFrameIndex ) );
            sequences.Add ( new MovieSequence ( this.downMovieSequenceName, downFrameIndex ) );
            sequences.Add ( new MovieSequence ( this.disableMovieSequenceName, disableFrameIndex ) );

            if ( null != movieSequences && movieSequences.Length != 0 )
                sequences.AddRange ( movieSequences );

            this.backgroundMovie = new Movie ( "background", resourceName, location, width, height, 0, 1f, this.upMovieSequenceName,
                sequences.ToArray ( )
                );

            this.Location = location;
        }