protected override bool GatherParams(out string map, out string faction)
 {
     if (this.FailedToLoad)
     {
         map = null;
         faction = null;
         return false;
     }
     if (this.dlg == null)
     {
         this.dlg = new DlgSupcomMapOptions("1v1");
     }
     if (this.dlg.ShowDialog() == DialogResult.OK)
     {
         this.SpecifiedMap = this.dlg.FetchMap();
         this.SpecifiedFaction = this.dlg.Faction;
     }
     else
     {
         map = null;
         faction = null;
         return false;
     }
     map = this.SpecifiedMap;
     faction = this.SpecifiedFaction;
     return true;
 }
Beispiel #2
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);
     }
 }
Beispiel #3
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;
 }
Beispiel #4
0
 public void PlayRankedGame(bool playNow, string kind, List<string> allies, string teamname, bool isTournament)
 {
     ThreadStart start = null;
     try
     {
         this.PlayNowMatch = playNow;
         if (this.mSearchingForAutomatch || (SupcomAutomatch.GetSupcomAutomatch().State != SupcomAutoState.Unavailable))
         {
             DlgMessage.ShowDialog(Loc.Get("<LOC>You are already in the ranked game queue."));
         }
         else if ((((GameInformation.SelectedGame.GameLocation != null) && (GameInformation.SelectedGame.GameLocation.Length > 0)) && System.IO.File.Exists(GameInformation.SelectedGame.GameLocation)) || this.LocateExe(GameInformation.SelectedGame.ExeName, true))
         {
             if (!(User.Current.IsAdmin || this.IsGameCurrent))
             {
                 this.UpdateSupCom();
             }
             else
             {
                 DlgSupcomMapOptions options;
                 SupComGameManager.LastLocation = GameInformation.SelectedGame.GameLocation;
                 SupComGameManager.GameArgs = Program.Settings.SupcomPrefs.CommandLineArgs;
                 if (isTournament)
                 {
                     if (TournamentCommands.sFaction.ToUpper().IndexOf("ANY FACTION") >= 0)
                     {
                         playNow = false;
                     }
                     if (TournamentCommands.sMap.ToUpper().IndexOf("LADDER MAPS") >= 0)
                     {
                         playNow = false;
                     }
                 }
                 if ((playNow && !isTournament) && ((((Program.Settings.SupcomPrefs.RankedGames.Maps == null) || (Program.Settings.SupcomPrefs.RankedGames.Maps.Length < 1)) || (Program.Settings.SupcomPrefs.RankedGames.Faction == null)) || (Program.Settings.SupcomPrefs.RankedGames.Faction.Length < 1)))
                 {
                     playNow = false;
                 }
                 if (isTournament)
                 {
                     options = new DlgSupcomMapOptions("1v1");
                     if (TournamentCommands.sFaction.ToUpper().IndexOf("ANY FACTION") < 0)
                     {
                         options.rbAeon.Enabled = false;
                         options.rbUEF.Enabled = false;
                         options.rbCybran.Enabled = false;
                         options.rbRandom.Enabled = false;
                     }
                     if (TournamentCommands.sMap.ToUpper().IndexOf("LADDER MAPS") < 0)
                     {
                         options.gpgMapSelectGrid.Enabled = false;
                     }
                 }
                 else if (kind.ToUpper().IndexOf("CHALLENGE") == 0)
                 {
                     options = new DlgSupcomMapOptions("1v1");
                 }
                 else
                 {
                     options = new DlgSupcomMapOptions(kind);
                 }
                 bool flag = this.IsRegularRankedGame();
                 if ((playNow || flag) || (options.ShowDialog() == DialogResult.OK))
                 {
                     this.StatusButtonRankedGameCancel.Click += new EventHandler(this.StatusButtonRankedGameCancel_Click);
                     this.mAutoStatus = Loc.Get("<LOC>Searching for game ");
                     this.StatusButtonRankedGameCancel.Text = Loc.Get("<LOC>Cancel");
                     this.pbMiddle.Add(this.StatusButtonRankedGameCancel);
                     this.mSearchingForAutomatch = true;
                     this.miGameGroup.Enabled = false;
                     this.btnHostGame.Enabled = false;
                     this.btnJoinGame.Enabled = false;
                     this.btnArrangedTeam.Enabled = false;
                     if (playNow)
                     {
                         this.btnPlayNow.Image = SkinManager.GetImage("nav-cancel_play_now.png");
                         this.btnPlayNow.ToolTipText = Loc.Get("<LOC>Cancel Ranked Game Search");
                         this.btnRankedGame.Enabled = false;
                     }
                     else
                     {
                         this.btnRankedGame.Image = SkinManager.GetImage("nav-cancel_ranked_game.png");
                         this.btnRankedGame.ToolTipText = Loc.Get("<LOC>Cancel Ranked Game Search");
                         this.btnPlayNow.Enabled = false;
                     }
                     this.mLastStatus = this.skinDropDownStatus.Text;
                     this.SetStatusButtons(1);
                     if (start == null)
                     {
                         start = delegate {
                             VGen1 method = null;
                             int num = 0;
                             while (this.mSearchingForAutomatch)
                             {
                                 try
                                 {
                                     num++;
                                     if (!base.Disposing && !base.IsDisposed)
                                     {
                                         if (method == null)
                                         {
                                             method = delegate (object objcount) {
                                                 try
                                                 {
                                                     int seconds = (int) objcount;
                                                     TimeSpan span = new TimeSpan(0, 0, seconds);
                                                     this.ChangeStatus("<LOC>Searching", StatusIcons.search);
                                                     this.SetStatus(this.mAutoStatus + " (" + span.ToString() + ")", new object[0]);
                                                 }
                                                 catch (Exception exception)
                                                 {
                                                     ErrorLog.WriteLine(exception);
                                                 }
                                             };
                                         }
                                         base.BeginInvoke(method, new object[] { num });
                                     }
                                     else
                                     {
                                         this.mSearchingForAutomatch = false;
                                     }
                                     Thread.Sleep(0x3e8);
                                 }
                                 catch (Exception exception)
                                 {
                                     ErrorLog.WriteLine(exception);
                                 }
                             }
                         };
                     }
                     Thread thread = new Thread(start);
                     thread.IsBackground = true;
                     thread.Start();
                     if (kind == "1v1")
                     {
                         SupcomAutomatch.GetSupcomAutomatch().RegisterNewGame(kind);
                     }
                     else if ((kind.IndexOf("TOURNY") == 0) || (kind.IndexOf("CHALLENGE") == 0))
                     {
                         SupcomAutomatch.GetSupcomAutomatch().RegisterNewGame(kind, null, "", true);
                     }
                     else
                     {
                         SupcomAutomatch.GetSupcomAutomatch().RegisterNewGame(kind, allies, teamname);
                     }
                     SupcomAutomatch.GetSupcomAutomatch().OnAutomatchStats += new AutomatchStatsDelegate(this.FrmMain_OnAutomatchStats);
                     if (!this.IsRegularRankedGame())
                     {
                         if (isTournament)
                         {
                             if (TournamentCommands.sFaction.ToUpper().IndexOf("RANDOM FACTION") >= 0)
                             {
                                 SupcomAutomatch.GetSupcomAutomatch().Faction = Program.Settings.SupcomPrefs.RankedGames.RandomFaction();
                             }
                             else if (TournamentCommands.sFaction.ToUpper().IndexOf("ANY FACTION") < 0)
                             {
                                 SupcomAutomatch.GetSupcomAutomatch().Faction = "/" + TournamentCommands.sFaction;
                             }
                             else
                             {
                                 SupcomAutomatch.GetSupcomAutomatch().Faction = Program.Settings.SupcomPrefs.RankedGames.FetchFaction();
                             }
                             if (TournamentCommands.sMap.ToUpper().IndexOf("LADDER MAPS") < 0)
                             {
                                 SupcomAutomatch.GetSupcomAutomatch().MapName = TournamentCommands.sMap;
                             }
                             else
                             {
                                 SupcomAutomatch.GetSupcomAutomatch().MapName = Program.Settings.SupcomPrefs.RankedGames.FetchMap();
                             }
                         }
                         else
                         {
                             SupcomAutomatch.GetSupcomAutomatch().Faction = Program.Settings.SupcomPrefs.RankedGames.FetchFaction();
                             SupcomAutomatch.GetSupcomAutomatch().MapName = Program.Settings.SupcomPrefs.RankedGames.FetchMap();
                         }
                     }
                     if (this.mFirstRankedSupcomGame)
                     {
                         this.mFirstRankedSupcomGame = false;
                         SupcomAutomatch.GetSupcomAutomatch().OnLaunchGame += new EventHandler(this.AutomatchLaunchGame);
                         SupcomAutomatch.GetSupcomAutomatch().OnStatusChanged += new StringEventHandler2(this.AutomatchStatusChanged);
                         SupcomAutomatch.GetSupcomAutomatch().OnExit += new EventHandler(this.AutomatchExit);
                     }
                 }
             }
         }
     }
     catch (Exception exception)
     {
         ErrorLog.WriteLine(exception);
     }
 }
 protected override void ProcessArgs(string args)
 {
     string[] strArray = args.Split(";".ToCharArray());
     this.dlg = new DlgSupcomMapOptions();
     bool flag = false;
     foreach (string str in strArray)
     {
         string str2 = str.Split("=".ToCharArray())[0].ToLower();
         string faction = str.Split("=".ToCharArray())[1].ToLower();
         string str5 = str2;
         if (str5 != null)
         {
             if (!(str5 == "factions"))
             {
                 if (str5 == "maps")
                 {
                     goto Label_01EA;
                 }
             }
             else
             {
                 if (faction.IndexOf("aeon") < 0)
                 {
                     this.dlg.AeonEnabled = false;
                 }
                 if (faction.IndexOf("cybran") < 0)
                 {
                     this.dlg.CybranEnabled = false;
                 }
                 if (faction.IndexOf("seraphim") < 0)
                 {
                     this.dlg.SeraphimEnabled = false;
                 }
                 if (faction.IndexOf("uef") < 0)
                 {
                     this.dlg.UEFEnabled = false;
                 }
                 if (faction.IndexOf("random") < 0)
                 {
                     this.dlg.RandomEnabled = false;
                 }
                 if ((faction.IndexOf(",") < 0) && (faction != "random"))
                 {
                     this.SpecifiedFaction = "/" + faction;
                     this.dlg.SelectFaction(faction);
                 }
                 else if ((faction.IndexOf(",") < 0) && (faction == "random"))
                 {
                     this.SpecifiedFaction = faction;
                     this.dlg.SelectFaction(faction);
                 }
                 else
                 {
                     this.dlg.SelectPreferredFaction();
                 }
             }
         }
         goto Label_028A;
     Label_01EA:
         if (faction.IndexOf(",") < 0)
         {
             if (!this.dlg.AddMap(faction, false))
             {
                 this.ErrorOnLoad();
                 return;
             }
             this.SpecifiedMap = faction;
         }
         else
         {
             foreach (string str4 in faction.Split(",".ToCharArray()))
             {
                 if (!this.dlg.AddMap(str4, true))
                 {
                     this.ErrorOnLoad();
                     return;
                 }
             }
         }
         flag = true;
     Label_028A:;
     }
     if (!flag)
     {
         this.dlg.AddDefaultMaps("1v1");
     }
 }