From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XMainClient/XItem.cs | 166 +++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XItem.cs (limited to 'Client/Assets/Scripts/XMainClient/XItem.cs') diff --git a/Client/Assets/Scripts/XMainClient/XItem.cs b/Client/Assets/Scripts/XMainClient/XItem.cs new file mode 100644 index 00000000..51e79afa --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XItem.cs @@ -0,0 +1,166 @@ +using System; +using XMainClient.Utility; +using XUtliPoolLib; + +namespace XMainClient +{ + internal abstract class XItem : XDataBase + { + public ItemType Type + { + get + { + return (ItemType)this.type; + } + } + + public uint Prof + { + get + { + return XBagDocument.GetItemProf(this.itemID); + } + } + + public IXItemDescription Description + { + get + { + return XItem.GetItemDescription(this.Type, this.itemID); + } + } + + public virtual bool bHasPPT + { + get + { + return false; + } + } + + public virtual bool Treasure + { + get + { + return false; + } + } + + public virtual AttrType Atype + { + get + { + return AttrType.None; + } + } + + public ulong uid; + + public uint type; + + public int itemID; + + public int itemCount; + + public bool bBinding; + + public uint smeltDegreeNum; + + public ItemList.RowData itemConf; + + public double blocking; + + public uint bexpirationTime; + + private static XEquipDescription s_EquipDescription = new XEquipDescription(); + + private static XEmblemDescription s_EmblemDescription = new XEmblemDescription(); + + private static XJadeDescription s_JadeDescription = new XJadeDescription(); + + private static XFashionDescription s_FashionDescription = new XFashionDescription(); + + private static XFashionHairDescription s_FashionHairDescription = new XFashionHairDescription(); + + private static XNormalDescription s_NormalDescription = new XNormalDescription(); + + private static XartifactDescription s_ArtifactDescription = new XartifactDescription(); + + public override void Init() + { + base.Init(); + this.uid = 0UL; + this.type = 0u; + this.itemID = 0; + this.itemCount = 0; + this.smeltDegreeNum = 0u; + this.bBinding = false; + this.itemConf = null; + } + + public virtual uint GetPPT(XAttributes attributes = null) + { + return 0u; + } + + public virtual string ToPPTString(XAttributes attributes = null) + { + return string.Empty; + } + + public static bool IsVirtualItem(int itemID) + { + return itemID < XFastEnumIntEqualityComparer.ToInt(ItemEnum.VIRTUAL_ITEM_MAX); + } + + public static IXItemDescription GetItemDescription(ItemType type, int itemid = 0) + { + switch (type) + { + case ItemType.EQUIP: + return XItem.s_EquipDescription; + case ItemType.PECK: + case ItemType.VIRTUAL_ITEM: + case ItemType.MATERAIL: + break; + case ItemType.FASHION: + return XItem.SelectFashionDescription(itemid); + case ItemType.EMBLEM: + return XItem.s_EmblemDescription; + case ItemType.JADE: + return XItem.s_JadeDescription; + default: + if (type == ItemType.ARTIFACT) + { + return XItem.s_ArtifactDescription; + } + break; + } + return XItem.s_NormalDescription; + } + + private static IXItemDescription SelectFashionDescription(int itemid) + { + bool flag = itemid == 0; + IXItemDescription result; + if (flag) + { + result = XItem.s_FashionDescription; + } + else + { + FashionList.RowData fashionConf = XBagDocument.GetFashionConf(itemid); + bool flag2 = fashionConf == null || XFastEnumIntEqualityComparer.ToInt(FashionPosition.Hair) != (int)fashionConf.EquipPos; + if (flag2) + { + result = XItem.s_FashionDescription; + } + else + { + result = XItem.s_FashionHairDescription; + } + } + return result; + } + } +} -- cgit v1.1-26-g67d0