public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (ScenarioStats?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ TotalPiesEarned;
         return(hashCode);
     }
 }
        public bool Equals(WarzoneStat other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(base.Equals(other) &&
                   ScenarioStats.OrderBy(ss => ss.GameBaseVariantId).ThenBy(ss => ss.MapId).SequenceEqual(other.ScenarioStats.OrderBy(ss => ss.GameBaseVariantId).ThenBy(ss => ss.MapId)) &&
                   TotalPiesEarned == other.TotalPiesEarned);
        }
Esempio n. 3
0
    /// <summary>
    /// Draw download options screen
    /// </summary>
    public void DrawList()
    {
        Destroyer.Dialog();
        localManifest = IniRead.ReadFromString("");
        if (File.Exists(saveLocation() + "/manifest.ini"))
        {
            localManifest = IniRead.ReadFromIni(saveLocation() + "/manifest.ini");
        }

        // Heading
        UIElement ui = new UIElement();

        ui.SetLocation(2, 1, UIScaler.GetWidthUnits() - 4, 3);
        ui.SetText(new StringKey("val", "QUEST_NAME_DOWNLOAD", game.gameType.QuestName()));
        ui.SetFont(game.gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetLargeFont());

        UIElementScrollVertical scrollArea = new UIElementScrollVertical();

        scrollArea.SetLocation(1, 5, UIScaler.GetWidthUnits() - 2f, 21f);
        new UIElementBorder(scrollArea);

        // Start here
        float offset = 0;

        // Loop through all available quests
        foreach (RemoteQuest rq in remoteQuests)
        {
            string file      = rq.name + ".valkyrie";
            string questName = rq.GetData("name." + game.currentLang);
            if (questName.Length == 0)
            {
                questName = rq.GetData("name." + rq.GetData("defaultlanguage"));
            }
            if (questName.Length == 0)
            {
                questName = rq.name;
            }

            int remoteFormat = 0;
            int.TryParse(rq.GetData("format"), out remoteFormat);
            bool formatOK = (remoteFormat >= QuestData.Quest.minumumFormat) && (remoteFormat <= QuestData.Quest.currentFormat);

            if (!formatOK)
            {
                continue;
            }

            bool exists = File.Exists(saveLocation() + Path.DirectorySeparatorChar + file);
            bool update = true;
            if (exists)
            {
                string localHash  = localManifest.Get(rq.name, "version");
                string remoteHash = rq.GetData("version");

                update = !localHash.Equals(remoteHash);
            }

            bool has_stats_bar = false;


            Color bg         = Color.white;
            Color text_color = Color.black;
            if (exists)
            {
                if (update)
                {
                    // light pink
                    bg         = new Color(0.7f, 0.7f, 1f);
                    text_color = Color.black;
                }
                else
                {
                    // dark grey
                    bg         = new Color(0.1f, 0.1f, 0.1f);
                    text_color = Color.grey;
                }
            }

            // Frame
            ui = new UIElement(scrollArea.GetScrollTransform());
            ui.SetLocation(0.95f, offset, UIScaler.GetWidthUnits() - 4.9f, 3.6f);
            ui.SetBGColor(bg);
            if (update)
            {
                ui.SetButton(delegate { Selection(rq); });
            }
            offset += 0.05f;
            new UIElementBorder(ui, Color.grey);

            // Draw Image
            ui = new UIElement(scrollArea.GetScrollTransform());
            ui.SetLocation(1, offset, 3.5f, 3.5f);
            ui.SetBGColor(bg);
            if (update)
            {
                ui.SetButton(delegate { Selection(rq); });
            }

            if (rq.image != null)
            {
                ui.SetImage(rq.image);
            }

            ui = new UIElement(scrollArea.GetScrollTransform());
            ui.SetBGColor(Color.clear);
            ui.SetLocation(5, offset, UIScaler.GetWidthUnits() - 8, 2.5f);
            ui.SetTextPadding(1.2f);
            if (update && exists)
            {
                ui.SetText(new StringKey("val", "QUEST_NAME_UPDATE", questName), text_color);
            }
            else
            {
                ui.SetText(questName, text_color);
            }
            if (update)
            {
                ui.SetButton(delegate { Selection(rq); });
            }
            ui.SetTextAlignment(TextAnchor.MiddleLeft);
            ui.SetFontSize(Mathf.RoundToInt(UIScaler.GetSmallFont() * 1.4f));

            // Duration
            int lengthMax = 0;
            int.TryParse(rq.GetData("lengthmax"), out lengthMax);
            if (lengthMax > 0)
            {
                int lengthMin = 0;
                int.TryParse(rq.GetData("lengthmin"), out lengthMin);


                ui = new UIElement(scrollArea.GetScrollTransform());
                ui.SetLocation(7f, offset + 2.3f, 4, 1);
                ui.SetText(new StringKey("val", "DURATION"), text_color);
                ui.SetTextAlignment(TextAnchor.MiddleLeft);
                ui.SetBGColor(Color.clear);
                if (update)
                {
                    ui.SetButton(delegate { Selection(rq); });
                }

                ui = new UIElement(scrollArea.GetScrollTransform());
                ui.SetLocation(11f, offset + 2.3f, 5, 1);
                ui.SetText(lengthMin + "  -  " + lengthMax, text_color);
                ui.SetTextAlignment(TextAnchor.MiddleLeft);
                ui.SetBGColor(Color.clear);
                if (update)
                {
                    ui.SetButton(delegate { Selection(rq); });
                }
            }

            // Difficulty
            float difficulty = 0f;
            float.TryParse(rq.GetData("difficulty"), out difficulty);
            if (difficulty != 0)
            {
                ui = new UIElement(scrollArea.GetScrollTransform());
                ui.SetLocation(UIScaler.GetHCenter() - 5.5f, offset + 2.3f, 6, 1);
                ui.SetText(new StringKey("val", "DIFFICULTY"), text_color);
                if (update)
                {
                    ui.SetButton(delegate { Selection(rq); });
                }
                ui.SetTextAlignment(TextAnchor.MiddleRight);
                ui.SetBGColor(Color.clear);

                string symbol = "π"; // will
                if (game.gameType is MoMGameType)
                {
                    symbol = new StringKey("val", "ICON_SUCCESS_RESULT").Translate();
                }

                ui = new UIElement(scrollArea.GetScrollTransform());
                ui.SetLocation(UIScaler.GetHCenter(), offset + 1.8f, 9, 2);
                ui.SetText(symbol + symbol + symbol + symbol + symbol, text_color);
                ui.SetBGColor(Color.clear);
                ui.SetFontSize(UIScaler.GetMediumFont());
                if (update)
                {
                    ui.SetButton(delegate { Selection(rq); });
                }

                ui = new UIElement(scrollArea.GetScrollTransform());
                ui.SetLocation(UIScaler.GetHCenter() + 1.05f + (difficulty * 6.9f), offset + 1.8f, (1 - difficulty) * 6.9f, 1.6f);
                Color filter = bg;
                filter.a = 0.7f;
                ui.SetBGColor(filter);
                if (update)
                {
                    ui.SetButton(delegate { Selection(rq); });
                }
            }

            // Statistics
            string filename = file.ToLower();
            if (game.stats != null && game.stats.scenarios_stats != null && game.stats.scenarios_stats.ContainsKey(filename))
            {
                ScenarioStats q_stats   = game.stats.scenarios_stats[filename];
                int           win_ratio = (int)(q_stats.scenario_avg_win_ratio * 100);

                StringKey STATS_AVERAGE_WIN_RATIO    = new StringKey("val", "STATS_AVERAGE_WIN_RATIO", win_ratio);
                StringKey STATS_NO_AVERAGE_WIN_RATIO = new StringKey("val", "STATS_NO_AVERAGE_WIN_RATIO", win_ratio);
                StringKey STATS_NB_USER_REVIEWS      = new StringKey("val", "STATS_NB_USER_REVIEWS", q_stats.scenario_play_count);
                StringKey STATS_AVERAGE_DURATION     = new StringKey("val", "STATS_AVERAGE_DURATION", (int)(q_stats.scenario_avg_duration));
                StringKey STATS_NO_AVERAGE_DURATION  = new StringKey("val", "STATS_NO_AVERAGE_DURATION");

                //  rating
                string symbol = "★";
                if (game.gameType is MoMGameType)
                {
                    symbol = new StringKey("val", "ICON_TENTACLE").Translate();
                }
                float rating           = q_stats.scenario_avg_rating / 10;
                float score_text_width = 0;

                ui = new UIElement(scrollArea.GetScrollTransform());

                ui.SetText(symbol + symbol + symbol + symbol + symbol, text_color);
                score_text_width = ui.GetStringWidth(symbol + symbol + symbol + symbol + symbol, (int)System.Math.Round(UIScaler.GetMediumFont() * 1.4f)) + 1;
                ui.SetLocation(UIScaler.GetRight(-12f), offset + 0.6f, score_text_width, 2);
                ui.SetBGColor(Color.clear);
                ui.SetFontSize((int)System.Math.Round(UIScaler.GetMediumFont() * 1.4f));
                ui.SetTextAlignment(TextAnchor.MiddleLeft);
                if (update)
                {
                    ui.SetButton(delegate { Selection(rq); });
                }

                ui = new UIElement(scrollArea.GetScrollTransform());
                ui.SetLocation(UIScaler.GetRight(-12) + (rating * (score_text_width - 1)), offset + 0.6f, (1 - rating) * score_text_width, 2);
                Color filter = bg;
                filter.a = 0.7f;
                ui.SetBGColor(filter);
                if (update)
                {
                    ui.SetButton(delegate { Selection(rq); });
                }

                //  Number of user reviews
                float user_review_text_width = 0;
                ui = new UIElement(scrollArea.GetScrollTransform());
                user_review_text_width = ui.GetStringWidth(STATS_NB_USER_REVIEWS, UIScaler.GetSmallFont()) + 1;
                ui.SetText(STATS_NB_USER_REVIEWS, text_color);
                ui.SetLocation(UIScaler.GetRight(-12) + (score_text_width / 2) - (user_review_text_width / 2), offset + 2.3f, user_review_text_width, 1);
                ui.SetTextAlignment(TextAnchor.MiddleLeft);
                ui.SetBGColor(Color.clear);
                ui.SetFontSize(UIScaler.GetSmallFont());
                if (update)
                {
                    ui.SetButton(delegate { Selection(rq); });
                }

                if (q_stats.scenario_avg_duration > 0 || win_ratio >= 0)
                {
                    has_stats_bar = true;

                    // Additional information in frame
                    ui = new UIElement(scrollArea.GetScrollTransform());
                    ui.SetLocation(3.5f + 1f, offset + 3.6f, UIScaler.GetWidthUnits() - 4.9f - 3.5f - 0.05f, 1.2f);
                    if (exists)
                    {
                        ui.SetBGColor(bg);
                    }
                    else
                    {
                        ui.SetBGColor(new Color(0.8f, 0.8f, 0.8f));
                    }
                    if (update)
                    {
                        ui.SetButton(delegate { Selection(rq); });
                    }

                    //  average duration
                    ui = new UIElement(scrollArea.GetScrollTransform());
                    ui.SetLocation(6f, offset + 3.8f, 14, 1);
                    if (q_stats.scenario_avg_duration > 0)
                    {
                        ui.SetText(STATS_AVERAGE_DURATION, text_color);
                    }
                    else
                    {
                        ui.SetText(STATS_NO_AVERAGE_DURATION, text_color);
                    }
                    ui.SetTextAlignment(TextAnchor.MiddleLeft);
                    ui.SetBGColor(Color.clear);
                    if (update)
                    {
                        ui.SetButton(delegate { Selection(rq); });
                    }

                    //  average win ratio
                    ui = new UIElement(scrollArea.GetScrollTransform());
                    ui.SetLocation(UIScaler.GetHCenter() - 5.5f, offset + 3.8f, 15, 1);
                    if (win_ratio >= 0)
                    {
                        ui.SetText(STATS_AVERAGE_WIN_RATIO, text_color);
                    }
                    else
                    {
                        ui.SetText(STATS_NO_AVERAGE_WIN_RATIO, text_color);
                    }
                    ui.SetBGColor(Color.clear);
                    ui.SetTextAlignment(TextAnchor.MiddleCenter);
                    if (update)
                    {
                        ui.SetButton(delegate { Selection(rq); });
                    }
                }
            }

            // Size is 1.2 to be clear of characters with tails
            if (exists)
            {
                float string_width = 0;

                if (update)
                {
                    ui = new UIElement(scrollArea.GetScrollTransform());
                    ui.SetText(CommonStringKeys.UPDATE, Color.black);
                    string_width = ui.GetStringWidth(CommonStringKeys.UPDATE, UIScaler.GetSmallFont()) + 1.3f;
                    ui.SetButton(delegate { Delete(file); Selection(rq); });
                    ui.SetLocation(0.95f, offset + 3.6f, string_width, 1.2f);
                    ui.SetBGColor(new Color(0, 0.5f, 0.68f));           // 0080AF
                    new UIElementBorder(ui, new Color(0, 0.3f, 0.43f)); // 00516f
                }

                ui = new UIElement(scrollArea.GetScrollTransform());
                ui.SetText(CommonStringKeys.DELETE, Color.black);
                string_width = ui.GetStringWidth(CommonStringKeys.DELETE, UIScaler.GetSmallFont()) + 1.3f;
                ui.SetButton(delegate { Delete(file); });
                ui.SetLocation(0.95f + UIScaler.GetWidthUnits() - 4.9f - string_width, offset + 3.6f, string_width, 1.2f);
                ui.SetBGColor(new Color(0.7f, 0, 0));
                new UIElementBorder(ui, new Color(0.45f, 0, 0));
            }

            if (has_stats_bar || exists)
            {
                offset += 1.2f;
            }

            offset += 4.6f;
        }

        foreach (KeyValuePair <string, Dictionary <string, string> > kv in localManifest.data)
        {
            // Only looking for files missing from remote
            bool onRemote = false;
            foreach (RemoteQuest rq in remoteQuests)
            {
                if (rq.name.Equals(kv.Key))
                {
                    onRemote = true;
                }
            }
            if (onRemote)
            {
                continue;
            }

            string type = localManifest.Get(kv.Key, "type");

            // Only looking for packages of this game type
            if (!game.gameType.TypeName().Equals(type))
            {
                continue;
            }

            string file = kv.Key + ".valkyrie";
            // Size is 1.2 to be clear of characters with tails
            if (File.Exists(saveLocation() + Path.DirectorySeparatorChar + file))
            {
                ui = new UIElement(scrollArea.GetScrollTransform());
                ui.SetLocation(1, offset, UIScaler.GetWidthUnits() - 8, 1.2f);
                ui.SetTextPadding(1.2f);
                ui.SetText(file, Color.black);
                ui.SetBGColor(new Color(0.1f, 0.1f, 0.1f));
                ui.SetTextAlignment(TextAnchor.MiddleLeft);

                ui = new UIElement(scrollArea.GetScrollTransform());
                ui.SetLocation(UIScaler.GetWidthUnits() - 12, offset, 8, 1.2f);
                ui.SetText(CommonStringKeys.DELETE, Color.black);
                ui.SetTextAlignment(TextAnchor.MiddleLeft);
                ui.SetButton(delegate { Delete(file); });
                ui.SetBGColor(new Color(0.7f, 0, 0));
                offset += 2;
            }
        }

        scrollArea.SetScrollSize(offset);

        ui = new UIElement();
        ui.SetLocation(1, UIScaler.GetBottom(-3), 8, 2);
        ui.SetText(CommonStringKeys.BACK, Color.red);
        ui.SetButton(delegate { Cancel(); });
        ui.SetFont(game.gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        new UIElementBorder(ui, Color.red);
    }
Esempio n. 4
0
        public QuestSelectionScreen(Dictionary <string, QuestData.Quest> ql)
        {
            questList = ql;
            Game game = Game.Get();

            // If a dialog window is open we force it closed (this shouldn't happen)
            foreach (GameObject go in GameObject.FindGameObjectsWithTag(Game.DIALOG))
            {
                Object.Destroy(go);
            }

            // Clean up downloader if present
            foreach (GameObject go in GameObject.FindGameObjectsWithTag(Game.QUESTUI))
            {
                Object.Destroy(go);
            }

            // Heading
            UIElement ui = new UIElement();

            ui.SetLocation(2, 1, UIScaler.GetWidthUnits() - 4, 3);
            ui.SetText(new StringKey("val", "SELECT", game.gameType.QuestName()));
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetLargeFont());

            // error message if stats are not available
            if (game.stats.error_download)
            {
                float error_string_width = 0;
                ui = new UIElement();
                if (game.stats.error_download_description == "ERROR NETWORK")
                {
                    StringKey STATS_ERROR_NETWORK = new StringKey("val", "STATS_ERROR_NETWORK");
                    ui.SetText(STATS_ERROR_NETWORK, Color.red);
                    error_string_width = ui.GetStringWidth(STATS_ERROR_NETWORK);
                }
                else
                {
                    StringKey STATS_ERROR_HTTP = new StringKey("val", "STATS_ERROR_HTTP", game.stats.error_download_description);
                    ui.SetText(STATS_ERROR_HTTP, Color.red);
                    error_string_width = ui.GetStringWidth(STATS_ERROR_HTTP);
                }
                ui.SetLocation(UIScaler.GetHCenter() - (error_string_width / 2f), UIScaler.GetBottom(-3f), error_string_width, 2.4f);
                ui.SetTextAlignment(TextAnchor.MiddleCenter);
                ui.SetBGColor(Color.clear);
            }

            // error message if stats are not available
            if (game.stats.download_ongoing)
            {
                float ongoing_string_width = 0;
                ui = new UIElement();
                StringKey STATS_DOWNLOAD_ONGOING = new StringKey("val", "STATS_DOWNLOAD_ONGOING");
                ui.SetText(STATS_DOWNLOAD_ONGOING, Color.white);
                ongoing_string_width = ui.GetStringWidth(STATS_DOWNLOAD_ONGOING);
                ui.SetLocation(UIScaler.GetHCenter() - (ongoing_string_width / 2f), UIScaler.GetBottom(-3f), ongoing_string_width, 2.4f);
                ui.SetTextAlignment(TextAnchor.MiddleCenter);
                ui.SetBGColor(Color.clear);
            }

            UIElementScrollVertical scrollArea = new UIElementScrollVertical();

            scrollArea.SetLocation(1, 5, UIScaler.GetWidthUnits() - 2f, 21f);
            new UIElementBorder(scrollArea);

            // Start here
            float offset = 0;

            // Loop through all available quests
            foreach (KeyValuePair <string, QuestData.Quest> q in questList)
            {
                if (q.Value.GetMissingPacks(game.cd.GetLoadedPackIDs()).Count == 0)
                {
                    string key = q.Key;
                    LocalizationRead.AddDictionary("qst", q.Value.localizationDict);
                    string translation = q.Value.name.Translate();

                    // Frame
                    ui = new UIElement(scrollArea.GetScrollTransform());
                    ui.SetLocation(0.95f, offset, UIScaler.GetWidthUnits() - 4.9f, 3.6f);
                    ui.SetBGColor(Color.white);
                    ui.SetButton(delegate { Selection(key); });
                    offset += 0.05f;
                    new UIElementBorder(ui, Color.grey);

                    // Draw Image
                    ui = new UIElement(scrollArea.GetScrollTransform());
                    ui.SetLocation(1, offset, 3.5f, 3.5f);
                    ui.SetBGColor(Color.white);
                    ui.SetButton(delegate { Selection(key); });
                    if (q.Value.image.Length > 0)
                    {
                        ui.SetImage(ContentData.FileToTexture(Path.Combine(q.Value.path, q.Value.image)));
                    }

                    // Quest name
                    ui = new UIElement(scrollArea.GetScrollTransform());
                    ui.SetBGColor(Color.clear);
                    ui.SetLocation(5f, offset - 0.2f, UIScaler.GetWidthUnits() - 8, 2.5f);
                    ui.SetTextPadding(0.5f);
                    ui.SetText(translation, Color.black);
                    ui.SetButton(delegate { Selection(key); });
                    ui.SetTextAlignment(TextAnchor.MiddleLeft);
                    ui.SetFontSize(Mathf.RoundToInt(UIScaler.GetSmallFont() * 1.4f));
                    ui.SetFont(game.gameType.GetHeaderFont());

                    // Duration
                    if (q.Value.lengthMax != 0)
                    {
                        ui = new UIElement(scrollArea.GetScrollTransform());
                        ui.SetLocation(6.5f, offset + 2.3f, 4, 1);
                        ui.SetText(new StringKey("val", "DURATION"), Color.black);
                        ui.SetButton(delegate { Selection(key); });
                        ui.SetTextAlignment(TextAnchor.MiddleLeft);
                        ui.SetBGColor(Color.clear);

                        ui = new UIElement(scrollArea.GetScrollTransform());
                        ui.SetLocation(10.5f, offset + 2.3f, 5, 1);
                        ui.SetText(q.Value.lengthMin + "  -  " + q.Value.lengthMax, Color.black);
                        ui.SetButton(delegate { Selection(key); });
                        ui.SetTextAlignment(TextAnchor.MiddleLeft);
                        ui.SetBGColor(Color.clear);
                    }

                    // Difficulty
                    if (q.Value.difficulty != 0)
                    {
                        ui = new UIElement(scrollArea.GetScrollTransform());
                        ui.SetLocation(UIScaler.GetHCenter() - 5.5f, offset + 2.3f, 6, 1);
                        ui.SetText(new StringKey("val", "DIFFICULTY"), Color.black);
                        ui.SetButton(delegate { Selection(key); });
                        ui.SetTextAlignment(TextAnchor.MiddleRight);
                        ui.SetBGColor(Color.clear);

                        string symbol = "π"; // will
                        if (game.gameType is MoMGameType)
                        {
                            symbol = new StringKey("val", "ICON_SUCCESS_RESULT").Translate();
                        }
                        ui = new UIElement(scrollArea.GetScrollTransform());
                        ui.SetLocation(UIScaler.GetHCenter(), offset + 1.8f, 9, 2);
                        ui.SetText(symbol + symbol + symbol + symbol + symbol, Color.black);
                        ui.SetBGColor(Color.clear);
                        ui.SetFontSize(UIScaler.GetMediumFont());
                        ui.SetButton(delegate { Selection(key); });

                        ui = new UIElement(scrollArea.GetScrollTransform());
                        ui.SetLocation(UIScaler.GetHCenter() + 1.05f + (q.Value.difficulty * 6.9f), offset + 1.8f, (1 - q.Value.difficulty) * 6.9f, 1.6f);
                        ui.SetBGColor(new Color(1, 1, 1, 0.7f));
                        ui.SetButton(delegate { Selection(key); });
                    }

                    // Statistics
                    string filename = Path.GetFileName(key).ToLower();
                    if (game.stats != null && game.stats.scenarios_stats != null && game.stats.scenarios_stats.ContainsKey(filename))
                    {
                        ScenarioStats q_stats   = game.stats.scenarios_stats[filename];
                        int           win_ratio = (int)(q_stats.scenario_avg_win_ratio * 100);

                        StringKey STATS_AVERAGE_WIN_RATIO    = new StringKey("val", "STATS_AVERAGE_WIN_RATIO", win_ratio);
                        StringKey STATS_NO_AVERAGE_WIN_RATIO = new StringKey("val", "STATS_NO_AVERAGE_WIN_RATIO", win_ratio);
                        StringKey STATS_NB_USER_REVIEWS      = new StringKey("val", "STATS_NB_USER_REVIEWS", q_stats.scenario_play_count);
                        StringKey STATS_AVERAGE_DURATION     = new StringKey("val", "STATS_AVERAGE_DURATION", (int)(q_stats.scenario_avg_duration));
                        StringKey STATS_NO_AVERAGE_DURATION  = new StringKey("val", "STATS_NO_AVERAGE_DURATION");

                        //  rating
                        string symbol = "★";
                        if (game.gameType is MoMGameType)
                        {
                            symbol = new StringKey("val", "ICON_TENTACLE").Translate();
                        }
                        float rating           = q_stats.scenario_avg_rating / 10;
                        float score_text_width = 0;

                        ui = new UIElement(scrollArea.GetScrollTransform());

                        ui.SetText(symbol + symbol + symbol + symbol + symbol, Color.black);
                        score_text_width = ui.GetStringWidth(symbol + symbol + symbol + symbol + symbol, (int)System.Math.Round(UIScaler.GetMediumFont() * 1.4f)) + 1;
                        ui.SetLocation(UIScaler.GetRight(-12f), offset + 0.6f, score_text_width, 2);
                        ui.SetBGColor(Color.clear);
                        ui.SetFontSize((int)System.Math.Round(UIScaler.GetMediumFont() * 1.4f));
                        ui.SetTextAlignment(TextAnchor.MiddleLeft);
                        ui.SetButton(delegate { Selection(key); });

                        ui = new UIElement(scrollArea.GetScrollTransform());
                        ui.SetLocation(UIScaler.GetRight(-12) + (rating * (score_text_width - 1)), offset + 0.6f, (1 - rating) * score_text_width, 2);
                        ui.SetBGColor(new Color(1, 1, 1, 0.7f));
                        ui.SetButton(delegate { Selection(key); });

                        //  Number of user reviews
                        float user_review_text_width = 0;
                        ui = new UIElement(scrollArea.GetScrollTransform());
                        user_review_text_width = ui.GetStringWidth(STATS_NB_USER_REVIEWS, UIScaler.GetSmallFont()) + 1;
                        ui.SetText(STATS_NB_USER_REVIEWS, Color.black);
                        ui.SetLocation(UIScaler.GetRight(-12) + (score_text_width / 2) - (user_review_text_width / 2), offset + 2.3f, user_review_text_width, 1);
                        ui.SetTextAlignment(TextAnchor.MiddleLeft);
                        ui.SetBGColor(Color.clear);
                        ui.SetFontSize(UIScaler.GetSmallFont());
                        ui.SetButton(delegate { Selection(key); });

                        if (q_stats.scenario_avg_duration > 0 || win_ratio >= 0)
                        {
                            // Additional information in Grey frame
                            ui = new UIElement(scrollArea.GetScrollTransform());
                            ui.SetLocation(3.5f + 1f, offset + 3.6f, UIScaler.GetWidthUnits() - 4.9f - 3.5f - 0.05f, 1.2f);
                            ui.SetBGColor(Color.grey);
                            ui.SetButton(delegate { Selection(key); });

                            //  average duration
                            ui = new UIElement(scrollArea.GetScrollTransform());
                            ui.SetLocation(5f, offset + 3.8f, 14, 1);
                            if (q_stats.scenario_avg_duration > 0)
                            {
                                ui.SetText(STATS_AVERAGE_DURATION, Color.white);
                            }
                            else
                            {
                                ui.SetText(STATS_NO_AVERAGE_DURATION, Color.white);
                            }
                            ui.SetTextAlignment(TextAnchor.MiddleLeft);
                            ui.SetBGColor(Color.clear);
                            ui.SetButton(delegate { Selection(key); });

                            //  average win ratio
                            ui = new UIElement(scrollArea.GetScrollTransform());
                            ui.SetLocation(UIScaler.GetHCenter() - 5.5f, offset + 3.8f, 15, 1);
                            if (win_ratio >= 0)
                            {
                                ui.SetText(STATS_AVERAGE_WIN_RATIO, Color.white);
                            }
                            else
                            {
                                ui.SetText(STATS_NO_AVERAGE_WIN_RATIO, Color.white);
                            }
                            ui.SetBGColor(Color.clear);
                            ui.SetTextAlignment(TextAnchor.MiddleCenter);
                            ui.SetButton(delegate { Selection(key); });

                            offset += 1.4f;
                        }
                    }

                    offset += 4.5f;
                }
            }

            // Loop through all unavailable quests
            foreach (KeyValuePair <string, QuestData.Quest> q in questList)
            {
                if (q.Value.GetMissingPacks(game.cd.GetLoadedPackIDs()).Count > 0)
                {
                    string key = q.Key;
                    LocalizationRead.AddDictionary("qst", q.Value.localizationDict);
                    string translation = q.Value.name.Translate();

                    // Size is 1.2 to be clear of characters with tails
                    ui = new UIElement(scrollArea.GetScrollTransform());
                    ui.SetLocation(1, offset, UIScaler.GetWidthUnits() - 5, 1.2f);
                    ui.SetText(new StringKey("val", "INDENT", translation), Color.black);
                    ui.SetTextAlignment(TextAnchor.MiddleLeft);
                    ui.SetBGColor(new Color(0.4f, 0.4f, 0.4f));
                    offset += 1.2f;

                    foreach (string s in q.Value.GetMissingPacks(game.cd.GetLoadedPackIDs()))
                    {
                        ui = new UIElement(scrollArea.GetScrollTransform());
                        ui.SetLocation(3, offset, UIScaler.GetWidthUnits() - 9, 1.2f);
                        ui.SetText(new StringKey("val", "REQUIRES_EXPANSION", game.cd.GetContentName(s)), Color.black);
                        ui.SetTextAlignment(TextAnchor.MiddleLeft);
                        ui.SetBGColor(new Color(0.4f, 0.4f, 0.4f));
                        offset += 1.2f;
                    }

                    offset += 0.8f;
                }
            }

            scrollArea.SetScrollSize(offset);

            ui = new UIElement();
            ui.SetLocation(1, UIScaler.GetBottom(-3), 8, 2);
            ui.SetText(CommonStringKeys.BACK, Color.red);
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetMediumFont());
            ui.SetButton(delegate { Cancel(); });
            new UIElementBorder(ui, Color.red);

            ui = new UIElement();
            ui.SetLocation(UIScaler.GetRight(-9), UIScaler.GetBottom(-3), 8, 2);
            ui.SetText(DOWNLOAD, Color.green);
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetMediumFont());
            ui.SetButton(delegate { Download(); });
            new UIElementBorder(ui, Color.green);
        }