Rename AddRaceSuffixLogic to AddFactionSuffixLogic

This commit is contained in:
penev92
2015-07-15 05:51:05 +03:00
committed by Pavel Penev
parent 9a36bf6bcd
commit b34810c1d3
8 changed files with 105 additions and 100 deletions

View File

@@ -569,7 +569,7 @@
<Compile Include="Widgets\Logic\CreditsLogic.cs" />
<Compile Include="Widgets\Logic\DirectConnectLogic.cs" />
<Compile Include="Widgets\Logic\DisconnectWatcherLogic.cs" />
<Compile Include="Widgets\Logic\Ingame\AddRaceSuffixLogic.cs" />
<Compile Include="Widgets\Logic\Ingame\AddFactionSuffixLogic.cs" />
<Compile Include="Widgets\Logic\Ingame\ClassicProductionLogic.cs" />
<Compile Include="Widgets\Logic\Ingame\ControlGroupLogic.cs" />
<Compile Include="Widgets\Logic\Ingame\DebugMenuLogic.cs" />

View File

@@ -0,0 +1,39 @@
#region Copyright & License Information
/*
* Copyright 2007-2015 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System;
using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Widgets.Logic
{
public class AddFactionSuffixLogic
{
[ObjectCreator.UseCtor]
public AddFactionSuffixLogic(Widget widget, World world)
{
string faction;
if (!ChromeMetrics.TryGet("FactionSuffix-" + world.LocalPlayer.Faction.InternalName, out faction))
faction = world.LocalPlayer.Faction.InternalName;
var suffix = "-" + faction;
var buttonWidget = widget as ButtonWidget;
if (buttonWidget != null)
buttonWidget.Background += suffix;
else
{
var imageWidget = widget as ImageWidget;
if (imageWidget != null)
imageWidget.ImageCollection += suffix;
else
throw new InvalidOperationException("AddFactionSuffixLogic only supports ButtonWidget and ImageWidget");
}
}
}
}

View File

@@ -1,34 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2015 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System;
using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Widgets.Logic
{
public class AddRaceSuffixLogic
{
[ObjectCreator.UseCtor]
public AddRaceSuffixLogic(Widget widget, World world)
{
string race;
if (!ChromeMetrics.TryGet("RaceSuffix-" + world.LocalPlayer.Faction.InternalName, out race))
race = world.LocalPlayer.Faction.InternalName;
var suffix = "-" + race;
if (widget is ButtonWidget)
((ButtonWidget)widget).Background += suffix;
else if (widget is ImageWidget)
((ImageWidget)widget).ImageCollection += suffix;
else
throw new InvalidOperationException("AddRaceSuffixLogic only supports ButtonWidget and ImageWidget");
}
}
}

View File

@@ -149,7 +149,7 @@ Container@PLAYER_WIDGETS:
Children:
LogicTicker@RADAR_TICKER:
Image@INSIGNIA:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 60
Y: 75
ImageCollection: radar

View File

@@ -17,7 +17,7 @@ Container@PLAYER_WIDGETS:
Container@PALETTE_FOREGROUND:
Children:
Image@ICON_TEMPLATE:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X:0-2
Y:0-2
Width: 62
@@ -26,7 +26,7 @@ Container@PLAYER_WIDGETS:
ImageCollection: sidebar
ImageName: background-supportoverlay
Image@SIDEBAR_BACKGROUND_TOP:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: WINDOW_RIGHT - 250
Y: 10
Width: 238
@@ -41,7 +41,7 @@ Container@PLAYER_WIDGETS:
Y: 7
Children:
Button@BEACON_BUTTON:
Logic: BeaconOrderButtonLogic, AddRaceSuffixLogic
Logic: BeaconOrderButtonLogic, AddFactionSuffixLogic
Width: 28
Height: 28
Background: sidebar-button
@@ -54,7 +54,7 @@ Container@PLAYER_WIDGETS:
Y: 6
ImageCollection: order-icons
Button@SELL_BUTTON:
Logic: SellOrderButtonLogic, AddRaceSuffixLogic
Logic: SellOrderButtonLogic, AddFactionSuffixLogic
X: 32
Width: 28
Height: 28
@@ -68,7 +68,7 @@ Container@PLAYER_WIDGETS:
Y: 6
ImageCollection: order-icons
Button@POWER_BUTTON:
Logic: PowerdownOrderButtonLogic, AddRaceSuffixLogic
Logic: PowerdownOrderButtonLogic, AddFactionSuffixLogic
X: 64
Width: 28
Height: 28
@@ -82,7 +82,7 @@ Container@PLAYER_WIDGETS:
Y: 6
ImageCollection: order-icons
Button@REPAIR_BUTTON:
Logic: RepairOrderButtonLogic, AddRaceSuffixLogic
Logic: RepairOrderButtonLogic, AddFactionSuffixLogic
X: 96
Width: 28
Height: 28
@@ -96,7 +96,7 @@ Container@PLAYER_WIDGETS:
Y: 6
ImageCollection: order-icons
MenuButton@DEBUG_BUTTON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
Key: escape Shift
X: 128
Width: 28
@@ -112,7 +112,7 @@ Container@PLAYER_WIDGETS:
ImageCollection: order-icons
ImageName: debug
MenuButton@DIPLOMACY_BUTTON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
MenuContainer: INGAME_DIPLOMACY_BG
HideIngameUI: false
Pause: false
@@ -131,7 +131,7 @@ Container@PLAYER_WIDGETS:
ImageCollection: order-icons
ImageName: diplomacy
MenuButton@OPTIONS_BUTTON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
Key: escape
X: 192
Width: 28
@@ -213,14 +213,14 @@ Container@PLAYER_WIDGETS:
Container@PALETTE_BACKGROUND:
Children:
Image@ROW_TEMPLATE:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
Width: 238
Height: 47
ClickThrough: false
ImageCollection: sidebar
ImageName: background-iconrow
Image@BOTTOM_CAP:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
Width: 238
Height: 8
ClickThrough: false
@@ -253,7 +253,7 @@ Container@PLAYER_WIDGETS:
Height: 240
Children:
ProductionTypeButton@BUILDING:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
Width: 28
Height: 28
VisualHeight: 0
@@ -268,7 +268,7 @@ Container@PLAYER_WIDGETS:
Y: 6
ImageCollection: production-icons
ProductionTypeButton@DEFENSE:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
Y: 31
Width: 28
Height: 28
@@ -284,7 +284,7 @@ Container@PLAYER_WIDGETS:
Y: 6
ImageCollection: production-icons
ProductionTypeButton@INFANTRY:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
Y: 62
Width: 28
Height: 28
@@ -300,7 +300,7 @@ Container@PLAYER_WIDGETS:
Y: 6
ImageCollection: production-icons
ProductionTypeButton@VEHICLE:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
Y: 93
Width: 28
Height: 28
@@ -316,7 +316,7 @@ Container@PLAYER_WIDGETS:
Y: 6
ImageCollection: production-icons
ProductionTypeButton@AIRCRAFT:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
Y: 124
Width: 28
Height: 28
@@ -332,7 +332,7 @@ Container@PLAYER_WIDGETS:
Y: 6
ImageCollection: production-icons
ProductionTypeButton@NAVAL:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
Y: 155
Width: 28
Height: 28
@@ -348,7 +348,7 @@ Container@PLAYER_WIDGETS:
Y: 6
ImageCollection: production-icons
Button@SCROLL_UP_BUTTON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
Y: 186
Width: 28
Height: 22
@@ -363,7 +363,7 @@ Container@PLAYER_WIDGETS:
ImageCollection: scrollbar
ImageName: up_arrow
Button@SCROLL_DOWN_BUTTON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
Y: 211
Width: 28
Height: 22

View File

@@ -25,13 +25,13 @@ Metrics:
SpawnColor: 255,255,255
SpawnContrastColor: 0,0,0
SpawnLabelOffset: 0,1
RaceSuffix-allies: allies
RaceSuffix-england: allies
RaceSuffix-france: allies
RaceSuffix-germany: allies
RaceSuffix-soviet: soviet
RaceSuffix-russia: soviet
RaceSuffix-ukraine: soviet
FactionSuffix-allies: allies
FactionSuffix-england: allies
FactionSuffix-france: allies
FactionSuffix-germany: allies
FactionSuffix-soviet: soviet
FactionSuffix-russia: soviet
FactionSuffix-ukraine: soviet
IncompatibleGameColor: 169,169,169
CantJoinGameColor: 211,211,211
ProtectedGameColor: 255,0,0
@@ -39,4 +39,4 @@ Metrics:
WaitingGameColor: 0,255,0
IncompatibleWaitingGameColor: 50,205,50
GameStartedColor: 255,165,0
IncompatibleGameStartedColor: 210,105,30
IncompatibleGameStartedColor: 210,105,30

View File

@@ -108,7 +108,7 @@ order-icons-gdi: chrome.png
diplomacy-disabled: 327,481,30,31
diplomacy-active: 296,481,30,31
# make this paragraph AddRaceSuffixLogic compatible
# make this paragraph AddFactionSuffixLogic compatible
sidebar-bits-gdi: chrome.png
production-tooltip-time: 416,208,16,16
production-tooltip-power: 480,160,16,16
@@ -230,7 +230,7 @@ order-icons-nod: chrome.png
diplomacy-disabled: 839,481,30,31
diplomacy-active: 808,481,30,31
# make this paragraph AddRaceSuffixLogic compatible
# make this paragraph AddFactionSuffixLogic compatible
sidebar-bits-nod: chrome.png
production-tooltip-time: 928,208,16,16
production-tooltip-power: 992,160,16,16
@@ -249,7 +249,7 @@ cash-icons-nod: chrome.png
# GENERIC
# ----------------------------------------------------------------------
# make this paragraph AddRaceSuffixLogic compatible
# make this paragraph AddFactionSuffixLogic compatible
sidebar-bits: chrome.png
production-tooltip-time: 416,208,16,16
production-tooltip-power: 480,160,16,16

View File

@@ -17,7 +17,7 @@ Container@PLAYER_WIDGETS:
Container@PALETTE_FOREGROUND:
Children:
Image@ICON_TEMPLATE:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X:0-2
Y:0-2
Width: 64
@@ -26,7 +26,7 @@ Container@PLAYER_WIDGETS:
ImageCollection: sidebar
ImageName: background-supportoverlay
Image@SIDEBAR_BACKGROUND_TOP:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: WINDOW_RIGHT - 235
Y: 0
Width: 235
@@ -41,7 +41,7 @@ Container@PLAYER_WIDGETS:
Y: 21
Children:
MenuButton@DEBUG_BUTTON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
Key: escape Shift
X: 13
Width: 30
@@ -52,13 +52,13 @@ Container@PLAYER_WIDGETS:
VisualHeight: 0
Children:
Image@ICON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 0
Y: 0
ImageCollection: order-icons
ImageName: debug
Button@REPAIR_BUTTON:
Logic: RepairOrderButtonLogic, AddRaceSuffixLogic
Logic: RepairOrderButtonLogic, AddFactionSuffixLogic
X: 43
Width: 30
Height: 31
@@ -68,12 +68,12 @@ Container@PLAYER_WIDGETS:
VisualHeight: 0
Children:
Image@ICON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 0
Y: 0
ImageCollection: order-icons
Button@SELL_BUTTON:
Logic: SellOrderButtonLogic, AddRaceSuffixLogic
Logic: SellOrderButtonLogic, AddFactionSuffixLogic
X: 73
Width: 30
Height: 31
@@ -83,12 +83,12 @@ Container@PLAYER_WIDGETS:
VisualHeight: 0
Children:
Image@ICON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 0
Y: 0
ImageCollection: order-icons
Button@BEACON_BUTTON:
Logic: BeaconOrderButtonLogic, AddRaceSuffixLogic
Logic: BeaconOrderButtonLogic, AddFactionSuffixLogic
X: 103
Width: 30
Height: 31
@@ -98,12 +98,12 @@ Container@PLAYER_WIDGETS:
VisualHeight: 0
Children:
Image@ICON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 0
Y: 0
ImageCollection: order-icons
Button@POWER_BUTTON:
Logic: PowerdownOrderButtonLogic, AddRaceSuffixLogic
Logic: PowerdownOrderButtonLogic, AddFactionSuffixLogic
X: 133
Width: 30
Height: 31
@@ -113,12 +113,12 @@ Container@PLAYER_WIDGETS:
VisualHeight: 0
Children:
Image@ICON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 0
Y: 0
ImageCollection: order-icons
MenuButton@DIPLOMACY_BUTTON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
MenuContainer: INGAME_DIPLOMACY_BG
HideIngameUI: false
Pause: false
@@ -132,13 +132,13 @@ Container@PLAYER_WIDGETS:
VisualHeight: 0
Children:
Image@ICON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 0
Y: 0
ImageCollection: order-icons
ImageName: diplomacy
MenuButton@OPTIONS_BUTTON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
Key: escape
X: 193
Width: 30
@@ -149,7 +149,7 @@ Container@PLAYER_WIDGETS:
VisualHeight: 0
Children:
Image@ICON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 0
Y: 0
ImageCollection: order-icons
@@ -159,7 +159,7 @@ Container@PLAYER_WIDGETS:
Children:
LogicTicker@RADAR_TICKER:
Image@INSIGNIA:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 37
Y: 85
ImageCollection: radar
@@ -201,7 +201,7 @@ Container@PLAYER_WIDGETS:
TooltipTemplate: SIMPLE_TOOLTIP
Children:
Image@CASH_ICON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 0-17
Y: 5
ImageCollection: cash-icons
@@ -219,7 +219,7 @@ Container@PLAYER_WIDGETS:
TooltipTemplate: SIMPLE_TOOLTIP
Children:
Image@POWER_ICON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: PARENT_RIGHT + 0
Y: 5
ImageCollection: power-icons
@@ -234,14 +234,14 @@ Container@PLAYER_WIDGETS:
Container@PALETTE_BACKGROUND:
Children:
Image@ROW_TEMPLATE:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
Width: 235
Height: 52
ClickThrough: false
ImageCollection: sidebar
ImageName: background-iconrow
Image@BOTTOM_CAP:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
Width: 235
Height: 26
ClickThrough: false
@@ -264,7 +264,7 @@ Container@PLAYER_WIDGETS:
Y: 0
Children:
Image@ROW_TEMPLATE:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
Width: 235
Height: 52
IgnoreMouseOver: true
@@ -277,7 +277,7 @@ Container@PLAYER_WIDGETS:
Height: 311
Children:
ProductionTypeButton@BUILDING:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 41
Y: 1
Width: 30
@@ -290,12 +290,12 @@ Container@PLAYER_WIDGETS:
HotkeyName: ProductionTypeBuildingKey
Children:
Image@ICON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 7
Y: 7
ImageCollection: production-icons
ProductionTypeButton@DEFENSE:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 72
Y: 1
Width: 30
@@ -308,12 +308,12 @@ Container@PLAYER_WIDGETS:
HotkeyName: ProductionTypeDefenseKey
Children:
Image@ICON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 7
Y: 7
ImageCollection: production-icons
ProductionTypeButton@INFANTRY:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 103
Y: 1
Width: 30
@@ -326,12 +326,12 @@ Container@PLAYER_WIDGETS:
HotkeyName: ProductionTypeInfantryKey
Children:
Image@ICON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 6
Y: 7
ImageCollection: production-icons
ProductionTypeButton@VEHICLE:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 134
Y: 1
Width: 30
@@ -344,12 +344,12 @@ Container@PLAYER_WIDGETS:
HotkeyName: ProductionTypeVehicleKey
Children:
Image@ICON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 7
Y: 7
ImageCollection: production-icons
ProductionTypeButton@AIRCRAFT:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 165
Y: 1
Width: 30
@@ -362,12 +362,12 @@ Container@PLAYER_WIDGETS:
HotkeyName: ProductionTypeAircraftKey
Children:
Image@ICON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 7
Y: 7
ImageCollection: production-icons
Button@SCROLL_UP_BUTTON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 74
Y: PARENT_BOTTOM + 36
Width: 34
@@ -377,7 +377,7 @@ Container@PLAYER_WIDGETS:
TooltipText: Scroll up
TooltipContainer: TOOLTIP_CONTAINER
Button@SCROLL_DOWN_BUTTON:
Logic: AddRaceSuffixLogic
Logic: AddFactionSuffixLogic
X: 141
Y: PARENT_BOTTOM + 36
Width: 34