/// <summary> /// 添加按钮响应 /// </summary> protected void addButton_Click(object sender, EventArgs e) { mw.Enums.RandType type = (mw.Enums.RandType) int.Parse(this.randTypeDropDownList.SelectedValue); if (this.configListBox.Items.Count >= LuckDraw.GetRandTypeLimit(type)) { return; } mw.RandConfig config = new mw.RandConfig(); config.rand_type = (mw.Enums.RandType) int.Parse(this.randTypeDropDownList.SelectedValue); if (!this.UpdateConfig(config)) { return; } config.index = this.CreateIndex(); RandTable.RandList.Add(config); TableManager.Save(RandTable.RandList); string text = this.GetConfigText(config); this.configListBox.Items.Add(new ListItem(text, text + this.configListBox.Items.Count)); this.addButton.Enabled = this.configListBox.Items.Count < LuckDraw.GetRandTypeLimit(type); }
/// <summary> /// 刷新商店列表 /// </summary> private void RefreshRandList() { mw.Enums.RandType type = (mw.Enums.RandType) int.Parse(this.randTypeDropDownList.SelectedValue); this.rewardTypeDropDownList.Items.Clear(); if (type == mw.Enums.RandType.RAND_TYPE_LUCK) { this.rewardTypeDropDownList.Items.Add(new ListItem("碎片", ((int)mw.Enums.RewardType.RWD_TYPE_CHIP).ToString())); this.minCountTextBox.Visible = true; this.certainlyLabel.Visible = false; this.counterIndexTextBox.Visible = false; this.counterValueTextBox.Visible = false; } else { //this.rewardTypeDropDownList.Items.Add(new ListItem("经济", ((int)mw.Enums.RewardType.RWD_TYPE_ECONOMIC).ToString())); this.rewardTypeDropDownList.Items.Add(new ListItem("物品", ((int)mw.Enums.RewardType.RWD_TYPE_ITEM).ToString())); this.rewardTypeDropDownList.Items.Add(new ListItem("卡牌", ((int)mw.Enums.RewardType.RWD_TYPE_CARD).ToString())); this.rewardTypeDropDownList.Items.Add(new ListItem("碎片", ((int)mw.Enums.RewardType.RWD_TYPE_CHIP).ToString())); this.rewardTypeDropDownList.Items.Add(new ListItem("宠物", ((int)mw.Enums.RewardType.RWD_TYPE_PET).ToString())); this.minCountTextBox.Visible = false; this.certainlyLabel.Visible = true; this.counterIndexTextBox.Visible = true; this.counterValueTextBox.Visible = true; } if (type == mw.Enums.RandType.RAND_TYPE_YUANBAO_ACTIVITY) { this.limitTextBox.Visible = true; this.minTextBox.Visible = false; this.maxTextBox.Visible = false; this.numberLabel.Text = "限制购买次数"; } else { this.limitTextBox.Visible = false; this.minTextBox.Visible = true; this.maxTextBox.Visible = true; this.numberLabel.Text = "随机范围"; } this.configListBox.Items.Clear(); for (int i = 0; i < RandTable.RandList.Count;) { mw.RandConfig config = RandTable.RandList[i]; if (config.rand_type != type) { ++i; continue; } if (this.configListBox.Items.Count < LuckDraw.GetRandTypeLimit(type)) { string text = this.GetConfigText(config); this.configListBox.Items.Add(new ListItem(text, text + this.configListBox.Items.Count)); ++i; } else { RandTable.RandList.RemoveAt(i); } } this.addButton.Enabled = this.configListBox.Items.Count < LuckDraw.GetRandTypeLimit(type); this.UpdateRewordId(); }