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


C# ItemType.ToString方法代码示例

本文整理汇总了C#中ItemType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ItemType.ToString方法的具体用法?C# ItemType.ToString怎么用?C# ItemType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ItemType的用法示例。


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

示例1: ItemEntity

        //constructor
        /// <summary>
        /// ItemEntity, class contructor, passes entity data to base.
        /// </summary>
        /// <param name="x">X position of the item</param>
        /// <param name="y">Y position of the item</param>
        /// <param name="itemType">Type of item</param>
        public ItemEntity(double x, double y, ItemType itemType)
            : base(x, y, new HitBox[] { new HitBox(x - (GameResources.GameImage("Item" + itemType.ToString()).Width / 2.0), y - (GameResources.GameImage("Item" + itemType.ToString()).Height / 2), GameResources.GameImage("Item" + itemType.ToString()).Width, GameResources.GameImage("Item" + itemType.ToString()).Height)}, 1, "Item" + itemType.ToString())
        {
            _itemType = itemType;

            _vectorMovement = new VectorMovement(90.0, 5.0);
            _gravMovement = new GravitationalMovement(0.0, -3.0, 0.0, 0.1, 0.0, 1.8);
        }
开发者ID:6819710,项目名称:UnreasonableMechanism,代码行数:15,代码来源:ItemEntity.cs

示例2: GenerateRandomElement

        public Item GenerateRandomElement(ItemType itemType)
        {
            try
            {
                // select count of Items with correct Type
                // the itemname structure Itemtype_ModeNumber example: BOOTS_001 , BELT_104
                // where mode is 0 = normal , 1 = nightmare, 2 = hell
                // there are missing snoId for nightmare and hell so just use items from normal mode
                const string modeId = "0";

                String querypart = String.Format("from items where itemname like '{0}_{1}%'", itemType.ToString(), modeId);
                String countQuery = String.Format("SELECT count(*) {0}", querypart);
                var cmd = new SQLiteCommand(countQuery, Storage.GameDataDBManager.Connection);
                var reader = cmd.ExecuteReader();
                reader.Read();
                int itemsCount = reader.GetInt32(0);

                if (itemsCount == 0)
                {
                    querypart = String.Format("from items where itemname like '{0}%'", itemType.ToString());
                    countQuery = String.Format("SELECT count(*) {0}", querypart);
                    cmd = new SQLiteCommand(countQuery, Storage.GameDataDBManager.Connection);
                    reader = cmd.ExecuteReader();
                    reader.Read();
                    itemsCount = reader.GetInt32(0);
                }

                // Now select random element
                int selectedElementNr = RandomHelper.Next(itemsCount);
                String selectRandom = String.Format("SELECT itemname, snoId {0} limit {1},1", querypart, selectedElementNr);
                cmd = new SQLiteCommand(selectRandom, Storage.GameDataDBManager.Connection);
                reader = cmd.ExecuteReader();

                if (!reader.HasRows)
                {
                    throw new Exception("Missing Data in DB");
                }

                while (reader.Read())
                {
                    var itemName = (String)reader.GetString(0);
                    var snoId = (int)reader.GetInt32(1);
                    return CreateItem(itemName, snoId, itemType);
                }
            }
            catch (Exception e)
            {
                Logger.ErrorException(e, "Error generating item of type: {0}", itemType.ToString());
            }
            return null;
        }
开发者ID:Sanchen,项目名称:mooege,代码行数:51,代码来源:ItemTypeGenerator.cs

示例3: ItemEntity

 /// <summary>
 /// Constructs a new item entitiy.
 /// </summary>
 /// <param name="location">Position of the item (point).</param>
 /// <param name="itemType">Type of item (itemtype).</param>
 public ItemEntity(Point location, ItemType itemType)
     : base("Item" + itemType.ToString(), InitBounding(location, itemType), 1)
 {
     _itemType = itemType;
     _flag = itemType == ItemType.Star;
     _movement = new Gravity(new Vector(0, -3), new Vector(0, 0.1), 1.8);
 }
