Exemplo n.º 1
0
        public void SetCurrentMap(MapCache mapCache)
        {
            CurrentMap = mapCache;

            var mapWindow = _window.Controls.FindControl(_optionsPath + ":MapWindow");

            MapUtils.SetMapPreview(mapCache, mapWindow, _game);

            // Set map text
            var textEntryMap = _window.Controls.FindControl(_optionsPath + ":TextEntryMapDisplay");
            var mapKey       = mapCache.GetNameKey();

            textEntryMap.Text = mapKey.Translate();
        }
Exemplo n.º 2
0
        public void SetCurrentMap(MapCache mapCache)
        {
            _game.SkirmishManager.Settings.MapName = mapCache.Name;

            Logger.Info("Set current map to " + mapCache.Name);

            CurrentMap = mapCache;

            var mapWindow = _window.Controls.FindControl(_optionsPath + MapWindow);

            MapUtils.SetMapPreview(mapCache, mapWindow, _game);

            // Set map text
            var textEntryMap = _window.Controls.FindControl(_optionsPath + ":TextEntryMapDisplay");
            var mapKey       = mapCache.GetNameKey();

            textEntryMap.Text = mapKey.Translate();
        }
        public static void SkirmishMapSelectMenuInit(Window window, Game game)
        {
            _game = game;

            void SetPreviewMap(MapCache mapCache)
            {
                _previewMap = mapCache;

                var mapPreview = window.Controls.FindControl("SkirmishMapSelectMenu.wnd:WinMapPreview");

                MapUtils.SetMapPreview(mapCache, mapPreview, game);
            }

            SetPreviewMap(SkirmishGameOptionsMenuCallbacks.GameOptions.CurrentMap);

            // Official maps
            var mapCaches   = game.AssetStore.MapCaches;
            var listBoxMaps = (ListBox)window.Controls.FindControl(ListBoxMapPrefix);
            var items       = new List <ListBoxDataItem>();

            foreach (var mapCache in mapCaches)
            {
                if (mapCache.IsMultiplayer)
                {
                    items.Add(new ListBoxDataItem(mapCache, new[] { "", mapCache.GetNameKey().Translate() }, listBoxMaps.TextColor));
                }
            }

            listBoxMaps.Items = items.ToArray();

            listBoxMaps.SelectedIndexChanged += (sender, e) =>
            {
                var selectedItem = listBoxMaps.Items[listBoxMaps.SelectedIndex];

                var mapCache = selectedItem.DataItem as MapCache;

                SetPreviewMap(mapCache);
            };
        }