private void HandleDownloadFinished(CustomComponent cc, bool success)
        {
            cc.DownloadFinished        -= cc_DownloadFinished;
            cc.DownloadProgressChanged -= cc_DownloadProgressChanged;

            var btn = installationButtons.Find(b => object.ReferenceEquals(b.Tag, cc));

            btn.AllowClick = true;

            if (!success)
            {
                if (!downloadCancelled)
                {
                    XNAMessageBox.Show(WindowManager, "可选组件下载失败",
                                       string.Format("组件 {0} 下载失败。" + Environment.NewLine +
                                                     "打开 client.log 查看细节。" + Environment.NewLine + Environment.NewLine +
                                                     "如果问题依旧存在,请联系mod作者寻求帮助。",
                                                     cc.GUIName));
                }

                btn.Text = "安装";

                if (File.Exists(ProgramConstants.GamePath + cc.LocalPath))
                {
                    btn.Text = "更新";
                }
            }
            else
            {
                XNAMessageBox.Show(WindowManager, "下载完成",
                                   string.Format("组件 {0} 下载完成。", cc.GUIName));
                btn.Text = "卸载";
            }
        }
예제 #2
0
        private void SaveSettings()
        {
            bool restartRequired = false;

            try
            {
                foreach (var panel in optionsPanels)
                {
                    restartRequired = panel.Save() || restartRequired;
                }

                UserINISettings.Instance.SaveSettings();
            }
            catch (Exception ex)
            {
                Logger.Log("Saving settings failed! Error message: " + ex.Message);
                XNAMessageBox.Show(WindowManager, "Saving Settings Failed",
                                   "Saving settings failed! Error message: " + ex.Message);
            }

            Disable();

            if (restartRequired)
            {
                var msgBox = new XNAMessageBox(WindowManager, "Restart Required",
                                               "The client needs to be restarted for some of the changes to take effect." +
                                               Environment.NewLine + Environment.NewLine +
                                               "Do you want to restart now?", XNAMessageBoxButtons.YesNo);
                msgBox.Show();
                msgBox.YesClickedAction = RestartMsgBox_YesClicked;
            }
        }
예제 #3
0
        private void BtnCreateGame_LeftClick(object sender, EventArgs e)
        {
            string gameName = tbGameName.Text.Replace(";", string.Empty);

            if (string.IsNullOrEmpty(gameName))
            {
                return;
            }

            if (new ProfanityFilter().IsOffensive(gameName))
            {
                XNAMessageBox.Show(WindowManager, "Offensive game name",
                                   "Please enter a less offensive game name.");
                return;
            }

            if (!lbTunnelList.IsValidIndexSelected())
            {
                return;
            }

            GameCreated?.Invoke(this, new GameCreationEventArgs(gameName,
                                                                int.Parse(ddMaxPlayers.SelectedItem.Text), tbPassword.Text,
                                                                tunnelHandler.Tunnels[lbTunnelList.SelectedIndex]));
        }
        private void SaveSettings()
        {
            bool restartRequired = false;

            try
            {
                foreach (var panel in optionsPanels)
                {
                    restartRequired = panel.Save() || restartRequired;
                }

                UserINISettings.Instance.SaveSettings();
            }
            catch (Exception ex)
            {
                Logger.Log("Saving settings failed! Error message: " + ex.Message);
                XNAMessageBox.Show(WindowManager, "设置保存失败",
                                   "您所作的更改无法保存。错误信息: " + ex.Message);
            }

            Disable();

            if (restartRequired)
            {
                var msgBox = new XNAMessageBox(WindowManager, "需要重启",
                                               "为了使部分设置生效,必须重启客户端。" +
                                               Environment.NewLine + Environment.NewLine +
                                               "您希望现在重启吗?", XNAMessageBoxButtons.YesNo);
                msgBox.Show();
                msgBox.YesClickedAction = RestartMsgBox_YesClicked;
            }
        }
