public void updata(theHero owner) { setSpaceNow(); setBurdenNow(); setMaxBurden(owner.getMaxBurden()); setMaxSpace(6 + getExtarRoom());//容量6==无背包 owner.setBurden(owner.getHeroBag().getBurdenNow()); if (getSpaceNow() > getMaxSpace()) { int count = 0, aim = getSpaceNow() - getMaxSpace(); for (int i = 0; i < itemArray.Count; i++) { if (((defaultItem)itemArray[i]).getIsEquited()) { continue; } if (count == aim) { break; } owner.getStandBlock().getItemInGround().Add(((defaultItem)itemArray[i])); owner.getMessageBox().Items.Add(((defaultItem)itemArray[i]).getName() + "掉在地上了!"); count++; itemArray.RemoveAt(i); i--; } } }
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); }