示例#1
0
        public Theater(RenderTarget2D renderTexture)
        {
            int bodyWidth       = 38;
            int charactetOffset = 20;

            Env = ContentLibrary.GetSprite(SpriteList.env_school);

            this.renderTexture            = renderTexture;
            TheaterCharacters[0]          = ContentLibrary.GetTheaterCharacter(TheaterCharactersList.character1);
            TheaterCharacters[0].Position = new Vector2(bodyWidth + charactetOffset * 0, 61);
            TheaterCharacters[0].Fliped   = true;

            TheaterCharacters[1]          = ContentLibrary.GetTheaterCharacter(TheaterCharactersList.character2);
            TheaterCharacters[1].Position = new Vector2(bodyWidth + charactetOffset * 1, 61);
            TheaterCharacters[1].Fliped   = true;

            TheaterCharacters[2]          = ContentLibrary.GetTheaterCharacter(TheaterCharactersList.character3);
            TheaterCharacters[2].Position = new Vector2(bodyWidth + charactetOffset * 2, 62);

            TheaterCharacters[3]          = ContentLibrary.GetTheaterCharacter(TheaterCharactersList.character4);
            TheaterCharacters[3].Position = new Vector2(bodyWidth + charactetOffset * 3, 61);

            TheaterCharacters[4]          = ContentLibrary.GetTheaterCharacter(TheaterCharactersList.character5);
            TheaterCharacters[4].Position = new Vector2(bodyWidth + charactetOffset * 4, 61);

            TheaterCharacters[5]          = ContentLibrary.GetTheaterCharacter(TheaterCharactersList.character6);
            TheaterCharacters[5].Position = new Vector2(bodyWidth + charactetOffset * 5, 61);

            TheaterCharacters[6]          = ContentLibrary.GetTheaterCharacter(TheaterCharactersList.character7);
            TheaterCharacters[6].Position = new Vector2(bodyWidth + charactetOffset * 6, 61);
        }
示例#2
0
        public override void Draw(GameTime gameTime, GraphicsDevice graphicsDevice, SpriteBatch spriteBatch)
        {
            graphicsDevice.SetRenderTarget(theaterRenderTexture);
            Theater.Draw(spriteBatch);

            graphicsDevice.SetRenderTarget(mainRenderTexture);
            graphicsDevice.Clear(Color.Gray);
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, null);

            Canvas.Draw(spriteBatch);

            Rectangle theaterDestRect = new Rectangle(Point.Zero, (new Vector2(1080, 462)).ToPoint());

            if (Theater.Active)
            {
                spriteBatch.Draw(theaterRenderTexture, theaterDestRect, Color.White);
            }

            spriteBatch.End();


            graphicsDevice.SetRenderTarget(null);
            graphicsDevice.Clear(Color.Black);
            Rectangle mainDestRect = new Rectangle(renderTextureOffset.ToPoint(), (new Vector2(1080, 1920) * renderTextureScale).ToPoint());

            spriteBatch.Begin();
            spriteBatch.Draw(mainRenderTexture, mainDestRect, MainTextureTintColor);
            spriteBatch.DrawString(ContentLibrary.GetFont(FontList.Sans_serif), "karim2989.itch.io & wassim tounsi", Vector2.Zero, new Color(100, 100, 100, 20), 0, Vector2.Zero, .3f, SpriteEffects.None, 0);
            spriteBatch.End();
        }
示例#3
0
 public MessageBox(Element parent, Sprite sprite, Point position, Point size, string[] bodyMessage, string bottomMessage, bool centralizeText = false) : base(parent, sprite, position, size, GamePlayScreen.renderTextureScale)
 {
     smallfont           = ContentLibrary.GetFont(FontList.Sans_serif);
     largefont           = ContentLibrary.GetFont(FontList.Sans_serif_large);
     this.bodyMessage    = bodyMessage;
     this.bottomMessage  = bottomMessage;
     this.centralizeText = centralizeText;
 }
示例#4
0
        public override void Start()
        {
            Canvas = new Canvas(new Rectangle(0, 462, 1080, 1920 - 462));

            //scenario = Scenario.FromString(File.ReadAllText("c:\\dev\\FlirtGame\\FlirtGame\\game.txt"));
            scenario = Scenario.FromString(ContentLibrary.GetXml(XmlFile.game1));

            ContentLibrary.LoadTheaterCharacter(scenario, game.GraphicsDevice);
            Theater = new Theater(theaterRenderTexture);
        }
示例#5
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            ContentLibrary.LoadedTexture(Content, GraphicsDevice);
            ContentLibrary.LoadSprites(Content, GraphicsDevice);
            ContentLibrary.LoadFont(Content);
            ContentLibrary.LoadSounds(Content);
            ContentLibrary.loadXml(Content);

            CurrentScreen.Start();

            // TODO: use this.Content to load your game content here
        }
示例#6
0
        public Coroutine WalkInCoroutine()
        {
            float time      = 15f;
            float dirention = Fliped ? 1:-1;

            for (int j = 0; j < 6; j++)
            {
                ContentLibrary.GetSound(SoundList.jump).Play();
                for (int i = 0; i < (int)time; i++)
                {
                    Position        = new Vector2(Position.X + 2 * dirention, Position.Y);
                    PositionYOffset = (float)Math.Sin((1 / time) * i * Math.PI) * 5;
                    yield return(0);
                }
                for (int i = 0; i < 2; i++)
                {
                    yield return(0);
                }
            }
        }