예제 #5
0
        private void CheckForbiddenFiles()
        {
            List <string> presentFiles = ClientConfiguration.Instance.ForbiddenFiles.ToList()
                                         .FindAll(f => !string.IsNullOrWhiteSpace(f) && File.Exists(ProgramConstants.GamePath + f));

            if (presentFiles.Count > 0)
            {
                XNAMessageBox.Show(WindowManager, "Interfering Files Detected",
#if TS
                                   "You have installed the mod on top of a Tiberian Sun" + Environment.NewLine +
                                   "copy! This mod is standalone, therefore you have to" + Environment.NewLine +
                                   "install it in an empty folder. Otherwise the mod won't" + Environment.NewLine +
                                   "function correctly." +
                                   Environment.NewLine + Environment.NewLine +
                                   "Please reinstall the mod into an empty folder to play."
#else
                                   "The following interfering files are present:" +
                                   Environment.NewLine + Environment.NewLine +
                                   String.Join(Environment.NewLine, presentFiles) +
                                   Environment.NewLine + Environment.NewLine +
                                   "The mod won't work correctly without those files removed."
#endif
                                   );
            }
        }
        private void HandleDownloadFinished(CustomComponent cc, bool success)
        {
            cc.DownloadFinished        -= cc_DownloadFinished;
            cc.DownloadProgressChanged -= cc_DownloadProgressChanged;

            var btn = installationButtons.Find(b => object.ReferenceEquals(b.Tag, cc));

            btn.AllowClick = true;

            if (!success)
            {
                if (!downloadCancelled)
                {
                    XNAMessageBox.Show(WindowManager, "Optional Component Download Failed",
                                       string.Format("Download of optional component {0} failed." + Environment.NewLine +
                                                     "See client.log for details." + Environment.NewLine + Environment.NewLine +
                                                     "If this problem continues, please contact your mod's authors for support.",
                                                     cc.GUIName));
                }

                btn.Text = "Install";

                if (File.Exists(ProgramConstants.GamePath + cc.LocalPath))
                {
                    btn.Text = "Update";
                }
            }
            else
            {
                XNAMessageBox.Show(WindowManager, "Download Completed",
                                   string.Format("Download of optional component {0} completed succesfully.", cc.GUIName));
                btn.Text = "Uninstall";
            }
        }
        private void BtnMapEditorCompatibilityFix_LeftClick(object sender, EventArgs e)
        {
            if (FinalSunCompatFixInstalled)
            {
                try
                {
                    Process sdbinst = Process.Start("sdbinst.exe", "-q -n \"Final Sun Compatibility Fix\"");

                    sdbinst.WaitForExit();

                    RegistryKey regKey = Registry.CurrentUser.OpenSubKey("SOFTWARE", true);
                    regKey = regKey.CreateSubKey("Tiberian Sun Client");
                    regKey.SetValue("FSCompatFixInstalled", "No");

                    btnMapEditorCompatibilityFix.Text = "Enable";

                    Logger.Log("FinalSun Compatibility Fix succesfully uninstalled.");
                    XNAMessageBox.Show(WindowManager, "Compatibility Fix Uninstalled",
                                       "The FinalSun Compatibility Fix has been succesfully uninstalled.");

                    FinalSunCompatFixInstalled = false;
                }
                catch (Exception ex)
                {
                    Logger.Log("Uninstalling FinalSun Compatibility Fix failed. Error message: " + ex.Message);
                    XNAMessageBox.Show(WindowManager, "Uninstalling Compatibility Fix Failed",
                                       "Uninstalling FinalSun Compatibility Fix failed. Error message: " + ex.Message);
                }

                return;
            }


            try
            {
                Process sdbinst = Process.Start("sdbinst.exe", "-q \"" + ProgramConstants.GamePath + "Resources\\FSCompatFix.sdb\"");

                sdbinst.WaitForExit();

                RegistryKey regKey = Registry.CurrentUser.OpenSubKey("SOFTWARE", true);
                regKey = regKey.CreateSubKey("Tiberian Sun Client");
                regKey.SetValue("FSCompatFixInstalled", "Yes");

                btnMapEditorCompatibilityFix.Text = "Disable";

                Logger.Log("FinalSun Compatibility Fix succesfully installed.");
                XNAMessageBox.Show(WindowManager, "Compatibility Fix Installed",
                                   "The FinalSun Compatibility Fix has been succesfully installed.");

                FinalSunCompatFixInstalled = true;
            }
            catch (Exception ex)
            {
                Logger.Log("Installing FinalSun Compatibility Fix failed. Error message: " + ex.Message);
                XNAMessageBox.Show(WindowManager, "Installing Compatibility Fix Failed",
                                   "Installing FinalSun Compatibility Fix failed. Error message: " + ex.Message);
            }
        }
