コード例 #1
0
ファイル: MainForm.cs プロジェクト: viticm/pap2
        /// <summary>
        /// 开始调试脚本
        /// </summary>
        private void StartDebug(DebugMode currentDebugMode)
        {
            // 检查调试文件是否都已经存在
            if (!CheckDebugFileReady())
            {
                MessageBox.Show("请先确定调试文件都已经正确挂接!", "开始调试", MessageBoxButtons.OK, MessageBoxIcon.Information);
                SettingForm sForm = new SettingForm();
                sForm.CurrentUpdateScriptFont = new SettingForm.UpdateScriptFont(UpdateScriptFont);
                sForm.CurrentUpdateScriptForeColor = new SettingForm.UpdateScriptForeColor(UpdateScriptForeColor);
                sForm.ShowDialog();
                return;
            }

            // 检查调试模式是否变更过
            if (debugMode != DebugMode.None && debugMode != currentDebugMode)
            {
                switch (currentDebugMode)
                {
                    case DebugMode.Client:
                        {
                            if (Helper.CheckProcessExist("JX3Client", false))
                            {
                                MessageBox.Show("从服务端脚本切换到客户端脚本调试时,需要修改挂接文件,请先关闭JX3Client.exe!", "开始调试",
                                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                                return;
                            }

                            break;
                        }
                    case DebugMode.Server:
                        {
                            if  (Helper.CheckProcessExist("SO3GameServer", false))
                            {
                                MessageBox.Show("从客户端脚本切换到服务端脚本调试时,需要修改挂接文件,请先关闭JX3Client.exe!", "开始调试",
                                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                                return;
                            }

                            break;
                        }
                }
            }

            // 挂接调试文件
            switch (currentDebugMode)
            {
                case DebugMode.Client:
                    {
                        DetachServerDebugFile();

                        if (!AttachClientDebugFile())
                        {
                            return;
                        }

                        break;
                    }
                case DebugMode.Server:
                    {
                        DetachClientDebugFile();

                        if (!AttachServerDebugFile())
                        {
                            return;
                        }

                        break;
                    }
            }

            debugMode = currentDebugMode;

            PrintOutputText("开始调试脚本...");
            networkManager = NetworkManager.GetNetworkManager();
            networkManager.BeginReceiveUdpMessage();
            PrintOutputText("开始等待响应调试请求...");
            StartDebugWaitTimer(Helper.BreakPointWaitCircle, DebugState.WaitStartDebugActivated);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: viticm/pap2
 /// <summary>
 /// 设置配置项
 /// </summary>
 /// <param name="sender">事件发送者</param>
 /// <param name="e">事件参数</param>
 private void btnSetup_Click(object sender, EventArgs e)
 {
     SettingForm settingForm = new SettingForm();
     settingForm.CurrentUpdateScriptFont = new SettingForm.UpdateScriptFont(UpdateScriptFont);
     settingForm.CurrentUpdateScriptForeColor = new SettingForm.UpdateScriptForeColor(UpdateScriptForeColor);
     settingForm.ShowDialog();
 }