开发者ID:6819710,项目名称:UnreasonableMechanism,代码行数:12,代码来源:ItemEntity.cs

示例4: ItemBuilder

 //private ItemType _itemType;
 private ItemBuilder(ItemType type)
 {
     //_itemType = type;
     _item = new Item
         {
             Name = type.ToString()
         };
 }
开发者ID:glucolo,项目名称:Gilded-Rose-Kata,代码行数:9,代码来源:ItemBuilder.cs

示例5: GetInstance

 public static Item GetInstance(ItemType type)
 {
     Item result;
       if(!ItemCache.TryGetValue(type, out result)) {
     result = Resources.Load<Item>(ITEMS_FOLDER_PATH + type.ToString());
     result.Type = type;
     ItemCache.Add(type, result);
       }
       return result;
 }
开发者ID:satirikasha,项目名称:MatchThree,代码行数:10,代码来源:Item.cs

示例6: ItemEntity

        /// <summary>
        /// ItemEntity Constructor, initalises item.
        /// </summary>
        /// <param name="point"></param>
        /// <param name="itemType"></param>
        public ItemEntity(Point2D point, ItemType itemType)
            : base(point, InitaliseBounding(point, itemType), 1, "Item" + itemType.ToString())
        {
            _itemType = itemType;

            _movement = new GravitationalMovement(new Velocity2D(-3.0, 90.0), new Acceleration2D(new Vector2D(0, 0.1), 1.8));
            _flagMovement = new VectorMovement(new Velocity2D(5.0, 90.0));

            _flag = _itemType == UnrealMechanismCS.ItemType.Star;
        }
开发者ID:6819710,项目名称:UnreasonableMechanism,代码行数:15,代码来源:ItemEntity.cs

示例7: Item

 public Item(string name, int ID, string desc, int power, int speed, ItemType type)
 {
     itemName = name;
     itemID = ID;
     itemDesc = desc;
     itemIcon = Resources.Load<Texture2D> (type.ToString () + " Assets/" + name);
     itemPower = power;
     itemSpeed = speed;
     itemType = type;
 }
开发者ID:ChopsNappleSauce,项目名称:re-aniMatt,代码行数:10,代码来源:Item.cs

示例8: GetItemList

        /// <summary>
        /// 取得項目
        /// </summary>
        /// <param name="name"></param>
        /// <param name="itmType"></param>
        /// <returns></returns>
        public List<string> GetItemList(ItemType itmType)
        {
            List<string> retVal = new List<string>();

            UDT_SystemListDef data=UDTTransfer.GetSystemListByName(itmType.ToString());
            XElement elmData = XElement.Parse(data.Content);
            if (elmData != null)
                retVal = (from elm in elmData.Elements("item") select elm.Attribute("name").Value).ToList();
            return retVal;
        }
开发者ID:ChunTaiChen,项目名称:Counsel_System,代码行数:16,代码来源:CareRecordItemManager.cs

示例9: InitaliseBounding

        public static List<Bounding> InitaliseBounding(Point2D point, ItemType itemType)
        {
            List<Bounding> result = new List<Bounding>();

            result.Add(new Bounding(new Point2D[]
            {
                new Point2D(point.X + GameResources.GameImage("Item" + itemType.ToString()).Width,point.Y - GameResources.GameImage("Item" + itemType.ToString()).Height),
                new Point2D(point.X - GameResources.GameImage("Item" + itemType.ToString()).Width,point.Y - GameResources.GameImage("Item" + itemType.ToString()).Height),
                new Point2D(point.X - GameResources.GameImage("Item" + itemType.ToString()).Width,point.Y + GameResources.GameImage("Item" + itemType.ToString()).Height),
                new Point2D(point.X + GameResources.GameImage("Item" + itemType.ToString()).Width,point.Y + GameResources.GameImage("Item" + itemType.ToString()).Height)
            }));

            return result;
        }
开发者ID:6819710,项目名称:UnreasonableMechanism,代码行数:14,代码来源:ItemEntity.cs

