public InstructionsScene()
        {
            this.Camera.SetViewFromViewport();

            _texture = new Texture2D("/Application/assets/images/allSame.png",false);
            // started working out game logic in a seperate project Card Match Login
            _ti = new TextureInfo(_texture);
            SpriteUV titleScreen = new SpriteUV(_ti);
            titleScreen.Scale = _ti.TextureSizef;
            titleScreen.Pivot = new Vector2(0.5f,0.5f);
            titleScreen.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width/2,
                                              Director.Instance.GL.Context.GetViewport().Height/2);
            this.AddChild(titleScreen);

            Vector4 origColor = titleScreen.Color;
            titleScreen.Color = new Vector4(0,0,0,0);
            var tintAction = new TintTo(origColor,10.0f);
            ActionManager.Instance.AddAction(tintAction,titleScreen);
            tintAction.Run();

            Scheduler.Instance.ScheduleUpdateForTarget(this,0,false);

            // Clear any queued clicks so we dont immediately exit if coming in from the menu
            Touch.GetData(0).Clear();
        }
Esempio n. 2
0
        public TitleScene()
        {
            this.Camera.SetViewFromViewport();
            _texture = new Texture2D("Application/images/title.png",false);
            _ti = new TextureInfo(_texture);
            SpriteUV titleScreen = new SpriteUV(_ti);
            titleScreen.Scale = _ti.TextureSizef;
            titleScreen.Pivot = new Vector2(0.5f,0.5f);
            titleScreen.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width/2,
                                              Director.Instance.GL.Context.GetViewport().Height/2);
            this.AddChild(titleScreen);

            Vector4 origColor = titleScreen.Color;
            titleScreen.Color = new Vector4(0,0,0,0);
            var tintAction = new TintTo(origColor,10.0f);
            ActionManager.Instance.AddAction(tintAction,titleScreen);
            tintAction.Run();

            _titleSong = new Bgm("/Application/audio/titlesong.mp3");

            if(_songPlayer != null)
            _songPlayer.Dispose();
            _songPlayer = _titleSong.CreatePlayer();

            Scheduler.Instance.ScheduleUpdateForTarget(this,0,false);

            // Clear any queued clicks so we dont immediately exit if coming in from the menu
            Touch.GetData(0).Clear();
        }
Esempio n. 3
0
        public TitleScene()
        {
            if(AppMain.am == null) {
                AppMain.am = new AudioManager();
            } else {
                AppMain.am.changeSong(false);
            }
            this.Camera.SetViewFromViewport();
            _texture = new Texture2D("/Application/images/title.png", false);
            _textureInfo = new TextureInfo(_texture);
            SpriteUV titleScreen = new SpriteUV(_textureInfo);
            titleScreen.Scale = _textureInfo.TextureSizef;
            titleScreen.Pivot = new Vector2(0.5f, 0.5f);
            ImageRect viewPort = Director.Instance.GL.Context.GetViewport();
            titleScreen.Position = new Vector2(viewPort.Width/2, viewPort.Height/2);
            this.AddChild(titleScreen);

            Vector4 origColour = titleScreen.Color;
            titleScreen.Color = new Vector4(0,0,0,0);
            var tintAction = new TintTo(origColour, 10.0f);
            ActionManager.Instance.AddAction(tintAction, titleScreen);
            tintAction.Run();

            Scheduler.Instance.ScheduleUpdateForTarget(this, 0, false);

            // Clear any queued clicks so we don't immediately exit if coming in from the menu
            Touch.GetData (0).Clear();
        }
        public TitleScene()
        {
            this.Camera.SetViewFromViewport();

            _texture = new Texture2D("/Application/assets/images/header.png",false);
            _ti = new TextureInfo(_texture);
            SpriteUV titleScreen = new SpriteUV(_ti);
            titleScreen.Scale = _ti.TextureSizef;
            titleScreen.Pivot = new Vector2(0.5f,0.5f);
            titleScreen.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width/2,
                                              Director.Instance.GL.Context.GetViewport().Height/2);
            this.AddChild(titleScreen);

            Vector4 origColor = titleScreen.Color;
            titleScreen.Color = new Vector4(0,0,0,0);
            var tintAction = new TintTo(origColor,10.0f);
            ActionManager.Instance.AddAction(tintAction,titleScreen);
            tintAction.Run();

            // MUSIC
            Support.MusicSystem.Instance.Play("play.mp3");

            Scheduler.Instance.ScheduleUpdateForTarget(this,0,false);

            // Clear any queued clicks so we dont immediately exit if coming in from the menu
            Touch.GetData(0).Clear();
        }
