slightly nicer lobby dialog

This commit is contained in:
Chris Forbes
2010-01-16 12:47:01 +13:00
parent 58eccf822c
commit 9c8503f277
3 changed files with 25 additions and 2 deletions

View File

@@ -29,6 +29,7 @@ namespace OpenRa.Game
// Options menu (to be refactored) // Options menu (to be refactored)
bool optionsPressed = false; bool optionsPressed = false;
readonly Sprite[] optionsSprites; readonly Sprite[] optionsSprites;
readonly Sprite[] panelSprites;
// Buttons // Buttons
readonly Animation repairButton; readonly Animation repairButton;
@@ -106,6 +107,9 @@ namespace OpenRa.Game
SpriteSheetBuilder.LoadAllSprites("dd-bkgnd")[0], SpriteSheetBuilder.LoadAllSprites("dd-bkgnd")[0],
}; };
panelSprites = Graphics.Util.MakeArray(8,
n => SequenceProvider.GetImageFromCollection(renderer, "panel", n.ToString()));
tabSprites = Rules.NewUnitInfo.Values tabSprites = Rules.NewUnitInfo.Values
.Where(u => u.Traits.Contains<BuildableInfo>()) .Where(u => u.Traits.Contains<BuildableInfo>())
@@ -203,6 +207,14 @@ namespace OpenRa.Game
renderer.DrawText(client.State.ToString(), new int2(r.Left + 390, y), Color.White); renderer.DrawText(client.State.ToString(), new int2(r.Left + 390, y), Color.White);
y += 30; y += 30;
} }
var typingBox = new Rectangle(r.Left + 20, r.Bottom - 47, r.Width - 40, 27);
var chatBox = new Rectangle(r.Left + 20, r.Bottom - 269, r.Width - 40, 220);
DrawDialogBackground(typingBox, panelSprites, false);
DrawDialogBackground(chatBox, panelSprites, false);
DrawChat(typingBox, chatBox);
} }
public void TickRadarAnimation() public void TickRadarAnimation()
@@ -472,6 +484,7 @@ namespace OpenRa.Game
var sr = isShp ? shpRenderer : rgbaRenderer; var sr = isShp ? shpRenderer : rgbaRenderer;
if (ss.Length > 8)
for( var x = r.Left + (int)ss[2].size.X; x < r.Right - (int)ss[3].size.X; x += (int)ss[8].size.X ) for( var x = r.Left + (int)ss[2].size.X; x < r.Right - (int)ss[3].size.X; x += (int)ss[8].size.X )
for( var y = r.Top + (int)ss[0].size.Y; y < r.Bottom - (int)ss[1].size.Y; y += (int)ss[8].size.Y ) for( var y = r.Top + (int)ss[0].size.Y; y < r.Bottom - (int)ss[1].size.Y; y += (int)ss[8].size.Y )
sr.DrawSprite(ss[8], Game.viewport.Location + new float2(x, y), PaletteType.Chrome); sr.DrawSprite(ss[8], Game.viewport.Location + new float2(x, y), PaletteType.Chrome);
@@ -511,12 +524,12 @@ namespace OpenRa.Game
void DrawChat(Rectangle typingArea, Rectangle chatLogArea) void DrawChat(Rectangle typingArea, Rectangle chatLogArea)
{ {
var chatpos = new int2(chatLogArea.X + 2, chatLogArea.Bottom - 10); var chatpos = new int2(chatLogArea.X + 10, chatLogArea.Bottom - 6);
renderer.Device.EnableScissor(typingArea.Left, typingArea.Top, typingArea.Width, typingArea.Height); renderer.Device.EnableScissor(typingArea.Left, typingArea.Top, typingArea.Width, typingArea.Height);
if (Game.chat.isChatting) if (Game.chat.isChatting)
RenderChatLine(Tuple.New(Color.White, "Chat:", Game.chat.typing), RenderChatLine(Tuple.New(Color.White, "Chat:", Game.chat.typing),
new int2(typingArea.X + 2, typingArea.Y + 2)); new int2(typingArea.X + 10, typingArea.Y + 6));
renderer.Device.DisableScissor(); renderer.Device.DisableScissor();
renderer.Device.EnableScissor(chatLogArea.Left, chatLogArea.Top, chatLogArea.Width, chatLogArea.Height); renderer.Device.EnableScissor(chatLogArea.Left, chatLogArea.Top, chatLogArea.Width, chatLogArea.Height);

View File

@@ -121,5 +121,15 @@
<image name="soviet-Plane" x="134" y="160" width="27" height="41" /> <image name="soviet-Plane" x="134" y="160" width="27" height="41" />
<image name="soviet-Ship" x="134" y="200" width="27" height="41" /> <image name="soviet-Ship" x="134" y="200" width="27" height="41" />
</collection> </collection>
<collection name="panel" src="widget-panel.png">
<image name="0" x="4" y="0" width="248" height="4" />
<image name="1" x="4" y="252" width="248" height="4" />
<image name="2" x="0" y="4" width="4" height="248" />
<image name="3" x="252" y="4" width="4" height="248" />
<image name="4" x="0" y="0" width="4" height="4" />
<image name="5" x="252" y="0" width="4" height="4" />
<image name="6" x="0" y="252" width="4" height="4" />
<image name="7" x="252" y="252" width="4" height="4" />
</collection>
</chrome> </chrome>

BIN
widget-panel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB