Esempio n. 1
0
        public DecisionScreen(Game game) : base("Are you sure?")
        {
            Title.Position = new CPos(0, -2048, 0);

            text = new UITextLine(FontManager.Default, TextOffset.MIDDLE);
            Add(text);
        }
Esempio n. 2
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)
            });
        }
Esempio n. 3
0
        public override void Tick()
        {
            const int movement = 12;

            base.Tick();

            var toRemove = new List <UITextLine>();

            foreach (var line in lines)
            {
                line.Position -= new CPos(0, movement, 0);
                if (line.Position.Y <= Top - lineHeight / 2)
                {
                    toRemove.Add(line);
                }
            }

            foreach (var line in toRemove)
            {
                lines.Remove(line);
            }

            currentHeight += movement;
            if (currentHeight >= 0 && currentLine < lineData.Length)
            {
                var newLine = new UITextLine(FontManager.Default, TextOffset.MIDDLE)
                {
                    Position = new CPos(0, Bottom + lineHeight / 2, 0)
                };
                newLine.SetText(lineData[currentLine++]);

                lines.Add(newLine);

                currentHeight -= lineHeight;
            }

            if (lines.Count == 0)
            {
                wsImageTick++;

                var color = Math.Min((float)wsImageTick / (Settings.UpdatesPerSecond * 10) + Math.Min(wsImageTick / 100f, 0.1f), 1f);
                wsImage.Color = new Color(color, color, color, color);

                var scale = Math.Min((float)Math.Log10(wsImageTick + 100) / 3f, 1f);
                wsImage.Scale = scale;

                if (wsImageTick == 900)
                {
                    var text = new UITextLine(FontManager.Default, TextOffset.MIDDLE)
                    {
                        Color    = Color.Green,
                        Position = new CPos(0, 2048, 0)
                    };
                    text.SetText("Press any key to continue");

                    Add(text);
                }
            }
        }
Esempio n. 4
0
        public Screen(string title, int darkness = 128)
        {
            Title = new UITextLine(FontManager.Header, TextOffset.MIDDLE)
            {
                Scale = 1.2f
            };
            Title.SetText(title);

            this.darkness = new Color(0, 0, 0, darkness);
        }
Esempio n. 5
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);
        }
Esempio n. 6
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;
                }
            }
        }
Esempio n. 7
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();
        }
Esempio n. 8
0
        public CreatePieceScreen() : base("Create Piece")
        {
            Title.Position = new CPos(0, -4096, 0);

            Add(new Button("Cancel", "wooden", () => { ActiveScreen = false; })
            {
                Position = new CPos(4096, 6144, 0)
            });
            Add(new Button("Create", "wooden", create)
            {
                Position = new CPos(-4096, 6144, 0)
            });

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

            size.SetText("Size of Piece");
            Add(size);

            sizeX = new TextBox("wooden", 2, InputType.NUMBERS)
            {
                Position = new CPos(-1024, 0, 0),
                Text     = "16"
            };
            Add(sizeX);

            sizeY = new TextBox("wooden", 2, InputType.NUMBERS)
            {
                Position = new CPos(1024, 0, 0),
                Text     = "16"
            };
            Add(sizeY);
            name = new TextBox("wooden", 20, InputType.PATH)
            {
                Position = new CPos(0, 1536, 0),
                Text     = "unnamed piece"
            };
            Add(name);

            var warning = new UITextLine(FontManager.Default, TextOffset.MIDDLE)
            {
                Position = new CPos(0, 2548, 0),
                Color    = Color.Red
            };

            warning.SetText("Warning: by using an name for an already existing map, you override it!");
            Add(warning);
        }