예제 #8
0
        private void BtnGameCompatibilityFix_LeftClick(object sender, EventArgs e)
        {
            if (GameCompatFixInstalled)
            {
                try
                {
                    Process sdbinst = Process.Start("sdbinst.exe", "-q -n \"TS Compatibility Fix\"");

                    sdbinst.WaitForExit();

                    Logger.Log("DTA/TI/TS Compatibility Fix succesfully uninstalled.");
                    XNAMessageBox.Show(WindowManager, "兼容性修复程序已卸载",
                                       "DTA/TI/TS 兼容性修复已经成功卸载。");

                    RegistryKey regKey = Registry.CurrentUser.OpenSubKey("SOFTWARE", true);
                    regKey = regKey.CreateSubKey("Tiberian Sun Client");
                    regKey.SetValue("TSCompatFixInstalled", "No");

                    btnGameCompatibilityFix.Text = "启用";

                    GameCompatFixInstalled = false;
                }
                catch (Exception ex)
                {
                    Logger.Log("Uninstalling DTA/TI/TS Compatibility Fix failed. Error message: " + ex.Message);
                    XNAMessageBox.Show(WindowManager, "兼容性修复程序卸载失败",
                                       "DTA/TI/TS 兼容性修复卸载失败。错误信息: " + ex.Message);
                }

                return;
            }

            try
            {
                Process sdbinst = Process.Start("sdbinst.exe", "-q \"" + ProgramConstants.GamePath + "Resources\\compatfix.sdb\"");

                sdbinst.WaitForExit();

                Logger.Log("DTA/TI/TS Compatibility Fix succesfully installed.");
                XNAMessageBox.Show(WindowManager, "兼容性修复程序安装成功",
                                   "DTA/TI/TS 兼容性修复已经成功安装。");

                RegistryKey regKey = Registry.CurrentUser.OpenSubKey("SOFTWARE", true);
                regKey = regKey.CreateSubKey("Tiberian Sun Client");
                regKey.SetValue("TSCompatFixInstalled", "Yes");

                btnGameCompatibilityFix.Text = "Disable";

                GameCompatFixInstalled = true;
            }
            catch (Exception ex)
            {
                Logger.Log("Installing DTA/TI/TS Compatibility Fix failed. Error message: " + ex.Message);
                XNAMessageBox.Show(WindowManager, "兼容性修复程序安装失败",
                                   "DTA/TI/TS 兼容性修复安装失败。错误信息: " + ex.Message);
            }
        }
        private void TbChatInput_EnterPressed(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tbChatInput.Text))
            {
                return;
            }

            if (tbChatInput.Text.StartsWith("/"))
            {
                string text = tbChatInput.Text;
                string command;
                string parameters;

                int spaceIndex = text.IndexOf(' ');

                if (spaceIndex == -1)
                {
                    command    = text.Substring(1).ToUpper();
                    parameters = string.Empty;
                }
                else
                {
                    command    = text.Substring(1, spaceIndex - 1);
                    parameters = text.Substring(spaceIndex + 1);
                }

                tbChatInput.Text = string.Empty;

                foreach (var chatBoxCommand in chatBoxCommands)
                {
                    if (command.ToUpper() == chatBoxCommand.Command)
                    {
                        if (!IsHost && chatBoxCommand.HostOnly)
                        {
                            AddNotice(string.Format("/{0} is for game hosts only.", chatBoxCommand.Command));
                            return;
                        }

                        chatBoxCommand.Action(parameters);
                        return;
                    }
                }

                StringBuilder sb = new StringBuilder("To use a command, start your message with /<command>. Possible chat box commands: ");
                foreach (var chatBoxCommand in chatBoxCommands)
                {
                    sb.Append(Environment.NewLine);
                    sb.Append(Environment.NewLine);
                    sb.Append($"{chatBoxCommand.Command}: {chatBoxCommand.Description}");
                }
                XNAMessageBox.Show(WindowManager, "Chat Box Command Help", sb.ToString());
                return;
            }

            SendChatMessage(tbChatInput.Text);
            tbChatInput.Text = string.Empty;
        }
        private void BtnClearStatistics_LeftClick(object sender, EventArgs e)
        {
            var msgBox = new XNAMessageBox(WindowManager, "Clear all statistics",
                                           "All statistics data will be cleared from the database." +
                                           Environment.NewLine + Environment.NewLine +
                                           "Are you sure you want to continue?", XNAMessageBoxButtons.YesNo);

            msgBox.Show();
            msgBox.YesClickedAction = ClearStatisticsConfirmation_YesClicked;
        }
 private void BtnHelp_LeftClick(object sender, EventArgs args)
 {
     XNAMessageBox.Show(WindowManager, "Auto Allying",
                        "Auto allying allows the host to assign starting locations to teams, not players.\n" +
                        "When players are assigned to spawn locations, they will be auto assigned to teams based on these mappings.\n" +
                        "This is best used with random teams and random starts. However, only random teams is required.\n" +
                        "Manually specified starts will take precedence.\n\n" +
                        $"{TeamStartMapping.NO_TEAM} : Block this location from being assigned to a player.\n" +
                        $"{TeamStartMapping.RANDOM_TEAM} : Allow a player here, but don't assign a team."
                        );
 }
