/// <summary> /// Replaces variables like "$Online" with text in the server info /// </summary> private string ReplaceVariables(string infoText) { //Replace variables in the info text LobbyScreen screen = Interface.MainWindow.ScreenManager.Current as LobbyScreen; infoText = infoText.Replace("$Online", screen.Online.ToString()); infoText = infoText.Replace("$Name", screen.Name); infoText = infoText.Replace("$Rooms", screen.Rooms.Count.ToString()); return(infoText); }
private void RefreshRooms() { LobbyScreen screen = Interface.MainWindow.ScreenManager.Current as LobbyScreen; RoomListCtrl.Items.Clear(); foreach (LobbySaveData s in screen.Rooms) { RoomListCtrl.Items.Add(new LobbyDataControl(Manager, s)); } FilterRooms(); }
/// <summary> /// Loads rooms from the recieved lobby message /// </summary> public void LoadRooms() { //Set text with what has been recieved grpServer.Text = "Server [" + Game.NetManager.Client.ServerConnection.RemoteEndPoint.ToString() + "]"; LobbyScreen screen = Interface.MainWindow.ScreenManager.Current as LobbyScreen; lblName.Text = screen.Name; lblDescription.Text = screen.Description; lblDescription.Height = (int)Game.DefaultFont.MeasureRichString(lblDescription.Text, Manager).Y; lblInfo.Top = 16 + lblDescription.Bottom; lblInfo.Text = ReplaceVariables(screen.Intro); lblInfo.Height = (int)Game.DefaultFont.MeasureRichString(lblInfo.Text, Manager).Y; RefreshRooms(); }