Exemple #1
0
        public SimpleShadowEffect(Sprite sprite, Vector2?offset, Func <bool> whenToInvoke = null)
            : base(sprite, true)
        {
            Texture = TextureManager.CreateTexture2DBySingleColor(Color.Black, 1, 1);

            SetOffset(offset ?? new Vector2(0, 0));

            SetWhenToInvoke(whenToInvoke);

            SetTask(() =>
            {
                if (WhenToInvoke == null)
                {
                    return;
                }

                if (WhenToInvoke())
                {
                    Rectangle = new Rectangle((int)(Sprite.DestinationRectangle.X + OffSet.X), (int)(Sprite.DestinationRectangle.Y + OffSet.Y), Sprite.DestinationRectangle.Width, Sprite.DestinationRectangle.Height);

                    SetDrawable(true);
                }
                else
                {
                    Rectangle = Sprite.DestinationRectangle;

                    SetDrawable(false);
                }
            });

            SetDrawingTask(() =>
            {
                Sprite.Draw(() => Global.SpriteBatch.Draw(Texture, new Vector2(Rectangle.X, Rectangle.Y), Rectangle, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, Sprite.LayerDepth - 0.5f));
            });
        }
Exemple #2
0
        public override void LoadContent(Texture2D texture = null)
        {
            //Texture = new Texture2D(Global.SpriteBatch.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            //Texture.SetData(new[] { Color.White });

            Texture = TextureManager.CreateTexture2DBySingleColor(Color, 1, 1);
        }
Exemple #3
0
        public Container CreateEpisodeMenuContainer()
        {
            ///////Container
            var container = new Container();

            container.SetTexture(TextureManager.CreateTexture2DBySingleColor(new Color(143, 166, 225)));
            container.SetSize(new Vector2(250, 200));
            container.SetFrame(Color.Black);


            var firstRow = new Row();

            firstRow.SetTexture(TextureManager.CreateTexture2D("Textures/coral"));

            var secondRow = new Row();

            secondRow.SetTexture(TextureManager.CreateTexture2DByRandomColor());

            container.AddRow(firstRow, 80);
            container.AddRow(secondRow, 20);
            container.PrepareRows();
            container.SetDragable(true);

            var column1 = new Column();

            column1.SetTexture(TextureManager.CreateTexture2DByRandomColor());

            var column2 = new Column();

            column2.SetTexture(TextureManager.CreateTexture2DByRandomColor());


            //secondRow.PrepareColumns(floatTo:"left");

            //cr2c1.SetPadding(new Vector2(10));

            secondRow.AddColumn(column1, 20);
            secondRow.AddColumn(column2, 80);
            secondRow.PrepareColumns(isCentralized: true, floatTo: "left");

            lastTriangle = Triangle.PlayButton(Color.Green);
            column1.AddImage(lastTriangle.Texture);


            column2.SetFont("Episode 1", Color.White);

            column2.Font.SetLayerDepth(0.55f);

            return(container);
        }
Exemple #4
0
        public override bool Load()
        {
            var collection = new Dictionary <string, Action>();

            collection.Add("Back", () =>
            {
                DisableThenAddNew(PreviousScreen.Activate() ?? new MainMenu());
            });

            Components.AddRange(SortButtons(collection));

            TransparentBackground = TextureManager.CreateTexture2DBySingleColor(new Color((byte)0, (byte)0, (byte)0, (byte)(0.5 * 255)), 1, 1);

            return(true && base.Load());
        }
        private void LoadScrollContainer()
        {
            var scrollContainerSizeX = (float)Size.X * ScrollContainerWidthRatio / 100;

            var scrollContainer = new Container();

            scrollContainer.SetName("ScrollContainer");
            //scrollContainer.SetFrame(Color.Black);
            scrollContainer.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            scrollContainer.SetPosition(new Vector2(Position.X + Size.X - scrollContainerSizeX, Position.Y));
            scrollContainer.SetSize(new Vector2(scrollContainerSizeX, Size.Y));
            scrollContainer.FixToParentPosition(false);

            AddChild(scrollContainer);

            for (int i = 0; i < PageCount; i++)
            {
                var row = new Row();

                row.SetTexture(TextureManager.CreateTexture2DBySingleColor(new Color(62, 62, 66, 255)));

                var heightRatio = (float)1 / PageCount * 100;

                scrollContainer.AddRow(row, heightRatio);
            }

            var bar = new Column();

            bar.SetName("Bar");
            bar.SetTexture(TextureManager.CreateTexture2DBySingleColor(new Color(104, 104, 104, 255)));
            bar.SetDragable(true);
            bar.FixToParentPosition(false);

            var scrollContainerRows = scrollContainer.GetChildAs <Row>();

            var firstRow = scrollContainerRows.FirstOrDefault();

            scrollContainerRows.FirstOrDefault().AddColumn(bar, 70);

            scrollContainer.PrepareRows(isCentralized: true);

            RefreshRectangle();
        }
