customisable icon size in build palette for d2k, fixes #2521

This commit is contained in:
Matthias Mailänder
2013-04-15 12:11:30 +02:00
parent f80180509c
commit 4a2473a1a5
3 changed files with 398 additions and 9 deletions

View File

@@ -30,6 +30,9 @@ namespace OpenRA.Mods.RA.Widgets
public string HoldText = "";
public string RequiresText = "";
public int IconWidth = 64;
public int IconHeight = 48;
ProductionQueue CurrentQueue;
List<ProductionQueue> VisibleQueues;
@@ -75,7 +78,7 @@ namespace OpenRA.Mods.RA.Widgets
public override Rectangle EventBounds
{
get { return new Rectangle((int)(paletteOrigin.X) - 24, (int)(paletteOrigin.Y), 215, Math.Max(48 * numActualRows, 40 * tabs.Count + 9)); }
get { return new Rectangle((int)(paletteOrigin.X) - 24, (int)(paletteOrigin.Y), 215, Math.Max(IconHeight * numActualRows, 40 * tabs.Count + 9)); }
}
public override void Tick()
@@ -217,16 +220,16 @@ namespace OpenRA.Mods.RA.Widgets
for (var w = 0; w < numActualRows; w++)
WidgetUtils.DrawRGBA(
ChromeProvider.GetImage(paletteCollection, "bg-" + (w % 4)),
new float2(origin.X - 9, origin.Y + 48 * w));
new float2(origin.X - 9, origin.Y + IconHeight * w));
WidgetUtils.DrawRGBA(ChromeProvider.GetImage(paletteCollection, "bottom"),
new float2(origin.X - 9, origin.Y - 1 + 48 * numActualRows));
new float2(origin.X - 9, origin.Y - 1 + IconHeight * numActualRows));
// Icons
string tooltipItem = null;
foreach (var item in allBuildables)
{
var rect = new RectangleF(origin.X + x * 64, origin.Y + 48 * y, 64, 48);
var rect = new RectangleF(origin.X + x * IconWidth, origin.Y + IconHeight * y, IconWidth, IconHeight);
var drawPos = new float2(rect.Location);
WidgetUtils.DrawSHP(iconSprites[item.Name], drawPos, worldRenderer);
@@ -277,7 +280,7 @@ namespace OpenRA.Mods.RA.Widgets
// Tooltip
if (tooltipItem != null && !paletteAnimating && paletteOpen)
DrawProductionTooltip(world, tooltipItem,
new float2(Game.viewport.Width, origin.Y + numActualRows * 48 + 9).ToInt2());
new float2(Game.viewport.Width, origin.Y + numActualRows * IconHeight + 9).ToInt2());
}
// Palette Dock
@@ -286,12 +289,12 @@ namespace OpenRA.Mods.RA.Widgets
for (int i = 0; i < numActualRows; i++)
WidgetUtils.DrawRGBA(ChromeProvider.GetImage(paletteCollection, "dock-" + (i % 4).ToString()),
new float2(Game.viewport.Width - 14, origin.Y + 48 * i));
new float2(Game.viewport.Width - 14, origin.Y + IconHeight * i));
WidgetUtils.DrawRGBA(ChromeProvider.GetImage(paletteCollection, "dock-bottom"),
new float2(Game.viewport.Width - 14, origin.Y - 1 + 48 * numActualRows));
new float2(Game.viewport.Width - 14, origin.Y - 1 + IconHeight * numActualRows));
return 48 * y + 9;
return IconHeight * y + 9;
}
string GetOverlayForItem(ProductionItem item)

386
mods/d2k/chrome/ingame.yaml Normal file
View File