示例10: createNewItem

    // ------------------------------------------------------------------------------------ //
    public static ItemBase createNewItem(ItemType itemType)
    {
        GameObject itemGameObject = Instantiate (ResourcesBase.load("Prefabs/UI/Plane", true)) as GameObject;

        itemGameObject.name = "Item" + itemType.ToString();
        itemGameObject.tag = ItemBase.ITEM_TAG;

        ItemBase itemBase = null;

        if (itemType == ItemType.Bonus) {
            itemBase = itemGameObject.AddComponent<ItemBonus>();
        }
        else {
            SLog.logError("ItemFactory createNewItem(): unknown type == " + itemType.ToString());
        }

        if (itemBase != null) {
            itemBase.initialize();
        }

        return itemBase;
    }
开发者ID:YuriyKokosha,项目名称:PonyGame,代码行数:23,代码来源:ItemFactory.cs

示例11: AddItem

 /// <summary>
 /// 新增項目
 /// </summary>
 /// <param name="itemName"></param>
 /// <param name="itmType"></param>
 public void AddItem(string itemName, ItemType itmType)
 {
     UDT_SystemListDef data=UDTTransfer.GetSystemListByName(itmType.ToString());
     XElement elmData = XElement.Parse(data.Content);
     List<UDT_SystemListDef> update= new List<UDT_SystemListDef>();
     if (elmData != null)
     {
         XElement elm = new XElement("item");
         elm.SetAttributeValue("name", itemName);
         elmData.Add(elm);
     }
     data.Content = elmData.ToString();
     update.Add(data);
     UDTTransfer.UpdateSystemList(update);
 }
开发者ID:ChunTaiChen,项目名称:Counsel_System,代码行数:20,代码来源:CareRecordItemManager.cs

示例12: ItemPickedUp

	// Receives message
	public void ItemPickedUp(ItemType type_){
		// Adds item to inventory list
		if (itemList.Count < inventorySpaces) {
			// Checks the item isn't already in the list
			bool exists = false;
			foreach(ItemType item in itemList){
				if(item == type_){
					exists = true;
				}
				break;
			}
			if(!exists){
				Debug.Log ("Item Picked Up: " + type_.ToString ());
				itemList.Add (type_);

				switch(type_){
					case ItemType.CEREAL_BOX:
						cerealBoxIcon.SetActive(true);
						break;
					case ItemType.BOWL:
						bowlIcon.SetActive(true);
						break;
					case ItemType.MILK:
						milkIcon.SetActive(true);
						break;
					case ItemType.SPOON:
						spoonIcon.SetActive(true);
						break;
					case ItemType.SPANNER:
						spannerIcon.SetActive(true);
						break;
					case ItemType.TOWEL_DIRTY:
						towelDirtyIcon.SetActive(true);
						break;
					case ItemType.TOWEL_CLEAN:
						towelCleanIcon.SetActive(true);
						break;
					case ItemType.BUNDLE_OF_CLOTHES:
						bundleOfClothesIcon.SetActive(true);
						break;
					case ItemType.KEY:
						keyIcon.SetActive(true);
						break;
				}
			}
		}
	}
开发者ID:DeanoMachino,项目名称:Monday-Morning,代码行数:48,代码来源:InventoryManager.cs

示例13: generateRandomElement

        public Item generateRandomElement(ItemType itemType)
        {
            try
            {

                // select count of Items with correct Type
                // the itemname structure ITEMTYPE_NUMBER example: BOOTS_001 , BELT_004
                String querypart = String.Format("from items where itemname like '{0}_%'", itemType.ToString());
                String countQuery = String.Format("SELECT count(*) {0}", querypart);
                var cmd = new SQLiteCommand(countQuery, Storage.GameDataDBManager.Connection);
                var reader = cmd.ExecuteReader();
                reader.Read();
                int itemsCount = reader.GetInt32(0);

                // Now select random element 
                var rand = new Random();
                int selectedElementNr = rand.Next(itemsCount);
                String selectRandom = String.Format("SELECT itemname {0} limit {1},1", querypart, selectedElementNr);
                cmd = new SQLiteCommand(selectRandom, Storage.GameDataDBManager.Connection);
                reader = cmd.ExecuteReader();

                if (!reader.HasRows)
                {
                    throw new Exception("Missing Data in DB");
                }

                while (reader.Read())
                {
                    var itemName = (String)reader.GetString(0);
                    var id = (int)StringHashHelper.HashItemName(itemName);
                    var item = new Item(id, itemType);
                    return item;
                }

            }
            catch (Exception e)
            {
                Logger.ErrorException(e, "Error generating Item");
            }

            return null;
        }