Esempio n. 9
0
        public StartScreen(Game game) : base("")
        {
            var ws = new UIImage(new BatchObject(UISpriteManager.Get("logo")[0]))
            {
                Position = new CPos(0, -3072, 0),
                Scale    = 0.8f
            };

            Add(ws);

            var welcome = new UITextLine(FontManager.Header, TextOffset.MIDDLE)
            {
                Position = new CPos(0, -512, 0)
            };

            welcome.SetText("Welcome to Warrior's Snuggery!");
            Add(welcome);

            var tutorial = new UITextLine(FontManager.Header, TextOffset.MIDDLE)
            {
                Position = new CPos(0, 1536, 0)
            };

            tutorial.SetText("If you don't know how to play yet, move down to the tutorial!");
            Add(tutorial);

            var warning = new UITextLine(FontManager.Header, TextOffset.MIDDLE)
            {
                Position = new CPos(0, 4096, 0), Color = new Color(0.5f, 0.5f, 1f)
            };

            warning.SetText("WS is still under development. If you encounter any bugs, please report them.");
            Add(warning);

            Add(new Button("Lets go!", "wooden", () => game.ShowScreen(ScreenType.DEFAULT, false))
            {
                Position = new CPos(0, 6144, 0)
            });
        }
Esempio n. 10
0
        public InfoScreen()
        {
            var corner = (int)(WindowInfo.UnitWidth * 512) - 128;

            version = new UITextLine(FontManager.Default, TextOffset.RIGHT)
            {
                Position = new CPos(corner, 6192, 0),
                Color    = Color.Yellow
            };
            version.SetText(Settings.Version);
            visibility = new UITextLine(FontManager.Default, TextOffset.RIGHT)
            {
                Position = new CPos(corner, 6692, 0)
            };
            tick = new UITextLine(FontManager.Default, TextOffset.RIGHT)
            {
                Position = new CPos(corner, 7692, 0)
            };
            render = new UITextLine(FontManager.Default, TextOffset.RIGHT)
            {
                Position = new CPos(corner, 7192, 0)
            };
        }
Esempio n. 11
0
        public LifeShopScreen(Game game) : base("Lifes")
        {
            this.game      = game;
            Title.Position = new CPos(0, -4096, 0);

            Add(new MoneyDisplay(game)
            {
                Position = new CPos(Left + 2048, Bottom - 1024, 0)
            });
            Add(new HealthDisplay(game)
            {
                Position = new CPos(0, -2048, 0)
            });

            information = new UITextLine(FontManager.Default, TextOffset.MIDDLE)
            {
                Position = new CPos(0, -2048 - 712, 0)
            };
            Add(information);

            price = new UITextLine(FontManager.Default, TextOffset.MIDDLE)
            {
                Position = new CPos(0, 0, 0)
            };
            Add(price);

            Add(new Button("Buy life", "wooden", buyLife)
            {
                Position = new CPos(0, 1024, 0)
            });
            Add(new Button("Resume", "wooden", () => game.ShowScreen(ScreenType.DEFAULT, false))
            {
                Position = new CPos(0, 6144, 0)
            });

            updateInformation();
        }
Esempio n. 12
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
            };
        }
