Beispiel #1
0
        protected override void LoadScreenContent(ContentManager content)
        {
            background                = new ScrollBackground(content);
            backgroundCopy            = new ScrollBackground(content);
            windowWidth               = GraphicsDeviceManager.DefaultBackBufferWidth;
            backgroundCopy.Position.X = -windowWidth;

            //resumeButton = new Button(content, "Go!", new Vector2(180, 400), Color.White);

            exitButton = new Button(content, "Main Menu", new Vector2(300, 400), Color.White);
            levelFont  = content.Load <SpriteFont>(@"Fonts/tileFont");
            titleFont  = content.Load <SpriteFont>(@"Fonts/screenFont");
            levelTile  = content.Load <Texture2D>(@"Images/LevelSelectTile");
            padlock    = content.Load <Texture2D>(@"Images/Padlock");
            checkmark  = content.Load <Texture2D>(@"Images/Checkmark");

            levelList = new List <LevelButton>();

            //draw level buttons
            short level   = 1;
            int   xOffset = 70;
            int   yOffset = 45;

            for (int i = 0; i < MAX_ROWS; i++)
            {
                for (int j = 0; j < MAX_COLS; j++)
                {
                    levelButton = new LevelButton(content, level.ToString(), level,
                                                  new Vector2(j * 70f + xOffset, i * 70f + yOffset), Color.Red);
                    levelList.Add(levelButton); //there should be 50 of these
                    level++;
                }
            }
        }
Beispiel #2
0
        protected override void LoadScreenContent(ContentManager content)
        {
            background                = new ScrollBackground(content);
            backgroundCopy            = new ScrollBackground(content);
            windowWidth               = GraphicsDeviceManager.DefaultBackBufferWidth;
            backgroundCopy.Position.X = -windowWidth;

            exitButton = new Button(content, "Quit Tutorial", new Vector2(440, 400), Color.White);
            pageButton = new Button(content, "Change Page", new Vector2(180, 400), Color.White);
            nextPage   = false;

            ball        = content.Load <Texture2D>(@"Tiles/WreckingBall");
            normalTile  = content.Load <Texture2D>(@"Tiles/NormalTile");
            emptyTile   = content.Load <Texture2D>(@"Tiles/EmptyTile");
            superTile   = content.Load <Texture2D>(@"Tiles/SuperTile");
            targetTile  = content.Load <Texture2D>(@"Tiles/TargetTile");
            durableTile = content.Load <Texture2D>(@"Tiles/DurableTile");
            chainTile   = content.Load <Texture2D>(@"Tiles/ChainTile");

            ballName        = content.Load <Texture2D>(@"Images/BallName");
            normalTileName  = content.Load <Texture2D>(@"Images/NormalTileName");
            emptyTileName   = content.Load <Texture2D>(@"Images/EmptyTileName");
            superTileName   = content.Load <Texture2D>(@"Images/SuperTileName");
            durableTileName = content.Load <Texture2D>(@"Images/DurableTileName");
            targetTileName  = content.Load <Texture2D>(@"Images/TargetTileName");
            chainTileName   = content.Load <Texture2D>(@"Images/ChainTileName");

            font = content.Load <SpriteFont>(@"Fonts/screenFont");
        }
Beispiel #3
0
        protected override void LoadScreenContent(ContentManager content)
        {
            background                = new ScrollBackground(content);
            backgroundCopy            = new ScrollBackground(content);
            windowWidth               = GraphicsDeviceManager.DefaultBackBufferWidth;
            backgroundCopy.Position.X = -windowWidth;

            exitButton = new Button(content, "Back", new Vector2(300, 400), Color.White);
            screenFont = content.Load <SpriteFont>(@"Fonts/screenFont");
        }
        protected override void LoadScreenContent(ContentManager content)
        {
            background                = new ScrollBackground(content);
            backgroundCopy            = new ScrollBackground(content);
            windowWidth               = GraphicsDeviceManager.DefaultBackBufferWidth;
            backgroundCopy.Position.X = -windowWidth;

            tutorialButton = new Button(content, "Tutorial", new Vector2(100, 100), Color.White);
            musicButton    = new Button(content, "Choose BGM", new Vector2(500, 100), Color.White);
            deleteButton   = new Button(content, "Reset Records", new Vector2(100, 200), Color.White);
            exitButton     = new Button(content, "Main Menu", new Vector2(300, 400), Color.White);
            aboutButton    = new Button(content, "About", new Vector2(500, 200), Color.White);
            screenFont     = content.Load <SpriteFont>(@"Fonts/screenFont");
        }
