예제 #1
0
        public VirusButtonAnnouncerEntity(AnnouncerEnded endFunction, Color color, Dictionary<Type, EnemyData> viewedEnemies, string playText, ButtonPressed playPressed)
            : base(endFunction, 325)
        {
            this.text = new Text("Security Console", FontSize.Large);
            this.text.OriginX = this.text.Width / 2;

            this.virusBackImage = new Image(OGE.Content.Load<Texture2D>(@"Graphics\Entities\WindowGraphics\EnemyWindow"));
            this.virusBackImage.CenterOrigin();
            this.virusBackImage.TintColor = color;

            this.startLevel = new Button(color, playText, playPressed);
            this.nextVirus = new Button(color, "Next =>", GetNextEnemy);
            this.previousVirus = new Button(color, "<= Previous", GetPreviousEnemy);

            this.startLevel.TintColor = color;
            this.nextVirus.TintColor = color;
            this.previousVirus.TintColor = color;

            this.startLevel.Position.X = OGE.HUDCamera.Width / 2;
            this.startLevel.Position.Y = OGE.HUDCamera.Height / 2 + maxHeight / 2 - 40;

            this.previousVirus.Position.X = OGE.HUDCamera.Width / 2 - 350;
            this.previousVirus.Position.Y = OGE.HUDCamera.Height / 2 + maxHeight / 2 - 40;

            this.nextVirus.Position.X = OGE.HUDCamera.Width / 2 + 350;
            this.nextVirus.Position.Y = OGE.HUDCamera.Height / 2 + maxHeight / 2 - 40;

            this.viewedEnemies = viewedEnemies;
            this.selectedKey = 0;
            this.keys = this.viewedEnemies.Keys.ToList();
            if (this.viewedEnemies.Count > 0)
            {
                this.enemy = Activator.CreateInstance(keys[selectedKey], false) as BaseEntity;
            }

            this.nameWordText = new Text("Name", FontSize.Small);
            this.nameText = new Text("", FontSize.Small);
            this.descriptionWordText = new Text("Description", FontSize.Small);
            this.descriptionText = new Text("", FontSize.Small);

            this.nameText.TintColor = color;
            this.nameWordText.TintColor = color;
            this.descriptionWordText.TintColor = color;
            this.descriptionText.TintColor = color;

            this.nameWordText.Align(AlignType.Center);
            this.nameText.Align(AlignType.Center);
            this.descriptionText.Align(AlignType.Center);
            this.descriptionWordText.Align(AlignType.Center);

            this.TintColor = color;
        }
        public LevelSelectorAnnouncer(AnnouncerEnded endFunction,Color color, ButtonPressed playPressed, ButtonPressed backPressed)
            : base(endFunction, (float)(Math.Ceiling(LevelData.MAX_LEVEL_DRIVE_NUMBER / 5.0) * 110 + 200))
        {
            text = new Text("Sector Console", FontSize.Large);
            text.Align(AlignType.Center);

            levels = new List<CheckButton>();

            int rowNumber = (int)Math.Ceiling(LevelData.MAX_LEVEL_DRIVE_NUMBER / 5.0);
            for (int i = 0; i < rowNumber; i++)
            {
                int coloumNumber = Math.Min(5, LevelData.MAX_LEVEL_DRIVE_NUMBER - i * 5);
                for (int j = 0; j < coloumNumber; j++)
                {
                    levels.Add(new CheckButton(color, (i * 5 + j + 1).ToString(), new ButtonPressed(ClearSelection)));
                    levels[levels.Count - 1].Position.X = OGE.HUDCamera.Width / 2 + (j - coloumNumber / 2.0f) * 110 + 50;
                    levels[levels.Count - 1].Position.Y = OGE.HUDCamera.Height / 2 + (i - rowNumber / 2.0f) * 110;
                    levels[levels.Count - 1].Selected = false;
                    levels[levels.Count - 1].Active = !GlobalVariables.LockedLevels[(GlobalVariables.CurrentDrive - 1) *
                        LevelData.MAX_LEVEL_DRIVE_NUMBER + i * 5 + j];
                }
            }

            levels[GlobalVariables.CurrentLevel - 1].Selected = true;
            TintColor = color;

            backButton = new Button(color, "Return to Drive Console", backPressed);
            backButton.Position.X = OGE.HUDCamera.Width / 2;
            backButton.Position.Y = OGE.HUDCamera.Height / 2 + maxHeight / 2 - 35;

            playButton = new Button(color, "Select Sector", playPressed);
            playButton.Position.X = backButton.Position.X;
            playButton.Position.Y = backButton.Position.Y - 60;

            selectedLevel = GlobalVariables.CurrentLevel;
            levelDataText = new Text("Sector Name: " + LevelData.GetLevel(selectedLevel).LevelName, FontSize.Medium);
            levelDataText.TintColor = color;
            levelDataText.Align(AlignType.Center);
        }