internal SceneT10( ) : base(Vector2.Zero, GestureType.None, new Resource[] { new Resource ( "play.image", ResourceType.Image, @"image\button1" ), new Resource ( "click.s", ResourceType.Sound, @"sound\click" ), }, new Making[] { new Button ( "b.play", "play.image", "PLAY", new Vector2 ( 100, 100 ), 100, 50, new Point ( 1, 1 ) ) }) { this.buttonPlay = this.makings[ "b.play" ] as Button; //this.buttonPlay.IsEnabled = false; this.buttonPlay.Pressing += this.buttonPlayPressing; this.buttonPlay.Pressed += this.buttonPlayPressed; }
internal SceneT14( ) : base(Vector2.Zero, GestureType.None, "background1", new Resource[] { new Resource ( "bird2.image", ResourceType.Image, @"image\bird2" ), new Resource ( "go.image", ResourceType.Image, @"image\button1" ), new Resource ( "stop.image", ResourceType.Image, @"image\button2" ), }, new Making[] { new Movie ( "bird", "bird2.image", 80, 80, 5, "stop", new MovieSequence ( "go", true, new Point ( 1, 1 ), new Point ( 2, 1 ) ), new MovieSequence ( "stop", true, new Point ( 3, 1 ) ) ), new Button ( "b.go", "go.image", "GO", new Vector2 ( 100, 100 ), 100, 50, new Point ( 1, 1 ) ), new Button ( "b.play", "stop.image", "STOP", new Vector2 ( 100, 300 ), 100, 50, new Point ( 1, 1 ) ) }) { this.goButton = this.makings[ "b.go" ] as Button; this.stopButton = this.makings[ "b.play" ] as Button; this.goButton.Selected += this.goButtonSelected; this.stopButton.Selected += this.stopButtonSelected; }
internal static void Unpress( Button button ) { if ( !button.IsPressing ) return; button.IsPressing = false; button.unpress ( ); if ( null != button.Pressed ) button.Pressed ( button, new ButtonEventArgs ( button.command ) ); }
internal static void Select( Button button ) { if ( !button.isEnabled ) return; button.select ( ); if ( null != button.Selected ) button.Selected ( button, new ButtonEventArgs ( button.command ) ); }
internal static bool PressTest( Button button, IList<Motion> motions ) { if ( !button.isEnabled || !button.isVisible ) return false; foreach ( Motion motion in motions ) if ( motion.Type == MotionType.Down || motion.Type == MotionType.Press ) { Point location = new Point ( ( int ) motion.Position.X, ( int ) motion.Position.Y ); if ( button.bound.Contains ( location ) ) { Press ( button ); return true; } } Unpress ( button ); return false; }
internal static void Press( Button button ) { button.IsPressing = true; button.press ( ); if ( null != button.Pressing ) button.Pressing ( button, new ButtonEventArgs ( button.command ) ); }
internal static bool ClickTest( Button button, IList<Motion> motions ) { if ( !button.isEnabled || !button.isVisible ) return false; foreach ( Motion motion in motions ) if ( motion.Type == MotionType.Up ) { Point location = new Point ( ( int ) motion.Position.X, ( int ) motion.Position.Y ); if ( button.bound.Contains ( location ) ) { Select ( button ); return true; } } return false; }