예제 #12
0
 private void CopyLink(string link)
 {
     try
     {
         Clipboard.SetText(link);
     }
     catch (Exception)
     {
         XNAMessageBox.Show(WindowManager, "Error", "Unable to copy link");
     }
 }
예제 #13
0
        protected override void BtnLaunchGame_LeftClick(object sender, EventArgs e)
        {
            string error = CheckGameValidity();

            if (error == null)
            {
                SaveSettings();
                StartGame();
                return;
            }

            XNAMessageBox.Show(WindowManager, "Cannot launch game", error);
        }
예제 #14
0
        /// <summary>
        /// Checks files which are required for the mod to function
        /// but not distributed with the mod (usually base game files
        /// for YR mods which can't be standalone).
        /// </summary>
        private void CheckRequiredFiles()
        {
            List <string> absentFiles = ClientConfiguration.Instance.RequiredFiles.ToList()
                                        .FindAll(f => !string.IsNullOrWhiteSpace(f) && !File.Exists(ProgramConstants.GamePath + f));

            if (absentFiles.Count > 0)
            {
                XNAMessageBox.Show(WindowManager, "Missing Files",
                                   "The following required files are missing:" +
                                   Environment.NewLine + Environment.NewLine +
                                   string.Join(Environment.NewLine, absentFiles) +
                                   Environment.NewLine + Environment.NewLine +
                                   "You won't be able to play without those files.");
            }
        }
        private void BtnDelete_LeftClick(object sender, EventArgs e)
        {
            SavedGame sg     = savedGames[lbSaveGameList.SelectedIndex];
            var       msgBox = new XNAMessageBox(WindowManager, "Delete Confirmation",
                                                 "The following saved game will be deleted permanently:" + Environment.NewLine +
                                                 Environment.NewLine +
                                                 "Filename: " + sg.FileName + Environment.NewLine +
                                                 "Saved game name: " + Renderer.GetSafeString(sg.GUIName, lbSaveGameList.FontIndex) + Environment.NewLine +
                                                 "Date and time: " + sg.LastModified.ToString() + Environment.NewLine +
                                                 Environment.NewLine +
                                                 "Are you sure you want to proceed?", XNAMessageBoxButtons.YesNo);

            msgBox.Show();
            msgBox.YesClickedAction = DeleteMsgBox_YesClicked;
        }
        private void BtnSave_LeftClick(object sender, EventArgs e)
        {
            if (CustomComponent.IsDownloadInProgress())
            {
                var msgBox = new XNAMessageBox(WindowManager, "正在下载",
                                               "可选组件正在下载。如果关闭设置窗口,下载将会取消。" +
                                               Environment.NewLine + Environment.NewLine +
                                               "确定要关闭?", XNAMessageBoxButtons.YesNo);
                msgBox.Show();
                msgBox.YesClickedAction = SaveDownloadCancelConfirmation_YesClicked;

                return;
            }

            SaveSettings();
        }
예제 #17
0
        private void BtnSave_LeftClick(object sender, EventArgs e)
        {
            if (CustomComponent.IsDownloadInProgress())
            {
                var msgBox = new XNAMessageBox(WindowManager, "Downloads in progress",
                                               "Optional component downloads are in progress. The downloads will be cancelled if you exit the Options menu." +
                                               Environment.NewLine + Environment.NewLine +
                                               "Are you sure you want to continue?", XNAMessageBoxButtons.YesNo);
                msgBox.Show();
                msgBox.YesClickedAction = SaveDownloadCancelConfirmation_YesClicked;

                return;
            }

            SaveSettings();
        }
