public bool isBurden(defaultItem item) { if (getBurdenNow() + item.getWeight() > getMaxBurden()) { return(true); } else { return(false); } }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (listBox1.SelectedItems.Count > 0) { index = listBox1.SelectedIndex; selectedItem = (defaultItem)(listBox2.Items[index]); } else { selectedItem = null; } }
public void moveOneItemBagToBlock() { if (getHeroBagList().SelectedItems.Count > 0) { int index = getHeroBagList().SelectedIndex; selectedItem = (defaultItem)(getHeroBagListTrue().Items[index]); getHeroBagList().Items.RemoveAt(index); getHeroBagListTrue().Items.RemoveAt(index); getHero().getHeroBag().DestoryAnItem(selectedItem); getTheBlock().getItemInGround().Add(selectedItem); } else { return; } }
private void listBox1_MouseDown(object sender, MouseEventArgs e) { if (listBox1.Items.Count == 0) { return; } if (listBox1.SelectedItem == null) { return; } else { index = listBox1.SelectedIndex; selectedItem = (defaultItem)(listBox2.Items[index]); DragDropEffects dde1 = DoDragDrop(selectedItem, DragDropEffects.All); } }
public void moveAllItemBlockToBag() { if (getBlockItemList().Items.Count > 0) { for (int i = 0; i < getBlockItemList().Items.Count; i++) { getHero().getHeroBag().updata(getHero()); if (getHero().getHeroBag().isOutOfSpace()) { return; } selectedItem = (defaultItem)getBlockItemListTrue().Items[i]; getHero().getHeroBag().addOneItem(selectedItem); getTheBlock().getItemInGround().Remove(selectedItem); } } }
public void addOneItem(defaultItem item) { if (item == null) { return; } if (isBurden(item)) { owner.getMessageBox().Items.Add("超重啦,不能拿下" + item.getName() + "啦"); //System.Console.WriteLine("超重啦,不能拿下" + item.getName() + "啦"); return; } if (isOutOfSpace()) { owner.getMessageBox().Items.Add("背包放不下啦,不能拿下" + item.getName() + "啦"); //System.Console.WriteLine("背包放不下啦,不能拿下" + item.getName() + "啦"); return; } itemArray.Add(item); }
private void setNull() { q.Text = ""; q.Tag = nullItem; w.Text = ""; w.Tag = nullItem; e.Text = ""; e.Tag = nullItem; a.Text = ""; a.Tag = nullItem; s.Text = ""; s.Tag = nullItem; d.Text = ""; d.Tag = nullItem; z.Text = ""; z.Tag = nullItem; x.Text = ""; x.Tag = nullItem; c.Text = ""; c.Tag = nullItem; selectedItem = null; }
public void moveOneItemBlockToBag() { getHero().getHeroBag().updata(getHero()); if (getHero().getHeroBag().isOutOfSpace()) { return; } if (getBlockItemList().SelectedItems.Count > 0) { int index = getBlockItemList().SelectedIndex; selectedItem = (defaultItem)getBlockItemListTrue().Items[index]; getBlockItemList().Items.RemoveAt(index); getBlockItemListTrue().Items.RemoveAt(index); getHeroBagList().Items.Add(selectedItem.getName()); getHeroBagListTrue().Items.Add(selectedItem); getHero().getHeroBag().addOneItem(selectedItem); getTheBlock().getItemInGround().Remove(selectedItem); } else { return; } }
//显示数据 private void showItemInfo(defaultItem item) { itemName.Text = item.getName(); itemLevel.Text = item.getLevel() + "级"; itemEnduranceBar.Maximum = (int)item.getMaxEndurance(); itemEnduranceBar.Value = (int)item.getEndurance(); itemEnduranceShow.Text = (int)item.getEndurance() + "/" + (int)item.getMaxEndurance(); itemCost.Text = item.getCost() + "元"; itemDescribe.Text = item.getDescribe(); itemEffectDescribe.Text = item.getEffecDescribe(); itemType.Text = tl.ItemTypeToString(item.getType()); itemWeight.Text = item.getWeight() + "千克"; switch (item.getType()) { case 1: { DIYLabel_1.Text = "新鲜程度:" + item.getQualityIndex() + "%"; break; } case 2: { DIYLabel_1.Text = "攻击力:" + item.getMinDamage() + "~" + item.getMaxDamage() + "\n魔法攻击力:" + item.getMinMagicDamage() + "~" + item.getMaxMagicDamage() + "\n命中率:" + item.getHitRate() + "%" + "\n暴击率:" + item.getGreatDamageRate(); break; } case 3: { DIYLabel_1.Text = "容量:" + item.getRoom(); break; } case 4: { DIYLabel_1.Text = "攻击力:" + item.getMinDamage() + "~" + item.getMaxDamage() + "\n魔法攻击力:" + item.getMinMagicDamage() + "~" + item.getMaxMagicDamage() + "\n命中率:" + item.getHitRate() + "%" + "\n暴击率:" + item.getGreatDamageRate(); break; } } }
public void updata() { getBlockItemList().Items.Clear(); getBlockItemListTrue().Items.Clear(); getHeroBagList().Items.Clear(); getHeroBagListTrue().Items.Clear(); for (int i = 0; i < getTheBlock().getItemInGround().Count; i++) { selectedItem = (defaultItem)(getTheBlock().getItemInGround()[i]); getBlockItemList().Items.Add(selectedItem.getName()); getBlockItemListTrue().Items.Add(selectedItem); } for (int i = 0; i < getHero().getHeroBag().getItemArrayCount(); i++) { if (((defaultItem)getHero().getHeroBag().getItemArray()[i]).getIsEquited()) { continue; } selectedItem = (defaultItem)getHero().getHeroBag().getItemArray()[i]; getHeroBagList().Items.Add(selectedItem.getName()); getHeroBagListTrue().Items.Add(selectedItem); } getHero().getHeroBag().updata(getHero()); }
public void setTakenRing(defaultItem takenRing) { this.takenRing = takenRing; }
public void setTakenGlove(defaultItem takenGlove) { this.takenGlove = takenGlove; }
public void addAnItemToPreList(defaultItem item) { getPreCraftItemList().Add(item); }
public void removeAnItemFromPreList(defaultItem item) { getPreCraftItemList().Remove(item); }
public void setTakenBelt(defaultItem takenBelt) { this.takenBelt = takenBelt; }
public void setTakenPocked(defaultItem takenPocked) { this.takenPocked = takenPocked; }
public void DestoryAnItem(defaultItem item) { HDI.DestoryAnItem(owner, item, itemArray); updata(owner); }
public void setTakenShoes(defaultItem takenShoes) { this.takenShoes = takenShoes; }
public void setTakenNecklace(defaultItem takenNecklace) { this.takenNecklace = takenNecklace; }
//当选择的物品改变 private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (this.listBox1.SelectedItems.Count > 0) { //获取选中的物品,根据物品的特性选择显示按钮 //TODO 代码量太大,可以实现简单的函数来控制按钮的显示与否 int index = this.listBox1.SelectedIndex; selectedItem = (defaultItem)listBox2.Items[index]; showItemInfo(selectedItem); switch (selectedItem.getType()) { case 1: { UseButton.Visible = true; EquipButton.Visible = false; break; } case 2: { UseButton.Visible = true; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 3: { UseButton.Visible = false; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 4: { UseButton.Visible = false; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 5: { UseButton.Visible = false; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 6: { UseButton.Visible = false; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 7: { UseButton.Visible = false; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 8: { UseButton.Visible = false; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 9: { UseButton.Visible = false; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 10: { UseButton.Visible = false; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 11: { UseButton.Visible = false; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 12: { UseButton.Visible = false; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 13: { UseButton.Visible = false; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 14: { UseButton.Visible = false; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 15: { UseButton.Visible = false; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 16: { UseButton.Visible = false; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 17: { UseButton.Visible = false; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 18: { UseButton.Visible = false; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 19: { UseButton.Visible = false; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 20: { UseButton.Visible = false; EquipButton.Visible = true; if (selectedItem.getIsEquited()) { EquipButton.Text = "卸下"; } else { EquipButton.Text = "装备"; } break; } case 21: { UseButton.Visible = false; EquipButton.Visible = false; break; } case 22: { UseButton.Visible = false; EquipButton.Visible = false; break; } } } else { } }
public void setTakenSign(defaultItem takenSign) { this.takenSign = takenSign; }
public bool addOneItem(defaultItem item) { theHeroBag.addOneItem(item); return(true); }
public void setTakeInHand(defaultItem takeInHand) { this.takeInHand = takeInHand; }
public void setTakenEarplug(defaultItem takenEarplug) { this.takenEarplug = takenEarplug; }
public void setTakenMask(defaultItem takenMask) { this.takenMask = takenMask; }
public void DestoryAnItem(theHero owner, defaultItem item, ArrayList itemArray) { int i = itemArray.IndexOf(item); itemArray.RemoveAt(i); if (item.getIsEquited()) { switch (item.getType()) { case 2: { if (owner.getHero_LeftHand().getTakeInHand() == item) { owner.getHero_LeftHand().setTakeInHand(null); owner.getHero_LeftHand().setIsEquipedSomething(false); } else { owner.getHero_RightHand().setTakeInHand(null); owner.getHero_RightHand().setIsEquipedSomething(false); } break; } case 3: { if (owner.getHero_LeftHand().getTakeInHand() == item) { owner.getHero_LeftHand().setTakeInHand(null); owner.getHero_LeftHand().setIsEquipedSomething(false); } else { owner.getHero_RightHand().setTakeInHand(null); owner.getHero_RightHand().setIsEquipedSomething(false); } break; } case 4: { if (owner.getHero_LeftHand().getTakeInHand() == item && owner.getHero_RightHand().getTakeInHand() == item) { owner.getHero_LeftHand().setTakeInHand(null); owner.getHero_LeftHand().setIsEquipedSomething(false); owner.getHero_RightHand().setTakeInHand(null); owner.getHero_RightHand().setIsEquipedSomething(false); } break; } case 5: { if (owner.getHero_Web().getTakenBelt() == item) { owner.getHero_Web().setTakenBelt(null); owner.getHero_Web().setIsEquipBelt(false); } break; } case 6: { if (owner.getHero_Chest().getTakenCloth() == item) { owner.getHero_Chest().setTakenCloth(null); owner.getHero_Chest().setIsEquipedCloth(false); } break; } case 7: { if (owner.getHero_Chest().getTakenCloth() == item) { owner.getHero_Chest().setTakenCloth(null); owner.getHero_Chest().setIsEquipedCloth(false); } break; } case 8: { if (owner.getHero_Head().getTakenGlass() == item) { owner.getHero_Head().setTakenGlass(null); owner.getHero_Head().setIsEquipedGlass(false); } break; } case 9: { if (owner.getHero_LeftHand().getTakenGlove() == item && owner.getHero_RightHand().getTakenGlove() == item) { owner.getHero_LeftHand().setTakenGlove(null); owner.getHero_LeftHand().setIsEquipedGlove(false); owner.getHero_RightHand().setTakenGlove(null); owner.getHero_RightHand().setIsEquipedGlove(false); } break; } case 10: { if (owner.getHero_Head().getTakenHat() == item) { owner.getHero_Head().setTakenHat(null); owner.getHero_Head().setIsEquipedHat(false); } break; } case 11: { if (owner.getHero_Head().getTakenMask() == item) { owner.getHero_Head().setTakenMask(null); owner.getHero_Head().setIsEquipedMask(false); } break; } case 12: { if (owner.getHero_Neck().getTakenNecklace() == item) { owner.getHero_Neck().setTakenNecklace(null); owner.getHero_Neck().setIsEquipedNecklace(false); } break; } case 13: { if (owner.getHero_Chest().getTakenBackpack() == item) { owner.getHero_Chest().setTakenBackpack(null); owner.getHero_Chest().setIsEquipedBackpack(false); } break; } case 14: { if (owner.getHero_LeftLeg().getTakenPants() == item && owner.getHero_RightLeg().getTakenPants() == item) { owner.getHero_LeftLeg().setTakenPants(null); owner.getHero_LeftLeg().setIsEquipedPants(false); owner.getHero_RightLeg().setTakenPants(null); owner.getHero_RightLeg().setIsEquipedPants(false); } break; } case 15: { if (owner.getHero_Web().getTakenPocked() == item) { owner.getHero_Web().setTakenPocked(null); owner.getHero_Web().setIsEquipPocked(false); } break; } case 16: { if (owner.getHero_LeftHand().getTakenRing() == item) { owner.getHero_LeftHand().setTakenRing(null); owner.getHero_LeftHand().setIsEquipedRing(false); } else { owner.getHero_RightHand().setTakenRing(null); owner.getHero_RightHand().setIsEquipedRing(false); } break; } case 17: { if (owner.getHero_LeftFoot().getTakenShoes() == item && owner.getHero_RightFoot().getTakenShoes() == item) { owner.getHero_LeftFoot().setTakenShoes(null); owner.getHero_LeftFoot().setIsEquipedShoes(false); owner.getHero_RightFoot().setTakenShoes(null); owner.getHero_RightFoot().setIsEquipedShoes(false); } break; } case 18: { if (owner.getHero_LeftArm().getTakenSign() == item) { owner.getHero_LeftArm().setTakenSign(null); owner.getHero_LeftArm().setIsEquipedSign(false); } else { owner.getHero_RightArm().setTakenSign(null); owner.getHero_RightArm().setIsEquipedSign(false); } break; } case 19: { if (owner.getHero_Chest().getTakenSign() == item) { owner.getHero_Chest().setTakenSign(null); owner.getHero_Chest().setIsEquipedSign(false); } break; } case 20: { if (owner.getHero_LeftFoot().getTakenStock() == item && owner.getHero_RightFoot().getTakenStock() == item) { owner.getHero_LeftFoot().setTakenStock(null); owner.getHero_LeftFoot().setIsEquipedStock(false); owner.getHero_RightFoot().setTakenStock(null); owner.getHero_RightFoot().setIsEquipedStock(false); } break; } } } }
public void setTakenHat(defaultItem takenHat) { this.takenHat = takenHat; }
public void setTakenStock(defaultItem takenStock) { this.takenStock = takenStock; }
public void setTakenPants(defaultItem takenPants) { this.takenPants = takenPants; }
public void setTakenGlass(defaultItem takenGlass) { this.takenGlass = takenGlass; }