Polish
This commit is contained in:
@@ -25,8 +25,6 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
{
|
{
|
||||||
public class CreateServerMenuDelegate : IWidgetDelegate
|
public class CreateServerMenuDelegate : IWidgetDelegate
|
||||||
{
|
{
|
||||||
static bool AdvertiseServerOnline = Game.Settings.InternetServer;
|
|
||||||
|
|
||||||
public CreateServerMenuDelegate()
|
public CreateServerMenuDelegate()
|
||||||
{
|
{
|
||||||
var r = Chrome.rootWidget;
|
var r = Chrome.rootWidget;
|
||||||
@@ -56,7 +54,7 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
int listenPort = int.Parse(cs.GetWidget<TextFieldWidget>("LISTEN_PORT").Text);
|
int listenPort = int.Parse(cs.GetWidget<TextFieldWidget>("LISTEN_PORT").Text);
|
||||||
int extPort = int.Parse(cs.GetWidget<TextFieldWidget>("EXTERNAL_PORT").Text);
|
int extPort = int.Parse(cs.GetWidget<TextFieldWidget>("EXTERNAL_PORT").Text);
|
||||||
|
|
||||||
Server.Server.ServerMain(AdvertiseServerOnline, Game.Settings.MasterServer,
|
Server.Server.ServerMain(Game.Settings.InternetServer, Game.Settings.MasterServer,
|
||||||
gameName, listenPort, extPort, mods, map);
|
gameName, listenPort, extPort, mods, map);
|
||||||
|
|
||||||
Log.Write("debug", "Joining server");
|
Log.Write("debug", "Joining server");
|
||||||
@@ -66,9 +64,10 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
|
|
||||||
cs.GetWidget<TextFieldWidget>("LISTEN_PORT").Text = Game.Settings.ListenPort.ToString();
|
cs.GetWidget<TextFieldWidget>("LISTEN_PORT").Text = Game.Settings.ListenPort.ToString();
|
||||||
cs.GetWidget<TextFieldWidget>("EXTERNAL_PORT").Text = Game.Settings.ExternalPort.ToString();
|
cs.GetWidget<TextFieldWidget>("EXTERNAL_PORT").Text = Game.Settings.ExternalPort.ToString();
|
||||||
r.GetWidget<CheckboxWidget>("CHECKBOX_ONLINE").Checked = () => {return AdvertiseServerOnline;};
|
cs.GetWidget<CheckboxWidget>("CHECKBOX_ONLINE").Checked = () => Game.Settings.InternetServer;
|
||||||
r.GetWidget("CHECKBOX_ONLINE").OnMouseDown = mi => {
|
cs.GetWidget("CHECKBOX_ONLINE").OnMouseDown = mi => {
|
||||||
AdvertiseServerOnline = !AdvertiseServerOnline;
|
Game.Settings.InternetServer ^= true;
|
||||||
|
Game.Settings.Save();
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,6 +96,8 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
|
|
||||||
void UpdatePlayerList()
|
void UpdatePlayerList()
|
||||||
{
|
{
|
||||||
|
// This causes problems for people who are in the process of editing their names (the widgets vanish from beneath them)
|
||||||
|
// Todo: handle this nicer
|
||||||
Players.Children.Clear();
|
Players.Children.Clear();
|
||||||
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
@@ -109,7 +111,6 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
template = LocalPlayerTemplate.Clone();
|
template = LocalPlayerTemplate.Clone();
|
||||||
var name = template.GetWidget<TextFieldWidget>("NAME");
|
var name = template.GetWidget<TextFieldWidget>("NAME");
|
||||||
name.Text = c.Name;
|
name.Text = c.Name;
|
||||||
name.OnLoseFocus = () => name.Text = c.Name;
|
|
||||||
name.OnEnterKey = () =>
|
name.OnEnterKey = () =>
|
||||||
{
|
{
|
||||||
name.Text = name.Text.Trim();
|
name.Text = name.Text.Trim();
|
||||||
@@ -126,6 +127,7 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
Chrome.selectedWidget = null;
|
Chrome.selectedWidget = null;
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
name.OnLoseFocus = () => name.OnEnterKey();
|
||||||
|
|
||||||
var color = template.GetWidget<ButtonWidget>("COLOR");
|
var color = template.GetWidget<ButtonWidget>("COLOR");
|
||||||
color.OnMouseUp = CyclePalette;
|
color.OnMouseUp = CyclePalette;
|
||||||
|
|||||||
@@ -141,10 +141,12 @@ namespace OpenRA.Widgets
|
|||||||
// Inset text by the margin and center vertically
|
// Inset text by the margin and center vertically
|
||||||
var textPos = pos + new int2( margin, (Bounds.Height - textSize.Y)/2 - VisualHeight);
|
var textPos = pos + new int2( margin, (Bounds.Height - textSize.Y)/2 - VisualHeight);
|
||||||
|
|
||||||
// Right align and scissor when the text overflows
|
// Right align when editing and scissor when the text overflows
|
||||||
if (textSize.X > Bounds.Width - 2*margin)
|
if (textSize.X > Bounds.Width - 2*margin)
|
||||||
{
|
{
|
||||||
|
if (Chrome.selectedWidget == this)
|
||||||
textPos += new int2(Bounds.Width - 2*margin - textSize.X,0);
|
textPos += new int2(Bounds.Width - 2*margin - textSize.X,0);
|
||||||
|
|
||||||
Game.chrome.renderer.Device.EnableScissor(pos.X + margin, pos.Y, Bounds.Width - 2*margin, Bounds.Bottom);
|
Game.chrome.renderer.Device.EnableScissor(pos.X + margin, pos.Y, Bounds.Width - 2*margin, Bounds.Bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user