本文整理汇总了C#中Item类的典型用法代码示例。如果您正苦于以下问题:C# Item类的具体用法?C# Item怎么用?C# Item使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Item类属于命名空间,在下文中一共展示了Item类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadRepositoryXml
public static void LoadRepositoryXml(string filePath, ContentManager content)
{
XmlDocument document = new XmlDocument();
document.Load(filePath);
foreach (XmlNode itemNode in document.SelectNodes("ItemRepository/Item"))
{
Item item = new Item();
item.Name = XmlExtensions.GetAttributeValue(itemNode, "Name", null, true);
item.FriendlyName = itemNode.SelectSingleNode("FriendlyName").InnerText;
item.Description = itemNode.SelectSingleNode("Description").InnerText;
item.Weight = XmlExtensions.GetAttributeValue<float>(itemNode, "Weight", 0);
item.ItemType = (ItemType)Enum.Parse(typeof(ItemType), XmlExtensions.GetAttributeValue(itemNode, "ItemType", null, true));
foreach(XmlNode drawableSetNode in itemNode.SelectNodes("Drawables/Drawable"))
{
string src = XmlExtensions.GetAttributeValue(drawableSetNode, "src");
DrawableSet.LoadDrawableSetXml(item.Drawables, src, content);
}
if (itemNode.SelectSingleNode("Icon") != null)
item.Icon = content.Load<Texture2D>(XmlExtensions.GetAttributeValue(itemNode.SelectSingleNode("Icon"), "src"));
GameItems.Add(item.Name, item);
}
}
示例2: StartGift
/// <summary>
/// Starts a new session and calls Gift.
/// </summary>
/// <param name="target"></param>
/// <param name="creature"></param>
/// <param name="gift"></param>
public void StartGift(NPC target, Creature creature, Item gift)
{
if (!this.Start(target, creature))
return;
this.Script.GiftAsync(gift);
}
示例3: Fuma
public Fuma() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
Name = "Fuma";
Body = 400;
Female = false;
SetStr( 536, 585 );
SetDex( 126, 145 );
SetInt( 281, 305 );
SetHits( 322, 351 );
SetDamage( 13, 16 );
SetDamageType( ResistanceType.Physical, 100 );
SetResistance( ResistanceType.Physical, 35, 45 );
SetResistance( ResistanceType.Fire, 30, 40 );
SetResistance( ResistanceType.Cold, 25, 35 );
SetResistance( ResistanceType.Poison, 30, 40 );
SetResistance( ResistanceType.Energy, 30, 40 );
SetSkill( SkillName.EvalInt, 85.1, 100.0 );
SetSkill( SkillName.Magery, 85.1, 100.0 );
SetSkill( SkillName.MagicResist, 80.2, 110.0 );
SetSkill( SkillName.Tactics, 60.1, 80.0 );
SetSkill( SkillName.Wrestling, 40.1, 50.0 );
Fame = 15000;
Karma = -15000;
VirtualArmor = 40;
Item hair = new Item( Utility.RandomList( 0x203B, 0x2049, 0x2048, 0x204A ) );
hair.Hue = Utility.RandomHairHue();
hair.Layer = Layer.Hair;
hair.Movable = false;
AddItem( hair );
NinjaTabi ninjatabi = new NinjaTabi();
ninjatabi.Hue = 0x1;
AddItem( ninjatabi );
LeatherNinjaPants ninjapants = new LeatherNinjaPants();
ninjapants.Hue = 1;
AddItem(ninjapants);
LeatherNinjaJacket ninjajacket = new LeatherNinjaJacket();
ninjajacket.Hue = 1;
AddItem(ninjajacket);
LeatherJingasa jingasa = new LeatherJingasa();
jingasa.Hue = 1;
AddItem(jingasa);
}
示例4: Dueller
public Dueller()
: base("The DuelMaster")
{
InitStats(100, 100, 25);
Hue = Utility.RandomSkinHue();
Female = false;
Direction = Direction.Down;
Body = 0x190;
Name = NameList.RandomName("male");
Title = "The DuelMaster";
AddItem(new Tunic(0x48D));
AddItem(new LongPants(0x48D));
AddItem(new SkullCap(0x48D));
AddItem(new Boots());
Item hair = new Item(Utility.RandomList(0x203B, 0x203C, 0x203D, 0x2044, 0x2045, 0x2047, 0x2049, 0x204A));
hair.Hue = Utility.RandomHairHue();
hair.Layer = Layer.Hair;
hair.Movable = false;
AddItem(hair);
Locations = new Point3D[10];
DuelSystem.Duellers.Add(this);
}
示例5: TryDropItem
public override bool TryDropItem(Mobile from, Item dropped, bool sendFullMessage)
{
if (!this.CheckHold(from, dropped, sendFullMessage, true))
return false;
BaseHouse house = BaseHouse.FindHouseAt(this);
if (house != null && house.IsLockedDown(this))
{
if (dropped is VendorRentalContract || (dropped is Container && ((Container)dropped).FindItemByType(typeof(VendorRentalContract)) != null))
{
from.SendLocalizedMessage(1062492); // You cannot place a rental contract in a locked down container.
return false;
}
if (!house.LockDown(from, dropped, false))
return false;
}
List<Item> list = this.Items;
for (int i = 0; i < list.Count; ++i)
{
Item item = list[i];
if (!(item is Container) && item.StackWith(from, dropped, false))
return true;
}
this.DropItem(dropped);
ItemFlags.SetTaken(dropped, true);
return true;
}
示例6: CheckItemUse
public override bool CheckItemUse(Mobile from, Item item)
{
if (this.IsDecoContainer && item is BaseBook)
return true;
return base.CheckItemUse(from, item);
}
示例7: OnDragDropInto
public override bool OnDragDropInto( Mobile from, Item dropped, Point3D point )
{
BasePiece piece = dropped as BasePiece;
if ( piece != null && piece.Board == this && base.OnDragDropInto( from, dropped, point ) )
{
Packet p = new PlaySound( 0x127, GetWorldLocation() );
p.Acquire();
if ( RootParent == from )
{
from.Send( p );
}
else
{
foreach ( NetState state in this.GetClientsInRange( 2 ) )
state.Send( p );
}
p.Release();
return true;
}
else
{
return false;
}
}
示例8: OnMoveOver
public override bool OnMoveOver( Mobile m )
{
if ( m == null || m.Deleted || m.Backpack == null || m.Backpack.Deleted )
return true;
if ( Active && m_itemType != null )
{
if ( !Creatures && !m.Player )
return true;
m_item = m.Backpack.FindItemByType(m_itemType, true);
if ( m_item != null )
{
StartTeleport(m);
return false;
}
else
{
if ( m_Message != null && m != null)
m.SendMessage(m_Message);
}
}
return true;
}
示例9: Inventory
public Inventory(int SCREEN_WIDTH, int SCREEN_HEIGHT, Pantheon gameReference)
{
locationBoxes = new List<Rectangle>();
equippedBoxes = new List<Rectangle>();
types = new List<int>();
infoBox = new Rectangle();
movingBox = new Rectangle();
trashBox = new Rectangle();
tempStorage = new Item();
this.SCREEN_WIDTH = SCREEN_WIDTH;
this.SCREEN_HEIGHT = SCREEN_HEIGHT;
SetBoxes();
selected = -1;
hoveredOver = -1;
color = new Color(34, 167, 222, 50);
trashColor = Color.White;
inventorySelector = gameReference.Content.Load<Texture2D>("Inventory/InvSelect");
trashCan = gameReference.Content.Load<Texture2D>("Inventory/TrashCan");
nullImage = new Texture2D(gameReference.GraphicsDevice, 1,1);
nullImage.SetData(new[] { new Color(0,0,0,0) });
}
示例10: ProcessCreate
// Process a new item that is being created
// Extracts the intent based on ItemType and extends as FieldValue on Item
// return true to indicate to sub-classes that processing is complete
public virtual bool ProcessCreate(Item item)
{
var intent = ExtractIntent(item);
if (intent != null)
CreateIntentFieldValue(item, intent);
return false;
}
示例11: getDropdown
public List<Item> getDropdown(string type)
{
List<Item> list = new List<Item>();
string dropdownFirst = "";
dropDownType review;
if (!Enum.TryParse(type, out review))
{
//throw bad enum parse
}
switch (review)
{
case dropDownType.PROVINCE:
list = getProvinces(dropDownType.PROVINCE);
dropdownFirst = "เลือกจังหวัด";
break;
case dropDownType.PROVINCEGOID:
list = getProvinces(dropDownType.PROVINCEGOID);
dropdownFirst = "เลือกจังหวัด";
break;
}
Item firstList = new Item();
firstList.value = "0";
firstList.name = "-- " + dropdownFirst + " --";
list.Insert(0, firstList);
return list;
}
示例12: ResurrectEntry
public ResurrectEntry( Mobile mobile, Item item ) : base( 6195, ResurrectRange )
{
m_Mobile = mobile;
m_Item = item;
Enabled = !m_Mobile.Alive;
}
示例13: IsEqual
public virtual bool IsEqual(Item item)
{
if (type != item.type) { return false; }
if (name.CompareTo(item.name) != 0) { return false; }
if (tradeAs != item.tradeAs) { return false; }
if (fullGround != item.fullGround) { return false; }
if (isAnimation != item.isAnimation) { return false; }
if (alwaysOnTop != item.alwaysOnTop) { return false; }
if (alwaysOnTopOrder != item.alwaysOnTopOrder) { return false; }
if (isUnpassable != item.isUnpassable) { return false; }
if (blockPathfinder != item.blockPathfinder) { return false; }
if (blockMissiles != item.blockMissiles) { return false; }
if (groundSpeed != item.groundSpeed) { return false; }
if (hasElevation != item.hasElevation) { return false; }
if (multiUse != item.multiUse) { return false; }
if (isHangable != item.isHangable) { return false; }
if (isHorizontal != item.isHorizontal) { return false; }
if (isVertical != item.isVertical) { return false; }
if (isMoveable != item.isMoveable) { return false; }
if (isPickupable != item.isPickupable) { return false; }
if (isReadable != item.isReadable) { return false; }
if (isRotatable != item.isRotatable) { return false; }
if (isStackable != item.isStackable) { return false; }
if (lightColor != item.lightColor) { return false; }
if (lightLevel != item.lightLevel) { return false; }
if (ignoreLook != item.ignoreLook) { return false; }
if (maxReadChars != item.maxReadChars) { return false; }
if (maxReadWriteChars != item.maxReadWriteChars) { return false; }
if (minimapColor != item.minimapColor) { return false; }
return true;
}
示例14: GetItemPriceModel
/// <summary>
/// Gets the item price model.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="lowestPrice">The lowest price.</param>
/// <param name="tags">Additional tags for promotion evaluation</param>
/// <returns>price model</returns>
/// <exception cref="System.ArgumentNullException">item</exception>
public PriceModel GetItemPriceModel(Item item, Price lowestPrice, Hashtable tags)
{
if (item == null)
{
throw new ArgumentNullException("item");
}
if (lowestPrice == null)
{
return new PriceModel();
}
var price = lowestPrice.Sale ?? lowestPrice.List;
var discount = _client.GetItemDiscountPrice(item, lowestPrice, tags);
var priceModel = CreatePriceModel(price, price - discount, UserHelper.CustomerSession.Currency);
priceModel.ItemId = item.ItemId;
//If has any variations
/* performance too slow with this method, need to store value on indexing instead
if (CatalogHelper.CatalogClient.GetItemRelations(item.ItemId).Any())
{
priceModel.PriceTitle = "Starting from:".Localize();
}
* */
return priceModel;
}
示例15: Equip
//Equips the item you click
public static void Equip(Item item)
{
Item prevItem;
if(item.itemType == Item.ItemType.Armor)
{
if(CharacterWindow.itemHead == null)
{
CharacterWindow.itemHead = item;
}
else
{
prevItem = CharacterWindow.itemHead;
Inventory.AddItem(prevItem.itemID);
CharacterWindow.itemHead = item;
print ("" + CharacterWindow.itemHead.itemName);
}
}
if(item.itemType == Item.ItemType.Weapon)
{
if(CharacterWindow.itemWeapon == null)
{
CharacterWindow.itemWeapon = item;
}
else
{
prevItem = CharacterWindow.itemWeapon;
Inventory.AddItem(prevItem.itemID);
CharacterWindow.itemWeapon = item;
print ("" + CharacterWindow.itemWeapon.itemName);
}
}
}