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


C# Terraria.Item类代码示例

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


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

示例1: Swap

 public static void Swap(bool cycle)
 {
     Player p = Main.player[Main.myPlayer];
     if (Main.gameMenu) return;
     Item[] temp = new Item[10];
     if (cycle)
     {
         for (int i = 0; i < 10; i++)
         {
             temp[i] = p.inventory[i];
             p.inventory[i] = p.inventory[i + 10];
             p.inventory[i + 10] = p.inventory[i + 20];
             p.inventory[i + 20] = p.inventory[i + 30];
             p.inventory[i + 30] = p.inventory[i + 40];
             p.inventory[i + 40] = temp[i];
         }
     }
     else
     {
         for (int i = 0; i < 10; i++)
         {
             temp[i] = p.inventory[i];
             p.inventory[i] = p.inventory[i + 40];
             p.inventory[i + 40] = temp[i];
         }
     }
 }
开发者ID:dougbenham,项目名称:TerrariaPatcher,代码行数:27,代码来源:HotbarSwap.cs

示例2: GetItem

        //new[]
        //    {
        //        new ItemId(1, "Gold Pickaxe"),
        //        new ItemId(4, "Gold Broadsword"),
        //        new ItemId(6, "Gold Shortsword"),
        //        new ItemId(10, "Gold Axe"),
        //        new ItemId(7, "Gold Hammer"),
        //        new ItemId(99, "Gold Bow"),
        //        new ItemId(1, "Silver Pickaxe"),
        //        new ItemId(4, "Silver Broadsword"),
        //        new ItemId(6, "Silver Shortsword"),
        //        new ItemId(10, "Silver Axe"),
        //        new ItemId(7, "Silver Hammer"),
        //        new ItemId(99, "Silver Bow"),
        //        new ItemId(1, "Copper Pickaxe"),
        //        new ItemId(4, "Copper Broadsword"),
        //        new ItemId(6, "Copper Shortsword"),
        //        new ItemId(10, "Copper Axe"),
        //        new ItemId(7, "Copper Hammer"),
        //        new ItemId(198, "Blue Phasesaber"),
        //        new ItemId(199, "Red Phasesaber"),
        //        new ItemId(200, "Green Phasesaber"),
        //        new ItemId(201, "Purple Phasesaber"),
        //        new ItemId(202, "White Phasesaber"),
        //        new ItemId(203, "Yellow Phasesaber"),
        //    };

        public Terraria.Item GetItem(int id)
        {
            var curitem = new Terraria.Item();
            curitem.SetDefaults(id);
            return curitem;

        }
开发者ID:KeviinSkyline,项目名称:Terraria-Map-Editor,代码行数:34,代码来源:TerrariaWrapper.cs

示例3: Handle

 public static void Handle(ref Item inv, int context = 0)
 {
     ItemSlot.singleSlotArray[0] = inv;
     ItemSlot.Handle(ItemSlot.singleSlotArray, context, 0);
     inv = ItemSlot.singleSlotArray[0];
     Recipe.FindRecipes();
 }
开发者ID:EmuDevs,项目名称:EDTerraria,代码行数:7,代码来源:ItemSlot.cs

示例4: PUIItemSlot

 public PUIItemSlot()
 {
     ShowTooltip = true;
     Width.Set(_texture.Width * SCALE, 0);
     Height.Set(_texture.Height * SCALE, 0);
     Item = new Item();
 }
开发者ID:chatrat12,项目名称:Prism,代码行数:7,代码来源:PUIItemSlot.cs

示例5: SetDefaults

		public override void SetDefaults(Item item)
		{
			if (item.type == ItemID.CopperShortsword)
			{
				item.damage = 50;
			}
		}
开发者ID:bluemagic123,项目名称:tModLoader,代码行数:7,代码来源:CopperShortsword.cs

示例6: CreateItem

 public static Item CreateItem(string itemName, int stack = 0)
 {
     Item item = new Item();
     item.RealSetDefaults(itemName);
     if (stack > 0) item.stack = stack;
     return item;
 }
开发者ID:Jaex,项目名称:Terraria-API,代码行数:7,代码来源:ItemHelper.cs

示例7: ReadExtraData

 public override void ReadExtraData(BinaryReader reader)
 {
     item = new Item();
     item.netDefaults((int)reader.ReadInt16());
     item.Prefix((int)reader.ReadByte());
     item.stack = (int)reader.ReadInt16();
 }
开发者ID:EmuDevs,项目名称:EDTerraria,代码行数:7,代码来源:TEItemFrame.cs

示例8: UIController

 static UIController()
 {
     _userInterface = new UserInterface();
     _state = new UIState();
     _userInterface.SetState(_state);
     TooltipText = string.Empty;
     TooltipItem = new Item();
 }
开发者ID:chatrat12,项目名称:Prism,代码行数:8,代码来源:UIController.cs

示例9: AddItem

 private void AddItem(Item item)
 {
     if (!string.IsNullOrEmpty(item.name))
     {
         ItemType itemType = new ItemType(item.type, item.name, item.color);
         Items.Add(itemType);
         LoadIcon(itemType);
     }
 }
开发者ID:Jaex,项目名称:Terraria-API,代码行数:9,代码来源:ItemManager.cs

示例10: Item

        TextSnippet ITagHandler.Parse(string text, Color baseColor, string options)
        {
            Item obj = new Item();
            int result1;
            if (int.TryParse(text, out result1))
                obj.netDefaults(result1);
            else
                obj.SetDefaults(text);

            if (obj.itemId <= 0)
                return new TextSnippet(text);

            obj.stack = 1;
            if (options != null)
            {
                string[] strArray = options.Split(',');
                for (int index = 0; index < strArray.Length; ++index)
                {
                    if (strArray[index].Length != 0)
                    {
                        switch (strArray[index][0])
                        {
                            case 'p':
                                int result2;
                                if (int.TryParse(strArray[index].Substring(1), out result2))
                                {
                                    obj.Prefix(Utils.Clamp<int>(result2, 0, 84));
                                    continue;
                                }
                                continue;
                            case 's':
                            case 'x':
                                int result3;
                                if (int.TryParse(strArray[index].Substring(1), out result3))
                                {
                                    obj.stack = Utils.Clamp<int>(result3, 1, obj.maxStack);
                                    continue;
                                }
                                continue;
                            default:
                                continue;
                        }
                    }
                }
            }

            string str = "";
            if (obj.stack > 1)
                str = " (" + obj.stack + ")";

            ItemSnippet itemSnippet = new ItemSnippet(obj);
            itemSnippet.Text = "[" + obj.AffixName() + str + "]";
            itemSnippet.CheckForHover = true;
            itemSnippet.DeleteWhole = true;
            return itemSnippet;
        }
开发者ID:EmuDevs,项目名称:EDTerraria,代码行数:56,代码来源:ItemTagHandler.cs

示例11: GenerateTag

        public static string GenerateTag(Item I)
        {
            string str = "[i";
            if (I.prefix != 0)
                str = str + "/p" + I.prefix;
            if (I.stack != 1)
                str = str + "/s" + I.stack;

            return str + ":" + I.netID + "]";
        }
开发者ID:EmuDevs,项目名称:EDTerraria,代码行数:10,代码来源:ItemTagHandler.cs

示例12: OnSetDefaultsString

        public static void OnSetDefaultsString(ref string itemname, Item item)
        {
            if (SetDefaultsString == null)
                return;
            var args = new SetDefaultsEventArgs<Item, string>()
            {
                Object = item,
                Info = itemname,
            };

            SetDefaultsString(args);

            itemname = args.Info;
        }
开发者ID:Jaex,项目名称:Terraria-API,代码行数:14,代码来源:ItemHooks.cs

示例13: OnSetDefaultsInt

        public static void OnSetDefaultsInt(ref int itemtype, Item item)
        {
            if (SetDefaultsInt == null)
                return;

            var args = new SetDefaultsEventArgs<Item, int>()
            {
                Object = item,
                Info = itemtype,
            };

            SetDefaultsInt(args);

            itemtype = args.Info;
        }
开发者ID:Jaex,项目名称:Terraria-API,代码行数:15,代码来源:ItemHooks.cs

示例14: RemoveItem

        public static bool RemoveItem(Item item)
        {
            if (item != null && item.active)
            {
                item.active = false;

                for (int i = 0; i < me.inventory.Length; i++)
                {
                    if (me.inventory[i] == item)
                    {
                        me.inventory[i] = new Item();
                        Main.PlaySound(7, (int)me.position.X, (int)me.position.Y, 1);
                        return true;
                    }
                }
            }

            return false;
        }
开发者ID:Jaex,项目名称:Terraria-API,代码行数:19,代码来源:ItemHelper.cs

示例15: UseItem

		public override bool UseItem(Item item, Player player)
		{
			if (item.healLife > 0)
			{
				if (player.GetModPlayer<ExamplePlayer>(mod).badHeal)
				{
					int heal = item.healLife;
					int damage = player.statLifeMax2 - player.statLife;
					if (heal > damage)
					{
						heal = damage;
					}
					if (heal > 0)
					{
						player.AddBuff(mod.BuffType("Undead2"), 2 * heal, false);
					}
				}
			}
			return base.UseItem(item, player);
		}
开发者ID:bluemagic123,项目名称:tModLoader,代码行数:20,代码来源:Potion.cs


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