Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
 private bool ValidateMaps()
 {
     OGen0 method = null;
     if ((base.InvokeRequired && !base.Disposing) && !base.IsDisposed)
     {
         if (method == null)
         {
             method = delegate {
                 return this.ValidateMaps();
             };
         }
         return (bool) base.Invoke(method);
     }
     if (!base.Disposing && !base.IsDisposed)
     {
         try
         {
             this.IsValidatingMaps = true;
             bool flag = false;
             DlgSupcomMapOptions options = new DlgSupcomMapOptions(this.Team.GameType, true);
             if (!(!(this.Team.PreferredMap != "none") || options.Maps.Contains(new SupcomMapInfo(this.Team.PreferredMap))))
             {
                 this.SystemMessage("<LOC>Map: {0} is not supported by this many players.", new object[] { SupcomLookups.TranslateMapCode(this.Team.PreferredMap) });
                 this.Team.PreferredMap = "none";
                 flag = true;
             }
             if (!(!(this.Team.NonPreferredMap != "none") || options.Maps.Contains(new SupcomMapInfo(this.Team.NonPreferredMap))))
             {
                 this.SystemMessage("<LOC>Map: {0} is not supported by this many players.", new object[] { SupcomLookups.TranslateMapCode(this.Team.NonPreferredMap) });
                 this.Team.NonPreferredMap = "none";
                 flag = true;
             }
             Program.Settings.SupcomPrefs.RankedGames.MapsChanged -= new PropertyChangedEventHandler(this.BindToPrefs);
             options.SaveMapPrefs();
             Program.Settings.SupcomPrefs.RankedGames.MapsChanged += new PropertyChangedEventHandler(this.BindToPrefs);
             if (flag)
             {
                 options.Dispose();
                 options = null;
                 Messaging.SendCustomCommand(this.Team.GetOtherMemberNames(), CustomCommands.TeamGameMap, new object[] { this.Team.PreferredMap, this.Team.NonPreferredMap });
                 this.RefreshMaps();
                 return false;
             }
             options.Dispose();
             options = null;
             return true;
         }
         catch (Exception exception)
         {
             ErrorLog.WriteLine(exception);
             return false;
         }
         finally
         {
             this.IsValidatingMaps = false;
         }
     }
     return false;
 }