Beispiel #5
0
    // Use this for initialization
    void Start()
    {
        Posicion = transform;
        //current pos = new position
        transform.position = new Vector3(12f, -5.6f, 0);


        _savePosition     = GameObject.Find("savePosition").GetComponent <SavePosition>();
        _scrollBackground = GameObject.Find("Background").GetComponent <ScrollBackground>();
        _uiManager        = GameObject.Find("Canvas").GetComponent <UIManager>();

        if (_uiManager != null)
        {
            _uiManager.UpdateLives(_lives);
        }
    }
Beispiel #6
0
        protected override void LoadScreenContent(ContentManager content)
        {
            //background = new Background(content);
            background                = new ScrollBackground(content);
            backgroundCopy            = new ScrollBackground(content);
            windowWidth               = GraphicsDeviceManager.DefaultBackBufferWidth;
            backgroundCopy.Position.X = -windowWidth;

            ball        = content.Load <Texture2D>(@"Tiles/WreckingBall");
            normalTile  = content.Load <Texture2D>(@"Tiles/NormalTile");
            emptyTile   = content.Load <Texture2D>(@"Tiles/EmptyTile");
            superTile   = content.Load <Texture2D>(@"Tiles/SuperTile");
            targetTile  = content.Load <Texture2D>(@"Tiles/TargetTile");
            durableTile = content.Load <Texture2D>(@"Tiles/DurableTile");
            chainTile   = content.Load <Texture2D>(@"Tiles/ChainTile");

            levelWinImg  = content.Load <Texture2D>(@"Images/LevelClearImg");
            levelLoseImg = content.Load <Texture2D>(@"Images/LevelFailImg");

            //load fonts
            hudFont    = content.Load <SpriteFont>(@"Fonts/screenFont");
            buttonFont = content.Load <SpriteFont>(@"Fonts/buttonFont");
            tileFont   = content.Load <SpriteFont>(@"Fonts/tileFont");


            //Button for quickly restarting a level
            // restartButton = new Button(content, "Restart Level", new Vector2(550, 0), Color.White);

            //Button for exiting level
            quitButton = new Button(content, "Level Select", new Vector2(60, 410), Color.White);

            //tutorial button
            helpButton = new Button(content, "Tutorial", new Vector2(300, 410), Color.White);

            //music button
            musicButton = new Button(content, "Change Music", new Vector2(540, 410), Color.White);

            //set up level
            level     = new Level(ball, normalTile, emptyTile, hudFont);
            levelCopy = level;

            clock = new Timer();
        }
Beispiel #7
0
        protected override void LoadScreenContent(ContentManager content)
        {
            background                = new ScrollBackground(content);
            backgroundCopy            = new ScrollBackground(content);
            windowWidth               = GraphicsDeviceManager.DefaultBackBufferWidth;
            backgroundCopy.Position.X = -windowWidth;


            resumeButton   = new Button(content, "Level Select", new Vector2(60, 400), Color.White);
            tutorialButton = new Button(content, "Help & Options", new Vector2(300, 400), Color.White);
            exitButton     = new Button(content, "Back to Title", new Vector2(540, 400), Color.White);
            if (trialModeEnabled)
            {
                marketButton = new Button(content, "Marketplace", new Vector2(300, 50), Color.White);
            }

            //set up music tracks
            tracklist[0] = content.Load <Song>(@"Music/Street Lights");
            tracklist[1] = content.Load <Song>(@"Music/Slipped");
            tracklist[2] = content.Load <Song>(@"Music/Lost");
            tracklist[3] = content.Load <Song>(@"Music/Trade Off");
        }
