private void BtnScoreAddReduce_Click(object sender, EventArgs e) { bool exchangeAB = _chkScoreExchangeLR.Checked; if (sender == btnScoreAddA) { Common.g_Game.SetScoreAR(exchangeAB ? true : false, true); } else if (sender == btnScoreAddB) { Common.g_Game.SetScoreAR(exchangeAB ? false : true, true); } else if (sender == btnScoreReduceA) { Common.g_Game.SetScoreAR(exchangeAB ? true : false, false); } else if (sender == btnScoreReduceB) { Common.g_Game.SetScoreAR(exchangeAB ? false : true, false); } else { Debug.Assert(false); return; } Common.dbGameObj2Db(Common.g_nMatchID, Common.g_Game); RefreshAll(); Common.NotifyMatchResult(); Common.dbMatchModifyTimeSet(); }
private void btnMainSendMessage_Click(object sender, EventArgs e) { Common.NotifyMatchResult(); Common.NotifyMatchStatus(); //2013-02-24 好像没啥用,先不发了 //Common.g_Plugin.DataChangedNotify(OVRDataChangedType.emSplitCompetitorMember, -1, -1, -1, Common.g_nMatchID, Common.g_nMatchID, null); //Common.g_Plugin.DataChangedNotify(OVRDataChangedType.emMatchStatistic, -1, -1, -1, Common.g_nMatchID, Common.g_nMatchID, null); }
//For timeout Subtitution private void _btnTimeSub_Click(object sender, EventArgs e) { int curSet = Common.g_Game.GetCurSet(); bool exchangeAB = _chkScoreExchangeLR.Checked; bool bResult = false; if (sender == _btnTimeAAdd) { bResult = Common.dbSettingSubtitutionTimeOutCount(true, exchangeAB ? false : true, true, curSet); } else if (sender == _btnTimeAReduce) { bResult = Common.dbSettingSubtitutionTimeOutCount(true, exchangeAB ? false : true, false, curSet); } else if (sender == _btnTimeBAdd) { bResult = Common.dbSettingSubtitutionTimeOutCount(true, exchangeAB ? true : false, true, curSet); } else if (sender == _btnTimeBReduce) { bResult = Common.dbSettingSubtitutionTimeOutCount(true, exchangeAB ? true : false, false, curSet); } else if (sender == _btnSubAAdd) { bResult = Common.dbSettingSubtitutionTimeOutCount(false, exchangeAB ? false : true, true, curSet); } else if (sender == _btnSubAReduce) { bResult = Common.dbSettingSubtitutionTimeOutCount(false, exchangeAB ? false : true, false, curSet); } else if (sender == _btnSubBAdd) { bResult = Common.dbSettingSubtitutionTimeOutCount(false, exchangeAB ? true : false, true, curSet); } else if (sender == _btnSubBReduce) { bResult = Common.dbSettingSubtitutionTimeOutCount(false, exchangeAB ? true : false, false, curSet); } else { Debug.Assert(false); return; } if (!bResult) { MessageBox.Show("修改失败!"); } Common.dbMatchModifyTimeSet(); Common.NotifyMatchResult(); RefreshAll(); }
private void dgvMatchScore_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == 0) //更换当前局 { if (e.ColumnIndex >= 3 && e.ColumnIndex <= 7) { Common.g_Game.SetCurSet(e.ColumnIndex - 2); Common.dbGameObj2Db(Common.g_nMatchID, Common.g_Game); RefreshAll(); Common.NotifyMatchResult(); Common.g_Plugin.DataChangedNotify(OVRDataChangedType.emSplitCompetitorMember, -1, -1, -1, Common.g_nMatchID, Common.g_nMatchID, null); } } else if (e.RowIndex == 1) //设球权 { if (e.ColumnIndex == 2) { Common.g_Game.SetServeTeamB(false); Common.dbGameObj2Db(Common.g_nMatchID, Common.g_Game); dgvMatchScoreRefresh(); Common.NotifyMatchResult(); } } else if (e.RowIndex == 2) //设球权 { if (e.ColumnIndex == 2) { Common.g_Game.SetServeTeamB(true); Common.dbGameObj2Db(Common.g_nMatchID, Common.g_Game); dgvMatchScoreRefresh(); Common.NotifyMatchResult(); } } else { //Debug.Assert(false); } }
private void dgvMatchScore_CellEndEdit(object sender, DataGridViewCellEventArgs e) { //没有选中的当前单元格,肯定不会 if (dgvMatchScore.CurrentCell == null) { return; } //判断是否编辑的是IRM if (e.RowIndex >= 1 && e.RowIndex <= 2 && e.ColumnIndex == 1) { //有可能为空 Int32 nIRM_ID = Common.Str2Int(dgvMatchScore.CurrentCell.Tag); if (!Common.dbIRMSet(Common.g_nMatchID, nIRM_ID, (e.RowIndex == 1))) { MessageBox.Show("设置IRM信息失败!"); } Common.dbMatchModifyTimeSet(); Common.NotifyMatchResult(); return; } //是否为编辑值 if (((DataGridView)sender).CurrentCell.Value != null) { String strNewValue = ((DataGridView)sender).CurrentCell.Value.ToString(); //判断是否编辑比分 if (e.RowIndex >= 1 && e.RowIndex <= 2 && e.ColumnIndex >= 3 && e.ColumnIndex <= 7) { Int32 nCurScore = Common.Str2Int(strNewValue); nCurScore = Math.Max(nCurScore, 0); bool bTeamB = (e.RowIndex == 2); Int32 nSet = e.ColumnIndex - 2; Int32 ptsSetOppr = Common.g_Game.GetScoreSet(!bTeamB, nSet); Int32 scoreWin = Common.g_isVB ? 25 : 21; //在第五局如果输入的值大于15分,给予一个提示 if (Common.g_isVB && nCurScore > 15 && nSet == 5 && nCurScore > ptsSetOppr + 2) { if (MessageBox.Show("第5局比分一般不会大于15. 是否继续?", "比分提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { Common.g_Game.SetScore(nCurScore, bTeamB, nSet); } } else if (!Common.g_isVB && nCurScore > 15 && nSet == 3 && nCurScore > ptsSetOppr + 2) { if (MessageBox.Show("第3局比分一般不会大于15. 是否继续?", "比分提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { Common.g_Game.SetScore(nCurScore, bTeamB, nSet); } } else if (nCurScore > scoreWin && nCurScore > ptsSetOppr + 2) { if (MessageBox.Show("比分一般不会大于" + scoreWin.ToString() + ". 是否继续?", "比分提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { Common.g_Game.SetScore(nCurScore, bTeamB, nSet); } } else { Common.g_Game.SetScore(nCurScore, bTeamB, nSet); } Common.dbGameObj2Db(Common.g_nMatchID, Common.g_Game); dgvMatchScoreRefresh(); Common.NotifyMatchResult(); return; } //时间 if (e.RowIndex == 3 && e.ColumnIndex >= 3 && e.ColumnIndex <= 8) { int nTime = 0; int nIndex = strNewValue.IndexOf(':'); if (nIndex > 0) { nTime = Common.Str2Int(strNewValue.Substring(0, nIndex)) * 60; nTime += Common.Str2Int(strNewValue.Substring(nIndex + 1, strNewValue.Length - nIndex - 1)); } else { nTime = Common.Str2Int(strNewValue); } if (nTime > 999) { nTime = 999; } if (nTime < 0) { nTime = 0; } if (e.ColumnIndex - 2 == 6) { Common.g_Game.SetTimeMatch(nTime.ToString()); } else if (e.ColumnIndex - 2 < 6 && e.ColumnIndex - 2 > 0) { int nSet = e.ColumnIndex - 2; Common.g_Game.SetTimeSet(nTime.ToString(), nSet); } else { Debug.Assert(false); } Common.dbGameObj2Db(Common.g_nMatchID, Common.g_Game); dgvMatchScoreRefresh(); Common.NotifyMatchResult(); return; } } }