예제 #18
0
        private void BtnForceUpdate_LeftClick(object sender, EventArgs e)
        {
            var msgBox = new XNAMessageBox(WindowManager, "Force Update Confirmation",
                                           "WARNING: Force update will result in files being re-verified" + Environment.NewLine +
                                           "and re-downloaded. While this may fix problems with game" + Environment.NewLine +
                                           "files, this also may delete some custom modifications" + Environment.NewLine +
                                           "made to this installation. Use at your own risk!" +
                                           Environment.NewLine + Environment.NewLine +
                                           "If you proceed, the options window will close and the" + Environment.NewLine +
                                           "client will proceed to checking for updates." +
                                           Environment.NewLine + Environment.NewLine +
                                           "Do you really want to force update?" + Environment.NewLine, XNAMessageBoxButtons.YesNo);

            msgBox.Show();
            msgBox.YesClickedAction = ForceUpdateMsgBox_YesClicked;
        }
예제 #19
0
        private void BtnBack_LeftClick(object sender, EventArgs e)
        {
            if (CustomComponent.IsDownloadInProgress())
            {
                var msgBox = new XNAMessageBox(WindowManager, "Downloads in progress",
                                               "Optional component downloads are in progress. The downloads will be cancelled if you exit the Options menu." +
                                               Environment.NewLine + Environment.NewLine +
                                               "Are you sure you want to continue?", XNAMessageBoxButtons.YesNo);
                msgBox.Show();
                msgBox.YesClickedAction = ExitDownloadCancelConfirmation_YesClicked;

                return;
            }

            WindowManager.SoundPlayer.SetVolume(Convert.ToSingle(UserINISettings.Instance.ClientVolume));
            Disable();
        }
예제 #20
0
        private void CUpdater_FileIdentifiersUpdated()
        {
            if (!isStartingForceUpdate)
            {
                return;
            }

            if (CUpdater.DTAVersionState == VersionState.UNKNOWN)
            {
                XNAMessageBox.Show(WindowManager, "Force Update Failure", "Checking for updates failed.");
                CloseWindow();
                return;
            }

            SetData(CUpdater.ServerGameVersion);
            CUpdater.StartAsyncUpdate();
            isStartingForceUpdate = false;
        }
        private void Btn_LeftClick(object sender, EventArgs e)
        {
            var btn = (XNAClientButton)sender;

            var cc = (CustomComponent)btn.Tag;

            if (cc.IsBeingDownloaded)
            {
                return;
            }

            if (File.Exists(ProgramConstants.GamePath + cc.LocalPath))
            {
                if (cc.LocalIdentifier == cc.RemoteIdentifier)
                {
                    File.Delete(ProgramConstants.GamePath + cc.LocalPath);
                    btn.Text = "安装";
                    return;
                }

                btn.AllowClick = false;

                cc.DownloadFinished        += cc_DownloadFinished;
                cc.DownloadProgressChanged += cc_DownloadProgressChanged;
                Thread thread = new Thread(cc.DownloadComponent);
                thread.Start();
            }
            else
            {
                var msgBox = new XNAMessageBox(WindowManager, "确认启用组件",
                                               "为了启用 " + cc.GUIName + " 插件,客户端要下载所需的文件到你的游戏目录。" +
                                               Environment.NewLine + Environment.NewLine +
                                               "这将占据你磁盘上 " + GetSizeString(cc.RemoteSize) + " 的空间。" +
                                               Environment.NewLine +
                                               "插件的下载可能持续几分钟甚至数小时,具体取决于您的网速。" +
                                               Environment.NewLine + Environment.NewLine +
                                               "在插件下载时您将无法游玩。确定继续?", XNAMessageBoxButtons.YesNo);
                msgBox.Tag = btn;

                msgBox.Show();
                msgBox.YesClickedAction = MsgBox_YesClicked;
            }
        }