开发者ID:kwyjibbo,项目名称:d3sharp,代码行数:42,代码来源:ItemTypeGenerator.cs

示例14: AddItem

		internal void AddItem(ItemType itemType, int lineNumber, string description, Protean.Hub.Files.File sourceFile)
		{
			ListViewItem item = new ListViewItem();
			item.Tag = sourceFile;
			item.Text = itemType.ToString();

			item.ImageIndex	= this.IconFromType(itemType);


			item.SubItems.Add(new ListViewItem.ListViewSubItem(item, lineNumber.ToString()));
			item.SubItems.Add(new ListViewItem.ListViewSubItem(item, description.Trim()));
			item.SubItems.Add(new ListViewItem.ListViewSubItem(item, sourceFile.FileNameOnly));
			item.SubItems.Add(new ListViewItem.ListViewSubItem(item, sourceFile.FileNameExpanded));

			this.m_ListItems.Add(item);
			this.lsv_Tasks.Items.Add((ListViewItem)item.Clone());

			this.sbp_TotalItems.Text = "Total items: " + this.lsv_Tasks.Items.Count.ToString();
			this.sbp_FilterItems.Text = "Filtered items: " + this.lsv_Tasks.Items.Count.ToString();

		}
开发者ID:Sodaware,项目名称:protean.todolist,代码行数:21,代码来源:frm_TodoList.cs

示例15: QueryItemsExtended

        public ExtendedItem[][] QueryItemsExtended(string workspaceName, string workspaceOwner, 
																							 ItemSpec[] itemSpecs,	
																							 DeletedState deletedState, ItemType itemType)
        {
            Message msg = new Message(GetWebRequest (new Uri(Url)), "QueryItemsExtended");

            if (!String.IsNullOrEmpty(workspaceName)) msg.Body.WriteElementString("workspaceName", workspaceName);
            if (!String.IsNullOrEmpty(workspaceOwner)) msg.Body.WriteElementString("workspaceOwner", workspaceOwner);

            msg.Body.WriteStartElement("items");
            foreach (ItemSpec itemSpec in itemSpecs)
                {
                    itemSpec.ToXml(msg.Body, "ItemSpec");
                }
            msg.Body.WriteEndElement();

            msg.Body.WriteElementString("deletedState",
                                                                    deletedState.ToString());
            msg.Body.WriteElementString("itemType",
                                                                    itemType.ToString());

            List< ExtendedItem[] > listOfItemArrays = new List<ExtendedItem[] >();
            using (HttpWebResponse response = Invoke(msg))
                {
                    XmlReader results = msg.ResponseReader(response);
                    while (results.Read())
                        {
                            if (results.NodeType == XmlNodeType.Element &&
                                    results.Name == "ArrayOfExtendedItem")
                                {
                                    List<ExtendedItem> items = new List<ExtendedItem>();
                                    while (results.Read())
                                        {
                                            //Console.WriteLine("	 " + results.Name + ":" + results.NodeType);
                                            if (results.NodeType == XmlNodeType.EndElement &&
                                                    results.Name == "ArrayOfExtendedItem") break;
                                            if (results.NodeType == XmlNodeType.Element &&
                                                    results.Name == "ExtendedItem")
                                                items.Add(ExtendedItem.FromXml(this, results));
                                        }
                                    listOfItemArrays.Add(items.ToArray());
                                }
                        }
                }

            return listOfItemArrays.ToArray();
        }
开发者ID:Jeff-Lewis,项目名称:opentf,代码行数:47,代码来源:Repository.cs


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