@@ -0,0 +1,386 @@
Container@INGAME_ROOT:
Logic:IngameChromeLogic
Children:
WorldInteractionController@INTERACTION_CONTROLLER:
X:0
Y:0
Width:WINDOW_RIGHT
Height:WINDOW_BOTTOM
ViewportScrollController:
X:0
Y:0
Width:WINDOW_RIGHT
Height:WINDOW_BOTTOM
WorldCommand:
X:0
Y:0
Width:WINDOW_RIGHT
Height:WINDOW_BOTTOM
Timer@GAME_TIMER:
X: WINDOW_RIGHT/2
Y: 0-10
StrategicProgress@STRATEGIC_PROGRESS:
X: WINDOW_RIGHT/2
Y: 40
Background@POSTGAME_BG:
X:(WINDOW_RIGHT - WIDTH)/2
Y:(WINDOW_BOTTOM - HEIGHT)/2
Width:400
Height:100
Background:dialog4
Visible:false
Children:
Label@TEXT:
X:(PARENT_RIGHT - WIDTH)/2
Y:0
Width:200
Height:80
Align:Center
Button@POSTGAME_OBSERVE:
X:10
Y:(PARENT_BOTTOM - HEIGHT - 10)
Width:150
Height:25
Font:Bold
Text:Observe
Button@POSTGAME_QUIT:
X:(PARENT_RIGHT - WIDTH - 10)
Y:(PARENT_BOTTOM - HEIGHT - 10)
Width:150
Height:25
Font:Bold
Text:Leave
SupportPowerBin@INGAME_POWERS_BIN:
X:0
Y:25
ReadyText: READY
HoldText: ON HOLD
BuildPalette@INGAME_BUILD_PALETTE:
X:WINDOW_RIGHT - 250
Y:280
Width:250
Height:500
ReadyText: READY
HoldText: ON HOLD
RequiresText: Requires
IconWidth: 60
IconHeight: 47
Button@INGAME_OPTIONS_BUTTON:
X:0
Y:0
Width:160
Height:25
Text:Options
Font:Bold
Key: escape
Button@INGAME_DIPLOMACY_BUTTON:
X:162
Y:0
Width:160
Height:25
Text:Diplomacy
Font:Bold
Button@CHEATS_BUTTON:
X:324
Y:0
Width:160
Height:25
Text:Cheats
Visible:false
Font:Bold
Button@OBJECTIVES_BUTTON:
X:486
Y:0
Width:160
Height:25
Text:Objectives
Visible:false
Font:Bold
RadarBin@INGAME_RADAR_BIN:
WorldInteractionController:INTERACTION_CONTROLLER
PowerBin@INGAME_POWER_BIN:
MoneyBin@INGAME_MONEY_BIN:
X:WINDOW_RIGHT - WIDTH
Y:0
Width:320
Height: 32
Children:
OrderButton@SELL:
Logic:OrderButtonsChromeLogic
X:3
Y:0
Width:30
Height:30
Image:sell
Description:Sell
LongDesc:Sell buildings, reclaiming a \nproportion of their build cost
OrderButton@POWER_DOWN:
Logic:OrderButtonsChromeLogic
X:39
Y:0
Width:30
Height:30
Image:power
Description:Powerdown
LongDesc:Disable unneeded structures so their \npower can be used elsewhere
OrderButton@REPAIR:
Logic:OrderButtonsChromeLogic
X:75
Y:0
Width:30
Height:30
Image:repair
Description:Repair
LongDesc:Repair damaged buildings
WorldTooltip:
Background@INGAME_OPTIONS_BG:
X:(WINDOW_RIGHT - WIDTH)/2
Y:(WINDOW_BOTTOM - HEIGHT)/2
Width:300
Height:295
Visible:false
Children:
Label@LABEL_TITLE:
X:(PARENT_RIGHT - WIDTH)/2
Y:20
Width:250
Height:25
Text:Options
Align:Center
Font:Bold
Button@RESUME:
X:(PARENT_RIGHT - WIDTH)/2
Y:60
Width:160
Height:25
Text:Resume
Font:Bold
Key:escape
Button@SETTINGS:
X:(PARENT_RIGHT - WIDTH)/2
Y:100
Width:160
Height:25
Text:Settings
Font:Bold
Button@MUSIC:
X:(PARENT_RIGHT - WIDTH)/2
Y:140
Width:160
Height:25
Text:Music
Font:Bold
Button@SURRENDER:
X:(PARENT_RIGHT - WIDTH)/2
Y:180
Width:160
Height:25
Text:Surrender
Font:Bold
Button@DISCONNECT:
X:(PARENT_RIGHT - WIDTH)/2
Y:220
Width:160
Height:25
Text:Abort Mission
Font:Bold
Background@DIPLOMACY_BG:
Logic:DiplomacyLogic
X:(WINDOW_RIGHT - WIDTH)/2
Y:(WINDOW_BOTTOM - HEIGHT)/2
Width:450
Height:400
Visible:false
Children:
Label@LABEL_TITLE:
X:(PARENT_RIGHT - WIDTH)/2
Y:20
Width:250
Height:25
Text:Diplomacy
Align:Center
Font:Bold
ChatDisplay@CHAT_DISPLAY:
X:250
Y:WINDOW_BOTTOM - HEIGHT - 30
Width: 760
Height: 200
DrawBackground: False
RemoveTime:250
UseContrast: yes
ChatEntry@CHAT_ENTRY:
X:250
Y:WINDOW_BOTTOM - HEIGHT
Width: 760
Height: 30
UseContrast: yes
Background@PERF_BG:
ClickThrough:true
Background:dialog4
Logic:PerfDebugLogic
X:10
Y:WINDOW_BOTTOM - 250
Width: 210
Height: 250
Children:
PerfGraph@GRAPH:
X:5
Y:5
Width:200
Height:200
Label@TEXT:
X:20
Y:205
Width:170
Height:40
Container@OBSERVER_ROOT:
Visible:true
Logic:IngameObserverChromeLogic
Children:
WorldInteractionController@INTERACTION_CONTROLLER:
X:0
Y:0
Width:WINDOW_RIGHT
Height:WINDOW_BOTTOM
ViewportScrollController:
X:0
Y:0
Width:WINDOW_RIGHT
Height:WINDOW_BOTTOM
Timer@GAME_TIMER:
X: WINDOW_RIGHT/2
Y: 0-10
Background@POSTGAME_BG:
X:(WINDOW_RIGHT - WIDTH)/2
Y:(WINDOW_BOTTOM - HEIGHT)/2
Width:400
Height:100
Background:dialog4
Visible:false
Children:
Label@TEXT:
X:(PARENT_RIGHT - WIDTH)/2
Y:0
Width:200
Height:80
Align:Center
Button@POSTGAME_OBSERVE:
X:10
Y:(PARENT_BOTTOM - HEIGHT - 10)
Width:150
Height:25
Font:Bold
Text:Observe
Button@POSTGAME_QUIT:
X:(PARENT_RIGHT - WIDTH - 10)
Y:(PARENT_BOTTOM - HEIGHT - 10)
Width:150
Height:25
Font:Bold
Text:Leave
SupportPowerBin@INGAME_POWERS_BIN:
X:0
Y:25
Button@INGAME_OPTIONS_BUTTON:
X:0
Y:0
Width:160
Height:25
Text:Options
Font:Bold
Key:escape
WorldTooltip:
Background@INGAME_OPTIONS_BG:
X:(WINDOW_RIGHT - WIDTH)/2
Y:(WINDOW_BOTTOM - HEIGHT)/2
Width:300
Height:295
Visible:false
Children:
Label@LABEL_TITLE:
X:(PARENT_RIGHT - WIDTH)/2
Y:20
Width:250
Height:25
Text:Options
Align:Center
Font:Bold
Button@RESUME:
X:(PARENT_RIGHT - WIDTH)/2
Y:60
Width:160
Height:25
Text:Resume
Font:Bold
Key:escape
Button@SETTINGS:
X:(PARENT_RIGHT - WIDTH)/2
Y:100
Width:160
Height:25
Text:Settings
Font:Bold
Button@MUSIC:
X:(PARENT_RIGHT - WIDTH)/2
Y:140
Width:160
Height:25
Text:Music
Font:Bold
Button@SURRENDER:
X:(PARENT_RIGHT - WIDTH)/2
Y:180
Width:160
Height:25
Text:Surrender
Font:Bold
Button@DISCONNECT:
X:(PARENT_RIGHT - WIDTH)/2
Y:220
Width:160
Height:25
Text:Abort Mission
Font:Bold
ChatDisplay@CHAT_DISPLAY:
X:250
Y:WINDOW_BOTTOM - HEIGHT - 30
Width: 760
Height: 200
DrawBackground: False
RemoveTime:250
UseContrast: yes
ChatEntry@CHAT_ENTRY:
X:250
Y:WINDOW_BOTTOM - HEIGHT
Width: 760
Height: 30
UseContrast: yes
Background@PERF_BG:
ClickThrough:true
Background:dialog4
Logic:PerfDebugLogic
X:10
Y:WINDOW_BOTTOM - 250
Width: 210
Height: 250
Children:
PerfGraph@GRAPH:
X:5
Y:5
Width:200
Height:200
Label@TEXT:
X:20
Y:205
Width:170
Height:40
Background@FMVPLAYER:
Width:WINDOW_RIGHT
Height:WINDOW_BOTTOM
Background:dialog4
Children:
VqaPlayer@PLAYER:
X:0
Y:0
Width:WINDOW_RIGHT
Height:WINDOW_BOTTOM

View File

@@ -45,7 +45,7 @@ Assemblies:
ChromeLayout:
mods/d2k/chrome/gameinit.yaml
mods/ra/chrome/ingame.yaml
mods/d2k/chrome/ingame.yaml
mods/ra/chrome/ingame-chat.yaml
mods/d2k/chrome/mainmenu.yaml
mods/ra/chrome/settings.yaml