• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ItemSlot类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ItemSlot的典型用法代码示例。如果您正苦于以下问题:C# ItemSlot类的具体用法?C# ItemSlot怎么用?C# ItemSlot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ItemSlot类属于命名空间,在下文中一共展示了ItemSlot类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Raycast

    /// <summary>
    /// Raycasts from the mouse
    /// returns true if something was hit
    /// 
    /// uses out to return relevant menu scripts
    /// 
    /// </summary>
    /// <param name="hitInfo"></param>
    /// <param name="items"></param>
    /// <param name="itemSlots"></param>
    /// <returns></returns>
    public bool Raycast(out RaycastHit[] hitInfo, out Item[] items, out ItemSlot[] itemSlots)
    {
        items = new Item[0];
        itemSlots = new ItemSlot[0];
        hitInfo = Physics.RaycastAll (m_MainCamera.ScreenPointToRay (Input.mousePosition), RAYCAST_DISTANCE, m_RaycastMask.value);
        Debug.DrawLine (m_MainCamera.ScreenPointToRay(Input.mousePosition).origin, m_MainCamera.ScreenPointToRay(Input.mousePosition).origin + (m_MainCamera.ScreenPointToRay(Input.mousePosition).direction * RAYCAST_DISTANCE), Color.black, 1.0f);

        if(hitInfo.Length > 0)
        {//hit at least one menu thing
            List<Item> itemsFound = new List<Item>();
            List<ItemSlot> itemSlotsFound = new List<ItemSlot>();

            for(int i = 0; i < hitInfo.Length; i++)
            {
                Item item = hitInfo[i].collider.gameObject.GetComponent<Item>();
                if (item != null)
                    itemsFound.Add(item);

                ItemSlot itemSlot = hitInfo[i].collider.gameObject.GetComponent<ItemSlot>();
                if (itemSlot != null)
                    itemSlotsFound.Add(itemSlot);
            }

            items = itemsFound.ToArray();
            itemSlots = itemSlotsFound.ToArray();

            return true;
        }
        return false;
    }
开发者ID:KristofferMatis,项目名称:Ludum_Dare_32_Proj1,代码行数:41,代码来源:ClickHandler.cs


示例2: DrawItem

        /// <summary>
        /// Отрисовка предмета в инвентаре
        /// </summary>
        /// <param name="item">Рисуемый предмет</param>
        /// <param name="offsetX">Смещение (позиция) инвентаря по x</param>
        /// <param name="offsetY">Смещение (позиция) инвентаря по y</param>
        /// <param name="fixWebPosition">при fixWebPosition=true предмет рисуется "в сетке"</param>
        /// <param name="drawIcon">при drawIcon=false, предмет рисуется без иконки</param>
        public void DrawItem(ItemSlot item, float offsetX, float offsetY, bool fixWebPosition = true, bool drawIcon = true)
        {
            Rect cellRectangle;

            if (fixWebPosition) {

                cellRectangle = new Rect(offsetX + CellSettings.cellPaddingX + (item.position.X - 1) * CellSettings.cellWidth+shadowSize,
                                         offsetY + CellSettings.cellPaddingY + (item.position.Y - 1) * CellSettings.cellHeight+shadowSize,
                                         CellSettings.cellWidth,
                                         CellSettings.cellHeight);

            } else {

                cellRectangle = new Rect(offsetX+shadowSize,
                                         offsetY+shadowSize,
                                         CellSettings.cellWidth,
                                         CellSettings.cellHeight);

            }

            string description = item.item.getCount()>1? item.item.getCount().ToString()+CLang.getInstance().get(Dictionary.K_COUNT) : "";

            GUI.Box(cellRectangle, description, labelShadow);

            cellRectangle.x-=shadowSize;
            cellRectangle.y-=shadowSize;

            if (drawIcon)
                labelStyle.normal.background = item.item.resource.icon;

            GUI.color = new Color(1f,1f,1f,1f);
            GUI.Box(cellRectangle, description, labelStyle);
        }
开发者ID:Baensi,项目名称:Assets,代码行数:41,代码来源:ItemDrawService.cs


示例3: CraftingGrid

        public CraftingGrid(GameWorld GameWorld, Vector2 Position)
        {
            this.Position = Position;
            RecipePartIdMatching = new int[5, 5];

            for (int y = 0; y < 5; y++)
            {
                for (int x = 0; x < 5; x++)
                {
                    RecipeSlots[x, y] = new ItemSlot(GameWorld);
                    RecipeSlots[x, y].Visible = true;
                    Vector2 UpperLeftPos = Position + new Vector2(x * 34, y * 34);
                    RecipeSlots[x, y].Position = new Rectangle((int)UpperLeftPos.X, (int)UpperLeftPos.Y, 32, 32);
                    RecipeSlots[x, y].OnStackModified += UpdateGrid;
                    RecipePartIdMatching[x, y] = -1;
                }
            }

            OutputSlot = new ItemSlot(GameWorld);
            OutputSlot.Visible = true;
            OutputSlot.State = ItemSlot.SlotState.InputLocked;
            OutputSlot.Position = new Rectangle((int)Position.X + 5 * 32 + 10, (int)Position.Y + 2 * 32, 32, 32);

            OutputSlot.OnStackModified += ItemCrafted;
        }
开发者ID:vinterdo,项目名称:SteamAge,代码行数:25,代码来源:CraftingGrid.cs


示例4: SwapItemsNoReAdding

    public static void SwapItemsNoReAdding(ItemSlot slot1, ItemSlot slot2)
    {
        Item tempItem = slot1.getItem();
        slot1.m_Item = slot2.getItem();
        slot2.m_Item = tempItem;

        slot1.getItem().OnMount(slot1);
        slot2.getItem().OnMount(slot2);
    }
开发者ID:KristofferMatis,项目名称:Ludum_Dare_32_Proj1,代码行数:9,代码来源:ItemSlot.cs


示例5: DrawCellsItem

        public void DrawCellsItem(float offsetX, float offsetY, ItemSlot item, Texture2D image)
        {
            Rect cellRect = new Rect();

            cellRect.x = offsetX + (item.getPosition().X - 1) * CellSettings.cellWidth + CellSettings.cellPaddingX;
            cellRect.y = offsetY + (item.getPosition().Y - 1) * CellSettings.cellHeight + CellSettings.cellPaddingY;
            cellRect.width = CellSettings.cellWidth * item.item.getSize().getWidth();
            cellRect.height = CellSettings.cellHeight * item.item.getSize().getHeight();

            GUI.DrawTextureWithTexCoords(cellRect, image, textCoords);
        }
开发者ID:Baensi,项目名称:Assets,代码行数:11,代码来源:InventoryExternalDrawServices.cs


示例6: Swap

	public void Swap (ItemSlot other) {
		if (!CanSwap (other))
			return;

		var swapper = other.currentItem;
		other.currentItem = currentItem;
		currentItem = swapper;

		RestoreItem ();
		other.RestoreItem ();
	}
开发者ID:djackddonovan,项目名称:GGJ2016,代码行数:11,代码来源:ItemSlot.cs


示例7: SetItem

 public EquipmentItem SetItem(ItemSlot slot, EquipmentItem item)
 {
     if (!(item is EquipmentItem))
         return null;
     var eqItem = item as EquipmentItem;
     if (eqItem.RequiredSpecialisation != Specialisation.NONE
         && eqItem.RequiredSpecialisation != this.Specialisation)
         return null;
     EquipmentItem oldItem = null;
     if (Items.ContainsKey(slot))
         oldItem = Items[slot];
     Items[slot] = eqItem;
     return oldItem;
 }
开发者ID:Flosus,项目名称:Mini,代码行数:14,代码来源:Layout.cs


示例8: UnitInventory

	/// <summary>
	/// C'tor
	/// </summary>
	/// <param name="_slotsData">Data about slot: slot key && available item types for the slot</param>
	/// <param name="onEquipmentUpdate"></param>
	public UnitInventory(Dictionary<EUnitEqupmentSlot, EItemType[]> _slotsData, ArrayRO<ItemSlot> _initialItems, Action<EUnitEqupmentSlot, EItemKey, EItemKey> onEquipmentUpdate) {
		_slotsConfig = _slotsData;

		_equipment = new ItemSlot[_slotsConfig.Count];
		int i = 0;
		foreach(KeyValuePair<EUnitEqupmentSlot, EItemType[]> kvp in _slotsConfig) {
			_equipment[i] = new ItemSlot(kvp.Key, EItemKey.None);
			i++;
		}

		for (i = 0; i < _initialItems.Length; i++) {
			Equip(_initialItems[i].SlotName, _initialItems[i].ItemKey);
		}

		_onEquipmentUpdate = onEquipmentUpdate;
	}
开发者ID:UpdateShu,项目名称:ForceFury_Unity5,代码行数:21,代码来源:UnitInventory.cs


示例9: Show

	public void Show(ItemSlot itemSlot)
	{

		Vector3 pos = Input.mousePosition;

		pos.x = Mathf.Clamp01(pos.x / Screen.width);
		pos.y = Mathf.Clamp01(pos.y / Screen.height);

		if(_tempRightClick == null)
		{
			_itemSlot = itemSlot;
			_tempRightClick = NGUITools.AddChild(this.gameObject.transform.parent.gameObject, RightClickPrefab);
			_tempRightClick.transform.position = _camera.ViewportToWorldPoint(pos);
			RightClickMaker m = _tempRightClick.GetComponent<RightClickMaker>();
			m.Make(_itemSlot);
		}
	}
开发者ID:Gapti,项目名称:Starboard_INT,代码行数:17,代码来源:RightClickManager.cs


示例10: SetItemInSlot

        private void SetItemInSlot(Item value, ItemSlot slot)
        {
            if (!CanEquip(value, slot))
                return;
            
            var old = Equip.FirstOrDefault(i => i.Slot == slot);
            if (old != null)
            {
                Equip.Remove(old);
                old.Slot = ItemSlot.Unequipable;
            }

            if (value != null)
            {
                value.Slot = slot;
                Equip.Add(value);
            }
            OnPropertyChanged(slot.ToString());
            RefreshItemAttributes();
        }
开发者ID:mihailim,项目名称:PoESkillTree,代码行数:20,代码来源:ItemAttributes.cs


示例11: JsonDeserializer

    // Reader
    public static object JsonDeserializer(Jboy.JsonReader reader)
    {
        if(reader.TryReadNull())
            return null;

        var itemSlot = new ItemSlot();

        reader.ReadObjectStart();

        // ID
        reader.ReadPropertyName("item");
        itemSlot.item = Jboy.Json.ReadObject<Item>(reader);

        // Count
        reader.ReadPropertyName("count");
        itemSlot.count = (ulong)reader.ReadNumber();

        reader.ReadObjectEnd();

        return itemSlot;
    }
开发者ID:judah4,项目名称:battle-of-mages,代码行数:22,代码来源:ItemSlot.cs


示例12: SetEquipStatus

	void SetEquipStatus(ItemSlot itemSlot)
	{

		var type = itemSlot.GetType();

		if(type == typeof(StorageSlot))
		{
			EquipButton.SetActive(true);
			UnequipButton.SetActive(false);
		}
		else if(type == typeof(EquipmentSlot))
		{
			EquipButton.SetActive(false);
			UnequipButton.SetActive(true);
		}
		else
		{
			EquipButton.SetActive(false);
			UnequipButton.SetActive(true);
		}
	}
开发者ID:Gapti,项目名称:Starboard_INT,代码行数:21,代码来源:RightClickMaker.cs


