本文整理汇总了C#中Server.Item类的典型用法代码示例。如果您正苦于以下问题:C# Item类的具体用法?C# Item怎么用?C# Item使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Item类属于Server命名空间,在下文中一共展示了Item类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public bool Update(Item oldItem, Item newItem)
{
try
{
_ctx.Entry(oldItem).CurrentValues.SetValues(newItem);
return true;
}
catch
{
return false;
}
}
示例2: Insert
public bool Insert(Item item)
{
try
{
_ctx.Items.Add(item);
return true;
}
catch
{
return false;
}
}
示例3: Delete
public bool Delete(Item item)
{
try
{
_ctx.Items.Remove(item);
return true;
}
catch
{
return false;
}
}
示例4: AddProperties
public virtual void AddProperties(Item item)
{
if (item == null || item.Deleted)
{
return;
}
if (User.IsOnline())
{
item.SendInfoTo(User.NetState, true);
}
AddProperties(item.Serial);
}
示例5: OnDragDrop
public override bool OnDragDrop(Mobile from, Item trashed)
{
if (from == null || trashed == null || trashed.Deleted || !IsAccessibleTo(from))
{
return false;
}
if (this.IsBound() && !this.IsBoundTo(from))
{
from.SendMessage(0x22, "That does not belong to you.");
return false;
}
if (!this.IsBoundTo(from))
{
this.CheckBinding(
from,
r =>
{
switch (r)
{
case ItemBindResult.NoAccess:
{
from.SendMessage(0x22, "{0} must be bound to you before you can use it.", this.ResolveName(from.GetLanguage()));
}
break;
}
},
true,
ConfirmBind,
!ConfirmBind);
from.SendMessage(0x22, "{0} must be bound to you before you can use it.", this.ResolveName(from.GetLanguage()));
return false;
}
return base.OnDragDrop(from, trashed);
}
示例6: Create
public ItemModel Create(Item item)
{
return new ItemModel()
{
Id = item.Id,
UserId = item.UserId,
User = Create(item.User),
Count = item.Count,
Level = item.Level,
LevelProgress = item.LevelProgress,
ItemTemplate = Create(item.ItemTemplate),
};
}
示例7: Deserialize
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
reader.ReadInt();
Original = reader.ReadItem();
if (Original == null)
Delete();
}
示例8: ItemClone
public ItemClone(Item original)
{
Original = original;
foreach (var property in (typeof(Item)).GetProperties())
if (property.CanRead && property.CanWrite)
property.SetValue(this, property.GetValue(original, null), null);
Movable = false;
}
示例9: SendLocalizedMessageTo
public static void SendLocalizedMessageTo( Item from, Mobile to, int number, int hue )
{
SendLocalizedMessageTo( from, to, number, "", hue );
}
示例10: SendMessageTo
public static void SendMessageTo( Item from, Mobile to, string text, int hue )
{
to.Send( new UnicodeMessage( from.Serial, from.ItemID, MessageType.Regular, hue, 3, "ENU", "", text ) );
}
示例11: BottleInscriberGump
public BottleInscriberGump(Mobile from, object o)
: base(0, 0)
{
m_Bottle = o as Item;
m_From = from;
AddPage(0);
AddBackground(1, 9, 372, 144, 5054);
AddBackground(11, 19, 352, 124, 3500);
AddLabel(50, 27, 0, "Quel nom désirez vous lui donner ?");
AddImage(48, 49, 1141);
AddTextEntry(57, 50, 91, 18, 0x000, 0, "Écrire ici");
AddButton(62, 85, 4023, 4025, 1, GumpButtonType.Reply, 0);
AddButton(222, 85, 4020, 4022, 2, GumpButtonType.Reply, 0);
AddLabel(97, 93, 0, "Ok");
AddLabel(258, 93, 0, "Annuler");
}