Esempio n. 13
0
        public SettingsScreen(Game game) : base("Settings")
        {
            this.game      = game;
            Title.Position = new CPos(0, -4096, 0);

            // Window
            var fullscreen = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6096, -3000, 0)
            };

            fullscreen.SetText("Fullscreen:");
            Add(fullscreen);

            var width = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6096, -2300, 0)
            };

            if (Settings.Fullscreen)
            {
                width.SetColor(new Color(128, 128, 128));
            }
            width.SetText("Width:");
            Add(width);

            var height = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6096, -1600, 0)
            };

            if (Settings.Fullscreen)
            {
                height.SetColor(new Color(128, 128, 128));
            }
            height.SetText("Height:");
            Add(height);

            fullscreenCheck = new CheckBox("wooden", Settings.Fullscreen, (ticked) =>
            {
                width.SetColor(ticked ? new Color(128, 128, 128) : Color.White);
                height.SetColor(ticked ? new Color(128, 128, 128) : Color.White);
            })
            {
                Position = new CPos(-1536, -3000, 0)
            };
            Add(fullscreenCheck);

            widthWrite = new TextBox("wooden", 5, InputType.NUMBERS)
            {
                Position = new CPos(-2048, -2300, 0),
                Text     = Settings.Width.ToString(),
                OnEnter  = () =>
                {
                    var parse = int.Parse(widthWrite.Text);
                    if (parse < 640)
                    {
                        widthWrite.Text = 640 + "";
                    }
                    else if (parse > ScreenInfo.ScreenWidth)
                    {
                        widthWrite.Text = ScreenInfo.ScreenWidth + "";
                    }
                }
            };
            Add(widthWrite);

            heightWrite = new TextBox("wooden", 5, InputType.NUMBERS)
            {
                Position = new CPos(-2048, -1600, 0),
                Text     = Settings.Height.ToString(),
                OnEnter  = () =>
                {
                    var parse = int.Parse(heightWrite.Text);
                    if (parse < 480)
                    {
                        heightWrite.Text = 480 + "";
                    }
                    else if (parse > ScreenInfo.ScreenHeight)
                    {
                        heightWrite.Text = ScreenInfo.ScreenHeight + "";
                    }
                }
            };
            Add(heightWrite);

            // Graphics
            var vSync = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-512, -3000, 0)
            };

            vSync.SetText("Enable V-Sync:");
            Add(vSync);

            var pixeling = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-512, -2300, 0)
            };

            pixeling.SetText("Enable Pixeling:");
            Add(pixeling);

            var textshadow = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-512, -1600, 0)
            };

            textshadow.SetText("Enable text shadows:");
            Add(textshadow);

            vSyncCheck = new CheckBox("wooden", Settings.VSync, (b) =>
            {
                Settings.VSync = b;
                Window.SetVSync();
            })
            {
                Position = new CPos(6656, -3000, 0)
            };
            Add(vSyncCheck);
            pixelingCheck = new CheckBox("wooden", Settings.EnablePixeling, (b) => Settings.EnablePixeling = b)
            {
                Position = new CPos(6656, -2300, 0)
            };
            Add(pixelingCheck);
            textshadowCheck = new CheckBox("wooden", Settings.EnableTextShadowing, (b) => Settings.EnableTextShadowing = b)
            {
                Position = new CPos(6656, -1600, 0)
            };
            Add(textshadowCheck);

            // Scrolling
            var scrollSpeed = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6144, -600, 0)
            };

            scrollSpeed.SetText("Camera panning speed:");
            Add(scrollSpeed);
            var edgeScrolling = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6144, 100, 0)
            };

            edgeScrolling.SetText("Edge Panning (0 = disabled):");
            Add(edgeScrolling);

            panningSlider = new SliderBar(4096, "wooden", () => Settings.ScrollSpeed = (int)(panningSlider.Value * 10))
            {
                Position = new CPos(5120, -600, 0),
                Value    = Settings.ScrollSpeed / 10f
            };
            Add(panningSlider);
            edgePanningSlider = new SliderBar(4096, "wooden", () => Settings.EdgeScrolling = (int)(edgePanningSlider.Value * 10))
            {
                Position = new CPos(5120, 100, 0),
                Value    = Settings.EdgeScrolling / 10f
            };
            Add(edgePanningSlider);

            // Additional features
            var frameLimiter = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6144, 1000, 0)
            };

            frameLimiter.SetText("Framelimiter (0 = disabled):");
            Add(frameLimiter);

            frameLimiterWrite = new TextBox("wooden", 2, InputType.NUMBERS)
            {
                Position = new CPos(5120, 1000, 0),
                Text     = Settings.FrameLimiter.ToString(),
                OnEnter  = () =>
                {
                    var number = int.Parse(frameLimiterWrite.Text);
                    if (number > ScreenInfo.ScreenRefreshRate)
                    {
                        frameLimiterWrite.Text = ScreenInfo.ScreenRefreshRate.ToString();
                    }
                }
            };
            Add(frameLimiterWrite);

            var developerMode = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6144, 1900, 0)
            };

            developerMode.SetText("Enable Developermode:");
            Add(developerMode);
            developerModeCheck = new CheckBox("wooden", Settings.DeveloperMode, (b) =>
            {
                Settings.DeveloperMode = b;
            })
            {
                Position = new CPos(5120, 1900, 0)
            };
            Add(developerModeCheck);

            // Volume
            var masterVol = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6144, 2800, 0)
            };

            masterVol.SetText("Master Volume:");
            Add(masterVol);
            var effectVol = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6144, 3700, 0)
            };

            effectVol.SetText("Effects Volume:");
            Add(effectVol);
            var musicVol = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6144, 4600, 0)
            };

            musicVol.SetText("Music Volume:");
            Add(musicVol);

            masterVolumeSlider = new SliderBar(4096, "wooden", () =>
            {
                Settings.MasterVolume = (float)Math.Round(masterVolumeSlider.Value, 2);
                MusicController.UpdateVolume();
            })
            {
                Position = new CPos(5120, 2800, 0),
                Value    = Settings.MasterVolume
            };
            Add(masterVolumeSlider);
            effectVolumeSlider = new SliderBar(4096, "wooden", () =>
            {
                Settings.EffectsVolume = (float)Math.Round(effectVolumeSlider.Value, 2);
            })
            {
                Position = new CPos(5120, 3700, 0),
                Value    = Settings.EffectsVolume
            };
            Add(effectVolumeSlider);
            musicVolumeSlider = new SliderBar(4096, "wooden", () =>
            {
                Settings.MusicVolume = (float)Math.Round(musicVolumeSlider.Value, 2);
                MusicController.UpdateVolume();
            })
            {
                Position = new CPos(5120, 4600, 0),
                Value    = Settings.MusicVolume
            };
            Add(musicVolumeSlider);

            var warning = new UITextLine(FontManager.Default, TextOffset.MIDDLE)
            {
                Position = new CPos(0, 5450, 0),
                Color    = Color.Red
            };

            warning.SetText("Some changes only take effect after restarting and can cause visual bugs.");
            Add(warning);

            Add(new Button("Apply", "wooden", Save)
            {
                Position = new CPos(-5120, 6144, 0)
            });
            Add(new Button("Save & Back", "wooden", () => game.ShowScreen(ScreenType.MENU))
            {
                Position = new CPos(5120, 6144, 0)
            });
            Add(new Button("Key Bindings", "wooden", () => game.ShowScreen(ScreenType.KEYSETTINGS))
            {
                Position = new CPos(0, 6144, 0)
            });
        }
