Example #1
0
        public void LoadContent(ContentManager content)
        {
            InputManager.Instance.OnBackButtonClicked += Instance_OnBackButtonClicked;
            float x = game.GetScaledResolution().X, y = game.GetScaledResolution().Y;

            logo = new Image(new Vector2(x * 0.1f, 0), new Vector2(x * 0.8f, y * 0.8f), "Textures/Logo", Color.White, Vector2.Zero);
            logo.LoadContent(content);
            levelText = new Text(Vector2.Zero, "Level:", Color.White);
            levelText.LoadContent(content);
            levelNumber = new Text(Vector2.Zero, levels[currentLevel], Color.Blue);
            levelNumber.LoadContent(content);
            levelNumber.Clicked += LevelNumber_Clicked;
            levelText.Position   = new Vector2((x - (levelText.Size.X + levelNumber.Size.X)) / 2, y * 0.72f);
            levelNumber.Position = new Vector2(levelText.Position.X + levelText.Size.X, levelText.Position.Y);

            caveText = new Text(Vector2.Zero, "Cave:", Color.White);
            caveText.LoadContent(content);
            caveNumber = new Text(Vector2.Zero, caves[currentCave], Color.Blue);
            caveNumber.LoadContent(content);
            caveNumber.Clicked += CaveNumber_Clicked;
            caveText.Position   = new Vector2((x - (caveText.Size.X + caveNumber.Size.X)) / 2, y * 0.82f);
            caveNumber.Position = new Vector2(caveText.Position.X + caveText.Size.X, caveText.Position.Y);

            playText = new Text(Vector2.Zero, "Start", Color.Blue);
            playText.LoadContent(content);
            playText.Position = new Vector2((x - playText.Size.X) / 2, y * 0.92f);
            playText.Clicked += PlayText_Clicked;

            theme = content.Load <Song>("Sounds/Theme");
            MediaPlayer.Play(theme);
            MediaPlayer.IsRepeating = true;
        }
Example #2
0
        public override void LoadContent()
        {
            pane = new Pane()
            {
                buttonLeft   = game.Content.Load <Texture2D>("Textures/UI/box/boxleft"),
                buttonRight  = game.Content.Load <Texture2D>("Textures/UI/box/boxright"),
                buttonMiddle = game.Content.Load <Texture2D>("Textures/UI/box/boxmiddle"),
                alpha        = mainAlpha - 3.0f,
                color        = Color.White,
                rect         = new Rectangle(0, 768 - height, 1366, height)
            };

            speaker = new Text()
            {
                color    = Color.Black * mainAlpha,
                game     = this.game,
                font     = "fonts/big",
                position = new Vector2(5, 768 - height + 15),
                text     = "speaker"
            }; speaker.LoadContent();

            message = new Text()
            {
                color    = Color.Black * mainAlpha,
                game     = this.game,
                font     = "fonts/small",
                position = new Vector2(5, 768 - height + 70),
                text     = "message"
            }; message.LoadContent();

            base.LoadContent();
        }
Example #3
0
        public override void LoadContent()
        {
            map = new mapImage()
            {
                levelID = ID,
                prefix  = "Textures/stage_previews/",
                game    = this.game
            };
            map.LoadContent();

            instructions = new Text()
            {
                color    = Color.Black,
                font     = "fonts/small",
                game     = game,
                position = Vector2.Zero,
                text     = "WASD to pan\nScroll to zoom\nControl to reset position\nShift to go faster\n\nSpace to start"
            }; instructions.LoadContent();

            levelname = new Text()
            {
                color = Color.Black,
                font  = "fonts/big",
                game  = game,
                text  = "Stage " + ID
            }; levelname.LoadContent();

            base.LoadContent();
        }
