Merge ColorPreviewManagerWidget into ColorPickerManager.

This commit is contained in:
Paul Chote
2021-04-11 21:55:23 +01:00
committed by teinarss
parent 7b58f03f1c
commit f65de2dd43
25 changed files with 59 additions and 103 deletions

View File

@@ -14,6 +14,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Traits;
using OpenRA.Network;
using OpenRA.Primitives;
using OpenRA.Traits;
@@ -32,7 +33,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
readonly WorldRenderer worldRenderer;
readonly bool skirmishMode;
readonly Ruleset modRules;
readonly World shellmapWorld;
readonly WebServices services;
enum PanelType { Players, Options, Music, Servers, Kick, ForceStart }
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
readonly Dictionary<string, LobbyFaction> factions = new Dictionary<string, LobbyFaction>();
readonly ColorPreviewManagerWidget colorPreview;
readonly ColorPickerManagerInfo colorManager;
readonly TabCompletionLogic tabCompletion = new TabCompletionLogic();
@@ -116,7 +116,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
// TODO: This needs to be reworked to support per-map tech levels, bots, etc.
modRules = modData.DefaultRules;
shellmapWorld = worldRenderer.World;
services = modData.Manifest.Get<WebServices>();
@@ -159,8 +158,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
editableSpectatorTemplate = players.Get("TEMPLATE_EDITABLE_SPECTATOR");
nonEditableSpectatorTemplate = players.Get("TEMPLATE_NONEDITABLE_SPECTATOR");
newSpectatorTemplate = players.Get("TEMPLATE_NEW_SPECTATOR");
colorPreview = lobby.Get<ColorPreviewManagerWidget>("COLOR_MANAGER");
colorPreview.Color = Game.Settings.Player.Color;
colorManager = modRules.Actors[SystemActors.World].TraitInfo<ColorPickerManagerInfo>();
colorManager.Update(worldRenderer, Game.Settings.Player.Color);
foreach (var f in modRules.Actors[SystemActors.World].TraitInfos<FactionInfo>())
factions.Add(f.InternalName, new LobbyFaction { Selectable = f.Selectable, Name = f.Name, Side = f.Side, Description = f.Description });
@@ -601,7 +600,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
else
LobbyUtils.SetupEditableNameWidget(template, slot, client, orderManager, worldRenderer);
LobbyUtils.SetupEditableColorWidget(template, slot, client, orderManager, shellmapWorld, colorPreview);
LobbyUtils.SetupEditableColorWidget(template, slot, client, orderManager, worldRenderer, colorManager);
LobbyUtils.SetupEditableFactionWidget(template, slot, client, orderManager, factions);
LobbyUtils.SetupEditableTeamWidget(template, slot, client, orderManager, map);
LobbyUtils.SetupEditableHandicapWidget(template, slot, client, orderManager, map);