/// <summary> /// 配置列表选中改变响应 /// </summary> protected void configListBox_SelectedIndexChanged(object sender, EventArgs e) { if (this.configListBox.SelectedIndex < 0) { return; } mw.RandConfig config = RandTable.GetConfig(this.configListBox.SelectedIndex, (mw.Enums.RandType) int.Parse(this.randTypeDropDownList.SelectedValue)); if (config == null) { return; } for (int i = 0; i < this.rewardTypeDropDownList.Items.Count; ++i) { if (this.rewardTypeDropDownList.Items[i].Value == ((int)config.reward_idx).ToString()) { this.rewardTypeDropDownList.SelectedIndex = i; break; } } this.UpdateRewordId(); for (int i = 0; i < this.idDropDownList.Items.Count; ++i) { if (this.idDropDownList.Items[i].Value == config.reward_type.ToString()) { this.idDropDownList.SelectedIndex = i; break; } } if (config.reward_count > 0) { this.minCountTextBox.Text = config.reward_count.ToString(); this.countTextBox.Text = config.reward_count.ToString(); } else { this.minCountTextBox.Text = config.reward_min_count.ToString(); this.countTextBox.Text = config.reward_max_count.ToString(); } if (config.rand_type != mw.Enums.RandType.RAND_TYPE_LUCK) { this.counterIndexTextBox.Text = config.check_idx.ToString(); this.counterValueTextBox.Text = config.limit_count.ToString(); } this.limitTextBox.Text = config.limit_count.ToString(); this.minTextBox.Text = config.min_rand.ToString(); this.maxTextBox.Text = config.max_rand.ToString(); }
/// <summary> /// 获取配置 /// </summary> /// <param name="index">配置索引</param> /// <param name="type">商城类型</param> /// <returns>配置</returns> public static mw.RandConfig GetConfig(int index, mw.Enums.RandType type) { int realIndex = RandTable.GetRealIndex(index, type); if (realIndex >= 0) { return(RandTable.RandList[realIndex]); } else { return(null); } }
/// <summary> /// 删除按钮响应 /// </summary> protected void deleteButton_Click(object sender, EventArgs e) { if (this.configListBox.SelectedIndex < 0) { return; } mw.Enums.RandType type = (mw.Enums.RandType) int.Parse(this.randTypeDropDownList.SelectedValue); RandTable.RandList.RemoveAt(RandTable.GetRealIndex(this.configListBox.SelectedIndex, type)); this.configListBox.Items.RemoveAt(this.configListBox.SelectedIndex); TableManager.Save(RandTable.RandList); this.addButton.Enabled = this.configListBox.Items.Count < Mall.GetRandTypeLimit(type); }
/// <summary> /// 修改按钮响应 /// </summary> protected void modifyButton_Click(object sender, EventArgs e) { if (this.configListBox.SelectedIndex < 0) { return; } mw.RandConfig config = RandTable.GetConfig(this.configListBox.SelectedIndex, (mw.Enums.RandType) int.Parse(this.randTypeDropDownList.SelectedValue)); if (!this.UpdateConfig(config)) { return; } TableManager.Save(RandTable.RandList); this.configListBox.SelectedItem.Text = this.GetConfigText(config); this.configListBox.SelectedItem.Value = this.configListBox.SelectedItem.Text + this.configListBox.SelectedIndex; }