Example #4
0
        public override void LoadContent()
        {
            player.LoadContent();
            manager.LoadContent();
            hud.LoadContent();

            foreach (GameObject t in tiles)
            {
                t.LoadContent();
            }

            foreach (GameObject g in enemies)
            {
                g.LoadContent();
            }

            debugheader = new Text()
            {
                color    = Color.White,
                font     = "fonts/small",
                game     = game,
                position = Vector2.Zero,
                text     = "testing interface"
            }; debugheader.LoadContent();

            base.LoadContent();
        }
        public override void ButtonOnClick(int buttonid)
        {
            base.ButtonOnClick(buttonid);

            if (MokeponChosen)
            {
                return;
            }

            if (poks[buttonid].HP <= 0)
            {
                return;
            }

            if (poks[buttonid] != cur)
            {
                MokeponChosen = true;
                Choice        = buttonid;
            }
            else if (!warning)
            {
                warning = true;
                Text t = new Text("This Mokepon is already in battle!", Color.Red, Vector2.Zero, Vector2.One, "Expression-pro-32px");
                t.LoadContent();
                t.MoveMid(new Vector2(Globals.ScreenWidth / 2, Globals.ScreenHeight - 75));
                Elements.Add(t);
            }
        }
Example #6
0
        public void LoadContent()
        {
            content = new ContentManager(ScreenManager.Instance.Content.ServiceProvider, "Content");

            playerImage.LoadContent();
            playerImage.MoveMid(new Vector2(Globals.ScreenWidth / 2, Globals.ScreenHeight / 2));

            world.LoadContent();
            locationName.LoadContent();
        }
Example #7
0
        public void LoadContent()
        {
            background.LoadContent();
            battleText.LoadContent();
            Dialogues.LoadContent();

            if (enemy.TauntText != null)
            {
                Dialogues.AddText(enemy.TauntText);
            }
            Dialogues.DisplayNext();
        }
Example #8
0
 public void LoadContent(ContentManager content)
 {
     resumeText = new Text(Vector2.Zero, "Resume", Color.White);
     resumeText.LoadContent(content);
     resumeText.Position = new Vector2(game.GetScaledResolution().X / 2 - resumeText.Size.X / 2, game.GetScaledResolution().Y * 0.3f);
     resumeText.Clicked += ResumeText_Clicked;
     mainMenuText        = new Text(Vector2.Zero, "Main menu", Color.White);
     mainMenuText.LoadContent(content);
     mainMenuText.Position = new Vector2(game.GetScaledResolution().X / 2 - mainMenuText.Size.X / 2, game.GetScaledResolution().Y * 0.6f);
     mainMenuText.Clicked += MainMenuText_Clicked;
     InputManager.Instance.OnBackButtonClicked += Instance_OnBackButtonClicked;
 }
Example #9
0
        public override void LoadContent()
        {
            pixel   = game.Content.Load <Texture2D>("p");
            texture = game.Content.Load <Texture2D>(path);

            healthText = new Text()
            {
                font = "fonts/big",
                game = this.game,
                text = bossName + ": " + health.ToString()
            }; healthText.LoadContent();

            base.LoadContent();
        }
Example #10
0
 public void LoadContent(ContentManager content)
 {
     congratulationText = new Text(Vector2.Zero, "Congratulations! You won!", Color.White);
     congratulationText.LoadContent(content);
     congratulationText.Position = new Vector2(game.GetScaledResolution().X / 2 - congratulationText.Size.X / 2, game.GetScaledResolution().Y * 0.25f);
     scoreText = new Text(Vector2.Zero, $"Your score: {score}", Color.White);
     scoreText.LoadContent(content);
     scoreText.Position = new Vector2(game.GetScaledResolution().X / 2 - scoreText.Size.X / 2, game.GetScaledResolution().Y * 0.50f);
     mainMenuText       = new Text(Vector2.Zero, "Main menu", Color.White);
     mainMenuText.LoadContent(content);
     mainMenuText.Position = new Vector2(game.GetScaledResolution().X / 2 - mainMenuText.Size.X / 2, game.GetScaledResolution().Y * 0.75f);
     mainMenuText.Clicked += MainMenuText_Clicked;
     InputManager.Instance.OnBackButtonClicked += Instance_OnBackButtonClicked;
 }
