void joinSession_Pressed(object sender, EventArgs e) { if (!Guide.IsVisible && !allScreens["chatScreen"].Visible) { availableSessions = NetworkSession.Find( NetworkSessionType.SystemLink, 2, null); allScreens["listSessions"].Visible = true; allScreens["titleScreen"].Visible = false; allScreens["listSessions"].AdditionalSprites.RemoveAll(ts => !(ts is TextSprite) || ts.Cast <TextSprite>().HoverColor != Color.LimeGreen); float y = 50; float x = 100; for (int sessionIndex = 0; sessionIndex < availableSessions.Count; sessionIndex++) { AvailableNetworkSession availableSession = availableSessions[sessionIndex]; string HostGamerTag = availableSession.HostGamertag; int GamersInSession = availableSession.CurrentGamerCount; SessionInfoDisplay info = new SessionInfoDisplay(spriteBatch, new Vector2(x, y), font, HostGamerTag + ": " + GamersInSession + "/2 gamers", availableSession); info.IsHoverable = true; info.NonHoverColor = Color.Black; info.HoverColor = Color.White; info.Pressed += new EventHandler(info_Pressed); allScreens["listSessions"].AdditionalSprites.Add(info); } } }
void joinSession_Pressed(object sender, EventArgs e) { if (!Guide.IsVisible && !allScreens["chatScreen"].Visible) { availableSessions = NetworkSession.Find( NetworkSessionType.SystemLink, 2, null); allScreens["listSessions"].Visible = true; allScreens["titleScreen"].Visible = false; allScreens["listSessions"].AdditionalSprites.RemoveAll(ts => !(ts is TextSprite) || ts.Cast<TextSprite>().HoverColor != Color.LimeGreen); float y = 50; float x = 100; for (int sessionIndex = 0; sessionIndex < availableSessions.Count; sessionIndex++) { AvailableNetworkSession availableSession = availableSessions[sessionIndex]; string HostGamerTag = availableSession.HostGamertag; int GamersInSession = availableSession.CurrentGamerCount; SessionInfoDisplay info = new SessionInfoDisplay(spriteBatch, new Vector2(x, y), font, HostGamerTag + ": " + GamersInSession + "/2 gamers", availableSession); info.IsHoverable = true; info.NonHoverColor = Color.Black; info.HoverColor = Color.White; info.Pressed += new EventHandler(info_Pressed); allScreens["listSessions"].AdditionalSprites.Add(info); } } }