Esempio n. 5
0
        public TitleScene()
        {
            this.Camera.SetViewFromViewport();
            m_texture = new Texture2D("Application/images/title.png", false);
            m_ti      = new TextureInfo(m_texture);
            SpriteUV titleScreen = new SpriteUV(m_ti);

            titleScreen.Scale    = m_ti.TextureSizef;
            titleScreen.Pivot    = new Vector2(0.5f, 0.5f);
            titleScreen.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width / 2.0f,
                                               Director.Instance.GL.Context.GetViewport().Height / 2.0f);
            this.AddChild(titleScreen);

            Vector4 origColor = titleScreen.Color;

            titleScreen.Color = new Vector4(0, 0, 0, 0);
            var tintAction = new TintTo(origColor, 10.0f);

            ActionManager.Instance.AddAction(tintAction, titleScreen);
            tintAction.Run();

            m_titleSong = new Bgm("/Application/audio/titlesong.mp3");

            if (m_songPlayer != null)
            {
                m_songPlayer.Dispose();
            }
            m_songPlayer = m_titleSong.CreatePlayer();

            Scheduler.Instance.ScheduleUpdateForTarget(this, 0, false);

            // Clear any queued clicks so we dont immediately exit if coming in from the menu
            Touch.GetData(0).Clear();
        }
Esempio n. 6
0
        protected override void OnUpdate(float timeStep)
        {
            var input = Input;

            const float      duration = 1f;        //2s
            FiniteTimeAction action   = null;

            if (input.GetKeyPress(Key.W))
            {
                action = new MoveBy(duration, new Vector3(0, 0, 5));
            }

            if (input.GetKeyPress(Key.S))
            {
                action = new MoveBy(duration, new Vector3(0, 0, -5));
            }

            if (input.GetKeyPress(Key.E))
            {
                action = new FadeIn(duration);
            }

            if (input.GetKeyPress(Key.Q))
            {
                action = new FadeOut(duration);
            }

            if (input.GetKeyPress(Key.R))
            {
                action = new EaseElasticInOut(new ScaleBy(duration, 1.3f));
            }

            if (input.GetKeyPress(Key.G))
            {
                action = new TintTo(duration, NextRandom(1), NextRandom(1), NextRandom(1));
            }

            if (action != null)
            {
                //can be awaited
                boxNode.RunActionsAsync(action);
            }
            base.OnUpdate(timeStep);
        }
Esempio n. 7
0
 private void setTintAction()
 {
     Vector4 originalColor = this.titleScreenSprite.Color;
     this.titleScreenSprite.Color = new Vector4(0,0,0,0);
     var tintAction = new TintTo(originalColor,10.0f);
     ActionManager.Instance.AddAction (tintAction, this.titleScreenSprite);
     tintAction.Run();
 }