Esempio n. 14
0
        public NewStoryGameScreen(Game game) : base("Play Story")
        {
            this.game      = game;
            Title.Position = new CPos(0, -4096, 0);

            var create = new UITextLine(FontManager.Default, TextOffset.MIDDLE)
            {
                Position = new CPos(0, -2048, 0)
            };

            create.SetText("Story line. Please adjust the parameters as you wish.");
            Add(create);

            var name = new UITextLine(FontManager.Default, TextOffset.RIGHT)
            {
                Position = new CPos(-2048, 0, 0)
            };

            name.SetText("Name: ");
            Add(name);

            nameInput = new TextBox("wooden", 15, InputType.PATH)
            {
                Position = new CPos(1024, 0, 0),
                Text     = "Name"
            };
            Add(nameInput);

            var difficulty = new UITextLine(FontManager.Default, TextOffset.RIGHT)
            {
                Position = new CPos(-2048, 1024, 0)
            };

            difficulty.SetText("Difficulty: ");
            Add(difficulty);

            difficultyInput = new SliderBar(4096, "wooden")
            {
                Position = new CPos(1024, 1024, 0)
            };
            Add(difficultyInput);

            var hardcore = new UITextLine(FontManager.Default, TextOffset.RIGHT)
            {
                Position = new CPos(0, -1024, 0)
            };

            hardcore.SetText("Hardcore (one life): ");
            Add(hardcore);

            hardcoreInput = new CheckBox("wooden")
            {
                Position = new CPos(1024, 2048, 0)
            };
            Add(hardcoreInput);

            var seed = new UITextLine(FontManager.Default, TextOffset.RIGHT)
            {
                Position = new CPos(-2048, 3072, 0)
            };

            seed.SetText("Seed: ");
            Add(seed);

            seedInput = new TextBox("wooden", 7, InputType.NUMBERS)
            {
                Position = new CPos(1024, 3072, 0),
                Text     = getSeed()
            };
            Add(seedInput);
            Add(new Button("Generate", "wooden", () => { seedInput.Text = getSeed(); })
            {
                Position = new CPos(6144, 3072, 0)
            });

            Add(new Button("Cancel", "wooden", () => game.ShowScreen(ScreenType.DEFAULT, false))
            {
                Position = new CPos(-4096, 6144, 0)
            });
            Add(new Button("Proceed", "wooden", () =>
            {
                if (!string.IsNullOrWhiteSpace(nameInput.Text))
                {
                    GameController.CreateNew(new GameSave((int)Math.Round(difficultyInput.Value * 10), hardcoreInput.Checked, nameInput.Text, int.Parse(seedInput.Text)), MissionType.STORY);
                }
            })
            {
                Position = new CPos(4096, 6144, 0)
            });
        }