Beispiel #8
0
        public override void Build()
        {
            random = new Random();
            floor  = Rect.Height * 0.9f;

            player = new AnimatedSprite(
                new TextureKeysProvider(
                    Assets.Image.Group("player"),
                    "1", "2", "3", "4", "3", "2"))
            {
                Scale  = new Vector2(0.5f),
                Left   = Rect.Width * 0.1f,
                Bottom = floor,
            };
            Add(player);

            ground = new ScrollBackground
            {
                Top     = floor,
                Left    = Rect.Left,
                Speed   = new Vector2(500, 0),
                Texture = Assets.Image.Load("ground", "ground")
            };
            Add(ground);

            textGroup = Assets.Image.Group("text");
            var scoreLabel = new FunnySprite
            {
                Texture = textGroup.Load("score"),
                Left    = 100,
                Top     = 30,
            };

            Add(scoreLabel);
            numbers = new List <FunnySprite>();
            for (var i = 0; i < 5; i++)
            {
                var n = new FunnySprite
                {
                    Left  = scoreLabel.Right + 20 + i * 50,
                    Top   = 50 - i * 10,
                    Speed = 30 + i * 10,
                };
                Add(n);
                numbers.Add(n);
            }

            var obsAssets = Assets.Image.Group("obstacles");

            obstacles = new AnimatedSprite[10];
            for (var i = 0; i < obstacles.Length; i++)
            {
                var a = new AnimatedSprite(null)
                {
                    Right = Rect.Left
                };
                Add(a);
                obstacles[i] = a;
            }
            obstacleTypes = new []
            {
                new ObstacleType(
                    frequency: 1f,
                    framesPerSecond: 0,
                    fromGround: 0,
                    provider: new TextureKeysProvider(obsAssets, "rock")),
                new ObstacleType(
                    frequency: 0.1f,
                    framesPerSecond: 2,
                    fromGround: 100,
                    provider: new TextureKeysProvider(obsAssets.Group("bird"), "1", "2")),
            };

            gameOver = new FunnySprite
            {
                Texture        = textGroup.Load("gameover"),
                CenteredOrigin = true,
                Left           = Rect.Center.X,
                Top            = Rect.Center.Y,
                Speed          = 22,
                Visible        = false,
            };
            Add(gameOver);
            replay = new Sprite
            {
                Texture        = textGroup.Load("replay"),
                CenteredOrigin = true,
                Left           = Rect.Center.X,
                Bottom         = floor,
                Visible        = false,
            };
            Add(replay);
        }
Beispiel #9
0
 public Gameover()
 {
     scrollBackground = GameObject.Find("MovableBg").GetComponent <ScrollBackground>();
 }