Esempio n. 8
0
    public static Scene MakeTestActionsScene()
    {
        TextureInfo Characters = new TextureInfo(new Texture2D("/Application/Sample/GameEngine2D/FeatureCatalog/data/PlanetCute/Objects.png", false), new Vector2i(7, 3));

        float world_scale = 0.036f;

        var sprite = new SpriteTile();

        sprite.TextureInfo = Characters;
        sprite.TileIndex1D = 2;
        sprite.Quad.S      = sprite.CalcSizeInPixels() * world_scale;
        sprite.CenterSprite();
        sprite.Color     = new Vector4(1.0f, 1.0f, 1.0f, 0.75f);
        sprite.BlendMode = BlendMode.Normal;

        var scene = new Scene()
        {
            Name = "Action tests"
        };

        scene.AddChild(sprite);

        var pos = new Vector2(0.0f, 0.0f);

        int writing_color_tag    = 333;
        int writing_position_tag = 65406;

        AddButton(scene, "MoveTo (0,0)", ref pos, () => { sprite.RunAction(new MoveTo(new Vector2(0.0f, 0.0f), 0.1f)); });
        AddButton(scene, "MoveBy (3,0)", ref pos, () => { sprite.RunAction(new MoveBy(new Vector2(3.0f, 0.0f), 0.1f)); });
        AddButton(scene, "ScaleBy (2,2)", ref pos, () => { sprite.RunAction(new ScaleBy(new Vector2(2.0f, 2.0f), 0.1f)); });
        AddButton(scene, "ScaleBy (0.5,0.5)", ref pos, () => { sprite.RunAction(new ScaleBy(new Vector2(0.5f, 0.5f), 0.1f)); });

        AddButton(scene, "TintTo White", ref pos, () =>
        {
            // prevent from running an other action that writes the color
            if (sprite.GetActionByTag(writing_color_tag) != null)
            {
                sprite.StopActionByTag(writing_color_tag);
            }

            sprite.RunAction(new TintTo(Math.SetAlpha(Colors.White, 0.75f), 2.0f)
            {
                Tag = writing_color_tag
            });
        }
                  );

        AddButton(scene, "TintTo Blue", ref pos, () =>
        {
            // prevent from running an other action that writes the color
            if (sprite.GetActionByTag(writing_color_tag) != null)
            {
                sprite.StopActionByTag(writing_color_tag);
            }

            sprite.RunAction(new TintTo(Math.SetAlpha(Colors.Blue, 0.75f), 2.0f)
            {
                Tag = writing_color_tag
            });
        }
                  );

        AddButton(scene, "Pingpong colors", ref pos, () =>

        {
            // prevent from running an other action that writes the color
            if (sprite.GetActionByTag(writing_color_tag) != null)
            {
                sprite.StopActionByTag(writing_color_tag);
            }

            var action12 = new TintTo(Colors.Green, 0.5f)
            {
                Tween = (t) => FMath.Sin(t * Math.Pi * 0.5f),
            };

            var action13 = new TintTo(Colors.Magenta, 0.5f)
            {
                Tween = (t) => FMath.Sin(t * Math.Pi * 0.5f),
            };

            var seq = new Sequence();
            seq.Add(action12);
            seq.Add(action13);
            var repeat0 = new RepeatForever()
            {
                InnerAction = seq, Tag = writing_color_tag
            };
            sprite.RunAction(repeat0);
        }
                  );

        AddButton(scene, "Pingpong position", ref pos, () =>

        {
            // prevent from running the same action twice
            // (we could also just hold an Action object somewhere and re-run, so that this check wouldn't be needed)
            if (sprite.GetActionByTag(writing_position_tag) != null)
            {
                sprite.StopActionByTag(writing_position_tag);
            }

            var action12 = new MoveTo(new Vector2(-5, 0), 0.5f)
            {
                Tween = (t) => FMath.Sin(t * Math.Pi * 0.5f),
            };

            var action13 = new MoveTo(new Vector2(5, 0), 0.5f)
            {
                Tween = (t) => FMath.Sin(t * Math.Pi * 0.5f),
            };

            var seq = new Sequence();
            seq.Add(action12);
            seq.Add(action13);
            var repeat0 = new RepeatForever()
            {
                InnerAction = seq, Tag = writing_position_tag
            };

            sprite.RunAction(repeat0);
        }
                  );

        AddButton(scene, "StopAllActions", ref pos, () => sprite.StopAllActions());

        scene.RegisterDisposeOnExit((System.IDisposable)Characters);

        return(scene);
    }
 public void TintBackground( Vector4 pColor, float pDuration )
 {
     var bgTint = new TintTo(pColor, pDuration) {
         Get = () => BackgroundColor,
         Set = value => {
             BackgroundColor = value;
             if(GameScene.Hud != null)
                 GameScene.Hud.HudBarMask.Color = value;
         },
         Tween = (x) => Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.PowEaseOut(x,2)
     };
     Director.Instance.CurrentScene.RunAction(bgTint);
 }
Esempio n. 10
0
 public static void ShiftLabelColor(this Label self, Vector4 pColor, float pDuration = 0.0f)
 {
     self.StopActionByTag(3);
     var shift = new TintTo(pColor, pDuration) {
         Tag = 3,
         Get = () => self.Color,
         Set = (value) => {
             self.Color.R = value.R;
             self.Color.G = value.G;
             self.Color.B = value.B;
         },
         Tween = (t) => Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.PowEaseOut(t,2)
     };
     self.RunAction(shift);
 }
Esempio n. 11
0
 public static void ShiftLabelAlpha( this SpriteBase self, Vector4 pColor, float pDuration=0.0f)
 {
     self.StopActionByTag(2);
     var shift = new TintTo(pColor, pDuration) {
         Tag = 2,
         Get = () => self.Color,
         Set = (value) => { self.Color.A = value.A; },
         Tween = (t) => Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.PowEaseOut(t,2)
     };
     self.RunAction(shift);
 }
Esempio n. 12
0
        public void StopEffect()
        {
            if ( Image.GetActionByTag( BLINK_COLOR_TAG ) != null )
                Image.StopActionByTag( BLINK_COLOR_TAG );

            var action = new TintTo(Colors.White, 0.2f)
            {
                Tween = (t) => Sce.PlayStation.Core.FMath.Sin(t*Math.Pi*0.5f),
            };

            Image.RunAction(action);
        }
Esempio n. 13
0
        public void StartEffect()
        {
            if ( Image.GetActionByTag( BLINK_COLOR_TAG ) != null )
                Image.StopActionByTag( BLINK_COLOR_TAG );

            var actionBlinkWhite = new TintTo( Colors.White, 0.2f )
            {
                Tween = (t) => Sce.PlayStation.Core.FMath.Sin(t*Math.Pi*0.5f),
            };

            var actionBlinkGrey = new TintTo( Colors.Grey50, 0.20f )
            {
                Tween = (t) => Sce.PlayStation.Core.FMath.Sin(t*Math.Pi*0.5f),
            };

            var seq = new Sequence();
            seq.Add( actionBlinkWhite );
            seq.Add( actionBlinkGrey );
            var repeat0 = new RepeatForever { InnerAction = seq, Tag = BLINK_COLOR_TAG };

            Image.RunAction( repeat0 );
        }