<commit_before>﻿using Scripts.Game.Serialized;
using Scripts.Model.Characters;
using Scripts.Model.Interfaces;
using Scripts.Model.Pages;
using Scripts.Model.Processes;
using System.Collections.Generic;

namespace Scripts.Game.Dungeons {
    public class DungeonPages : PageGroup {
        private readonly Party party;
        private readonly Flags flags;
        private readonly Page previous;

        public DungeonPages(Page previous, Party party, Flags flags) : base(new Page("Quest")) {
            var buttons = new List<IButtonable>();
            this.party = party;
            this.flags = flags;
            this.previous = previous;   

            Root.Icon = Util.GetSprite("dungeon-gate");
            Root.AddCharacters(Side.LEFT, party);
            Root.Condition = PageUtil.GetVisitProcessCondition(flags, party);

            buttons.Add(PageUtil.GenerateBack(previous));

            Area currentArea = GetCurrentArea(flags.CurrentArea);

            for (int i = 0; i < currentArea.Dungeons.Length; i++) {
                if (IsStagePlayable(i, currentArea)) {
                    buttons.Add(GetDungeonEntryProcess(i, currentArea));
                } else {
                    buttons.Add(new Process("<color=grey>???</color>", "Complete the previous stage to unlock."));
                }
            }

            Get(ROOT_INDEX).Actions = buttons;
            Get(ROOT_INDEX).OnEnter = () => {
                Get(ROOT_INDEX)
                .AddText(
                    "Select a stage."
                    );
            };
        }

        private Area GetCurrentArea(AreaType type) {
            return AreaList.ALL_AREAS[type](flags, party, previous, Root);
        }

        private bool IsStagePlayable(int index, Area area) {
            return index <= 0 || area.IsStageCleared(index - 1);
        }

        private Process GetDungeonEntryProcess(int index, Area area) {
            Dungeon dungeon = area.Dungeons[index];
            return new Process(
                    dungeon.ButtonText,
                    dungeon.Sprite,
                    () => dungeon.Invoke()
                );
        }
    }
}<commit_msg>special colors for boss and miniboss stages<commit_after>﻿using Scripts.Game.Serialized;
using Scripts.Model.Characters;
using Scripts.Model.Interfaces;
using Scripts.Model.Pages;
using Scripts.Model.Processes;
using System.Collections.Generic;
using UnityEngine;

namespace Scripts.Game.Dungeons {
    public class DungeonPages : PageGroup {
        private readonly Party party;
        private readonly Flags flags;
        private readonly Page previous;

        public DungeonPages(Page previous, Party party, Flags flags) : base(new Page("Quest")) {
            var buttons = new List<IButtonable>();
            this.party = party;
            this.flags = flags;
            this.previous = previous;   

            Root.Icon = Util.GetSprite("dungeon-gate");
            Root.AddCharacters(Side.LEFT, party);
            Root.Condition = PageUtil.GetVisitProcessCondition(flags, party);

            buttons.Add(PageUtil.GenerateBack(previous));

            Area currentArea = GetCurrentArea(flags.CurrentArea);

            for (int i = 0; i < currentArea.Dungeons.Length; i++) {
                if (IsStagePlayable(i, currentArea)) {
                    buttons.Add(GetDungeonEntryProcess(i, currentArea));
                } else {
                    buttons.Add(new Process("<color=grey>???</color>", "Complete the previous stage to unlock."));
                }
            }

            Get(ROOT_INDEX).Actions = buttons;
            Get(ROOT_INDEX).OnEnter = () => {
                Get(ROOT_INDEX)
                .AddText(
                    "Select a stage."
                    );
            };
        }

        private Area GetCurrentArea(AreaType type) {
            return AreaList.ALL_AREAS[type](flags, party, previous, Root);
        }

        private bool IsStagePlayable(int index, Area area) {
            return index <= 0 || area.IsStageCleared(index - 1);
        }

        private Process GetDungeonEntryProcess(int index, Area area) {
            Dungeon dungeon = area.Dungeons[index];
            Color buttonColor = Color.white;
            if (index == AreaList.MINIBOSS_INDEX) {
                buttonColor = AreaList.MINIBOSS_STAGE_TEXT_COLOR;
            } else if (index == AreaList.BOSS_INDEX) {
                buttonColor = AreaList.BOSS_STAGE_TEXT_COLOR;
            }
            return new Process(
                    Util.ColorString(string.Format("{0}-{1}", (int)area.Type, index), buttonColor),
                    dungeon.Sprite,
                    () => dungeon.Invoke()
                );
        }
    }
}
{'fraction_non_alphanumeric': 0.10124446319341911, 'fraction_numerical': 0.0016874077198903185, 'mean_word_length': 1.8480480480480481, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '359838', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1221, 'n_words': 273}