本文整理汇总了C#中ItemData.CreatNew方法的典型用法代码示例。如果您正苦于以下问题:C# ItemData.CreatNew方法的具体用法?C# ItemData.CreatNew怎么用?C# ItemData.CreatNew使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemData
的用法示例。
在下文中一共展示了ItemData.CreatNew方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddItem
protected override void AddItem(ItemData modified, int amount = -1, bool isSave = true)
{
ItemData newItem = null;
if (amount == -1)
{
amount = modified.stackSize;
modified.ownerContainer = this;
if (!AddToExistingStack(modified, modified.stackSize, isSave))
{
modified.CreatNew(out newItem, amount, this);
containerItems.Add(newItem);
AddItemEvent(newItem, isSave);
}
}
else
{
modified.CreatNew(out newItem, amount, this);
if (!AddToExistingStack(newItem, amount, isSave))
{
containerItems.Add(newItem);
AddItemEvent(newItem, isSave);
}
}
Destroy(modified.gameObject);
}
示例2: AddItem
protected override void AddItem(ItemData modified, int amount = -1, bool isSave = true)
{
if (amount == -1)
{
modified.ownerContainer = this;
if (!AddToExistingStack(modified, modified.stackSize))
{
AddItemEvent(modified, isSave);
chestItems.Add(modified);
}
}
else
{
ItemData newItem = null;
modified.CreatNew(out newItem, amount, this);
if (!AddToExistingStack(newItem, amount))
{
AddItemEvent(newItem, isSave);
chestItems.Add(newItem);
}
}
}
示例3: AddToSlot
public void AddToSlot(ItemData modified, int slotID, int amount = -1, bool isSave = true)
{
SlottedContainerSlotData selectedSlot = slots[slotID];
ItemData NewSlotData = null;
int TargetStackSize = amount;
if (amount == -1)
TargetStackSize = modified.stackSize;
if (TargetStackSize > selectedSlot.slotMaxCountLimit)
{
TargetStackSize = selectedSlot.slotMaxCountLimit;
}
modified.CreatNew(out NewSlotData, TargetStackSize, this);
selectedSlot.slotData = NewSlotData;
ModdifyStatsByFactor(NewSlotData, 1);
containerItems.Add(NewSlotData);
Destroy(modified.gameObject);
AddItemEvent(NewSlotData, isSave);
selectedSlot.OnItemChangedWrapper();
}
示例4: AddNewStackAmount
private void AddNewStackAmount(ItemData data, int amount, bool isSave)
{
ItemData newItem;
data.CreatNew(out newItem, amount, this);
Destroy(data.gameObject);
AddItemEvent(newItem, isSave);
containerItems.Add(newItem);
}