Example #11
0
        public override void ButtonOnClick(int buttonid)
        {
            if (Buttons[buttonid].ButtonText.TextValue == "SHIFT")
            {
                ToggleShift();
            }
            else if (Buttons[buttonid].ButtonText.TextValue == "BACK")
            {
                if (Input.Length > 0)
                {
                    Input = Input.Remove(Input.Length - 1);
                    (Elements[0] as Text).TextValue = Input + '_';
                    Elements[0].MoveMid(new Vector2(Globals.ScreenWidth / 2, 250));
                }
            }
            else if (Buttons[buttonid].ButtonText.TextValue == "ENTER")
            {
                if (Input.Length == 0 || Input.Length > 12)
                {
                    if (!errorShowed)
                    {
                        Text errorText = new Text("Length should be between 1 and 12 characters!", "Expression-pro-32px");
                        errorText.Color = Color.DarkRed;
                        errorText.LoadContent();
                        errorText.MoveMid(new Vector2(Globals.ScreenWidth / 2, 650));
                        Elements.Add(errorText);
                        errorShowed = true;
                    }

                    return;
                }

                Inserted = true;
                return;
            }
            else
            {
                string c = Buttons[buttonid].ButtonText.TextValue;
                if (c == "_")
                {
                    c = " ";
                }
                Input += c;
                (Elements[0] as Text).TextValue = Input + '_';
                Elements[0].MoveMid(new Vector2(Globals.ScreenWidth / 2, 250));
            }

            base.ButtonOnClick(buttonid);
        }
        public override void Update(GameTime gameTime)
        {
            scrollTo_wait -= gameTime.ElapsedGameTime.TotalSeconds;

            if (scrollTo_wait <= 0)
            {
                if (bottomid < Intro.Count)
                {
                    Text t = new Text(Intro[bottomid], "Expression-pro-32px");
                    t.LoadContent();
                    t.Color = Color.White;
                    t.MoveMid(new Vector2(Globals.ScreenWidth / 2, Globals.ScreenHeight));
                    Elements.Add(t);

                    ++bottomid;
                    scrollTo_wait = scrollDelay;
                    if (bottomid >= Intro.Count)
                    {
                        scrollTo_wait += 2 * scrollDelay;
                    }
                }
            }

            for (int i = 2; i < Elements.Count; ++i)
            {
                Elements[i].MoveVector(new Vector2(0, -(float)speed));
            }

            while (Elements.Count > 2 && Elements[2].Position.Y < 200)
            {
                Elements[2].UnloadContent();
                Elements.RemoveAt(2);
            }

            if (Managers.InputManager.Instance.AnyKeysPressed(Keys.Escape, Keys.Enter, Keys.Space))
            {
                (Managers.ScreenManager.Instance.CurrentScreen as Screens.MainMenuScreen).ChangeCanvas("SelectMokepon");
                return;
            }

            if (Elements.Count == 2)
            {
                (Managers.ScreenManager.Instance.CurrentScreen as Screens.MainMenuScreen).ChangeCanvas("SelectMokepon");
                return;
            }

            base.Update(gameTime);
        }
Example #13
0
        public void ChangeMap(string map, int d, int x, int y)
        {
            player.PositionX = x;
            player.PositionY = y;
            player.Direction = d;
            player.Location  = map;

            world.UnloadContent();
            GameManager.Instance.LoadWorld(player.Location);
            world = GameManager.Instance.World;
            world.LoadContent();
            locationName       = new Text(world.Name, "Expression-pro-32px");
            locationName.Color = Color.White;
            locationName.LoadContent();
            GameManager.Instance.SaveGame();
        }
