/// <summary> /// 创建随机组 /// </summary> /// <param name="sender">事件发送者</param> /// <param name="e">事件参数</param> private void buttonX5_Click(object sender, EventArgs e) { string groupName = textBoxX2.Text; if (groupName != "") { List <string> npcInfoList = new List <string>(); foreach (DataRow dataRow in BaseForm.npcTable.Rows) { npcInfoList.Add(string.Format("{0} ({1})", dataRow["Name"].ToString(), dataRow["ID"].ToString())); } RandomGroupConfigForm rForm = new RandomGroupConfigForm(npcInfoList); if (rForm.ShowDialog() == DialogResult.OK) { StringBuilder infoString = new StringBuilder(); foreach (string s in rForm.NpcTemplateIDList) { infoString.Append(string.Format("{0},", s)); } infoString.Remove(infoString.Length - 1, 1); baseDoc.DocLogical.DecoratedNewOneRandomGroup(groupName, infoString.ToString()); InitRandomGroup(); FillRandomGroup(); FillAllGroup(); // 自动为当前选中的对象设置分组 _AtlObjInfo objectInfo = randomGroupInfoList[randomGroupInfoList.Count - 1]; Hashtable infoTable = Helper.GetInfoTable(objectInfo); int groupID = int.Parse(infoTable["dwGroupID"] as string); SetGroup(groupID, GroupType.RandomGroup); MessageBox.Show("随机组创建成功!", "创建随机组", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("请先输入分组名称!", "创建随机组", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 创建随机组 /// </summary> /// <param name="sender">事件发送者</param> /// <param name="e">事件参数</param> private void buttonX5_Click(object sender, EventArgs e) { string groupName = textBoxX2.Text; if (groupName != "") { List<string> npcInfoList = new List<string>(); foreach (DataRow dataRow in BaseForm.npcTable.Rows) { npcInfoList.Add(string.Format("{0} ({1})", dataRow["Name"].ToString(), dataRow["ID"].ToString())); } RandomGroupConfigForm rForm = new RandomGroupConfigForm(npcInfoList); if (rForm.ShowDialog() == DialogResult.OK) { StringBuilder infoString = new StringBuilder(); foreach (string s in rForm.NpcTemplateIDList) { infoString.Append(string.Format("{0},", s)); } infoString.Remove(infoString.Length - 1, 1); baseDoc.DocLogical.DecoratedNewOneRandomGroup(groupName, infoString.ToString()); InitRandomGroup(); FillRandomGroup(); FillAllGroup(); // 自动为当前选中的对象设置分组 _AtlObjInfo objectInfo = randomGroupInfoList[randomGroupInfoList.Count - 1]; Hashtable infoTable = Helper.GetInfoTable(objectInfo); int groupID = int.Parse(infoTable["dwGroupID"] as string); SetGroup(groupID, GroupType.RandomGroup); MessageBox.Show("随机组创建成功!", "创建随机组", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("请先输入分组名称!", "创建随机组", MessageBoxButtons.OK, MessageBoxIcon.Information); } }