<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using OpenSage.Data.Ini;
using OpenSage.Gui;
using OpenSage.Gui.Wnd;
using OpenSage.Gui.Wnd.Controls;
using OpenSage.Logic;
using OpenSage.Mathematics;
using OpenSage.Network;

namespace OpenSage.Mods.Generals.Gui
{
    [WndCallbacks]
    public static class SkirmishGameOptionsMenuCallbacks
    {
        private const string ComboBoxTeamPrefix = "SkirmishGameOptionsMenu.wnd:ComboBoxTeam";
        private const string ComboBoxPlayerTemplatePrefix = "SkirmishGameOptionsMenu.wnd:ComboBoxPlayerTemplate";
        private const string ComboBoxColorPrefix = "SkirmishGameOptionsMenu.wnd:ComboBoxColor";
        private const string ComboBoxPlayerPrefix = "SkirmishGameOptionsMenu.wnd:ComboBoxPlayer";
        private static Window _window;
        private static Game _game;
        private static MapCache _currentMap;

        public static void SkirmishGameOptionsMenuSystem(Control control, WndWindowMessage message, ControlCallbackContext context)
        {
            switch (message.MessageType)
            {
                case WndWindowMessageType.SelectedButton:
                    switch (message.Element.Name)
                    {
                        case "SkirmishGameOptionsMenu.wnd:ButtonSelectMap":
                            OpenMapSelection(context);
                            break;

                        case "SkirmishGameOptionsMenu.wnd:ButtonStart":
                            ParsePlayerSettings(context.Game, out PlayerSetting[] settings);

                            if (!ValidateSettings(settings, context.WindowManager))
                            {
                                return;
                            }

                            context.Game.Scene2D.WndWindowManager.PopWindow();
                            context.Game.StartGame(
                                @"maps\Alpine Assault\Alpine Assault.map", // TODO
                                new EchoConnection(),
                                settings,
                                0);
                            break;

                        case "SkirmishGameOptionsMenu.wnd:ButtonBack":
                            context.WindowManager.SetWindow(@"Menus\MainMenu.wnd");<commit_msg>Use chosen map<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using OpenSage.Data.Ini;
using OpenSage.Gui;
using OpenSage.Gui.Wnd;
using OpenSage.Gui.Wnd.Controls;
using OpenSage.Logic;
using OpenSage.Mathematics;
using OpenSage.Network;

namespace OpenSage.Mods.Generals.Gui
{
    [WndCallbacks]
    public static class SkirmishGameOptionsMenuCallbacks
    {
        private const string ComboBoxTeamPrefix = "SkirmishGameOptionsMenu.wnd:ComboBoxTeam";
        private const string ComboBoxPlayerTemplatePrefix = "SkirmishGameOptionsMenu.wnd:ComboBoxPlayerTemplate";
        private const string ComboBoxColorPrefix = "SkirmishGameOptionsMenu.wnd:ComboBoxColor";
        private const string ComboBoxPlayerPrefix = "SkirmishGameOptionsMenu.wnd:ComboBoxPlayer";
        private static Window _window;
        private static Game _game;
        private static MapCache _currentMap;

        public static void SkirmishGameOptionsMenuSystem(Control control, WndWindowMessage message, ControlCallbackContext context)
        {
            switch (message.MessageType)
            {
                case WndWindowMessageType.SelectedButton:
                    switch (message.Element.Name)
                    {
                        case "SkirmishGameOptionsMenu.wnd:ButtonSelectMap":
                            OpenMapSelection(context);
                            break;

                        case "SkirmishGameOptionsMenu.wnd:ButtonStart":
                            ParsePlayerSettings(context.Game, out PlayerSetting[] settings);

                            if (!ValidateSettings(settings, context.WindowManager))
                            {
                                return;
                            }

                            context.Game.Scene2D.WndWindowManager.PopWindow();
                            context.Game.StartGame(
                                _currentMap.Name,
                                new EchoConnection(),
                                settings,
                                0);
                            break;

                        case "SkirmishGameOptionsMenu.wnd:ButtonBack":
                            context.WindowManager.SetWindow(@"Menus\MainMenu.wnd");
{'fraction_non_alphanumeric': 0.06425438596491229, 'fraction_numerical': 0.0008771929824561404, 'mean_word_length': 1.7229850746268656, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1694053', 'n_tokens_mistral': 1103, 'n_tokens_neox': 1061, 'n_words': 202}