本文整理汇总了C#中AwakeType类的典型用法代码示例。如果您正苦于以下问题:C# AwakeType类的具体用法?C# AwakeType怎么用?C# AwakeType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AwakeType类属于命名空间,在下文中一共展示了AwakeType类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveAwake
public int RemoveAwake()
{
if (listAwake.Count > 0)
{
listAwake.Remove(listAwake[listAwake.Count - 1]);
if (listAwake.Count == 0)
type = AwakeType.None;
return 1;
}
else
{
type = AwakeType.None;
return 0;
}
}
示例2: CheckAwakening
public bool CheckAwakening(UserItem item, AwakeType type)
{
if (item.Info.CanAwakening != true) return false;
if (item.Info.Grade == ItemGrade.None) return false;
if (IsMaxLevel()) return false;
if (this.type == AwakeType.None)
{
if (item.Info.Type == ItemType.Weapon)
{
if (type == AwakeType.DC ||
type == AwakeType.MC ||
type == AwakeType.SC)
{
this.type = type;
return true;
}
else
return false;
}
else if (item.Info.Type == ItemType.Helmet)
{
if (type == AwakeType.AC ||
type == AwakeType.MAC)
{
this.type = type;
return true;
}
else
return false;
}
else if (item.Info.Type == ItemType.Armour)
{
if (type == AwakeType.HPMP)
{
this.type = type;
return true;
}
else
return false;
}
else
return false;
}
else
{
if (this.type == type)
return true;
else
return false;
}
}
示例3: UpgradeAwake
public int UpgradeAwake(UserItem item, AwakeType type, out bool[] isHit)
{
//return -1 condition error, -1 = dont upgrade, 0 = failed, 1 = Succeed,
isHit = null;
if (CheckAwakening(item, type) != true)
return -1;
Random rand = new Random(DateTime.Now.Millisecond);
if (rand.Next(0, 100) <= AwakeSuccessRate)
{
isHit = Awakening(item);
return 1;
}
else
{
int idx;
isHit = makeHit(1, out idx);
return 0;
}
}
示例4: Awake
public Awake(BinaryReader reader)
{
type = (AwakeType)reader.ReadByte();
int count = reader.ReadInt32();
for (int i = 0; i < count; i++)
{
listAwake.Add(reader.ReadByte());
}
}
示例5: getAwakeTypeText
public string getAwakeTypeText(AwakeType type)
{
string typeName = "";
switch (type)
{
case AwakeType.DC:
typeName = "Bravery Glyph";
break;
case AwakeType.MC:
typeName = "Magic Glyph";
break;
case AwakeType.SC:
typeName = "Soul Glyph";
break;
case AwakeType.AC:
typeName = "Protection Glyph";
break;
case AwakeType.MAC:
typeName = "EvilSlayer Glyph";
break;
case AwakeType.HPMP:
typeName = "Body Glyph";
break;
default:
typeName = "Select Upgrade Item.";
break;
}
return typeName;
}
示例6: OnAwakeTypeSelect
public void OnAwakeTypeSelect(int Index)
{
SelectAwakeType.SelectedIndex = Index;
AwakeType type = getAwakeType(SelectAwakeType.Items[SelectAwakeType.SelectedIndex]);
CurrentAwakeType = type;
if (type != AwakeType.None)
{
Network.Enqueue(new C.AwakeningNeedMaterials { UniqueID = Items[0].UniqueID, Type = type });
}
}
示例7: ItemCell_Click
public void ItemCell_Click()
{
ItemCellClear();
SelectAwakeType.Items.Clear();
if (Items[0] == null)
{
SelectAwakeType.Items.Add("Select Upgrade Item.");
SelectAwakeType.SelectedIndex = SelectAwakeType.Items.Count-1;
CurrentAwakeType = AwakeType.None;
}
else
{
if (Items[0].Awake.getAwakeLevel() == 0)
{
SelectAwakeType.Items.Add("Select Upgrade Type.");
if (Items[0].Info.Type == ItemType.Weapon)
{
SelectAwakeType.Items.Add("Bravery Glyph");
SelectAwakeType.Items.Add("Magic Glyph");
SelectAwakeType.Items.Add("Soul Glyph");
}
else if (Items[0].Info.Type == ItemType.Helmet)
{
SelectAwakeType.Items.Add("Protection Glyph");
SelectAwakeType.Items.Add("EvilSlayer Glyph");
}
else
{
SelectAwakeType.Items.Add("Body Glyph");
}
}
else
{
SelectAwakeType.Items.Add(getAwakeTypeText(Items[0].Awake.type));
if (CurrentAwakeType != Items[0].Awake.type)
{
CurrentAwakeType = Items[0].Awake.type;
OnAwakeTypeSelect(0);
}
}
}
}
示例8: ReadPacket
protected override void ReadPacket(BinaryReader reader)
{
UniqueID = reader.ReadUInt64();
Type = (AwakeType)reader.ReadByte();
}
示例9: HasAwakeningNeedMaterials
public bool HasAwakeningNeedMaterials(UserItem item, AwakeType type)
{
Awake awake = item.Awake;
byte[] materialCount = new byte[2];
int idx = 0;
foreach (List<byte> material in Awake.AwakeMaterials[(int)type - 1])
{
byte materialRate = (byte)(Awake.AwakeMaterialRate[(int)item.Info.Grade - 1] * (float)awake.getAwakeLevel());
materialCount[idx] = material[(int)item.Info.Grade - 1];
materialCount[idx] += materialRate;
idx++;
}
byte[] currentCount = new byte[2] { 0, 0 };
for (int i = 0; i < Info.Inventory.Length; i++)
{
UserItem materialItem = Info.Inventory[i];
if (materialItem != null)
{
if (materialItem.Info.Grade == item.Info.Grade &&
materialItem.Info.Type == ItemType.Awakening)
{
if (materialItem.Info.Shape == ((int)type - 1) &&
materialCount[0] - currentCount[0] != 0)
{
if (materialItem.Count <= materialCount[0] - currentCount[0])
{
currentCount[0] += (byte)materialItem.Count;
}
else if (materialItem.Count > materialCount[0] - currentCount[0])
{
currentCount[0] = (byte)(materialCount[0] - currentCount[0]);
}
}
else if (materialItem.Info.Shape == 100 &&
materialCount[1] - currentCount[1] != 0)
{
if (materialItem.Count <= materialCount[1] - currentCount[1])
{
currentCount[1] += (byte)materialItem.Count;
}
else if (materialItem.Count > materialCount[1] - currentCount[1])
{
currentCount[1] = (byte)(materialCount[1] - currentCount[1]);
}
}
}
}
}
for (int i = 0; i < materialCount.Length; i++)
{
if (materialCount[i] != currentCount[i])
{
Enqueue(new S.Awakening { result = -4, removeID = -1 });
return false;
}
}
for (int i = 0; i < Info.Inventory.Length; i++)
{
if (Info.Inventory[i] != null)
{
if (Info.Inventory[i].Info.Grade == item.Info.Grade &&
Info.Inventory[i].Info.Type == ItemType.Awakening)
{
if (Info.Inventory[i].Info.Shape == ((int)type - 1) &&
currentCount[0] > 0)
{
if (Info.Inventory[i].Count <= currentCount[0])
{
Enqueue(new S.DeleteItem { UniqueID = Info.Inventory[i].UniqueID, Count = Info.Inventory[i].Count });
currentCount[0] -= (byte)Info.Inventory[i].Count;
Info.Inventory[i] = null;
}
else if (Info.Inventory[i].Count > currentCount[0])
{
Enqueue(new S.DeleteItem { UniqueID = Info.Inventory[i].UniqueID, Count = (uint)currentCount[0] });
Info.Inventory[i].Count -= currentCount[0];
currentCount[0] = 0;
}
}
else if (Info.Inventory[i].Info.Shape == 100 &&
currentCount[1] > 0)
{
if (Info.Inventory[i].Count <= currentCount[1])
{
Enqueue(new S.DeleteItem { UniqueID = Info.Inventory[i].UniqueID, Count = Info.Inventory[i].Count });
currentCount[1] -= (byte)Info.Inventory[i].Count;
Info.Inventory[i] = null;
}
else if (Info.Inventory[i].Count > currentCount[1])
{
Enqueue(new S.DeleteItem { UniqueID = Info.Inventory[i].UniqueID, Count = (uint)currentCount[1] });
Info.Inventory[i].Count -= currentCount[1];
currentCount[1] = 0;
}
//.........这里部分代码省略.........
示例10: AwakeningNeedMaterials
public void AwakeningNeedMaterials(ulong UniqueID, AwakeType type)
{
if (type == AwakeType.None) return;
foreach (UserItem item in Info.Inventory)
{
if (item != null)
{
if (item.UniqueID == UniqueID)
{
Awake awake = item.Awake;
byte[] materialCount = new byte[2];
int idx = 0;
foreach (List<byte> material in Awake.AwakeMaterials[(int)type - 1])
{
byte materialRate = (byte)(Awake.AwakeMaterialRate[(int)item.Info.Grade - 1] * (float)awake.getAwakeLevel());
materialCount[idx] = material[(int)item.Info.Grade - 1];
materialCount[idx] += materialRate;
idx++;
}
ItemInfo[] materials = new ItemInfo[2];
foreach (ItemInfo info in Envir.ItemInfoList)
{
if (item.Info.Grade == info.Grade &&
info.Type == ItemType.Awakening)
{
if (info.Shape == (short)type - 1)
{
materials[0] = info;
}
else if (info.Shape == 100)
{
materials[1] = info;
}
}
}
Enqueue(new S.AwakeningNeedMaterials { Materials = materials, MaterialsCount = materialCount });
break;
}
}
}
}
示例11: Awakening
public void Awakening(ulong UniqueID, AwakeType type)
{
if (NPCPage == null || !String.Equals(NPCPage.Key, NPCObject.AwakeningKey, StringComparison.CurrentCultureIgnoreCase))
return;
if (type == AwakeType.None) return;
for (int i = 0; i < Info.Inventory.Length; i++)
{
UserItem item = Info.Inventory[i];
if (item == null || item.UniqueID != UniqueID) continue;
Awake awake = item.Awake;
if (!item.Info.CanAwakening)
{
Enqueue(new S.Awakening { result = -1, removeID = -1 });
return;
}
if (awake.IsMaxLevel())
{
Enqueue(new S.Awakening { result = -2, removeID = -1 });
return;
}
if (Info.AccountInfo.Gold < item.AwakeningPrice())
{
Enqueue(new S.Awakening { result = -3, removeID = -1 });
return;
}
if (HasAwakeningNeedMaterials(item, type))
{
Info.AccountInfo.Gold -= item.AwakeningPrice();
Enqueue(new S.LoseGold { Gold = item.AwakeningPrice() });
bool[] isHit;
switch (awake.UpgradeAwake(item, type, out isHit))
{
case -1:
Enqueue(new S.Awakening { result = -1, removeID = -1 });
break;
case 0:
AwakeningEffect(false, isHit);
Info.Inventory[i] = null;
Enqueue(new S.Awakening { result = 0, removeID = (long)item.UniqueID });
break;
case 1:
Enqueue(new S.RefreshItem { Item = item });
AwakeningEffect(true, isHit);
Enqueue(new S.Awakening { result = 1, removeID = -1 });
break;
default:
break;
}
}
}
}