Example #14
0
 public void LoadContent(ContentManager content)
 {
     this.content = content;
     InputManager.Instance.OnBackButtonClicked += InputManager_OnBackButtonClicked;
     using (ContentManager c = new ContentManager(content.ServiceProvider, content.RootDirectory))
         try
         {
             map = c.Load <ActorMap>($"Maps/{firstMap}");
         }
         catch
         {
             map = c.Load <ActorMap>($"Maps/1");
         }
     map.LoadContent(content);
     map.PlayerKilled += Map_PlayerKilled;
     map.MapCompleted += Map_MapCompleted;
     Camera            = new Camera2D(game, new Vector2(game.GetScaledResolution().X, game.GetScaledResolution().Y *(1 - guiSize)));
     Camera.Initialize();
     Camera.CalculateDeadZone(map.Size, map.TileDimensions);
     Camera.Focus = map.Player;
     guiText      = new Text(new Vector2(game.GetScaledResolution().X *0.06f, game.GetScaledResolution().Y *guiSize / 4), $"[{map.DiamondsRequired}]/{map.DiamondValue} [{map.DiamondsCollected}] {map.Time} {map.Score}", Color.White);
     guiText.LoadContent(content);
 }
Example #15
0
        public override void LoadContent()
        {
            Base = new Pane()
            {
                buttonLeft   = game.Content.Load <Texture2D>("Textures/UI/box/boxLeft"),
                buttonMiddle = game.Content.Load <Texture2D>("Textures/UI/box/boxMiddle"),
                buttonRight  = game.Content.Load <Texture2D>("Textures/UI/box/boxRight"),
                rect         = new Rectangle(0, 768 - 80, 1366, 80)
            };

            nowPlaying = new Text()
            {
                game  = game,
                color = Color.Black,
                font  = "fonts/small"
            }; nowPlaying.LoadContent();

            message = new Tooltip(game)
            {
                pLeft         = "Textures/UI/box/boxLeft",
                pMid          = "Textures/UI/box/boxMiddle",
                pRight        = "Textures/UI/box/boxRight",
                font          = "fonts/small",
                label         = "Download this song from its official source\nSupport the dev who made the game and the soundtracks",
                padding       = new Vector2(16, 10),
                CornerCutting = PaneToMouse.cutType.jump
            }; message.LoadContent();

            play.LoadContent();
            pause.LoadContent();
            stop.LoadContent();
            repeat.LoadContent();
            playrandom.LoadContent();
            download.LoadContent();

            base.LoadContent();
        }
Example #16
0
        public override void LoadContent()
        {
            fnt = game.Content.Load <SpriteFont>("font");

            message = new Text
            {
                text     = "Key pressed (space)",
                position = new Vector2(300, 280),
                color    = Color.Black,
                game     = game,
                font     = "font"
            }; message.LoadContent();

            message2 = new Text
            {
                text     = "Key released (enter)",
                position = new Vector2(600, 280),
                color    = Color.Black,
                game     = game,
                font     = "font"
            }; message2.LoadContent();

            base.LoadContent();
        }
Example #17
0
        public override void LoadContent()
        {
            Texture2D left   = game.Content.Load <Texture2D>("button/left");
            Texture2D right  = game.Content.Load <Texture2D>("button/right");
            Texture2D middle = game.Content.Load <Texture2D>("button/middle");

            font = game.Content.Load <SpriteFont>("font");

            Tmanager = new TextManager(game);

            renderText = new Text
            {
                text     = "",
                position = new Vector2(400),
                color    = Color.Black,
                font     = @"font",
                game     = this.game
            }; renderText.LoadContent();

            start = new Button
            {
                buttonLeft         = left,
                buttonMiddle       = middle,
                buttonRight        = right,
                buttonColorDefault = Color.White,
                buttonColorHover   = Color.LightGray,
                buttonColorPressed = Color.DarkGray,
                focused            = true,
                label      = "start rendering text",
                labelColor = Color.Black,
                labelFont  = font,
                rect       = new Rectangle(200, 200, 250, 50)
            }; start.LoadContent();

            base.LoadContent();
        }
Example #18
0
        public override void Update(GameTime gametime)
        {
            newState = Keyboard.GetState();

            if (KeyboardStroke.KeyDown(oldState, newState, Keys.Space))
            {
                keypressed++;
            }

            if (KeyboardStroke.KeyUp(oldState, newState, Keys.Enter))
            {
                keyreleased++;
            }

            oldState = newState;

            keypressedDisp = new Text
            {
                text     = keypressed.ToString(),
                position = new Vector2(300),
                font     = "font",
                color    = Color.Black,
                game     = this.game
            }; keypressedDisp.LoadContent();
            base.Update(gametime);

            keyreleasedDisp = new Text
            {
                text     = keyreleased.ToString(),
                position = new Vector2(600, 300),
                font     = "font",
                color    = Color.Black,
                game     = this.game
            }; keyreleasedDisp.LoadContent();
            base.Update(gametime);
        }
