Show version on shellmap (via alzeih)

This commit is contained in:
Paul Chote
2010-07-03 15:23:44 +12:00
committed by Chris Forbes
parent 1b38c4a6cb
commit 2835fd66fe
6 changed files with 38 additions and 4 deletions

View File

@@ -18,6 +18,7 @@
*/ */
#endregion #endregion
using System; using System;
using OpenRA.FileFormats;
namespace OpenRA.Widgets.Delegates namespace OpenRA.Widgets.Delegates
{ {
public class MainMenuButtonsDelegate : IWidgetDelegate public class MainMenuButtonsDelegate : IWidgetDelegate
@@ -25,6 +26,15 @@ namespace OpenRA.Widgets.Delegates
public MainMenuButtonsDelegate() public MainMenuButtonsDelegate()
{ {
Chrome.rootWidget.GetWidget("MAINMENU_BUTTON_QUIT").OnMouseUp = mi => {Game.Exit(); return true;}; Chrome.rootWidget.GetWidget("MAINMENU_BUTTON_QUIT").OnMouseUp = mi => {Game.Exit(); return true;};
var version = Chrome.rootWidget.GetWidget("MAINMENU_BG").GetWidget<LabelWidget>("VERSION_STRING");
if (FileSystem.Exists("VERSION"))
{
var s = FileSystem.Open("VERSION");
version.Text = "Version: "+s.ReadAllText();
s.Close();
}
} }
} }
} }

View File

@@ -56,12 +56,18 @@ namespace OpenRA.Widgets
{ {
var font = (Bold) ? Game.chrome.renderer.BoldFont : Game.chrome.renderer.RegularFont; var font = (Bold) ? Game.chrome.renderer.BoldFont : Game.chrome.renderer.RegularFont;
var text = GetText(); var text = GetText();
if (text == null)
return;
int2 textSize = font.Measure(text); int2 textSize = font.Measure(text);
int2 position = DrawPosition(); int2 position = DrawPosition();
if (Align == TextAlign.Center) if (Align == TextAlign.Center)
position += new int2((Bounds.Width - textSize.X)/2, 0); position += new int2((Bounds.Width - textSize.X)/2, 0);
if (Align == TextAlign.Right)
position += new int2(Bounds.Width - textSize.X,0);
font.DrawText(text, position, Color.White); font.DrawText(text, position, Color.White);
} }

View File

@@ -102,6 +102,8 @@ namespace OpenRA.Widgets
substitutions.Add("WINDOW_RIGHT", Game.viewport.Width); substitutions.Add("WINDOW_RIGHT", Game.viewport.Width);
substitutions.Add("WINDOW_BOTTOM", Game.viewport.Height); substitutions.Add("WINDOW_BOTTOM", Game.viewport.Height);
substitutions.Add("PARENT_RIGHT", parentBounds.Width); substitutions.Add("PARENT_RIGHT", parentBounds.Width);
substitutions.Add("PARENT_LEFT", parentBounds.Left);
substitutions.Add("PARENT_TOP", parentBounds.Top);
substitutions.Add("PARENT_BOTTOM", parentBounds.Height); substitutions.Add("PARENT_BOTTOM", parentBounds.Height);
int width = Evaluator.Evaluate(Width, substitutions); int width = Evaluator.Evaluate(Width, substitutions);
int height = Evaluator.Evaluate(Height, substitutions); int height = Evaluator.Evaluate(Height, substitutions);

View File

@@ -53,6 +53,14 @@ Container:
Width:160 Width:160
Height:25 Height:25
Text:Quit Text:Quit
Label@VERSION_STRING:
Id:VERSION_STRING
X:WINDOW_RIGHT - PARENT_LEFT - WIDTH - 15
Y:WINDOW_BOTTOM - PARENT_TOP - 25
Width:400
Height:35
Text:
Align:Right
Background@CREATESERVER_BG: Background@CREATESERVER_BG:
Id:CREATESERVER_BG Id:CREATESERVER_BG
Delegate:CreateServerMenuDelegate Delegate:CreateServerMenuDelegate
@@ -650,7 +658,7 @@ Container:
Id:MUSIC_BG Id:MUSIC_BG
Delegate:MusicPlayerDelegate Delegate:MusicPlayerDelegate
X:WINDOW_RIGHT - 175 X:WINDOW_RIGHT - 175
Y:WINDOW_BOTTOM - 65 Y:WINDOW_BOTTOM - 95
Width: 160 Width: 160
Height: 55 Height: 55
Visible: true Visible: true

View File

@@ -53,6 +53,14 @@ Container:
Width:160 Width:160
Height:25 Height:25
Text:Quit Text:Quit
Label@VERSION_STRING:
Id:VERSION_STRING
X:WINDOW_RIGHT - PARENT_LEFT - WIDTH - 15
Y:WINDOW_BOTTOM - PARENT_TOP - 25
Width:400
Height:35
Text:
Align:Right
Background@CREATESERVER_BG: Background@CREATESERVER_BG:
Id:CREATESERVER_BG Id:CREATESERVER_BG
Delegate:CreateServerMenuDelegate Delegate:CreateServerMenuDelegate
@@ -649,7 +657,7 @@ Container:
Id:MUSIC_BG Id:MUSIC_BG
Delegate:MusicPlayerDelegate Delegate:MusicPlayerDelegate
X:WINDOW_RIGHT - 175 X:WINDOW_RIGHT - 175
Y:WINDOW_BOTTOM - 65 Y:WINDOW_BOTTOM - 95
Width: 160 Width: 160
Height: 55 Height: 55
Visible: true Visible: true

View File

@@ -25,7 +25,7 @@ cd $PAYLOAD
for i in $EXCLUDE; do for i in $EXCLUDE; do
find . -path "$i" -delete find . -path "$i" -delete
done done
date "+%Y%m%d%H" >> "VERSION" date "+%Y%m%d%H" > "VERSION"
zip payload -r -9 * zip payload -r -9 *
cd $PACKAGING_PATH cd $PACKAGING_PATH