예제 #22
0
        private void Btn_LeftClick(object sender, EventArgs e)
        {
            var btn = (XNAClientButton)sender;

            var cc = (CustomComponent)btn.Tag;

            if (cc.IsBeingDownloaded)
            {
                return;
            }

            if (File.Exists(ProgramConstants.GamePath + cc.LocalPath))
            {
                if (cc.LocalIdentifier == cc.RemoteIdentifier)
                {
                    File.Delete(ProgramConstants.GamePath + cc.LocalPath);
                    btn.Text = "Install";
                    return;
                }

                btn.AllowClick = false;

                cc.DownloadFinished        += cc_DownloadFinished;
                cc.DownloadProgressChanged += cc_DownloadProgressChanged;
                Thread thread = new Thread(cc.DownloadComponent);
                thread.Start();
            }
            else
            {
                var msgBox = new XNAMessageBox(WindowManager, "Confirmation Required",
                                               "To enable " + cc.GUIName + " the Client will download the necessary files to your game directory." +
                                               Environment.NewLine + Environment.NewLine +
                                               "This will take an additional " + cc.RemoteSize / 1048576 + " MB of disk space, and the download may last" +
                                               Environment.NewLine +
                                               "from a few minutes to multiple hours depending on your Internet connection speed." +
                                               Environment.NewLine + Environment.NewLine +
                                               "You will not be able to play during the download. Do you want to continue?", XNAMessageBoxButtons.YesNo);
                msgBox.Tag = btn;

                msgBox.Show();
                msgBox.YesClickedAction = MsgBox_YesClicked;
            }
        }
예제 #23
0
        private void UpdateWindow_UpdateFailed(object sender, UpdateFailureEventArgs e)
        {
            innerPanel.Hide();
            lblUpdateStatus.Text          = "Updating failed! Click to retry.";
            lblUpdateStatus.DrawUnderline = true;
            lblUpdateStatus.Enabled       = true;
            UpdateInProgress = false;

            innerPanel.Show(null); // Darkening
            XNAMessageBox msgBox = new XNAMessageBox(WindowManager, "Update failed",
                                                     string.Format("An error occured while updating. Returned error was: {0}" +
                                                                   Environment.NewLine + Environment.NewLine +
                                                                   "If you are connected to the Internet and your firewall isn't blocking" + Environment.NewLine +
                                                                   "{1}, and the issue is reproducible, contact us at " + Environment.NewLine +
                                                                   "{2} for support.",
                                                                   e.Reason, CUpdater.CURRENT_LAUNCHER_NAME, MainClientConstants.SUPPORT_URL_SHORT), XNAMessageBoxButtons.OK);

            msgBox.OKClickedAction = MsgBox_OKClicked;
            msgBox.Show();
        }
예제 #24
0
        private void BtnConnect_LeftClick(object sender, EventArgs e)
        {
            string errorMessage = NameValidator.IsNameValid(tbPlayerName.Text);

            if (!string.IsNullOrEmpty(errorMessage))
            {
                XNAMessageBox.Show(WindowManager, "Invalid Player Name", errorMessage);
                return;
            }

            ProgramConstants.PLAYERNAME = tbPlayerName.Text;

            UserINISettings.Instance.SkipConnectDialog.Value    = chkRememberMe.Checked;
            UserINISettings.Instance.PersistentMode.Value       = chkPersistentMode.Checked;
            UserINISettings.Instance.AutomaticCnCNetLogin.Value = chkAutoConnect.Checked;
            UserINISettings.Instance.PlayerName.Value           = ProgramConstants.PLAYERNAME;

            UserINISettings.Instance.SaveSettings();

            Connect?.Invoke(this, EventArgs.Empty);
        }
예제 #25
0
        /// <summary>
        /// Checks files which are required for the mod to function
        /// but not distributed with the mod (usually base game files
        /// for YR mods which can't be standalone).
        /// </summary>
        private void CheckRequiredFiles()
        {
            List <string> absentFiles = ClientConfiguration.Instance.RequiredFiles.ToList()
                                        .FindAll(f => !string.IsNullOrWhiteSpace(f) && !File.Exists(ProgramConstants.GamePath + f));

            if (absentFiles.Count > 0)
            {
                XNAMessageBox.Show(WindowManager, "Missing Files",
#if ARES
                                   "You are missing Yuri's Revenge files that are required" + Environment.NewLine +
                                   "to play this mod! Yuri's Revenge mods are not standalone," + Environment.NewLine +
                                   "so you need a copy of following Yuri's Revenge (v. 1.001)" + Environment.NewLine +
                                   "files placed in the mod folder to play the mod:" +
#else
                                   "The following required files are missing:" +
#endif
                                   Environment.NewLine + Environment.NewLine +
                                   String.Join(Environment.NewLine, absentFiles) +
                                   Environment.NewLine + Environment.NewLine +
                                   "You won't be able to play without those files.");
            }
        }
