private void button2_Click(object sender, EventArgs e) { ToolsHelper tl = new ToolsHelper(); string[] sRewardData = txtsRewardData.Text.Split('*'); lblExplain.Text = tl.ExplainRewardData(sRewardData, DataHelper.DdlDataSet.Tables["TalkManager.iGtype"]); }
private void ExplainBattleArea(DataGridViewRow dv, DataTable dt) { StringBuilder sbExplain = new StringBuilder(); StringBuilder sbExplainRed = new StringBuilder(); StringBuilder slExplain = new StringBuilder(); StringBuilder faleExplain = new StringBuilder(); string[] sMustJoinStaff = dv.Cells["sMustJoinStaff$2"].Value.ToString().Split('*'); foreach (string str in sMustJoinStaff) { string[] mustJoinStaff = str.Replace(")", "").Replace("(", "").Split(','); string huihe = mustJoinStaff[0]; string npcid = mustJoinStaff[1]; string zhenyin = mustJoinStaff[2]; string zyStr; string npcName = DataHelper.GetValue("BattleCharacterData", "Name", "CharID", npcid); if (zhenyin == "0") { zyStr = "我方"; sbExplain.AppendFormat("第{0}回合,{1}阵营,加入【{2}】", huihe, zyStr, npcName); sbExplain.Append("\r\n"); } else if (zhenyin == "1") { zyStr = "敌对"; sbExplainRed.AppendFormat("第{0}回合,{1}阵营,加入【{2}】", huihe, zyStr, npcName); sbExplainRed.Append("\r\n"); } else { zyStr = "中立"; sbExplain.AppendFormat("第{0}回合,{1}阵营,加入【{2}】", huihe, zyStr, npcName); sbExplain.Append("\r\n"); } } //胜利条件 int i = 0; string[] iVictory = dv.Cells["iVictory$4"].Value.ToString().Split('*'); foreach (string str in iVictory) { if (i != 0) { slExplain.Append(" 或 "); } i++; string[] victory = str.Replace(")", "").Replace("(", "").Split(','); if (victory[0] == "0" && victory[1] == "0" && victory[2] == "0") { slExplain.Append("对方全灭"); } else if (victory[0] == "1" && victory[1] != "0" && victory[2] == "0") { slExplain.AppendFormat("坚持{0}回合!", victory[1]); } else if (victory[0] == "0" && victory[1] != "0" && victory[2] == "0") { slExplain.AppendFormat("坚持{0}回合!", victory[1]); } else { slExplain.AppendFormat("弱鸡作者不明白{0}的意思", str); } } //失败条件 i = 0; string[] iFale = dv.Cells["iFale$5"].Value.ToString().Split('*'); foreach (string str in iFale) { if (i != 0) { faleExplain.Append(" 或 "); } i++; string[] victory = str.Replace(")", "").Replace("(", "").Split(','); if (victory[0] == "0" && victory[1] == "0" && victory[2] == "0") { faleExplain.Append("我方全灭"); } else if (victory[0] == "1" && victory[1] != "0" && victory[2] == "0") { faleExplain.AppendFormat("对方坚持了{0}回合!", victory[1]); } else if (victory[0] == "0" && victory[1] != "0" && victory[2] == "0") { faleExplain.AppendFormat("对方坚持了{0}回合!", victory[1]); } else { faleExplain.AppendFormat("弱鸡作者不明白{0}的意思", str); } } lblExplainRed.Text = sbExplainRed.ToString(); lblSl.Text = slExplain.ToString(); txtExplain.Text = sbExplain.ToString(); lblFale.Text = faleExplain.ToString(); DataRow[] drBa = DataHelper.XkfyData.Tables["RewardData"].Select($"iRID='{dv.Cells["sReward$6"].Value}'"); if (drBa.Length > 1) { return; } if (drBa.Length == 0) { txtWin.Text = $"数据有误,无法解析iRID={dv.Cells["sReward$6"].Value}"; return; } string[] sRewardData = drBa[0]["sRewardData"].ToString().Split('*'); txtWin.Text = tl.ExplainRewardData(sRewardData, dt); }