Esempio n. 15
0
        public KeySettingsScreen(Game game) : base("Key Bindings")
        {
            this.game = game;

            Title.Position = new CPos(0, -4096, 0);

            var font = FontManager.Default;

            Add(new Button("Save & Back", "wooden", () => game.ShowScreen(ScreenType.SETTINGS))
            {
                Position = new CPos(0, 6144, 0)
            });

            var type = PanelCache.Types["wooden"];

            var tPause = new UITextLine(font, TextOffset.RIGHT)
            {
                Position = new CPos(-1024, -4096, 0)
            };

            tPause.SetText("Pause/unpause");
            Add(tPause);
            pause = new KeyboardButton(Settings.KeyDictionary["Pause"], type)
            {
                Position = new CPos(1536, -4096, 0)
            };
            Add(pause);

            var tLock = new UITextLine(font, TextOffset.RIGHT)
            {
                Position = new CPos(-1024, -3072, 0)
            };

            tLock.SetText("Toggle camera lock");
            Add(tLock);
            @lock = new KeyboardButton(Settings.KeyDictionary["CameraLock"], type)
            {
                Position = new CPos(1536, -3072, 0)
            };
            Add(@lock);

            var tactivate = new UITextLine(font, TextOffset.RIGHT)
            {
                Position = new CPos(-1024, -2048, 0)
            };

            tactivate.SetText("Activate spell/actor");
            Add(tactivate);
            activate = new KeyboardButton(Settings.KeyDictionary["Activate"], type)
            {
                Position = new CPos(1536, -2048, 0)
            };
            Add(activate);

            var tMove = new UITextLine(font, TextOffset.RIGHT)
            {
                Position = new CPos(-3072, -1024, 0)
            };

            tMove.SetText("Movement");
            Add(tMove);
            var line = 0;

            foreach (var dir in new[] { "Up", "Down", "Left", "Right", "Above", "Below" })
            {
                var text = new UITextLine(font, TextOffset.RIGHT)
                {
                    Position = new CPos(-1024, -1024 + line * 640, 0)
                };
                text.SetText(dir);
                line++;
                Add(text);
            }
            up = new KeyboardButton(Settings.KeyDictionary["MoveUp"], type)
            {
                Position = new CPos(1536, -1024, 0)
            };
            Add(up);
            down = new KeyboardButton(Settings.KeyDictionary["MoveDown"], type)
            {
                Position = new CPos(1536, -1024 + 640, 1)
            };
            Add(down);
            left = new KeyboardButton(Settings.KeyDictionary["MoveLeft"], type)
            {
                Position = new CPos(1536, -1024 + 1280, 1)
            };
            Add(left);
            right = new KeyboardButton(Settings.KeyDictionary["MoveRight"], type)
            {
                Position = new CPos(1536, -1024 + 1920, 0)
            };
            Add(right);
            above = new KeyboardButton(Settings.KeyDictionary["MoveAbove"], type)
            {
                Position = new CPos(1536, -1024 + 2560, 1)
            };
            Add(above);
            below = new KeyboardButton(Settings.KeyDictionary["MoveBelow"], type)
            {
                Position = new CPos(1536, -1024 + 3200, 0)
            };
            Add(below);

            var tCam = new UITextLine(font, TextOffset.RIGHT)
            {
                Position = new CPos(-3072, 3072, 0)
            };

            tCam.SetText("Camera");
            Add(tCam);
            line = 0;
            foreach (var dir in new[] { "Up", "Down", "Left", "Right" })
            {
                var text = new UITextLine(font, TextOffset.RIGHT)
                {
                    Position = new CPos(-1024, 3072 + line * 640, 0)
                };
                text.SetText(dir);
                line++;
                Add(text);
            }
            camUp = new KeyboardButton(Settings.KeyDictionary["CameraUp"], type)
            {
                Position = new CPos(1536, 3072, 0)
            };
            Add(camUp);
            camDown = new KeyboardButton(Settings.KeyDictionary["CameraDown"], type)
            {
                Position = new CPos(1536, 3072 + 640, 1)
            };
            Add(camDown);
            camLeft = new KeyboardButton(Settings.KeyDictionary["CameraLeft"], type)
            {
                Position = new CPos(1536, 3072 + 1280, 1)
            };
            Add(camLeft);
            camRight = new KeyboardButton(Settings.KeyDictionary["CameraRight"], type)
            {
                Position = new CPos(1536, 3072 + 1920, 1)
            };
            Add(camRight);
        }
