private void bindAll() { #region 绑定元素 cboAE1.DataSource = GGCRUtil.ListActEarch(); cboAE2.DataSource = GGCRUtil.ListActEarch(); cboAE3.DataSource = GGCRUtil.ListActEarch(); cboAE4.DataSource = GGCRUtil.ListActEarch(); cboAE5.DataSource = GGCRUtil.ListActEarch(); cboAE1.DisplayMember = "Value"; cboAE2.DisplayMember = "Value"; cboAE3.DisplayMember = "Value"; cboAE4.DisplayMember = "Value"; cboAE5.DisplayMember = "Value"; cboAE1.ValueMember = "Key"; cboAE2.ValueMember = "Key"; cboAE3.ValueMember = "Key"; cboAE4.ValueMember = "Key"; cboAE5.ValueMember = "Key"; cboMpLimit.DataSource = GGCRUtil.ListWeaponMPLimit(); cboMpLimit.DisplayMember = "Value"; cboMpLimit.ValueMember = "Key"; List <KeyValuePair <string, string> > specList = gundamFile.ListWeaponSpec(); specList.Insert(0, new KeyValuePair <string, string>("0", "无")); cboSpec.DataSource = specList; cboSpec.DisplayMember = "Value"; cboSpec.ValueMember = "Key"; cboRange.DataSource = GGCRUtil.ListWeaponRange(); cboRange.DisplayMember = "Value"; cboRange.ValueMember = "Key"; cboWeaponType.DataSource = GGCRUtil.ListWeaponType(); cboWeaponType.DisplayMember = "Value"; cboWeaponType.ValueMember = "Key"; #endregion }
private void FrmEditGundam_Load(object sender, EventArgs e) { List <short> limit = null; if (gundamInfo != null) { limit = new List <short>(); short wid = gundamInfo.WeaponId; if (wid >= 0 && gundamInfo.WeaponCount > 0) { for (short i = 0; i < gundamInfo.WeaponCount; i++) { limit.Add((short)(wid + i)); } } short map = gundamInfo.WeaponMapID; if (map >= 0 && gundamInfo.WeaponMapCount > 0) { for (short i = 0; i < gundamInfo.WeaponMapCount; i++) { limit.Add((short)(map + i + gundamFile.WeaponNormalCount)); } } } bindAll(); weapons = new List <WeaponInfo>(); List <WeaponInfo> allWeapons = gundamFile.ListWeapons(); List <KeyValuePair <string, string> > ranges = GGCRUtil.ListWeaponRange(); Dictionary <short, WeaponInfo> noranges = new Dictionary <short, WeaponInfo>(); foreach (WeaponInfo w in allWeapons) { if (limit == null || limit.Contains(w.ID)) { weapons.Add(w); } bool find = false; foreach (KeyValuePair <string, string> rngs in ranges) { if (rngs.Key == w.Range.ToString()) { find = true; break; } } if (!find) { if (!noranges.ContainsKey(w.Range)) { noranges.Add(w.Range, w); } } } foreach (KeyValuePair <short, WeaponInfo> kv in noranges) { GGCRUtil.AddWeaponRange(kv.Key, kv.Key + " " + (kv.Value.IsMap ? ("MAP " + kv.Value.UnitName) : ("普通 " + kv.Value.UnitName))); } bindAll(); lsGundam.DataSource = weapons; lsGundam.DisplayMember = "UnitName"; lsGundam.ValueMember = "Address"; }