Exemple #6
0
        public EpisodeCard()
        {
            var sizeX1 = Global.ViewportWidth * 90 / 100;

            var sizeX2 = Global.ViewportWidth * 10 / 100;

            var scale = new Vector2(150 * Global.Scale.X, 150 * Global.Scale.Y / Global.ViewportHeight);

            SetSize(new Vector2(Global.ViewportWidth, Global.ViewportHeight));

            SetTexture(TextureManager.CreateTexture2DBySingleColor(Color.SeaShell));

            var leftSideContainer = new Container();

            //leftSideContainer.SetTexture(TextureManager.CreateTexture2DBySingleColor(Color.SlateBlue));
            leftSideContainer.SetSize(new Vector2(sizeX1, Global.ViewportHeight));

            var row1 = new Row();

            row1.MakeFrameVisible(true);
            //  row1.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            row1.SetFrame(Color.Tan);

            var column1 = new Column();

            column1.SetTexture(TextureManager.CreateTexture2DBySingleColor(Color.Red, 1, 1));

            var column2 = new Column();

            column2.SetTexture(TextureManager.CreateTexture2DBySingleColor(Color.Green, 1, 1));

            var column3 = new Column();

            column3.SetTexture(TextureManager.CreateTexture2DBySingleColor(Color.Blue, 1, 1));

            row1.AddColumn(column1, 25);
            row1.AddColumn(column2, 25);
            row1.AddColumn(column3, 25);


            leftSideContainer.AddRow(row1, 33);


            var row2 = new Row();

            row2.MakeFrameVisible(true);
            row2.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            row2.SetFrame(Color.Tan);

            leftSideContainer.AddRow(row2, 33);

            var row3 = new Row();

            row3.MakeFrameVisible(true);
            row3.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            row3.SetFrame(Color.Tan);

            leftSideContainer.AddRow(row3, 33);

            leftSideContainer.PrepareRows(true);


            //var rightSideContainer = new Container();
            //rightSideContainer.SetTexture(TextureManager.CreateTexture2DBySingleColor(Color.Tan));
            //rightSideContainer.SetPosition(new Vector2(leftSideContainer.Position.X + leftSideContainer.Size.X, leftSideContainer.Position.Y));
            //rightSideContainer.SetSize(new Vector2(sizeX2, Global.ViewportHeight));



            //container.SetSize(new Vector2(200, 150));
            ////container.SetColor(Color.MonoGameOrange);
            //container.SetTexture(TextureManager.CreateTexture2DByRandomColor(1,1));
            //container.SetMargin(new Vector2(10, 10));

            leftSideContainer.SetVisible(false);
            AddChild(leftSideContainer);
            //       AddChild(rightSideContainer);

            //rightSideContainer.SetVisible(false);

            //var scrollBarRow = new Row();
            //scrollBarRow.SetFrame(Color.Black,2f);
            //scrollBarRow.MakeFrameVisible(true);

            //var columnX = new Column();
            //columnX.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            //scrollBarRow.AddColumn(columnX,80);

            ////rightSideContainer.AddChild(scrollBar);
            //rightSideContainer.SetName("rightSideContainer");
            //rightSideContainer.AddRow(scrollBarRow, 1, 33);
            //rightSideContainer.PrepareRows(true);

            var scrollBar = new ScrollBar(3, 3);

            scrollBar.LoadContent(TextureManager.CreateTexture2DBySingleColor(Color.Tan));
            scrollBar.SetPosition(new Vector2(leftSideContainer.Position.X + leftSideContainer.Size.X, leftSideContainer.Position.Y));
            scrollBar.SetSize(new Vector2(sizeX2, Global.ViewportHeight));
            scrollBar.SetFrame(Color.Red, 2f);
            scrollBar.SetName("ScrollBar");
            scrollBar.PrepareRows(true);
            AddChild(scrollBar);
        }
Exemple #7
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            InputManager.IsActive = true;

            var scrollBarColumns = new Column[16];

            for (int i = 0; i < scrollBarColumns.Length; i++)
            {
                scrollBarColumns[i] = new Column();


                //scrollBarColumns[i].SetFrame(Color.Black);

                //scrollBarColumns[i].SetTexture(TextureManager.CreateTexture2DByRandomColor());
            }

            scrollBar = new ScrollBar(3, 3, 2.5f, null, scrollBarColumns);
            //scrollBar.LoadContent(TextureManager.CreateTexture2DBySingleColor(Color.Tan));
            //scrollBar.SetFrame(Color.Yellow,2f);
            //scrollBar.PrepareRows(true);

            scrollBar.SetFrame(makeFrameVisible: false);
            scrollBar.RefreshRectangle();

            var firstScrollBarRow       = scrollBar.Rows.FirstOrDefault();
            var firstScrollBarRowColumn = firstScrollBarRow.Columns.FirstOrDefault();

            var c = new Column();

            c.SetTexture(TextureManager.CreateTexture2DByRandomColor());

            c.SetSize(new Vector2(50, 50));
            //c.IncreaseLayerDepth();
            c.SetFont("Hewllow", Color.Yellow);


            firstScrollBarRowColumn.AddChild(c);



            container = new Container();
            container.SetDragable();
            container.SetTexture(TextureManager.CreateTexture2DBySingleColor(Color.Beige));
            container.SetSize(new Vector2(300, 200));


            var row = new Row();

            row.SetTexture(TextureManager.CreateTexture2DBySingleColor(new Color(36, 220, 151)));
            container.AddRow(row, 100);
            var r1c1 = new Column();

            r1c1.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            row.AddColumn(r1c1, 30);

            var r1c2 = new Column();

            r1c2.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            row.AddColumn(r1c2, 30);

            var r1c3 = new Column();

            r1c3.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            row.AddColumn(r1c3, 30);



            var row2 = new Row();

            row2.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            container.AddRow(row2, 100);

            var row3 = new Row();

            row3.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            container.AddRow(row3, 100);

            var row4 = new Row();

            row4.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            container.AddRow(row4, 100);

            container.PrepareRows();

            row.PrepareColumns(true, "right");


            cnt = CreateEpisodeMenuContainer();

            var x = 100;

            TextColumn = new Column();
            TextColumn.SetPosition(new Vector2(250, 250));
            TextColumn.SetSize(new Vector2(250, 200));
            TextColumn.SetFrame(Color.BlanchedAlmond);
            TextColumn.SetDragable(true);
            TextColumn.SetFont("Buttton1001", Color.Blue);

            TextColumn.AddChild(cnt);



            ////////------------

            //Button b = new Button("Play with me",new Vector2(400,150));
            //cr2c1.AddChild(b);
            //b.SetPosition(new Vector2(300, 150));
            //b.SetSize(cr2c1.Size - new Vector2(-20 - 20));


            //cnt.ShowSimpleShadow(true);

            //var pulsateEvent = cnt.GetEvent<PulsateEffect>();
            //pulsateEvent.SetWhenToInvoke(() => { return true; });

            //foreach (var children in cnt.Child)
            //{
            //    var pulsateEvent2 = (children as Sprite).GetEvent<PulsateEffect>();
            //    pulsateEvent2.SetWhenToInvoke(() => { return true; });
            //}



            rt2D = new RenderTarget2D(Global.GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.None);


            //rt2D = lastTriangle.Texture as RenderTarget2D; //Fonk(()=>lastTriangle.Draw(), 400, 400);

            //Stream stream = File.Create("rt2D.png");
            //rt2D.SaveAsPng(stream, rt2D.Width, rt2D.Height);
            //stream.Dispose();
        }
        public override void LoadContent(Texture2D texture = null)
        {
            base.LoadContent(texture);

            InnerTexture = TextureManager.CreateTexture2DBySingleColor(OppositeColor, 1, 1);
        }
Exemple #9
0
 public void SetTexture(Color color, int width = 1, int height = 1)
 {
     Texture = TextureManager.CreateTexture2DBySingleColor(color, width, height);
 }