コード例 #1
0
        public TextAnnouncerEntity(AnnouncerEnded endFunction, Color color, string title, string text, int width, float speed)
            : base(endFunction, 1)
        {
            this.text = new Text("", FontSize.Small);
            this.TintColor = color;

            titleText = new Text(title, FontSize.Large);
            inlineText = new Text(text[0] + "", FontSize.Medium);
            hintText = new Text("Click to continue", FontSize.Small);

            titleText.Align(AlignType.Center);
            hintText.Align(AlignType.Center);

            titleText.TintColor = color;
            hintText.TintColor = color;

            currentText = 1;
            totalText = Text.GetText(text, (int)(width / inlineText.Width));
            maxHeight = totalText.Split('\n').Length * inlineText.Height + titleText.Height + hintText.Height + 50;

            string[] separatedStrings = totalText.Split('\n');
            drawableInLineText = new List<Text>();
            for (int i = 0; i < separatedStrings.Length; i++)
            {
                drawableInLineText.Add(new Text("", FontSize.Medium));
                drawableInLineText[drawableInLineText.Count - 1].Align(AlignType.Center);
                drawableInLineText[drawableInLineText.Count - 1].TintColor = color;
            }

            this.textSpeed = speed;
        }
コード例 #2
0
        public StatisticAnnouncer(AnnouncerEnded endFunction, Color color, string title, List<string> names, 
            List<int> scores, List<string> units)
            : base(endFunction, 0)
        {
            this.text = new Text(title, FontSize.Large);
            this.text.Align(AlignType.Center);

            this.maxHeight += this.text.Height + 10;

            this.hintText = new Text("Click to return to Survival Console", FontSize.Small);
            this.hintText.Align(AlignType.Center);
            this.hintText.TintColor = color;

            this.maxHeight += this.hintText.Height + 20;

            this.data = new List<Text>();

            for (int i = 0; i < names.Count; i++)
            {
                this.data.Add(new Text(names[i] + ": " + scores[i] + " " + units[i], FontSize.Medium));

                this.data[i].Align(AlignType.Center);
                this.data[i].TintColor = color;

                this.maxHeight += this.data[i].Height + 10;
            }

            this.TintColor = color;
        }
コード例 #3
0
        public TimeAnnouncerEntity(AnnouncerEnded endFunction, float height, float time, FontSize size)
            : base(endFunction, height)
        {
            endAlarm = new Alarm(time, TweenType.OneShot, new AlarmFinished(FinishAnnouncer));
            AddTween(endAlarm, true);

            text = new Text("", size);
        }
コード例 #4
0
 public TitleTimeAnnouncerEntity(AnnouncerEnded endFunction, string text)
     : base(endFunction, 100, 2, FontSize.Large)
 {
     TextContext = text;
     this.speed = 4;
     this.text.OriginX = this.text.Width / 2;
     this.text.OriginY = this.text.Height / 2;
 }
コード例 #5
0
        public InGameAchievementAnnouncer(AnnouncerEnded endFunction, string achievementString, Color color)
            : base(endFunction, 0, 3.5f, Graphics.FontSize.Medium)
        {
            this.text.TextContext = achievementString;
            this.text.Align(Graphics.AlignType.Center);
            this.TintColor = color;
            this.speed = 5;

            this.maxHeight = this.text.Height + 20;
        }
コード例 #6
0
        public LevelNameAnnouncerEntity(AnnouncerEnded endFunction, string levelName, int levelNumber)
            : base(endFunction,100, 2, FontSize.Large)
        {
            this.levelNumberText = new Text("Sector " + levelNumber, FontSize.Small);
            this.levelNumberText.Align(AlignType.Center);

            TextContext = levelName;
            this.speed = 4;
            this.text.OriginX = this.text.Width / 2;
            this.text.OriginY = this.text.Height / 2;
        }
コード例 #7
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;
        }
コード例 #8
0
        public AchievementAnnouncer(AnnouncerEnded endFunction, Color color)
            : base(endFunction, 0)
        {
            this.text = new Text("Achievement Console", FontSize.Large);
            this.text.Align(AlignType.Center);
            this.text.TintColor = color;

            this.TintColor = color;

            this.openBracket = new List<Text>();
            this.achieved = new List<Text>();
            this.achievementName = new List<Text>();
            this.currentNumber = new List<Text>();

            foreach (KeyValuePair<Type,AchievementData> item in GlobalVariables.Achievements)
            {
                this.openBracket.Add(new Text("[ ", FontSize.Medium));

                if (item.Value.Achieved)
                {
                    this.achieved.Add(new Text("X", FontSize.Medium));
                }
                else
                {
                    this.achieved.Add(new Text(" ", FontSize.Medium));
                }

                this.achievementName.Add(new Text(" ] " + item.Value.Name + ": " + item.Value.Description, FontSize.Medium));
                this.currentNumber.Add(new Text(item.Value.CurrentNumber.ToString(), FontSize.Medium));
            }

            for (int i = 0; i < this.openBracket.Count; i++)
            {
                this.openBracket[i].TintColor = color;
                this.achieved[i].TintColor = color;
                this.achieved[i].Align(AlignType.Center);
                this.achievementName[i].TintColor = color;
                this.currentNumber[i].TintColor = color;
                this.currentNumber[i].Align(AlignType.Right);
            }

            this.hintText = new Text("Click to return to Drive Console", FontSize.Small);
            this.hintText.Align(AlignType.Center);
            this.hintText.TintColor = color;

            this.maxHeight = this.hintText.Height + this.text.Height +
                this.openBracket.Count * (this.openBracket[0].Height + 5) + 40;
        }
