本文整理汇总了C#中InvGameItem类的典型用法代码示例。如果您正苦于以下问题:C# InvGameItem类的具体用法?C# InvGameItem怎么用?C# InvGameItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InvGameItem类属于命名空间,在下文中一共展示了InvGameItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PickableObjectPickToInv
bool PickableObjectPickToInv () {
Debug.Log("Pick up detected!");
if (storage == null) return false;
if(storage != null){
for(int i=0; i<=storage.maxItemCount; i++){
if( null==storage.GetItem(i) ){
Debug.Log("Item put in "+i+" slot");
List<InvBaseItem> list = InvDatabase.list[0].items;
if (list.Count == 0) return false;
int qualityLevels = (int)quality;
int index = Random.Range(0, list.Count);
InvBaseItem item = list[inventoryItem.baseItemID];
InvGameItem gi = new InvGameItem(index, item);
gi.quality = inventoryItem.quality;
gi.itemLevel = inventoryItem.itemLevel;
storage.Replace(i, gi);
PickableObjectDestory();
return true;
}
}
}
Debug.Log("Package full or INVALID package!");
return false;
}
示例2: Start
void Start()
{
if (itemIDs != null && itemIDs.Length > 0)
{
int qualityLevels = (int)InvGameItem.Quality._LastDoNotUse;
for (int i = 0, imax = itemIDs.Length; i < imax; ++i)
{
int index = itemIDs[i];
InvBaseItem item = InvDatabase.FindByID(index);
if (item != null)
{
InvGameItem gi = new InvGameItem(index, item);
gi.quality = (InvGameItem.Quality)Random.Range(0, qualityLevels);
gi.itemLevel = NGUITools.RandomRange(item.minItemLevel, item.maxItemLevel);
satchel.PlaceItemInNextAvailableSlot(gi);
}
else
{
Debug.LogWarning("Can't resolve the item ID of " + index);
}
}
}
Destroy(this);
}
示例3: Start
private void Start()
{
if ((this.itemIDs != null) && (this.itemIDs.Length > 0))
{
InvEquipment component = base.GetComponent<InvEquipment>();
if (component == null)
{
component = base.gameObject.AddComponent<InvEquipment>();
}
int max = 12;
int index = 0;
int length = this.itemIDs.Length;
while (index < length)
{
int num4 = this.itemIDs[index];
InvBaseItem bi = InvDatabase.FindByID(num4);
if (bi != null)
{
InvGameItem item = new InvGameItem(num4, bi);
item.quality = (InvGameItem.Quality) UnityEngine.Random.Range(0, max);
item.itemLevel = NGUITools.RandomRange(bi.minItemLevel, bi.maxItemLevel);
component.Equip(item);
}
else
{
Debug.LogWarning("Can't resolve the item ID of " + num4);
}
index++;
}
}
UnityEngine.Object.Destroy(this);
}
示例4: Start
void Start ()
{
if (itemIDs != null && itemIDs.Length > 0)
{
InvEquipment eq = GetComponent<InvEquipment>();
if (eq == null) eq = gameObject.AddComponent<InvEquipment>();
int qualityLevels = (int)InvGameItem.Quality._LastDoNotUse;
for (int i = 0, imax = itemIDs.Length; i < imax; ++i)
{
int index = itemIDs[i];
InvBaseItem item = InvDatabase.FindByID(index);
if (item != null)
{
InvGameItem gi = new InvGameItem(index, item);
gi.quality = (InvGameItem.Quality)Random.Range(0, qualityLevels);
gi.itemLevel = NGUITools.RandomRange(item.minItemLevel, item.maxItemLevel);
eq.Equip(gi);
}
else
{
Debug.LogWarning("Can't resolve the item ID of " + index);
}
}
}
Destroy(this);
}
示例5: Equip
/// <summary>
/// Equip the specified item and return the item that was replaced.
/// </summary>
public InvGameItem Equip (InvGameItem item)
{
if (item != null)
{
InvBaseItem baseItem = item.baseItem;
if (baseItem != null) return Replace(baseItem.slot, item);
else Debug.LogWarning("Can't resolve the item ID of " + item.baseItemID);
}
return item;
}
示例6: Replace
/// <summary>
/// Replace an item in the container with the specified one.
/// </summary>
/// <returns>An item that was replaced.</returns>
public InvGameItem Replace (int slot, InvGameItem item)
{
if (slot < maxItemCount)
{
InvGameItem prev = items[slot];
mItems[slot] = item;
return prev;
}
return item;
}
示例7: ReplaceExisting
protected override InvGameItem ReplaceExisting(InvGameItem item)
{
string msg = "replacing if not null. equipment is: ";
if (equipment == null)
msg += "null!";
else
msg += equipment.name;
Debug.Log(msg);
return (equipment != null) ? equipment.Replace(slot, item) : item;
}
示例8: Replace
public InvGameItem Replace(int slot, InvGameItem item)
{
if (slot < this.maxItemCount)
{
InvGameItem item2 = this.items[slot];
this.mItems[slot] = item;
return item2;
}
return item;
}
示例9: HasEquipped
/// <summary>
/// Whether the specified item is currently equipped.
/// </summary>
public bool HasEquipped(InvGameItem item)
{
if (mItems != null)
{
foreach (InvGameItem i in mItems)
{
if (i == item) return true;
}
}
return false;
}
示例10: HasEquipped
/// <summary>
/// Whether the specified item is currently equipped.
/// </summary>
public bool HasEquipped(InvGameItem item)
{
if (mItems != null)
{
for (int i = 0, imax = mItems.Length; i < imax; ++i)
{
if (mItems[i] == item) return true;
}
}
return false;
}
示例11: Equip
/// <summary>
/// Equip the specified item and return the item that was replaced.
/// </summary>
public InvGameItem Equip(InvGameItem item)
{
if (item != null)
{
InvBaseItem baseItem = item.baseItem;
if (baseItem != null) return Replace(baseItem.slot, item);
else Debug.Log("Can't resolve the item ID of " + item.baseItemID);
}
else
Debug.Log("cannot find null item...");
return item;
}
示例12: OnClick
void OnClick()
{
if (equipment == null) return;
List<InvBaseItem> list = InvDatabase.list[0].items;
if (list.Count == 0) return;
int qualityLevels = (int)InvGameItem.Quality._LastDoNotUse;
int index = Random.Range(0, list.Count);
InvBaseItem item = list[index];
InvGameItem gi = new InvGameItem(index, item);
gi.quality = (InvGameItem.Quality)Random.Range(0, qualityLevels);
gi.itemLevel = NGUITools.RandomRange(item.minItemLevel, item.maxItemLevel);
equipment.Equip(gi);
}
示例13: Replace
/// <summary>
/// Equip the specified item automatically replacing an existing one.
/// </summary>
public InvGameItem Replace (InvBaseItem.Slot slot, InvGameItem item)
{
InvBaseItem baseItem = (item != null) ? item.baseItem : null;
if (slot != InvBaseItem.Slot.None)
{
// If the item is not of appropriate type, we shouldn't do anything
if (baseItem != null && baseItem.slot != slot) return item;
if (mItems == null)
{
// Automatically figure out how many item slots we need
int count = (int)InvBaseItem.Slot._LastDoNotUse;
mItems = new InvGameItem[count];
}
// Equip this item
InvGameItem prev = mItems[(int)slot - 1];
mItems[(int)slot - 1] = item;
// Get the list of all attachment points
if (mAttachments == null) mAttachments = GetComponentsInChildren<InvAttachmentPoint>();
// Equip the item visually
for (int i = 0, imax = mAttachments.Length; i < imax; ++i)
{
InvAttachmentPoint ip = mAttachments[i];
if (ip.slot == slot)
{
GameObject go = ip.Attach(baseItem != null ? baseItem.attachment : null);
if (baseItem != null && go != null)
{
//Renderer ren = go.renderer;
Renderer ren = go.GetComponent<Renderer>();
if (ren != null) ren.material.color = baseItem.color;
}
}
}
return prev;
}
else if (item != null)
{
Debug.LogWarning("Can't equip \"" + item.name + "\" because it doesn't specify an item slot");
}
return item;
}
示例14: Replace
public InvGameItem Replace(InvBaseItem.Slot slot, InvGameItem item)
{
InvBaseItem item2 = (item == null) ? null : item.baseItem;
if (slot != InvBaseItem.Slot.None)
{
if ((item2 != null) && (item2.slot != slot))
{
return item;
}
if (this.mItems == null)
{
int num = 8;
this.mItems = new InvGameItem[num];
}
InvGameItem item3 = this.mItems[((int) slot) - 1];
this.mItems[((int) slot) - 1] = item;
if (this.mAttachments == null)
{
this.mAttachments = base.GetComponentsInChildren<InvAttachmentPoint>();
}
int index = 0;
int length = this.mAttachments.Length;
while (index < length)
{
InvAttachmentPoint point = this.mAttachments[index];
if (point.slot == slot)
{
GameObject obj2 = point.Attach((item2 == null) ? null : item2.attachment);
if ((item2 != null) && (obj2 != null))
{
Renderer renderer = obj2.renderer;
if (renderer != null)
{
renderer.material.color = item2.color;
}
}
}
index++;
}
return item3;
}
if (item != null)
{
Debug.LogWarning("Can't equip \"" + item.name + "\" because it doesn't specify an item slot");
}
return item;
}
示例15: HasEquipped
public bool HasEquipped(InvGameItem item)
{
if (this.mItems != null)
{
int i = 0;
int num = this.mItems.Length;
while (i < num)
{
if (this.mItems[i] == item)
{
return true;
}
i++;
}
}
return false;
}