Example #19
0
        public override void LoadContent()
        {
            shF   = game.Content.Load <Texture2D>("Textures/UI/branding/shframework");
            pixel = game.Content.Load <Texture2D>("p");

            title = new Text()
            {
                color    = Color.Black,
                text     = "Settings",
                font     = "fonts/big",
                game     = game,
                position = new Vector2(135, 81)
            }; title.LoadContent();

            shFtext = new Text()
            {
                color    = Color.White,
                text     = "Powered by: Sh.Framework",
                font     = "fonts/vanilla",
                game     = game,
                position = new Vector2(125, 768 - 125 + 62)
            }; shFtext.LoadContent();

            tS = new Text()
            {
                color    = Color.White,
                text     = "Tiled level editor IO powered by TiledSharp",
                font     = "fonts/vanilla",
                game     = game,
                position = new Vector2(600, 768 - 125 + 62)
            }; tS.LoadContent();

            Shieyn = new Text()
            {
                color    = Color.Black,
                text     = "Developed by Shieyn",
                font     = "fonts/vanilla",
                game     = game,
                position = new Vector2(1366 - 330, 768 - 150)
            }; Shieyn.LoadContent();

            Texture2D  Left   = game.Content.Load <Texture2D>("Textures/UI/button/bL");
            Texture2D  Right  = game.Content.Load <Texture2D>("Textures/UI/button/bR");
            Texture2D  Middle = game.Content.Load <Texture2D>("Textures/UI/button/bM");
            SpriteFont font   = game.Content.Load <SpriteFont>("fonts/small");

            back = new Button()
            {
                buttonLeft         = Left,
                buttonRight        = Right,
                buttonMiddle       = Middle,
                labelFont          = font,
                label              = "X",
                buttonColorDefault = Color.Red,
                buttonColorHover   = Color.DarkRed,
                focused            = true,
                rect = new Rectangle(0, 0, 32, 32)
            }; back.LoadContent();

            bg = game.Content.Load <Texture2D>("Textures/bg/bg1");

            base.LoadContent();
        }
        public void LoadAndAddNewTextEntryBelowPrevious(Text text)
        {
            text.LoadContent(ScreenManager.Content);

            Text previousText = null;
            foreach (UIElement uielement in ActiveUIElements)
            {
                if (uielement as Text != null)
                {
                    if (previousText != null)
                    {
                        if (uielement.Position.Y > previousText.Position.Y)
                        {
                            previousText = (Text)uielement;
                        }
                    }
                    else
                    {
                        previousText = (Text)uielement;
                    }
                }
            }

            foreach (UIElement uielement in UIElementsToAdd)
            {
                if (uielement as Text != null)
                {
                    if (previousText != null)
                    {
                        if (uielement.Position.Y > previousText.Position.Y)
                        {
                            previousText = (Text)uielement;
                        }
                    }
                    else
                    {
                        previousText = (Text)uielement;
                    }
                }
            }

            if (previousText != null)
            {
                text.SetPosition(new Vector2(0, 4 * previousText.TextOrigin.Y));
                AddUIElementRelativeTo(text, previousText);
            }
            else
            {
                AddUIElement(text);
            }
        }
        public void SetHoverInfoText(string text, Vector2 position)
        {
            Text infoText = new Text(
                text,
                Vector2.Zero,
                100,
                Color.White,
                "Hover Info Text");
            infoText.LoadContent(ScreenManager.Content);

            HoverInfo = new Panel(
                "Sprites/UI/Panels/Panel",
                position,
                2 * infoText.TextOrigin,
                Color.Black,
                "Hover Info",
                0.5f);
            HoverInfo.LoadContent(ScreenManager.Content);
            HoverInfo.AddUIElement(infoText, infoText.Position);
        }