本文整理汇总了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);
}
示例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;
}
示例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);
}
示例4: ItemBuilder
//private ItemType _itemType;
private ItemBuilder(ItemType type)
{
//_itemType = type;
_item = new Item
{
Name = type.ToString()
};
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
}
}
}
示例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;
}
示例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();
}
示例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();
}