示例13: Make

	public void Make(ItemSlot itemSlot)
	{
		Item item = itemSlot.item;

		SetStackable(item);

		switch(item.Type)
		{
		case ItemType.Armor:
			SetArmorButtons(itemSlot);
			break;
		case ItemType.Consumable:
			SetConsumable(itemSlot);
			break;
		case ItemType.Enhancer:
			SetEnhancer(itemSlot);
			break;
		case ItemType.Generator:
			SetGenerator(itemSlot);
			break;
		case ItemType.LaserWeapon:
			SetLaserWeapon(itemSlot);
			break;
		case ItemType.LegacyWeapon:
			SetLegacyWeapon(itemSlot);
			break;
		case ItemType.MagneticWeapon:
			SetMagneticWeapon(itemSlot);
			break;
		case ItemType.Melee:
			SetMelee(itemSlot);
			break;
		case ItemType.Misc:
			SetMisc(itemSlot);
			break;
		case ItemType.Quest:
			SetQuest(itemSlot);
			break;
		}
	}
开发者ID:Gapti,项目名称:Starboard_INT,代码行数:40,代码来源:RightClickMaker.cs


示例14: GetEquippedBySlot

 public ushort GetEquippedBySlot(ItemSlot slot)
 {
     Equip eqp;
     if (EquippedItems.TryGetValue(slot, out eqp))
     {
         return eqp.ItemID;
     }
     else return ushort.MaxValue;
 }
开发者ID:Canic,项目名称:Zepheus_2k15,代码行数:9,代码来源:ZoneCharacter.cs


示例15: RaiseSmthMoveItem

 // called by engine
 void RaiseSmthMoveItem(Critter from_cr, Item item, ItemSlot from_slot)
 {
     if (SmthMoveItem != null)
         SmthMoveItem(this, new CritterSmthMoveItemEventArgs(this, from_cr, item, from_slot));
 }
开发者ID:rotators,项目名称:fosdk,代码行数:6,代码来源:Critter.Events.cs


示例16: CritterSmthMoveItemEventArgs

 public CritterSmthMoveItemEventArgs(Critter cr, Critter from_cr, Item item, ItemSlot from_slot)
     : base(cr, item, from_slot)
 {
     this.From = from_cr;
 }
开发者ID:rotators,项目名称:fosdk,代码行数:5,代码来源:Critter.Events.cs


示例17: CritterMoveItemEventArgs

 public CritterMoveItemEventArgs(Critter cr, Item item, ItemSlot from_slot)
     : base(cr)
 {
     this.Item = item;
     this.FromSlot = from_slot;
 }
开发者ID:rotators,项目名称:fosdk,代码行数:6,代码来源:Critter.Events.cs