Beispiel #10
0
        public override void Initialize()
        {
            // Determine the position and size of the interface.
            int x = 0, y = 0, w = 50, h = 40;
            // Pass an empty provider to the panel (the interface will be drawn on Main.tile).
            object provider = null;
            // Although we can use as a provider, for example, FakeTileRectangle from FakeManager:
            //object provider = FakeManager.FakeManager.Common.Add("TestPanelProvider", x, y, w, h);

            // Create a panel with a wall of diamond gemspark wall with black paint.
            Panel root = TUI.TUI.Create(new Panel("TestPanel", x, y, w, h, null,
                                                  new ContainerStyle()
            {
                Wall = WallID.DiamondGemspark, WallColor = PaintID.Black
            }, provider)) as Panel;
            // Create a Label widget (text display) with white characters.
            Label label1 = new Label(1, 1, 17, 2, "some text", new LabelStyle()
            {
                TextColor = PaintID.White
            });

            // Add to panel
            root.Add(label1);

            // Create a container that occupies the lower (larger) half of our panel, painted over with white paint.
            // The Add function returns the newly added object in the VisualObject type,
            // so adding an element can be implemented as follows:
            VisualContainer node = root.Add(
                new VisualContainer(0, 15, w, 25, null, new ContainerStyle()
            {
                WallColor = PaintID.White
            })
                ) as VisualContainer;

            // Add a button to this container, which, when clicked, will send the clicker to the chat.

            /*node.Add(new Button(5, 0, 12, 4, "lol", null, new ButtonStyle()
             * { Wall = 165, WallColor = PaintID.DeepGreen }, (self, touch) =>
             *    touch.Player().SendInfoMessage("You pressed lol button!")));*/

            if (false)
            {
                // Set the layout configuration.
                node.SetupLayout(Alignment.Center, Direction.Right, Side.Center, null, 3, false);
                // Add the InputLabel widget to the layout that allows you to input text.
                node.AddToLayout(new InputLabel(0, 0, new InputLabelStyle()
                {
                    TextColor = PaintID.Black, Type = InputLabelType.All, TextUnderline = LabelUnderline.None
                },
                                                new Input <string>("000", "000")));
                // Add to the layout one more ItemRack widget that corresponds to the Weapon rack: displaying an item
                // on a 3x3 rack. By clicking displays the relative and absolute coordinates of this click.
                node.AddToLayout(new ItemRack(0, 0, new ItemRackStyle()
                {
                    Type = 200, Left = true
                }, (self, touch) =>
                                              Console.WriteLine($"Touch: {touch.X}, {touch.Y}; absolute: {touch.AbsoluteX}, {touch.AbsoluteY}")));
                ItemRack irack1 = node.AddToLayout(new ItemRack(0, 0,
                                                                new ItemRackStyle()
                {
                    Type = 201, Left = true
                })) as ItemRack;
                // ItemRack allows you to add text on top using a sign:
                irack1.SetText("lololo\nkekeke");
                // Finally, add the slider to the layout.
                node.AddToLayout(new Slider(0, 0, 10, 2, new SliderStyle()
                {
                    Wall = WallID.AmberGemsparkOff, WallColor = PaintID.White
                }));
            }

            if (false)
            {
                // Set up the grid configuration. Specify that it has to fill all the cells automatically.
                // Two columns (right size of 15, left - everything else) and two lines, occupying the same amount of space.
                node.SetupGrid(
                    new ISize[] { new Relative(100), new Absolute(15) }, // Размеры колонок
                    new ISize[] { new Relative(50), new Relative(50) },  // Размеры линий
                    null, true);
                // In the top left cell (at the intersection of the first column and the first line), set the background color to orange.
                node[0, 0].Style.WallColor = PaintID.DeepOrange;
                // At the top right, we put a sapphire (blue) wall without paint.
                node[1, 0].Style.Wall      = WallID.SapphireGemspark;
                node[1, 0].Style.WallColor = PaintID.None;
                // In the bottom left cell, you can place the Label widget with the SandStoneSlab block.
                // Although the coordinates and sizes are specified as 0, they will automatically be
                // set, since the object is in the Grid.
                node[0, 1] = new Label(0, 0, 0, 0, "testing", null, new LabelStyle()
                {
                    Tile      = TileID.SandStoneSlab,
                    TileColor = PaintID.Red,
                    TextColor = PaintID.Black
                });
            }

            if (false)
            {
                // Install a large and complex grid.
                node.SetupGrid(new ISize[] { new Absolute(3), new Relative(50), new Absolute(6), new Relative(50) },
                               new ISize[] { new Relative(20), new Absolute(5), new Relative(80) });
                // Although we set the grid on the node, we can still add objects as before.
                // Add a button that draws the grid by pressing, and hides it when released.
                node.Add(new Button(3, 3, 10, 4, "show", null, new ButtonStyle()
                {
                    WallColor    = PaintID.DeepBlue,
                    BlinkStyle   = ButtonBlinkStyle.Full,
                    TriggerStyle = ButtonTriggerStyle.Both
                }, (self, touch) =>
                {
                    if (touch.State == TouchState.Begin)
                    {
                        node.ShowGrid();
                    }
                    else
                    {
                        node.Apply().Draw();
                    }
                }));
            }

            if (false)
            {
                // Add a label and immediately set Alignment.DownRight with indent 3 blocks to the right and 1 below.
                node.Add(new Label(0, 0, 16, 6, "test", new LabelStyle()
                {
                    WallColor = PaintID.DeepPink
                }))
                .SetAlignmentInParent(Alignment.DownRight, new ExternalIndent()
                {
                    Right = 3, Down = 1
                });
            }

            if (false)
            {
                // Let's make our node container the size of the root in width.
                node.SetFullSize(true, false);
            }

            node.SetupLayout(Alignment.Center, Direction.Down, Side.Center, null, 1, false);

            // VisualObject
            VisualObject obj = node.AddToLayout(new VisualObject(5, 5, 8, 4, null, new UIStyle()
            {
                Wall      = WallID.AmethystGemspark,
                WallColor = PaintID.DeepPurple
            }, (self, touch) =>
                                                                 TSPlayer.All.SendInfoMessage($"Relative: ({touch.X}, {touch.Y}); Absolute: ({touch.AbsoluteX}, {touch.AbsoluteY})")));

            // VisualContainer
            //VisualContainer node2 = node.Add(
            //    new VisualContainer(5, 5, 20, 10, null, new ContainerStyle() { WallColor = PaintID.Black })
            //) as VisualContainer;

            // Label
            Label label = node.AddToLayout(new Label(15, 5, 19, 4, "some text", new LabelStyle()
            {
                WallColor = PaintID.DeepLime,
                TextColor = PaintID.DeepRed
            })) as Label;

            // Button
            Button button = node.AddToLayout(new Button(15, 5, 12, 4, "lol", null, new ButtonStyle()
            {
                WallColor    = PaintID.DeepGreen,
                BlinkColor   = PaintID.Shadow,
                TriggerStyle = ButtonTriggerStyle.TouchEnd
            }, (self, touch) => touch.Player().SendInfoMessage("You released lol button!"))) as Button;

            // Slider
            Slider slider = node.AddToLayout(new Slider(15, 5, 10, 2, new SliderStyle()
            {
                Wall           = WallID.EmeraldGemspark,
                WallColor      = PaintID.White,
                SeparatorColor = PaintID.Black,
                UsedColor      = PaintID.DeepOrange
            }, new Input <int>(0, 0, (self, value, playerIndex) =>
                               TShock.Players[playerIndex].SendInfoMessage("Slider value: " + value)))) as Slider;

            // Checkbox
            Checkbox checkbox = node.AddToLayout(new Checkbox(15, 5, 2, new CheckboxStyle()
            {
                Wall         = WallID.EmeraldGemspark,
                WallColor    = PaintID.White,
                CheckedColor = PaintID.DeepRed
            }, new Input <bool>(false, false, (self, value, playerIndex) =>
                                TSPlayer.All.SendInfoMessage("Checkbox value: " + value)))) as Checkbox;

            // Separator
            Separator separator = node.AddToLayout(new Separator(6, new UIStyle()
            {
                Wall      = 156,
                WallColor = PaintID.DeepRed
            })) as Separator;

            // InputLabel
            InputLabel input = node.AddToLayout(new InputLabel(15, 5, new InputLabelStyle()
            {
                Type               = InputLabelType.All,
                TextUnderline      = LabelUnderline.Underline,
                TextColor          = PaintID.DeepRed,
                TextUnderlineColor = PaintID.Black // Этот параметр из LabelStyle
            }, new Input <string>("12345", "12345", (self, value, playerIndex) =>
                                  TSPlayer.All.SendInfoMessage("InputLabel value: " + value)))) as InputLabel;

            // ItemRack
            ItemRack irack = node.AddToLayout(new ItemRack(15, 5, new ItemRackStyle()
            {
                Type = ItemID.LargeDiamond,
                Size = ItemSize.Biggest,
                Left = true
            })) as ItemRack;
            ItemRack irack2 = node.AddToLayout(new ItemRack(20, 5, new ItemRackStyle()
            {
                Type = ItemID.SnowmanCannon,
                Size = ItemSize.Smallest,
                Left = true
            })) as ItemRack;

            irack2.SetText("This is a snowman cannon.");

            // VisualSign
            VisualSign vsign  = node.AddToLayout(new VisualSign(0, 0, "lmfao sosi(te pozhaluista)")) as VisualSign;
            VisualSign vsign2 = node.AddToLayout(new VisualSign(0, 0, "This is an example of what can happen " +
                                                                "if you use signs in TUI without FakeManager (only $399!)." +
                                                                "Text above would be empty. Even tho it has to have it...")) as VisualSign;

            // FormField
            FormField ffield = node.AddToLayout(new FormField(
                                                    new Checkbox(0, 0, 2, new CheckboxStyle()
            {
                Wall         = WallID.AmberGemspark,
                WallColor    = PaintID.White,
                CheckedColor = PaintID.DeepRed
            }), 15, 5, 20, 2, "check me", new LabelStyle()
            {
                TextColor     = PaintID.Shadow,
                TextAlignment = Alignment.Left
            }, new ExternalIndent()
            {
                Right = 1
            })) as FormField;

            // Image
            Image image = node.AddToLayout(new Image(15, 5, "Media\\Image.TEditSch")) as Image;

            // Video
            Video video = node.AddToLayout(new Video(15, 5, null, new VideoStyle()
            {
                Path      = "Media\\Animation-1",
                Delay     = 100,
                TileColor = PaintID.DeepTeal
            }, (self, touch) => (self as Video).ToggleStart())) as Video;

            // AlertWindow
            Button alertButton = node.AddToLayout(new Button(15, 10, 16, 4, "alert", null, new ButtonStyle()
            {
                Wall      = WallID.AmberGemspark,
                WallColor = PaintID.DeepOrange
            }, (self, touch) => node.Root.Alert("Hello world"))) as Button;

            // ConfirmWindow
            Button confirmButton = node.AddToLayout(new Button(15, 13, 20, 4, "confirm\npls", null, new ButtonStyle()
            {
                Wall      = WallID.AmberGemspark,
                WallColor = PaintID.DeepTeal
            }, (self, touch) => node.Root.Confirm("Very nice", value => TSPlayer.All.SendInfoMessage("Confirmed? " + value)))) as Button;

            // ScrollBackground
            // <Adding a lot of widgets to layout>
            // Specifying layer value as Int32.MinValue so that this widget would be under all other child objects,
            // although ScrollBackground specifies this layer by default in custructor so we don't have to do it manually.
            ScrollBackground scrollbg = node.Add(new ScrollBackground(true, true, true), Int32.MinValue) as ScrollBackground;

            // ScrollBar
            ScrollBar scrollbar = node.Add(new ScrollBar(Direction.Right)) as ScrollBar;

            // Arrow
            Arrow arrow = node.AddToLayout(new Arrow(15, 5, new ArrowStyle()
            {
                TileColor = PaintID.DeepBlue,
                Direction = Direction.Left
            })) as Arrow;
        }