예제 #1
0
        public VictoryScreen(Game game) : base("Victory!")
        {
            Title.Position = new CPos(0, -2048, 0);

            var won = new UITextLine(FontManager.Default, TextOffset.MIDDLE);

            won.WriteText("Level has been successfully completed. Congratulations!");
            Add(won);
            var score = new UITextLine(FontManager.Default, TextOffset.MIDDLE)
            {
                Position = new CPos(0, 1024, 0)
            };

            score.WriteText("Score: " + Color.Cyan + game.Save.CalculateScore());
            Add(score);

            Add(new Button("Headquarters", "wooden", GameController.CreateNextMenu)
            {
                Position = new CPos(-2048, 5120, 0)
            });
            Add(new Button("Next Level", "wooden", GameController.CreateNext)
            {
                Position = new CPos(2048, 5120, 0)
            });
        }
예제 #2
0
        public void SetMessage(int duration, string text)
        {
            var corner = (int)(WindowInfo.UnitWidth * 512);

            infoText.Position = new CPos(-corner + 512, -6144 - 256, 0);
            infoText.WriteText(text);
            infoTextDuration = duration;
        }
예제 #3
0
        public override void Tick()
        {
            base.Tick();

            if (!CursorOnUI())
            {
                // Zoom function
                Camera.Zoom(MouseInput.WheelState);

                // place something
                if (MouseInput.IsLeftClicked)
                {
                    place();
                }

                if (MouseInput.IsLeftDown && (currentSelected == Selected.TILE || currentSelected == Selected.WALL))
                {
                    place();
                }

                // Delete something
                if (MouseInput.IsRightClicked || MouseInput.IsRightDown)
                {
                    remove();
                }
            }

            var mouseInWorld = game.World.IsInWorld(MouseInput.GamePosition);

            mousePosition.WriteText((mouseInWorld ? Color.White : Color.Red) + "" + (MouseInput.GamePosition + game.World.Map.TopLeftCorner).ToMPos() + (mouseInWorld ? Color.Grey : new Color(1f, 0.75f, 0.75f)) + " | " + MouseInput.GamePosition);

            switch (currentSelected)
            {
            case Selected.TILE:
                terrainWidget.Tick();
                break;

            case Selected.ACTOR:
                actorWidget.Tick();
                break;

            case Selected.WALL:
                wallWidget.Tick();
                break;

            default:
                if (game.InteractionMode == InteractionMode.EDITOR)
                {
                    save.Tick();
                }

                break;
            }
        }
예제 #4
0
        public PausedScreen(Game game) : base("Paused")
        {
            this.game = game;
            var paused = new UITextLine(FontManager.Default, TextOffset.MIDDLE)
            {
                Position = new CPos(0, 2048, 0)
            };

            paused.WriteText(new Color(128, 128, 255) + "To unpause, press '" + Color.Yellow + Settings.GetKey("Pause") + new Color(128, 128, 255) + "'");
            Add(paused);
        }
예제 #5
0
        public DefeatScreen(Game game) : base("Defeat.")
        {
            Title.SetColor(Color.Red);

            var score = new UITextLine(FontManager.Default, TextOffset.MIDDLE)
            {
                Position = new CPos(0, 1024, 0)
            };

            score.WriteText("Achieved Score: " + Color.Blue + game.Save.CalculateScore());
            Add(score);
            var deaths = new UITextLine(FontManager.Default, TextOffset.MIDDLE)
            {
                Position = new CPos(0, 2048, 0)
            };

            deaths.WriteText(Color.Red + "Deaths: " + game.Save.Deaths);
            Add(deaths);

            if (game.Save.Hardcore)
            {
                game.Save.Delete();
                Add(new Button("Return to Main Menu", "wooden", GameController.CreateMainMenu)
                {
                    Position = new CPos(0, 5120, 0)
                });
            }
            else
            {
                Add(new Button("Restart Map", "wooden", GameController.CreateRestart)
                {
                    Position = new CPos(-2048, 5120, 0)
                });

                switch (game.MissionType)
                {
                case MissionType.TEST:
                    Add(new Button("Main Menu", "wooden", GameController.CreateMainMenu)
                    {
                        Position = new CPos(2048, 5120, 0)
                    });
                    break;

                case MissionType.STORY:
                case MissionType.NORMAL:
                case MissionType.TUTORIAL:
                    Add(new Button("Menu", "wooden", GameController.CreateMenu)
                    {
                        Position = new CPos(2048, 5120, 0)
                    });
                    break;
                }
            }
        }
예제 #6
0
        public void Add(string message, bool timeStamp = true)
        {
            if (timeStamp)
            {
                message = DateTime.Now.ToString("[HH:mm] ") + message;
            }

            var line = new UITextLine(font);

            line.WriteText(message);
            lines.Add(line);

            moveLines();
        }
예제 #7
0
        public EditorScreen(Game game) : base("Editor", 0)
        {
            this.game       = game;
            Title.Position += new CPos(0, -7120, 0);

            mousePosition = new UITextLine(FontManager.Default, TextOffset.RIGHT)
            {
                Position = new CPos(Right - 1024, -7172, 0)
            };
            Add(mousePosition);

            if (!string.IsNullOrEmpty(game.MapType.OverridePiece))
            {
                var pieceName = new UITextLine(FontManager.Default, TextOffset.RIGHT)
                {
                    Position = new CPos(Right - 1024, -7684, 0)
                };
                pieceName.WriteText("Piece name: " + Color.Green + game.MapType.OverridePiece);
                Add(pieceName);
            }

            save = new Button("Save", "wooden", savePiece)
            {
                Position = new CPos(Right - 2048, -5120, 0)
            };

            var checkBoxPosition = new CPos(Right - 1024, -6144, 0);

            showNone = new CheckBox("wooden", true, (b) => deselectBoxes(Selected.NONE))
            {
                Position = checkBoxPosition - new CPos(736 * 3, 0, 0)
            };
            Add(showNone);

            showTiles = new CheckBox("terrain_editor", onTicked: (b) => deselectBoxes(Selected.TILE))
            {
                Position = checkBoxPosition - new CPos(736 * 2, 0, 0)
            };
            Add(showTiles);

            showActors = new CheckBox("actor_editor", onTicked: (b) => deselectBoxes(Selected.ACTOR))
            {
                Position = checkBoxPosition - new CPos(736 * 1, 0, 0)
            };
            Add(showActors);

            showWalls = new CheckBox("wall_editor", onTicked: (b) => deselectBoxes(Selected.WALL))
            {
                Position = checkBoxPosition
            };
            Add(showWalls);

            var widgetPosition = new CPos(Right - 2048, -3584, 0);

            terrainWidget = new TerrainEditorWidget()
            {
                Position = widgetPosition
            };
            actorWidget = new ActorEditorWidget()
            {
                Position = widgetPosition
            };
            wallWidget = new WallEditorWidget()
            {
                Position = widgetPosition
            };
        }