Esempio n. 16
0
        public DefaultScreen(Game game) : base(string.Empty, 0)
        {
            this.game = game;

            particleManager = new SquareParticleManager();
            Add(particleManager);

            const int shift = margin;

            // Actors
            actorList = new ActorList(game, new MPos(512, 11 * 512), new MPos(512, 512), "wooden")
            {
                Position = new CPos(Left + 512 + margin, 768 + shift, 0)
            };
            Add(actorList);

            // Spells
            spellList = new SpellList(game, new MPos(512, 13 * 512), new MPos(512, 512), "stone")
            {
                Position = new CPos(Right - 512 - margin, 0, 0)
            };
            Add(spellList);

            manaBar = new DisplayBar(new MPos(Width / 2 - 1536, 256), PanelCache.Types["stone"], new Color(0, 0, 255, 196))
            {
                Position = new CPos(0, Bottom - 2048 + margin, 0)
            };
            Add(manaBar);
            healthBar = new DisplayBar(new MPos(Width / 2 - 256, 512), PanelCache.Types["wooden"], new Color(255, 0, 0, 196))
            {
                Position = new CPos(0, Bottom - 1024 + margin, 0)
            };
            Add(healthBar);

            var top = Top + 512 + margin;

            Add(new MoneyDisplay(game)
            {
                Position = new CPos(Left + 1536 + shift, top, 0)
            });
            Add(new HealthDisplay(game)
            {
                Position = new CPos(Left + 4096 + shift + margin, top, 0)
            });

            if (game.ObjectiveType == ObjectiveType.FIND_EXIT)
            {
                Add(new KeyDisplay(game)
                {
                    Position = new CPos(Left + 712 + shift, top + 1536 + shift + 128, 0)
                });
            }
            else if (game.ObjectiveType == ObjectiveType.SURVIVE_WAVES)
            {
                Add(new WaveDisplay(game)
                {
                    Position = new CPos(Left + 512 + shift, top + 1536 + shift + 128, 0)
                });
            }

            var menu = new CheckBox("menu", onTicked: (t) => game.ShowScreen(ScreenType.MENU, true))
            {
                Position = new CPos(Right - 512 - margin, Top + 512 + margin, 0),
                Scale    = 2.5f
            };

            Add(menu);

            // mission text
            var missionText = new UITextLine(FontManager.Header, TextOffset.MIDDLE)
            {
                Position = new CPos(0, top, 0)
            };
            var missionContent = string.Empty;

            switch (game.ObjectiveType)
            {
            case ObjectiveType.FIND_EXIT:
                missionContent = "Search for the exit and gain access to it!";
                break;

            case ObjectiveType.KILL_ENEMIES:
                missionContent = "Wipe out all enemies on the map!";
                break;

            case ObjectiveType.SURVIVE_WAVES:
                missionContent = "Defend your position from incoming waves!";
                break;
            }
            missionText.SetText(missionContent);

            if (game.Save.Level == game.Save.FinalLevel)
            {
                missionText.SetColor(Color.Blue);
            }
            else if (game.Save.Level > game.Save.FinalLevel)
            {
                missionText.SetColor(Color.Green);
            }

            Add(missionText);

            Add(new EnemyPointer(game));
        }
Esempio n. 17
0
 public InfoText()
 {
     infoText = new UITextLine(FontManager.Default);
 }