Remember the last map. Disable the server desc and password fields. Draw the chat entry box on top of the display box.
This commit is contained in:
@@ -27,6 +27,7 @@ namespace OpenRA.GameRules
|
|||||||
public bool AdvertiseOnline = true;
|
public bool AdvertiseOnline = true;
|
||||||
public string MasterServer = "http://master.open-ra.org/";
|
public string MasterServer = "http://master.open-ra.org/";
|
||||||
public bool AllowCheats = false;
|
public bool AllowCheats = false;
|
||||||
|
public string LastMap = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DebugSettings
|
public class DebugSettings
|
||||||
|
|||||||
@@ -199,6 +199,8 @@ namespace OpenRA.Mods.Cnc.Widgets
|
|||||||
var onSelect = new Action<Map>(m =>
|
var onSelect = new Action<Map>(m =>
|
||||||
{
|
{
|
||||||
orderManager.IssueOrder(Order.Command("map " + m.Uid));
|
orderManager.IssueOrder(Order.Command("map " + m.Uid));
|
||||||
|
Game.Settings.Server.LastMap = m.Uid;
|
||||||
|
Game.Settings.Save();
|
||||||
Widget.CloseWindow();
|
Widget.CloseWindow();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -46,13 +46,16 @@ namespace OpenRA.Mods.Cnc.Widgets
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
map = Game.modData.AvailableMaps.FirstOrDefault(m => m.Value.Selectable).Value;
|
if (string.IsNullOrEmpty(Game.Settings.Server.LastMap) || !Game.modData.AvailableMaps.TryGetValue(Game.Settings.Server.LastMap, out map))
|
||||||
|
map = Game.modData.AvailableMaps.FirstOrDefault(m => m.Value.Selectable).Value;
|
||||||
|
|
||||||
panel.GetWidget<MapPreviewWidget>("MAP_PREVIEW").Map = () => map;
|
panel.GetWidget<MapPreviewWidget>("MAP_PREVIEW").Map = () => map;
|
||||||
panel.GetWidget<LabelWidget>("MAP_NAME").GetText = () => map.Title;
|
panel.GetWidget<LabelWidget>("MAP_NAME").GetText = () => map.Title;
|
||||||
|
|
||||||
panel.GetWidget<TextFieldWidget>("SERVER_NAME").Text = settings.Server.Name ?? "";
|
panel.GetWidget<TextFieldWidget>("SERVER_NAME").Text = settings.Server.Name ?? "";
|
||||||
panel.GetWidget<TextFieldWidget>("LISTEN_PORT").Text = settings.Server.ListenPort.ToString();
|
panel.GetWidget<TextFieldWidget>("LISTEN_PORT").Text = settings.Server.ListenPort.ToString();
|
||||||
|
advertiseOnline = Game.Settings.Server.AdvertiseOnline;
|
||||||
|
|
||||||
var externalPort = panel.GetWidget<CncTextFieldWidget>("EXTERNAL_PORT");
|
var externalPort = panel.GetWidget<CncTextFieldWidget>("EXTERNAL_PORT");
|
||||||
externalPort.Text = settings.Server.ExternalPort.ToString();
|
externalPort.Text = settings.Server.ExternalPort.ToString();
|
||||||
externalPort.IsDisabled = () => !advertiseOnline;
|
externalPort.IsDisabled = () => !advertiseOnline;
|
||||||
@@ -60,6 +63,10 @@ namespace OpenRA.Mods.Cnc.Widgets
|
|||||||
var advertiseCheckbox = panel.GetWidget<CncCheckboxWidget>("ADVERTISE_CHECKBOX");
|
var advertiseCheckbox = panel.GetWidget<CncCheckboxWidget>("ADVERTISE_CHECKBOX");
|
||||||
advertiseCheckbox.IsChecked = () => advertiseOnline;
|
advertiseCheckbox.IsChecked = () => advertiseOnline;
|
||||||
advertiseCheckbox.OnClick = () => advertiseOnline ^= true;
|
advertiseCheckbox.OnClick = () => advertiseOnline ^= true;
|
||||||
|
|
||||||
|
// Disable these until we have some logic behind them
|
||||||
|
panel.GetWidget<CncTextFieldWidget>("SERVER_DESC").IsDisabled = () => true;
|
||||||
|
panel.GetWidget<CncTextFieldWidget>("SERVER_PASSWORD").IsDisabled = () => true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateAndJoin()
|
void CreateAndJoin()
|
||||||
@@ -68,6 +75,7 @@ namespace OpenRA.Mods.Cnc.Widgets
|
|||||||
Game.Settings.Server.ListenPort = int.Parse(panel.GetWidget<TextFieldWidget>("LISTEN_PORT").Text);
|
Game.Settings.Server.ListenPort = int.Parse(panel.GetWidget<TextFieldWidget>("LISTEN_PORT").Text);
|
||||||
Game.Settings.Server.ExternalPort = int.Parse(panel.GetWidget<TextFieldWidget>("EXTERNAL_PORT").Text);
|
Game.Settings.Server.ExternalPort = int.Parse(panel.GetWidget<TextFieldWidget>("EXTERNAL_PORT").Text);
|
||||||
Game.Settings.Server.AdvertiseOnline = advertiseOnline;
|
Game.Settings.Server.AdvertiseOnline = advertiseOnline;
|
||||||
|
Game.Settings.Server.LastMap = map.Uid;
|
||||||
Game.Settings.Save();
|
Game.Settings.Save();
|
||||||
|
|
||||||
Game.CreateServer(Game.Settings, map.Uid);
|
Game.CreateServer(Game.Settings, map.Uid);
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ Container@CREATESERVER_PANEL:
|
|||||||
Width:275
|
Width:275
|
||||||
MaxLength:50
|
MaxLength:50
|
||||||
Height:25
|
Height:25
|
||||||
Text:Describe your server here
|
|
||||||
Label@SERVER_PASSWORD_LABEL:
|
Label@SERVER_PASSWORD_LABEL:
|
||||||
X:15
|
X:15
|
||||||
Y:84
|
Y:84
|
||||||
|
|||||||
@@ -309,22 +309,6 @@ Container@SERVER_LOBBY:
|
|||||||
Text:Ready
|
Text:Ready
|
||||||
Align:Left
|
Align:Left
|
||||||
Bold:True
|
Bold:True
|
||||||
CncTextField@CHAT_TEXTFIELD:
|
|
||||||
Id:CHAT_TEXTFIELD
|
|
||||||
X:15
|
|
||||||
Y:PARENT_BOTTOM - HEIGHT - 15
|
|
||||||
Width:PARENT_RIGHT - 30
|
|
||||||
Height:25
|
|
||||||
LeftMargin:50
|
|
||||||
Background: panel-darkred
|
|
||||||
Children:
|
|
||||||
Label@LABEL_CHATTYPE:
|
|
||||||
Id:LABEL_CHATTYPE
|
|
||||||
Y:0-1
|
|
||||||
Width:45
|
|
||||||
Height:25
|
|
||||||
Align:Right
|
|
||||||
Text:Chat:
|
|
||||||
CncScrollPanel@CHAT_DISPLAY:
|
CncScrollPanel@CHAT_DISPLAY:
|
||||||
Id:CHAT_DISPLAY
|
Id:CHAT_DISPLAY
|
||||||
X:15
|
X:15
|
||||||
@@ -357,6 +341,22 @@ Container@SERVER_LOBBY:
|
|||||||
Height:14
|
Height:14
|
||||||
Width:PARENT_RIGHT - 100 - 10
|
Width:PARENT_RIGHT - 100 - 10
|
||||||
WordWrap:true
|
WordWrap:true
|
||||||
|
CncTextField@CHAT_TEXTFIELD:
|
||||||
|
Id:CHAT_TEXTFIELD
|
||||||
|
X:15
|
||||||
|
Y:PARENT_BOTTOM - HEIGHT - 15
|
||||||
|
Width:PARENT_RIGHT - 30
|
||||||
|
Height:25
|
||||||
|
LeftMargin:50
|
||||||
|
Background: panel-darkred
|
||||||
|
Children:
|
||||||
|
Label@LABEL_CHATTYPE:
|
||||||
|
Id:LABEL_CHATTYPE
|
||||||
|
Y:0-1
|
||||||
|
Width:45
|
||||||
|
Height:25
|
||||||
|
Align:Right
|
||||||
|
Text:Chat:
|
||||||
CncMenuButton@DISCONNECT_BUTTON:
|
CncMenuButton@DISCONNECT_BUTTON:
|
||||||
Id:DISCONNECT_BUTTON
|
Id:DISCONNECT_BUTTON
|
||||||
X:0
|
X:0
|
||||||
|
|||||||
Reference in New Issue
Block a user