本文整理汇总了C#中Slot.AddItemStack方法的典型用法代码示例。如果您正苦于以下问题:C# Slot.AddItemStack方法的具体用法?C# Slot.AddItemStack怎么用?C# Slot.AddItemStack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slot
的用法示例。
在下文中一共展示了Slot.AddItemStack方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MoveItem
//.........这里部分代码省略.........
while (!from.IsEmpty())
{
HoverIcon.hoverIcon.GetComponent<Slot>().Items.Push(from.RemoveItem());
}
GameControl.comboWindow.Created = false;
}
return;
}
}
}
if (clickedSlot.transform.parent.gameObject.Equals(GameControl.equipment.gameObject))
{
if (HoverIcon.hoverIcon != null)
{
if (HoverIcon.hoverIcon.GetComponent<Slot>().SlotItems().Type == BaseItem.ItemType.EQUIPMENT)
{
BaseEquipment item = (BaseEquipment)(HoverIcon.hoverIcon.GetComponent<Slot>().SlotItems());
if (!item.SubType.ToString().Equals(clickedSlot.name))
{
return;
}
GameControl.player.Stats.TransferStats(item.Stats);
}
else if (HoverIcon.hoverIcon.GetComponent<Slot>().SlotItems().Type == BaseItem.ItemType.WEAPON)
{
if (clickedSlot.name.Equals("MAINHAND") || clickedSlot.name.Equals("OFFHAND"))
{
BaseWeapon item = (BaseWeapon)(HoverIcon.hoverIcon.GetComponent<Slot>().SlotItems());
if (item.Hand==2 && !clickedSlot.name.Equals("MAINHAND"))
{
return;
}
GameControl.player.Stats.TransferStats(item.Stats);
}
else
{
return;
}
}
else
{
return;
}
}
else
{
if (!clickedSlot.IsEmpty())
{
GameControl.player.Stats.RemoveStats(clickedSlot.GetComponent<Slot>().SlotItems().Stats);
}
}
}
//If from is null and slot has items in it, set from equal to slicked slot
if (HoverIcon.hoverIcon == null)
{
if (!clickedSlot.IsEmpty())
{
from = clickedSlot;
CreateHoverIcon();
while (!from.IsEmpty())
{
HoverIcon.hoverIcon.GetComponent<Slot>().Items.Push(from.RemoveItem());
}
}
}
//If the hoverIcon exists and has items in it, run code
else if (HoverIcon.hoverIcon != null)
{
to = clickedSlot;
//If the slot clicked has Items in it, swap the items held with the items in slot
if (!to.IsEmpty())
{
Stack<BaseItem> tmpHover = HoverIcon.hoverIcon.GetComponent<Slot>().Items;
CreateHoverIcon();
Stack<BaseItem> leftOvers = to.AddItemStack(tmpHover);
if (leftOvers.Count == 0)
{
DestroyImmediate(HoverIcon.hoverIcon.gameObject);
}
else
{
HoverIcon.hoverIcon.GetComponent<Slot>().Items = leftOvers;
HoverIcon.hoverIcon.GetComponentInChildren<Text>().text = HoverIcon.hoverIcon.GetComponent<Slot>().Items.Count > 1 ? HoverIcon.hoverIcon.GetComponent<Slot>().Items.Count.ToString() : string.Empty;
}
to = null;
}
//If clicked slot is empty place items into slot
else
{
to.AddItemStack(HoverIcon.hoverIcon.GetComponent<Slot>().Items);
CreateToolTip();
to = null;
from = null;
Destroy(HoverIcon.hoverIcon.gameObject);
}
}
}