示例18: UpdateGraphEquipped

        private void UpdateGraphEquipped(string subgraph)
        {
            SetGraphControl(ComparisonGraph);
            CGL_Legend.LegendItems = Calculations.SubPointNameColors;
            ComparisonGraph.LegendItems = Calculations.SubPointNameColors;
            ComparisonGraph.Mode = ComparisonGraph.DisplayMode.Subpoints;
            List<ComparisonCalculationBase> itemCalculations = new List<ComparisonCalculationBase>();

            if (subgraph == "Gear" || subgraph == "All")
            {
                CharacterSlot[] slots = new CharacterSlot[]
                {
                     CharacterSlot.Back, CharacterSlot.Chest, CharacterSlot.Feet, CharacterSlot.Finger1,
                     CharacterSlot.Finger2, CharacterSlot.Hands, CharacterSlot.Head, CharacterSlot.Legs,
                     CharacterSlot.MainHand, CharacterSlot.Neck, CharacterSlot.OffHand, /*CharacterSlot.Projectile,
                     CharacterSlot.ProjectileBag,*/ CharacterSlot.Ranged, CharacterSlot.Shoulders,
                     CharacterSlot.Trinket1, CharacterSlot.Trinket2, CharacterSlot.Waist, CharacterSlot.Wrist
                };
                foreach (CharacterSlot slot in slots)
                {
                    ItemInstance item = Character[slot];
                    if (item != null)
                    {
                        itemCalculations.Add(Calculations.GetItemCalculations(item, Character, slot));
                    }
                }
            }
            if (subgraph == "Enchants" || subgraph == "All")
            {
                ItemSlot[] slots = new ItemSlot[]
                {
                     ItemSlot.Back, ItemSlot.Chest, ItemSlot.Feet, ItemSlot.Finger,
                     ItemSlot.Hands, ItemSlot.Head, ItemSlot.Legs,
                     ItemSlot.MainHand, ItemSlot.OffHand, ItemSlot.Ranged, ItemSlot.Shoulders,
                     ItemSlot.Waist, ItemSlot.Wrist
                };
                
                foreach (ItemSlot slot in slots)
                    foreach (ComparisonCalculationBase calc in Calculations.GetEnchantCalculations(slot, Character, Calculations.GetCharacterCalculations(Character), true))
                        itemCalculations.Add(calc);
            }
            if (subgraph == "Tinkerings" || subgraph == "All")
            {
                ItemSlot[] slots = new ItemSlot[]
                {
                     ItemSlot.Back, ItemSlot.Hands, ItemSlot.Waist,
                };
                foreach (ItemSlot slot in slots)
                    foreach (ComparisonCalculationBase calc in Calculations.GetTinkeringCalculations(slot, Character, Calculations.GetCharacterCalculations(Character), true))
                        itemCalculations.Add(calc);
            }
            if (subgraph == "Buffs" || subgraph == "All")
            {
                itemCalculations.AddRange(Calculations.GetBuffCalculations(Character, Calculations.GetCharacterCalculations(Character), ConvertBuffSelector("Current")));
                ComparisonGraph.DisplayCalcs(itemCalculations.ToArray());
            }
            // Now Push the results to the screen
            ComparisonGraph.DisplayCalcs(_itemCalculations = itemCalculations.ToArray());
        }
开发者ID:LucasPeacecraft,项目名称:rawr,代码行数:59,代码来源:GraphDisplay.xaml.cs


示例19: SlotIndex

 private static int SlotIndex(ItemSlot slot)
 {
     switch (slot)
     {
         case ItemSlot.Head:
         case ItemSlot.Chest:
         case ItemSlot.Legs:
         case ItemSlot.TwoHand:
             return 0;
         case ItemSlot.Shoulders:
         case ItemSlot.Hands:
         case ItemSlot.Waist:
         case ItemSlot.Feet:
             return 1;
         case ItemSlot.Wrist:
         case ItemSlot.Neck:
         case ItemSlot.Back:
         case ItemSlot.Finger:
         case ItemSlot.OffHand:
         default:
             return 2;
         case ItemSlot.MainHand:
         case ItemSlot.OneHand:
             return 3;
         case ItemSlot.Ranged:
             return 4;
     }
 }
开发者ID:LucasPeacecraft,项目名称:rawr,代码行数:28,代码来源:RandomSuffix.cs


示例20: AddCommandSet

    public CommandSet AddCommandSet(string name, int capacity, bool autoFire, E_CommandConsume consumeType, CommandSet pipe)
    {
        CommandSet ret = null;
        if (consumeType == E_CommandConsume.ItemSlot)
        {
            ret = new ItemSlot(name, pipe);
        }
        else if (consumeType == E_CommandConsume.None)
        {
            ret = new ConsumableCommandSet(capacity, autoFire, false, pipe);
        }
        else if (consumeType == E_CommandConsume.Skill)
        {
            ret = new SkillSlot(pipe);
        }

        if (ret != null)
        {
            commandQueue.Add(name, ret);
        }
        return ret;
    }
开发者ID:pb0,项目名称:ID0_Test,代码行数:22,代码来源:Automaton.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ItemStack类代码示例发布时间:2022-05-24
下一篇:
C# ItemLoadHandler类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap