当前位置: 首页>>代码示例>>C#>>正文


C# InvGameItem类代码示例

本文整理汇总了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;
	}
开发者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


注:本文中的InvGameItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。