fix indents everywhere
This commit is contained in:
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Cnc
|
||||
Game.MoveViewport(new int2(b.Left + b.Width/2, b.Top + b.Height/2));
|
||||
|
||||
Scripting.Media.PlayFMVFullscreen(w, "gdi1.vqa",
|
||||
() => Scripting.Media.PlayFMVFullscreen(w, "landing.vqa", () =>
|
||||
() => Scripting.Media.PlayFMVFullscreen(w, "landing.vqa", () =>
|
||||
{
|
||||
Sound.PlayMusic(Rules.Music["aoi"]);
|
||||
started = true;
|
||||
@@ -107,8 +107,8 @@ namespace OpenRA.Mods.Cnc
|
||||
}
|
||||
// GoodGuy win conditions
|
||||
// BadGuy is dead
|
||||
var badcount = self.World.Actors.Count(a => a != a.Owner.PlayerActor &&
|
||||
a.Owner == Players["BadGuy"] && !a.IsDead());
|
||||
var badcount = self.World.Actors.Count(a => a != a.Owner.PlayerActor &&
|
||||
a.Owner == Players["BadGuy"] && !a.IsDead());
|
||||
if (badcount != lastBadCount)
|
||||
{
|
||||
Game.Debug("{0} badguys remain".F(badcount));
|
||||
@@ -120,7 +120,7 @@ namespace OpenRA.Mods.Cnc
|
||||
|
||||
//GoodGuy lose conditions: MCV/cyard must survive
|
||||
var hasAnything = self.World.ActorsWithTrait<MustBeDestroyed>()
|
||||
.Any( a => a.Actor.Owner == Players["GoodGuy"] );
|
||||
.Any( a => a.Actor.Owner == Players["GoodGuy"] );
|
||||
if (!hasAnything)
|
||||
OnLose(self.World);
|
||||
|
||||
@@ -128,40 +128,40 @@ namespace OpenRA.Mods.Cnc
|
||||
if (ticks == 25*5)
|
||||
{
|
||||
ReinforceFromSea(self.World,
|
||||
Actors["lstStart"].Location,
|
||||
Actors["lstEnd"].Location,
|
||||
new int2(53,53),
|
||||
new string[] {"e1","e1","e1"},
|
||||
Actors["lstStart"].Location,
|
||||
Actors["lstEnd"].Location,
|
||||
new int2(53,53),
|
||||
new string[] {"e1","e1","e1"},
|
||||
Players["GoodGuy"]);
|
||||
}
|
||||
|
||||
if (ticks == 25*15)
|
||||
{
|
||||
ReinforceFromSea(self.World,
|
||||
Actors["lstStart"].Location,
|
||||
Actors["lstEnd"].Location,
|
||||
new int2(53,53),
|
||||
new string[] {"e1","e1","e1"},
|
||||
Actors["lstStart"].Location,
|
||||
Actors["lstEnd"].Location,
|
||||
new int2(53,53),
|
||||
new string[] {"e1","e1","e1"},
|
||||
Players["GoodGuy"]);
|
||||
}
|
||||
|
||||
if (ticks == 25*30)
|
||||
{
|
||||
ReinforceFromSea(self.World,
|
||||
Actors["lstStart"].Location,
|
||||
Actors["lstEnd"].Location,
|
||||
new int2(53,53),
|
||||
new string[] {"jeep"},
|
||||
Actors["lstStart"].Location,
|
||||
Actors["lstEnd"].Location,
|
||||
new int2(53,53),
|
||||
new string[] {"jeep"},
|
||||
Players["GoodGuy"]);
|
||||
}
|
||||
|
||||
if (ticks == 25*60)
|
||||
{
|
||||
ReinforceFromSea(self.World,
|
||||
Actors["lstStart"].Location,
|
||||
Actors["lstEnd"].Location,
|
||||
new int2(53,53),
|
||||
new string[] {"jeep"},
|
||||
Actors["lstStart"].Location,
|
||||
Actors["lstEnd"].Location,
|
||||
new int2(53,53),
|
||||
new string[] {"jeep"},
|
||||
Players["GoodGuy"]);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ namespace OpenRA.Mods.Cnc.Widgets
|
||||
{
|
||||
// Find an actor with a queue
|
||||
var producer = world.Selection.Actors.FirstOrDefault(a => a.IsInWorld
|
||||
&& a.World.LocalPlayer == a.Owner
|
||||
&& a.HasTrait<ProductionQueue>());
|
||||
&& a.World.LocalPlayer == a.Owner
|
||||
&& a.HasTrait<ProductionQueue>());
|
||||
if (producer != null)
|
||||
tabsWidget.Value.CurrentQueue = producer.TraitsImplementing<ProductionQueue>().First();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Cnc.Widgets
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncWorldInteractionControllerWidget([ObjectCreator.Param] World world,
|
||||
[ObjectCreator.Param] WorldRenderer worldRenderer)
|
||||
[ObjectCreator.Param] WorldRenderer worldRenderer)
|
||||
: base(world, worldRenderer)
|
||||
{
|
||||
tooltipContainer = new Lazy<TooltipContainerWidget>(() =>
|
||||
@@ -86,8 +86,8 @@ namespace OpenRA.Mods.Cnc.Widgets
|
||||
if (scrolltype != OpenRA.GameRules.MouseScrollType.Disabled && mi.Event == MouseInputEvent.Move &&
|
||||
(mi.Button == MouseButton.Middle || mi.Button == (MouseButton.Left | MouseButton.Right)))
|
||||
{
|
||||
var d = scrolltype == OpenRA.GameRules.MouseScrollType.Inverted ? -1 : 1;
|
||||
Game.viewport.Scroll((Viewport.LastMousePos - mi.Location) * d);
|
||||
var d = scrolltype == OpenRA.GameRules.MouseScrollType.Inverted ? -1 : 1;
|
||||
Game.viewport.Scroll((Viewport.LastMousePos - mi.Location) * d);
|
||||
}
|
||||
|
||||
return base.HandleMouseInput(mi);
|
||||
@@ -187,17 +187,17 @@ namespace OpenRA.Mods.Cnc.Widgets
|
||||
|
||||
if(Keyboard != ScrollDirection.None || Edge != ScrollDirection.None)
|
||||
{
|
||||
var scroll = new float2(0, 0);
|
||||
var scroll = new float2(0, 0);
|
||||
|
||||
// Modified to use the ViewportEdgeScrollStep setting - Gecko
|
||||
if (Keyboard.Includes(ScrollDirection.Up) || Edge.Includes(ScrollDirection.Up))
|
||||
scroll += new float2(0, -1);
|
||||
if (Keyboard.Includes(ScrollDirection.Right) || Edge.Includes(ScrollDirection.Right))
|
||||
scroll += new float2(1, 0);
|
||||
if (Keyboard.Includes(ScrollDirection.Down) || Edge.Includes(ScrollDirection.Down))
|
||||
scroll += new float2(0, 1);
|
||||
if (Keyboard.Includes(ScrollDirection.Left) || Edge.Includes(ScrollDirection.Left))
|
||||
scroll += new float2(-1, 0);
|
||||
// Modified to use the ViewportEdgeScrollStep setting - Gecko
|
||||
if (Keyboard.Includes(ScrollDirection.Up) || Edge.Includes(ScrollDirection.Up))
|
||||
scroll += new float2(0, -1);
|
||||
if (Keyboard.Includes(ScrollDirection.Right) || Edge.Includes(ScrollDirection.Right))
|
||||
scroll += new float2(1, 0);
|
||||
if (Keyboard.Includes(ScrollDirection.Down) || Edge.Includes(ScrollDirection.Down))
|
||||
scroll += new float2(0, 1);
|
||||
if (Keyboard.Includes(ScrollDirection.Left) || Edge.Includes(ScrollDirection.Left))
|
||||
scroll += new float2(-1, 0);
|
||||
|
||||
float length = Math.Max(1, scroll.Length);
|
||||
scroll.X = (scroll.X / length) * Game.Settings.Game.ViewportEdgeScrollStep;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public ButtonTooltipLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] ToggleButtonWidget button)
|
||||
[ObjectCreator.Param] ToggleButtonWidget button)
|
||||
{
|
||||
var label = widget.GetWidget<LabelWidget>("LABEL");
|
||||
var hotkey = widget.GetWidget<LabelWidget>("HOTKEY");
|
||||
|
||||
@@ -28,8 +28,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncCheatsLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] Action onExit,
|
||||
[ObjectCreator.Param] World world)
|
||||
[ObjectCreator.Param] Action onExit,
|
||||
[ObjectCreator.Param] World world)
|
||||
{
|
||||
var panel = widget.GetWidget("CHEATS_PANEL");
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
ColorRamp ramp;
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncColorPickerLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] ColorRamp initialRamp,
|
||||
[ObjectCreator.Param] Action<ColorRamp> onChange,
|
||||
[ObjectCreator.Param] Action<ColorRamp> onSelect,
|
||||
[ObjectCreator.Param] WorldRenderer worldRenderer)
|
||||
[ObjectCreator.Param] ColorRamp initialRamp,
|
||||
[ObjectCreator.Param] Action<ColorRamp> onChange,
|
||||
[ObjectCreator.Param] Action<ColorRamp> onSelect,
|
||||
[ObjectCreator.Param] WorldRenderer worldRenderer)
|
||||
{
|
||||
var panel = widget.GetWidget("COLOR_CHOOSER");
|
||||
ramp = initialRamp;
|
||||
@@ -34,9 +34,9 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
Action sliderChanged = () =>
|
||||
{
|
||||
ramp = new ColorRamp((byte)(255*hueSlider.Value),
|
||||
(byte)(255*satSlider.Value),
|
||||
(byte)(255*lumSlider.Value),
|
||||
10);
|
||||
(byte)(255*satSlider.Value),
|
||||
(byte)(255*lumSlider.Value),
|
||||
10);
|
||||
onChange(ramp);
|
||||
};
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
// Show connection failed dialog
|
||||
CloseWindow();
|
||||
Widget.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs()
|
||||
{
|
||||
{
|
||||
{ "onAbort", onAbort },
|
||||
{ "onRetry", onRetry },
|
||||
{ "host", host },
|
||||
@@ -49,11 +49,11 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncConnectingLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] string host,
|
||||
[ObjectCreator.Param] int port,
|
||||
[ObjectCreator.Param] Action onConnect,
|
||||
[ObjectCreator.Param] Action onRetry,
|
||||
[ObjectCreator.Param] Action onAbort)
|
||||
[ObjectCreator.Param] string host,
|
||||
[ObjectCreator.Param] int port,
|
||||
[ObjectCreator.Param] Action onConnect,
|
||||
[ObjectCreator.Param] Action onRetry,
|
||||
[ObjectCreator.Param] Action onAbort)
|
||||
{
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
Game.JoinServer(host, port);
|
||||
Widget.OpenWindow("CONNECTING_PANEL", new WidgetArgs()
|
||||
{
|
||||
{
|
||||
{ "host", host },
|
||||
{ "port", port },
|
||||
{ "onConnect", onConnect },
|
||||
@@ -82,16 +82,16 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{ "onRetry", () => Connect(host, port, onConnect, onAbort) }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class CncConnectionFailedLogic
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncConnectionFailedLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] string host,
|
||||
[ObjectCreator.Param] int port,
|
||||
[ObjectCreator.Param] Action onRetry,
|
||||
[ObjectCreator.Param] Action onAbort)
|
||||
[ObjectCreator.Param] string host,
|
||||
[ObjectCreator.Param] int port,
|
||||
[ObjectCreator.Param] Action onRetry,
|
||||
[ObjectCreator.Param] Action onAbort)
|
||||
{
|
||||
var panel = widget.GetWidget("CONNECTIONFAILED_PANEL");
|
||||
panel.GetWidget<ButtonWidget>("ABORT_BUTTON").OnClick = () => { Widget.CloseWindow(); onAbort(); };
|
||||
@@ -100,4 +100,4 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
widget.GetWidget<LabelWidget>("CONNECTING_DESC").GetText = () =>
|
||||
"Could not connect to {0}:{1}".F(host, port);
|
||||
}
|
||||
}}
|
||||
}}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncConquestObjectivesLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] World world)
|
||||
[ObjectCreator.Param] World world)
|
||||
{
|
||||
var panel = widget.GetWidget("CONQUEST_OBJECTIVES");
|
||||
panel.GetWidget<LabelWidget>("TITLE").GetText = () => "Conquest: " + world.Map.Title;
|
||||
|
||||
@@ -18,8 +18,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncDirectConnectLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] Action onExit,
|
||||
[ObjectCreator.Param] Action openLobby)
|
||||
[ObjectCreator.Param] Action onExit,
|
||||
[ObjectCreator.Param] Action openLobby)
|
||||
{
|
||||
var panel = widget.GetWidget("DIRECTCONNECT_PANEL");
|
||||
var ipField = panel.GetWidget<TextFieldWidget>("IP");
|
||||
|
||||
@@ -29,8 +29,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncDownloadPackagesLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] Dictionary<string,string> installData,
|
||||
[ObjectCreator.Param] Action afterInstall)
|
||||
[ObjectCreator.Param] Dictionary<string,string> installData,
|
||||
[ObjectCreator.Param] Action afterInstall)
|
||||
{
|
||||
this.installData = installData;
|
||||
this.afterInstall = afterInstall;
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncIngameChromeLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] World world )
|
||||
[ObjectCreator.Param] World world )
|
||||
{
|
||||
this.world = world;
|
||||
world.WorldActor.Trait<CncMenuPaletteEffect>()
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncIngameMenuLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] World world,
|
||||
[ObjectCreator.Param] Action onExit)
|
||||
[ObjectCreator.Param] World world,
|
||||
[ObjectCreator.Param] Action onExit)
|
||||
{
|
||||
var resumeDisabled = false;
|
||||
menu = widget.GetWidget("INGAME_MENU");
|
||||
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
hideButtons = true;
|
||||
Widget.OpenWindow("MUSIC_PANEL", new WidgetArgs()
|
||||
{
|
||||
{
|
||||
{ "onExit", () => hideButtons = false },
|
||||
});
|
||||
};
|
||||
@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
hideButtons = true;
|
||||
Widget.OpenWindow("SETTINGS_PANEL", new WidgetArgs()
|
||||
{
|
||||
{
|
||||
{ "world", world },
|
||||
{ "onExit", () => hideButtons = false },
|
||||
});
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
return;
|
||||
|
||||
if (!InstallUtils.ExtractFromPackage(source, extractPackage, filesToExtract, dest, onProgress, onError))
|
||||
return;
|
||||
return;
|
||||
|
||||
Game.RunAfterTick(() =>
|
||||
{
|
||||
|
||||
@@ -18,12 +18,12 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncInstallLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] Dictionary<string,string> installData,
|
||||
[ObjectCreator.Param] Action continueLoading)
|
||||
[ObjectCreator.Param] Dictionary<string,string> installData,
|
||||
[ObjectCreator.Param] Action continueLoading)
|
||||
{
|
||||
var panel = widget.GetWidget("INSTALL_PANEL");
|
||||
var args = new WidgetArgs()
|
||||
{
|
||||
{
|
||||
{ "afterInstall", () => { Widget.CloseWindow(); continueLoading(); } },
|
||||
{ "installData", installData }
|
||||
};
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
panel.GetWidget<ButtonWidget>("MODS_BUTTON").OnClick = () =>
|
||||
{
|
||||
Widget.OpenWindow("MODS_PANEL", new WidgetArgs()
|
||||
{
|
||||
{
|
||||
{ "onExit", () => {} },
|
||||
// Close this panel
|
||||
{ "onSwitch", Widget.CloseWindow },
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
};
|
||||
|
||||
Widget.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs()
|
||||
{
|
||||
{
|
||||
{ "onAbort", onExit },
|
||||
{ "onRetry", onRetry },
|
||||
{ "host", om.Host },
|
||||
@@ -85,11 +85,11 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
internal CncLobbyLogic([ObjectCreator.Param( "widget" )] Widget lobby,
|
||||
[ObjectCreator.Param] World world, // Shellmap world
|
||||
[ObjectCreator.Param] OrderManager orderManager,
|
||||
[ObjectCreator.Param] Action onExit,
|
||||
[ObjectCreator.Param] Action onStart,
|
||||
[ObjectCreator.Param] bool addBots)
|
||||
[ObjectCreator.Param] World world, // Shellmap world
|
||||
[ObjectCreator.Param] OrderManager orderManager,
|
||||
[ObjectCreator.Param] Action onExit,
|
||||
[ObjectCreator.Param] Action onStart,
|
||||
[ObjectCreator.Param] bool addBots)
|
||||
{
|
||||
this.orderManager = orderManager;
|
||||
this.OnGameStart = () => { CloseWindow(); onStart(); };
|
||||
@@ -119,7 +119,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
var map = mapPreview.Map();
|
||||
if (map == null || mi.Button != MouseButton.Left
|
||||
|| orderManager.LocalClient.State == Session.ClientState.Ready)
|
||||
|| orderManager.LocalClient.State == Session.ClientState.Ready)
|
||||
return;
|
||||
|
||||
var p = map.SpawnPoints
|
||||
@@ -225,7 +225,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
lobby.GetWidget<ButtonWidget>("MUSIC_BUTTON").OnClick = () =>
|
||||
{
|
||||
Widget.OpenWindow("MUSIC_PANEL", new WidgetArgs()
|
||||
{
|
||||
{
|
||||
{ "onExit", () => {} },
|
||||
});
|
||||
};
|
||||
@@ -290,8 +290,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
Func<int, ScrollItemWidget, ScrollItemWidget> setupItem = (ii, itemTemplate) =>
|
||||
{
|
||||
var item = ScrollItemWidget.Setup(itemTemplate,
|
||||
() => client.SpawnPoint == ii,
|
||||
() => orderManager.IssueOrder(Order.Command("spawn {0} {1}".F(client.Index, ii))));
|
||||
() => client.SpawnPoint == ii,
|
||||
() => orderManager.IssueOrder(Order.Command("spawn {0} {1}".F(client.Index, ii))));
|
||||
item.GetWidget<LabelWidget>("LABEL").GetText = () => ii == 0 ? "-" : ii.ToString();
|
||||
return item;
|
||||
};
|
||||
@@ -372,11 +372,11 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
}
|
||||
// Editable player in slot
|
||||
else if ((client.Index == orderManager.LocalClient.Index) ||
|
||||
(client.Bot != null && Game.IsHost))
|
||||
(client.Bot != null && Game.IsHost))
|
||||
{
|
||||
template = EditablePlayerTemplate.Clone();
|
||||
var botReady = (client.Bot != null && Game.IsHost
|
||||
&& orderManager.LocalClient.State == Session.ClientState.Ready);
|
||||
&& orderManager.LocalClient.State == Session.ClientState.Ready);
|
||||
var ready = botReady || client.State == Session.ClientState.Ready;
|
||||
|
||||
if (client.Bot != null)
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncMenuLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] World world)
|
||||
[ObjectCreator.Param] World world)
|
||||
{
|
||||
world.WorldActor.Trait<CncMenuPaletteEffect>()
|
||||
.Fade(CncMenuPaletteEffect.EffectType.Desaturated);
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
Menu = MenuType.None;
|
||||
Widget.OpenWindow("MODS_PANEL", new WidgetArgs()
|
||||
{
|
||||
{
|
||||
{ "onExit", () => Menu = MenuType.Main },
|
||||
{ "onSwitch", RemoveShellmapUI }
|
||||
});
|
||||
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
Menu = MenuType.None;
|
||||
Widget.OpenWindow("SERVERBROWSER_PANEL", new WidgetArgs()
|
||||
{
|
||||
{
|
||||
{ "onExit", () => Menu = MenuType.Multiplayer },
|
||||
{ "openLobby", () => OpenLobbyPanel(MenuType.Multiplayer, false) }
|
||||
});
|
||||
@@ -71,7 +71,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
Menu = MenuType.None;
|
||||
Widget.OpenWindow("CREATESERVER_PANEL", new WidgetArgs()
|
||||
{
|
||||
{
|
||||
{ "onExit", () => Menu = MenuType.Multiplayer },
|
||||
{ "openLobby", () => OpenLobbyPanel(MenuType.Multiplayer, false) }
|
||||
});
|
||||
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
Menu = MenuType.None;
|
||||
Widget.OpenWindow("DIRECTCONNECT_PANEL", new WidgetArgs()
|
||||
{
|
||||
{
|
||||
{ "onExit", () => Menu = MenuType.Multiplayer },
|
||||
{ "openLobby", () => OpenLobbyPanel(MenuType.Multiplayer, false) }
|
||||
});
|
||||
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
Menu = MenuType.None;
|
||||
Widget.OpenWindow("REPLAYBROWSER_PANEL", new WidgetArgs()
|
||||
{
|
||||
{
|
||||
{ "onExit", () => Menu = MenuType.Settings },
|
||||
{ "onStart", RemoveShellmapUI }
|
||||
});
|
||||
@@ -105,7 +105,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
Menu = MenuType.None;
|
||||
Widget.OpenWindow("MUSIC_PANEL", new WidgetArgs()
|
||||
{
|
||||
{
|
||||
{ "onExit", () => Menu = MenuType.Settings },
|
||||
});
|
||||
};
|
||||
@@ -114,7 +114,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
Menu = MenuType.None;
|
||||
Widget.OpenWindow("SETTINGS_PANEL", new WidgetArgs()
|
||||
{
|
||||
{
|
||||
{ "world", world },
|
||||
{ "onExit", () => Menu = MenuType.Settings },
|
||||
});
|
||||
@@ -146,9 +146,9 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
var map = WidgetUtils.ChooseInitialMap(Game.Settings.Server.Map);
|
||||
|
||||
CncConnectingLogic.Connect(IPAddress.Loopback.ToString(),
|
||||
Game.CreateLocalServer(map),
|
||||
() => OpenLobbyPanel(MenuType.Main, true),
|
||||
() => { Game.CloseServer(); Menu = MenuType.Main; });
|
||||
Game.CreateLocalServer(map),
|
||||
() => OpenLobbyPanel(MenuType.Main, true),
|
||||
() => { Game.CloseServer(); Menu = MenuType.Main; });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncModBrowserLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] Action onSwitch,
|
||||
[ObjectCreator.Param] Action onExit)
|
||||
[ObjectCreator.Param] Action onSwitch,
|
||||
[ObjectCreator.Param] Action onExit)
|
||||
{
|
||||
var panel = widget.GetWidget("MODS_PANEL");
|
||||
var modList = panel.GetWidget<ScrollPanelWidget>("MOD_LIST");
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncMusicPlayerLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] Action onExit)
|
||||
[ObjectCreator.Param] Action onExit)
|
||||
{
|
||||
panel = widget.GetWidget("MUSIC_PANEL");
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
|
||||
panel.GetWidget<LabelWidget>("TIME_LABEL").GetText = () => (currentSong == null) ? "" :
|
||||
"{0:D2}:{1:D2} / {2:D2}:{3:D2}".F((int)Sound.MusicSeekPosition / 60, (int)Sound.MusicSeekPosition % 60,
|
||||
currentSong.Length / 60, currentSong.Length % 60);
|
||||
currentSong.Length / 60, currentSong.Length % 60);
|
||||
panel.GetWidget<LabelWidget>("TITLE_LABEL").GetText = () => (currentSong == null) ? "" : currentSong.Title;
|
||||
|
||||
var musicSlider = panel.GetWidget<SliderWidget>("MUSIC_SLIDER");
|
||||
|
||||
@@ -42,8 +42,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncServerBrowserLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] Action openLobby,
|
||||
[ObjectCreator.Param] Action onExit)
|
||||
[ObjectCreator.Param] Action openLobby,
|
||||
[ObjectCreator.Param] Action onExit)
|
||||
{
|
||||
var panel = widget.GetWidget("SERVERBROWSER_PANEL");
|
||||
var sl = panel.GetWidget<ScrollPanelWidget>("SERVER_LIST");
|
||||
@@ -127,9 +127,9 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
return;
|
||||
}
|
||||
|
||||
var gamesWaiting = games.Where(g => g.CanJoin());
|
||||
var gamesWaiting = games.Where(g => g.CanJoin());
|
||||
|
||||
if (gamesWaiting.Count() == 0)
|
||||
if (gamesWaiting.Count() == 0)
|
||||
{
|
||||
searchStatus = SearchStatus.NoGames;
|
||||
return;
|
||||
@@ -138,7 +138,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
searchStatus = SearchStatus.Hidden;
|
||||
currentServer = gamesWaiting.FirstOrDefault();
|
||||
|
||||
foreach (var loop in gamesWaiting)
|
||||
foreach (var loop in gamesWaiting)
|
||||
{
|
||||
var game = loop;
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncSettingsLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] World world,
|
||||
[ObjectCreator.Param] Action onExit)
|
||||
[ObjectCreator.Param] World world,
|
||||
[ObjectCreator.Param] Action onExit)
|
||||
{
|
||||
this.world = world;
|
||||
var panel = widget.GetWidget("SETTINGS_PANEL");
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public ProductionTooltipLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] TooltipContainerWidget tooltipContainer,
|
||||
[ObjectCreator.Param] ProductionPaletteWidget palette)
|
||||
[ObjectCreator.Param] TooltipContainerWidget tooltipContainer,
|
||||
[ObjectCreator.Param] ProductionPaletteWidget palette)
|
||||
{
|
||||
var pm = palette.world.LocalPlayer.PlayerActor.Trait<PowerManager>();
|
||||
var pr = palette.world.LocalPlayer.PlayerActor.Trait<PlayerResources>();
|
||||
@@ -71,7 +71,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
var costString = "$: {0}".F(cost);
|
||||
costLabel.GetText = () => costString;
|
||||
costLabel.GetColor = () => pr.DisplayCash + pr.DisplayOre >= cost
|
||||
? Color.White : Color.Red;
|
||||
? Color.White : Color.Red;
|
||||
|
||||
var leftWidth = Math.Max(font.Measure(tooltip.Name).X, requiresFont.Measure(requiresString).X);
|
||||
var rightWidth = new [] {font.Measure(powerString).X, font.Measure(timeString).X, font.Measure(costString).X}.Aggregate(Math.Max);
|
||||
|
||||
@@ -18,8 +18,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public SimpleTooltipLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] TooltipContainerWidget tooltipContainer,
|
||||
[ObjectCreator.Param] Func<string> getText)
|
||||
[ObjectCreator.Param] TooltipContainerWidget tooltipContainer,
|
||||
[ObjectCreator.Param] Func<string> getText)
|
||||
{
|
||||
var label = widget.GetWidget<LabelWidget>("LABEL");
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public SupportPowerTooltipLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] TooltipContainerWidget tooltipContainer,
|
||||
[ObjectCreator.Param] SupportPowersWidget palette)
|
||||
[ObjectCreator.Param] TooltipContainerWidget tooltipContainer,
|
||||
[ObjectCreator.Param] SupportPowersWidget palette)
|
||||
{
|
||||
widget.IsVisible = () => palette.TooltipPower != null;
|
||||
var nameLabel = widget.GetWidget<LabelWidget>("NAME");
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
return;
|
||||
|
||||
time = "{0} / {1}".F(WidgetUtils.FormatTime(sp.RemainingTime),
|
||||
WidgetUtils.FormatTime(sp.Info.ChargeTime*25));
|
||||
WidgetUtils.FormatTime(sp.Info.ChargeTime*25));
|
||||
|
||||
if (sp == lastPower)
|
||||
return;
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public WorldTooltipLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] TooltipContainerWidget tooltipContainer,
|
||||
[ObjectCreator.Param] CncWorldInteractionControllerWidget wic)
|
||||
[ObjectCreator.Param] TooltipContainerWidget tooltipContainer,
|
||||
[ObjectCreator.Param] CncWorldInteractionControllerWidget wic)
|
||||
{
|
||||
widget.IsVisible = () => wic.TooltipType != Type.None;
|
||||
var label = widget.GetWidget<LabelWidget>("LABEL");
|
||||
|
||||
@@ -66,9 +66,9 @@ namespace OpenRA.Mods.Cnc.Widgets
|
||||
|
||||
var b = RenderBounds;
|
||||
var rect = new RectangleF(b.X,
|
||||
b.Y + (1-providedFrac)*b.Height,
|
||||
(float)b.Width,
|
||||
providedFrac*b.Height);
|
||||
b.Y + (1-providedFrac)*b.Height,
|
||||
(float)b.Width,
|
||||
providedFrac*b.Height);
|
||||
Game.Renderer.LineRenderer.FillRect(rect, color);
|
||||
|
||||
var indicator = ChromeProvider.GetImage("sidebar-bits", "left-indicator");
|
||||
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Cnc.Widgets
|
||||
lastDrainedFrac = drainedFrac = float2.Lerp(lastDrainedFrac.GetValueOrDefault(drainedFrac), drainedFrac, .3f);
|
||||
|
||||
float2 pos = new float2(b.X + b.Width - indicator.size.X,
|
||||
b.Y + (1-drainedFrac)*b.Height - indicator.size.Y / 2);
|
||||
b.Y + (1-drainedFrac)*b.Height - indicator.size.Y / 2);
|
||||
|
||||
Game.Renderer.RgbaSpriteRenderer.DrawSprite(indicator, pos);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Cnc.Widgets
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public ProductionPaletteWidget([ObjectCreator.Param] World world,
|
||||
[ObjectCreator.Param] WorldRenderer worldRenderer)
|
||||
[ObjectCreator.Param] WorldRenderer worldRenderer)
|
||||
{
|
||||
this.world = world;
|
||||
this.worldRenderer = worldRenderer;
|
||||
@@ -83,7 +83,7 @@ namespace OpenRA.Mods.Cnc.Widgets
|
||||
.ToDictionary(
|
||||
u => u.Name,
|
||||
u => Game.modData.SpriteLoader.LoadAllSprites(
|
||||
u.Traits.Get<TooltipInfo>().Icon ?? (u.Name + "icon"))[0]);
|
||||
u.Traits.Get<TooltipInfo>().Icon ?? (u.Name + "icon"))[0]);
|
||||
|
||||
overlayFont = Game.Renderer.Fonts["TinyBold"];
|
||||
holdOffset = new float2(32,24) - overlayFont.Measure("On Hold") / 2;
|
||||
@@ -257,21 +257,21 @@ namespace OpenRA.Mods.Cnc.Widgets
|
||||
var waiting = first != CurrentQueue.CurrentItem() && !first.Done;
|
||||
if (first.Done)
|
||||
overlayFont.DrawTextWithContrast("Ready",
|
||||
icon.Pos + readyOffset,
|
||||
Color.White, Color.Black, 1);
|
||||
icon.Pos + readyOffset,
|
||||
Color.White, Color.Black, 1);
|
||||
else if (first.Paused)
|
||||
overlayFont.DrawTextWithContrast("On Hold",
|
||||
icon.Pos + holdOffset,
|
||||
Color.White, Color.Black, 1);
|
||||
icon.Pos + holdOffset,
|
||||
Color.White, Color.Black, 1);
|
||||
else if (!waiting)
|
||||
overlayFont.DrawTextWithContrast(WidgetUtils.FormatTime(first.RemainingTimeActual),
|
||||
icon.Pos + timeOffset,
|
||||
Color.White, Color.Black, 1);
|
||||
icon.Pos + timeOffset,
|
||||
Color.White, Color.Black, 1);
|
||||
|
||||
if (total > 1 || waiting)
|
||||
overlayFont.DrawTextWithContrast(total.ToString(),
|
||||
icon.Pos + queuedOffset,
|
||||
Color.White, Color.Black, 1);
|
||||
icon.Pos + queuedOffset,
|
||||
Color.White, Color.Black, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,9 +67,9 @@ namespace OpenRA.Mods.Cnc.Widgets
|
||||
|
||||
var b = RenderBounds;
|
||||
var rect = new RectangleF(b.X,
|
||||
b.Y + (1-capacityFrac)*b.Height,
|
||||
(float)b.Width,
|
||||
capacityFrac*b.Height);
|
||||
b.Y + (1-capacityFrac)*b.Height,
|
||||
(float)b.Width,
|
||||
capacityFrac*b.Height);
|
||||
Game.Renderer.LineRenderer.FillRect(rect, color);
|
||||
|
||||
var indicator = ChromeProvider.GetImage("sidebar-bits", "right-indicator");
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Cnc.Widgets
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public SupportPowersWidget([ObjectCreator.Param] World world,
|
||||
[ObjectCreator.Param] WorldRenderer worldRenderer)
|
||||
[ObjectCreator.Param] WorldRenderer worldRenderer)
|
||||
{
|
||||
this.worldRenderer = worldRenderer;
|
||||
spm = world.LocalPlayer.PlayerActor.Trait<SupportPowerManager>();
|
||||
@@ -117,16 +117,16 @@ namespace OpenRA.Mods.Cnc.Widgets
|
||||
{
|
||||
if (p.Power.Ready)
|
||||
overlayFont.DrawTextWithContrast("Ready",
|
||||
p.Pos + readyOffset,
|
||||
Color.White, Color.Black, 1);
|
||||
p.Pos + readyOffset,
|
||||
Color.White, Color.Black, 1);
|
||||
else if (!p.Power.Active)
|
||||
overlayFont.DrawTextWithContrast("On Hold",
|
||||
p.Pos + holdOffset,
|
||||
Color.White, Color.Black, 1);
|
||||
p.Pos + holdOffset,
|
||||
Color.White, Color.Black, 1);
|
||||
else
|
||||
overlayFont.DrawTextWithContrast(WidgetUtils.FormatTime(p.Power.RemainingTime),
|
||||
p.Pos + timeOffset,
|
||||
Color.White, Color.Black, 1);
|
||||
p.Pos + timeOffset,
|
||||
Color.White, Color.Black, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Cnc.Widgets
|
||||
}
|
||||
}
|
||||
|
||||
public override string GetCursor(int2 pos) { return null; }
|
||||
public override Widget Clone() { throw new NotImplementedException(); }
|
||||
public override string GetCursor(int2 pos) { return null; }
|
||||
public override Widget Clone() { throw new NotImplementedException(); }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user