コード例 #9
0
        public AnnouncerEntity(AnnouncerEnded endFunction, float height)
        {
            this.endFunction = endFunction;
            this.maxHeight = height;

            this.EscapeHandler = null;

            this.status = AnnouncerStatus.Appearing;
            this.speed = 10;

            this.borderImage = new Image(OGE.Content.Load<Texture2D>(@"Graphics\Entities\WindowGraphics\Border"));
            this.bodyImage = new Image(OGE.Content.Load<Texture2D>(@"Graphics\Entities\WindowGraphics\Body"));

            this.borderImage.ScaleX = OGE.HUDCamera.Width / this.borderImage.Width;
            this.bodyImage.ScaleX = OGE.HUDCamera.Width / this.bodyImage.Width;
        }
コード例 #10
0
        public TitleButtonAnnouncerEntity(AnnouncerEnded endFunction, Color color, string title, List<Button> buttons)
            : base(endFunction, 60 * buttons.Count + 100)
        {
            this.text = new Text(title, FontSize.Large);
            this.text.OriginX = this.text.Width / 2;

            this.buttons = buttons;

            this.TintColor = color;
            for (int i = 0; i < this.buttons.Count; i++)
            {
                this.buttons[i].TintColor = color;
                this.buttons[i].AddFunction(FinishAnnouncer);
                this.buttons[i].Position.X = OGE.HUDCamera.Width / 2;
                this.buttons[i].Position.Y = OGE.HUDCamera.Height / 2 + maxHeight / 2 - (this.buttons.Count - i) * 60;
            }
        }
コード例 #11
0
        public CreditsAnnouncer(AnnouncerEnded endFunction, Color color, string title, List<CreditData> credits)
            : base(endFunction, 0)
        {
            this.text = new Text(title, FontSize.Large);
            this.text.Align(AlignType.Center);

            this.maxHeight += this.text.Height + 10;

            this.hintText = new Text("Click to return to Main Console", FontSize.Small);
            this.hintText.Align(AlignType.Center);
            this.hintText.TintColor = color;

            this.maxHeight += this.hintText.Height + 20;

            this.creditsText = new List<Text>();
            this.yPosition = new List<int>();

            int oldMaxHeight = (int)this.maxHeight;
            for (int i = 0; i < credits.Count; i++)
            {

                this.yPosition.Add((int)(this.maxHeight - oldMaxHeight));

                this.creditsText.Add(new Text(credits[i].Title, FontSize.Small));
                this.creditsText[this.creditsText.Count - 1].Align(AlignType.Center);
                this.creditsText[this.creditsText.Count - 1].TintColor = color;

                this.maxHeight += this.creditsText[this.creditsText.Count - 1].Height + 3;

                for (int j = 0; j < credits[i].Names.Count; j++)
                {
                    this.yPosition.Add((int)(this.maxHeight - oldMaxHeight));
                    this.creditsText.Add(new Text(credits[i].Names[j], FontSize.Medium));
                    this.creditsText[this.creditsText.Count - 1].Align(AlignType.Center);
                    this.creditsText[this.creditsText.Count - 1].TintColor = color;

                    this.maxHeight += this.creditsText[this.creditsText.Count - 1].Height + 15;
                }
            }

            this.maxHeight += 15;
            this.TintColor = color;
        }
コード例 #12
0
        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);
        }
コード例 #13
0
        public SettingsAnnouncerEntity(AnnouncerEnded endFunction, Color color, string title, List<ButtonPressed> buttons)
            : base(endFunction, 60 * buttons.Count + 60)
        {
            this.text = new Text(title, FontSize.Large);
            this.text.OriginX = this.text.Width / 2;

            this.buttons = new List<Button>();
            this.buttons.Add(new Button(color, "Music:", buttons[0]));
            this.buttons.Add(new Button(color, "Sound:", buttons[1]));
            this.buttons.Add(new Button(color, "Movement:", buttons[2]));
            this.buttons.Add(new Button(color, "FullScreen:", buttons[3]));
            this.buttons.Add(new Button(color, "Apply Settings", buttons[4]));

            UpdateButtonText();

            this.TintColor = color;
            for (int i = 0; i < this.buttons.Count; i++)
            {
                this.buttons[i].TintColor = color;
                this.buttons[i].Position.X = OGE.HUDCamera.Width / 2;
                this.buttons[i].Position.Y = OGE.HUDCamera.Height / 2 + maxHeight / 2 - (this.buttons.Count - i) * 60 + 20;
            }
        }