本文整理汇总了C#中InvGameItem类的典型用法代码示例。如果您正苦于以下问题:C# InvGameItem类的具体用法?C# InvGameItem怎么用?C# InvGameItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InvGameItem类属于命名空间,在下文中一共展示了InvGameItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:TAstylex,项目名称:Android_Projects,代码行数:29,代码来源:PickableObject.cs
示例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);
}
开发者ID:rstaewen,项目名称:Pharos,代码行数:26,代码来源:LoadInventory.cs
示例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);
}
开发者ID:Lessica,项目名称:Something-of-SHIPWAR-GAMES,代码行数:32,代码来源:EquipItems.cs
示例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);
}
开发者ID:FanKurt,项目名称:unity-example,代码行数:29,代码来源:EquipItems.cs
示例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;
}
开发者ID:CcUseGitHubLearn,项目名称:UIFrameWork,代码行数:14,代码来源:InvEquipment.cs
示例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;
}
开发者ID:289997171,项目名称:UIManager,代码行数:15,代码来源:UIItemStorage.cs
示例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;
}
开发者ID:rstaewen,项目名称:Pharos,代码行数:10,代码来源:UIEquipmentSlot.cs
示例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;
}
开发者ID:Lessica,项目名称:Something-of-SHIPWAR-GAMES,代码行数:10,代码来源:UIItemStorage.cs
示例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;
}
开发者ID:xxxred,项目名称:SoulOfSword,代码行数:14,代码来源:InvEquipment.cs
示例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;
}
开发者ID:rstaewen,项目名称:Pharos,代码行数:14,代码来源:InvEquipment.cs
示例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;
}
开发者ID:rstaewen,项目名称:Pharos,代码行数:15,代码来源:InvEquipment.cs
示例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);
}
开发者ID:289997171,项目名称:UIManager,代码行数:15,代码来源:EquipRandomItem.cs
示例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;
}
开发者ID:Warrenate,项目名称:NGUIRef,代码行数:52,代码来源:InvEquipment.cs
示例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;
}
开发者ID:Lessica,项目名称:Something-of-SHIPWAR-GAMES,代码行数:47,代码来源:InvEquipment.cs
示例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;
}
开发者ID:GameDiffs,项目名称:TheForest,代码行数:17,代码来源:InvEquipment.cs
示例16: OnClick
private void OnClick()
{
if (this.equipment != null)
{
List<InvBaseItem> items = InvDatabase.list[0].items;
if (items.Count != 0)
{
int max = 12;
int id = UnityEngine.Random.Range(0, items.Count);
InvBaseItem bi = items[id];
InvGameItem item = new InvGameItem(id, bi);
item.quality = (InvGameItem.Quality) UnityEngine.Random.Range(0, max);
item.itemLevel = NGUITools.RandomRange(bi.minItemLevel, bi.maxItemLevel);
this.equipment.Equip(item);
}
}
}
开发者ID:Lessica,项目名称:Something-of-SHIPWAR-GAMES,代码行数:17,代码来源:EquipRandomItem.cs
示例17: HasEquipped
public bool HasEquipped(InvGameItem item)
{
if (this.mItems != null)
{
int index = 0;
int length = this.mItems.Length;
while (index < length)
{
if (this.mItems[index] == item)
{
return true;
}
index++;
}
}
return false;
}
开发者ID:Lessica,项目名称:Something-of-SHIPWAR-GAMES,代码行数:17,代码来源:InvEquipment.cs
示例18: OnDrop
private void OnDrop(GameObject go)
{
InvGameItem item = this.Replace(mDraggedItem);
if (mDraggedItem == item)
{
NGUITools.PlaySound(this.errorSound);
}
else if (item != null)
{
NGUITools.PlaySound(this.grabSound);
}
else
{
NGUITools.PlaySound(this.placeSound);
}
mDraggedItem = item;
this.UpdateCursor();
}
开发者ID:Lessica,项目名称:Something-of-SHIPWAR-GAMES,代码行数:18,代码来源:UIItemSlot.cs
示例19: Replace
/// <summary>
/// Replace the observed item with the specified value. Should return the item that was replaced.
/// </summary>
override protected InvGameItem Replace (InvGameItem item)
{
if(equipmentDemo != null && equipmentMain != null){
InvGameItem iItem = null;
if(null==item){
equipmentMain.Unequip(slot);
iItem = equipmentDemo.Unequip(slot);
}else{
equipmentMain.Equip(item);
iItem = equipmentDemo.Equip(item);
}
Debug.Log("equipmentDemo "+equipmentDemo.equippedItems.Length);
Debug.Log("equipmentMain "+equipmentMain.equippedItems.Length);
return iItem;
}
Debug.LogWarning("equipmentMain or equipmentDemo not declare!");
return null;
}
开发者ID:TAstylex,项目名称:Android_Projects,代码行数:22,代码来源:UIEquipmentSlotModified.cs
示例20: ShowItem
/// <summary>
/// Show a tooltip with the tooltip text for the specified item.
/// </summary>
public static void ShowItem(InvGameItem item)
{
if (item != null)
{
InvBaseItem bi = item.baseItem;
if (bi != null)
{
string t = "[" + NGUITools.EncodeColor(item.color) + "]" + item.name + "[-]\n";
t += "[AFAFAF]Level " + item.itemLevel + " " + bi.slot;
List<InvStat> stats = item.CalculateStats();
for (int i = 0, imax = stats.Count; i < imax; ++i)
{
InvStat stat = stats[i];
if (stat.amount == 0) continue;
if (stat.amount < 0)
{
t += "\n[FF0000]" + stat.amount;
}
else
{
t += "\n[00FF00]+" + stat.amount;
}
if (stat.modifier == InvStat.Modifier.Percent) t += "%";
t += " " + stat.id;
t += "[-]";
}
if (!string.IsNullOrEmpty(bi.description)) t += "\n[FF9900]" + bi.description;
ShowText(t);
return;
}
}
if (mInstance != null) mInstance.mTarget = 0f;
}
开发者ID:vorrin,项目名称:samurai,代码行数:43,代码来源:UITooltip.cs
注:本文中的InvGameItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论