예제 #26
0
        /// <summary>
        /// Refreshes the option panels to account for possible
        /// changes that could affect theirs functionality.
        /// Shows the popup to inform the user if needed.
        /// </summary>
        /// <returns>A bool that determines whether the
        /// settings values were changed.</returns>
        private bool RefreshOptionPanels()
        {
            bool optionValuesChanged = false;

            foreach (var panel in optionsPanels)
            {
                optionValuesChanged = panel.RefreshPanel() || optionValuesChanged;
            }

            if (optionValuesChanged)
            {
                XNAMessageBox.Show(WindowManager, "Setting Value(s) Changed",
                                   "One or more setting values are" + Environment.NewLine +
                                   "no longer available and were changed." +
                                   Environment.NewLine + Environment.NewLine +
                                   "You may want to verify the new setting" + Environment.NewLine +
                                   "values in client's options window.");

                return(true);
            }

            return(false);
        }
예제 #27
0
        protected void LoadGame()
        {
            File.Delete(ProgramConstants.GamePath + "spawn.ini");

            File.Copy(ProgramConstants.GamePath + ProgramConstants.SAVED_GAME_SPAWN_INI, ProgramConstants.GamePath + "spawn.ini");

            IniFile spawnIni = new IniFile(ProgramConstants.GamePath + "spawn.ini");

            int    sgIndex    = (ddSavedGame.Items.Count - 1) - ddSavedGame.SelectedIndex;
            string sgFileName = string.Format("SVGM_{0}.NET", sgIndex.ToString("D3"));

            spawnIni.SetStringValue("Settings", "SaveGameName", sgFileName);
            spawnIni.SetBooleanValue("Settings", "LoadSaveGame", true);

            PlayerInfo localPlayer = Players.Find(p => p.Name == ProgramConstants.PLAYERNAME);

            if (localPlayer == null)
            {
                return;
            }

            spawnIni.SetIntValue("Settings", "Port", localPlayer.Port);

            for (int i = 1; i < Players.Count; i++)
            {
                string otherName = spawnIni.GetStringValue("Other" + i, "Name", string.Empty);

                if (string.IsNullOrEmpty(otherName))
                {
                    continue;
                }

                PlayerInfo otherPlayer = Players.Find(p => p.Name == otherName);

                if (otherPlayer == null)
                {
                    continue;
                }

                spawnIni.SetStringValue("Other" + i, "Ip", otherPlayer.IPAddress);
                spawnIni.SetIntValue("Other" + i, "Port", otherPlayer.Port);
            }

            WriteSpawnIniAdditions(spawnIni);
            spawnIni.WriteIniFile();

            File.Delete(ProgramConstants.GamePath + "spawnmap.ini");
            StreamWriter sw = new StreamWriter(ProgramConstants.GamePath + "spawnmap.ini");

            sw.WriteLine("[Map]");
            sw.WriteLine("Size=0,0,50,50");
            sw.WriteLine("LocalSize=0,0,50,50");
            sw.WriteLine();
            sw.Close();

            gameLoadTime = DateTime.Now;

            string saveFilePath = ProgramConstants.GamePath + MultiplayerSaveGameManager.SAVED_GAMES_MP_DIRECTORY + "/" + sgFileName;
            string metaFilePath = Path.ChangeExtension(saveFilePath, GameSessionManager.SavedGameMetaExtension);
            var    meta         = GameSessionInfo.ParseFromFile(metaFilePath);

            if (meta == null)
            {
                XNAMessageBox.Show(WindowManager, "Failed to load saved multiplayer game", "Failed to load saved game: saved game meta could not be parsed!");
                return;
            }

            var gameSessionInfo = new GameSessionManager(new GameSessionInfo(GameSessionType.MULTIPLAYER, meta.UniqueId), WindowManager.AddCallback);

            gameSessionInfo.StartSession();
            GameProcessLogic.GameProcessExited += SharedUILogic_GameProcessExited;
            GameProcessLogic.StartGameProcess(gameSessionInfo);

            UpdateDiscordPresence(true);
        }
예제 #28
0
 protected override void AddNotice(string message, Color color)
 {
     XNAMessageBox.Show(WindowManager, "Message", message);
 }
예제 #29
0
 public void AddMessage(ChatMessage message)
 => XNAMessageBox.Show(windowManager, "Message", message.Message);