public static TeamGame FromDataString(string data) { TeamGame team = new TeamGame(); string[] sourceArray = data.Split(new char[] { '|' }); team.PreferredMap = sourceArray[0]; team.NonPreferredMap = sourceArray[1]; string[] destinationArray = new string[sourceArray.Length - 2]; Array.ConstrainedCopy(sourceArray, 2, destinationArray, 0, destinationArray.Length); foreach (string str in destinationArray) { TeamGameMember item = TeamGameMember.FromDataString(team, str); team.TeamMembers.Add(item); if (team.TeamLeader == null) { team.TeamLeader = item; } } return team; }
public PnlTeamGameMember(TeamGame team) { this.InitializeComponent(); this.factionPicker.SelectedFactionChanged += new EventHandler(this.factionPicker_SelectedFactionChanged); this.mTeam = team; }
public void SetPlayer(TeamGame.TeamGameMember member) { this.mTeamMember = member; this.pingIndicator.PingMonitor = this.TeamMember; if (this.TeamMember != null) { if (this.TeamMember.IsSelf && this.TeamMember.IsTeamLeader) { if (!this.Team.HasLaunched) { this.Enable(); } this.gpgLabelInvite.Visible = false; this.gpgLabelKick.Visible = false; this.gpgLabelLeave.Visible = false; this.gpgLabelDisband.Visible = true; } else if (this.TeamMember.IsSelf) { if (!this.Team.HasLaunched) { this.Enable(); } this.gpgLabelDisband.Visible = false; this.gpgLabelInvite.Visible = false; this.gpgLabelKick.Visible = false; this.gpgLabelLeave.Visible = true; } else if (this.Team.TeamLeader.IsSelf) { this.Disable(); this.gpgLabelDisband.Visible = false; this.gpgLabelInvite.Visible = false; this.gpgLabelLeave.Visible = false; this.gpgLabelKick.Visible = true; } else { this.Disable(); this.gpgLabelDisband.Visible = false; this.gpgLabelInvite.Visible = false; this.gpgLabelKick.Visible = false; this.gpgLabelLeave.Visible = false; } this.UpdatePlayer(); this.gpgLabelName.ForeColor = Color.ForestGreen; } else { if (this.Team.TeamLeader.IsSelf) { this.Disable(); this.gpgLabelDisband.Visible = false; this.gpgLabelKick.Visible = false; this.gpgLabelLeave.Visible = false; this.gpgLabelInvite.Visible = true; } else { this.Disable(); this.gpgLabelDisband.Visible = false; this.gpgLabelInvite.Visible = false; this.gpgLabelKick.Visible = false; this.gpgLabelLeave.Visible = false; } this.gpgLabelName.Text = Loc.Get("<LOC>Open"); this.gpgLabelName.ForeColor = Color.DodgerBlue; this.factionPicker.SelectItem(SupcomLookups._Factions.Any); this.factionPicker.Text = Loc.Get("<LOC>Open"); this.gpgPictureBoxReady.Image = ControlRes.open_ready; } }
public DlgTeamGame() { this.components = null; this.MemberPanels = new List<PnlTeamGameMember>(TeamGame.MAX_TEAM_MEMBERS); this.ForceLeave = false; this.IsValidatingMaps = false; this.GameRunning = false; this.mChatLines = new BindingList<ChatLine>(); this.ChatRowPoints = new Dictionary<int, Rectangle>(); this.ChatRowHeights = new Dictionary<int, int>(); this.mFirstChatDraw = true; this.mChatHistory = new LinkedList<string>(); this.HistoryIndex = -1; try { this.InitializeComponent(); this.mTeam = new TeamGame(new TeamGame.TeamGameMember(User.Current.Name, User.Current.ID)); if ((Program.Settings.SupcomPrefs.RankedGames.Maps == null) || (Program.Settings.SupcomPrefs.RankedGames.Maps.Length < 1)) { DlgSupcomMapOptions options = new DlgSupcomMapOptions(this.Team.GameType, true); SupcomMapInfo[] array = new SupcomMapInfo[options.Maps.Count]; options.Maps.CopyTo(array, 0); options.Dispose(); options = null; Program.Settings.SupcomPrefs.RankedGames.Maps = array; } this.Construct(); Program.Settings.SupcomPrefs.RankedGames.MapsChanged += new PropertyChangedEventHandler(this.BindToPrefs); Program.Settings.SupcomPrefs.RankedGames.FactionChanged += new PropertyChangedEventHandler(this.BindToPrefs); this.SystemMessage("<LOC>You have formed a new team.", new object[0]); } catch (Exception exception) { ErrorLog.WriteLine(exception); } }
private void DisbandTeam(PnlTeamGameMember sender, TeamGame.TeamGameMember member) { this.OnDisbandTeam(); }
internal void UpdateMember(TeamGame.TeamGameMember member) { VGen0 method = null; if ((base.InvokeRequired && !base.Disposing) && !base.IsDisposed) { if (method == null) { method = delegate { this.UpdateMember(member); }; } base.BeginInvoke(method); } else if (!base.Disposing && !base.IsDisposed) { bool flag = this.Team.FindMember(member.Name) == null; this.Team.UpdateMember(member); if (flag && (this.Team.TeamMembers.Count <= TeamGame.MAX_TEAM_MEMBERS)) { this.MemberPanels[this.Team.TeamMembers.Count - 1].SetPlayer(member); this.SystemMessage("<LOC>{0} has joined the team.", new object[] { member.Name }); this.SystemMessage("<LOC>Team game mode is now set to {0}.", new object[] { Loc.Get(this.Team.GameType) }); SupcomAutomatch.GetSupcomAutomatch().Kind = this.Team.GameType; } else { foreach (PnlTeamGameMember member2 in this.MemberPanels) { if (!(member2.IsOpen || !member2.TeamMember.Equals(member))) { member2.SetPlayer(member); } } } this.UpdateLaunchAbility(); } }
private void OnMemberChanged(TeamGame.TeamGameMember member) { if (member.IsSelf) { string str; if (member.Faction == SupcomLookups._Factions.Any) { str = "random"; } else { str = "/" + member.Faction.ToString().ToLower(); } if (Program.Settings.SupcomPrefs.RankedGames.Faction != str) { Program.Settings.SupcomPrefs.RankedGames.Faction = str; } Messaging.SendCustomCommand(this.Team.GetOtherMemberNames(), CustomCommands.TeamGameMember, new object[] { member.ToDataString() }); this.UpdateLaunchAbility(); } }
private void MemberChanged(PnlTeamGameMember sender, TeamGame.TeamGameMember member) { this.OnMemberChanged(member); }
private void LeaveTeam(PnlTeamGameMember sender, TeamGame.TeamGameMember member) { this.OnLeaveTeam(); }
private void KickMember(PnlTeamGameMember sender, TeamGame.TeamGameMember member) { if (this.GameRunning) { this.ErrorMessage("<LOC>You must quit your current game first.", new object[0]); } else { string str; if (this.GameLaunched) { str = "<LOC>Are you sure you want to kick this team member? Kicking right now will abort your teams current game search."; } else { str = "<LOC>Are you sure you want to kick this team member?"; } if (new DlgYesNo(base.MainForm, "<LOC>Kick Member", str).ShowDialog() == DialogResult.Yes) { Messaging.SendCustomCommand(this.Team.GetOtherMemberNames(), CustomCommands.TeamGameKick, new object[] { member.Name }); this.RemoveMember(member.Name, "<LOC>{0} has been kicked out of your team game.", new object[] { member.Name }); } } }
private void InviteMember(PnlTeamGameMember sender, TeamGame.TeamGameMember member) { if (this.GameRunning) { this.ErrorMessage("<LOC>You must quit your current game first.", new object[0]); } else { DialogResult result; if (this.GameLaunched) { string msg = "<LOC>Inviting a new member right now will abort your teams current game search. Do you really want to invite a new member?"; if (new DlgYesNo(base.MainForm, "<LOC>Invite Member", msg).ShowDialog() == DialogResult.Yes) { this.CancelTeamAutomatch(); } else { return; } } string playerName = DlgAskQuestion.AskQuestion(base.MainForm, Loc.Get("<LOC>Enter the name of the player you want to invite to your team."), Loc.Get("<LOC>Invite"), false, out result); if (result == DialogResult.OK) { if ((playerName == null) || (playerName.Length < 3)) { this.ErrorMessage("<LOC>Player name cannot be less than {0} characters.", new object[] { 3 }); } else if ((playerName != null) && (playerName.Length > 0)) { this.OnInviteMember(playerName); } } } }
public DlgTeamGame(TeamGame team) { this.components = null; this.MemberPanels = new List<PnlTeamGameMember>(TeamGame.MAX_TEAM_MEMBERS); this.ForceLeave = false; this.IsValidatingMaps = false; this.GameRunning = false; this.mChatLines = new BindingList<ChatLine>(); this.ChatRowPoints = new Dictionary<int, Rectangle>(); this.ChatRowHeights = new Dictionary<int, int>(); this.mFirstChatDraw = true; this.mChatHistory = new LinkedList<string>(); this.HistoryIndex = -1; try { this.InitializeComponent(); this.mTeam = team; this.Construct(); Program.Settings.SupcomPrefs.RankedGames.FactionChanged += new PropertyChangedEventHandler(this.BindToPrefs); this.RefreshMaps(); this.SystemMessage("<LOC>You have joined the team.", new object[0]); } catch (Exception exception) { ErrorLog.WriteLine(exception); } }
public static TeamGame.TeamGameMember FromDataString(TeamGame team, string data) { TeamGame.TeamGameMember member = new TeamGame.TeamGameMember(team); string[] strArray = data.Split(new char[] { ';' }); member.mName = strArray[0]; member.mID = int.Parse(strArray[1]); member.mFaction = (SupcomLookups._Factions) uint.Parse(strArray[2]); member.mIsReady = byte.Parse(strArray[3]) > 0; return member; }
internal TeamGameMember(TeamGame team, string name, int id) { this.mIsReady = false; this.PingSendTime = 0; this.Pinging = false; this.mPingTime = 0; this.mTeam = team; this.mName = name; this.mID = id; }
internal TeamGameMember(TeamGame team) { this.mIsReady = false; this.PingSendTime = 0; this.Pinging = false; this.mPingTime = 0; this.mTeam = team; }
internal void ShowDlgTeamGame(TeamGame team) { FormClosedEventHandler handler = null; if (!(User.Current.IsAdmin || this.IsGameCurrent)) { this.UpdateSupCom(); } else if (!this.IsSupComPatching) { if (this.IsInTeamGame) { this.DlgTeamGame.BringToFront(); } else { if (team != null) { this.DlgTeamGame = new GPG.Multiplayer.Client.Games.SupremeCommander.DlgTeamGame(team); } else { this.DlgTeamGame = new GPG.Multiplayer.Client.Games.SupremeCommander.DlgTeamGame(); } if (handler == null) { handler = delegate (object s, FormClosedEventArgs e) { this.DlgTeamGame = null; }; } this.DlgTeamGame.FormClosed += handler; this.DlgTeamGame.Show(); } } }