本文整理汇总了C#中Weapon.GetName方法的典型用法代码示例。如果您正苦于以下问题:C# Weapon.GetName方法的具体用法?C# Weapon.GetName怎么用?C# Weapon.GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Weapon
的用法示例。
在下文中一共展示了Weapon.GetName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public void Render(RectTransform anchor, Weapon weapon)
{
bool showAbove = (anchor.position.y / Screen.height) <= .6;
float tooltipY = showAbove ? anchor.position.y + anchor.sizeDelta.y / 2 + bufferDistance:
anchor.position.y - (anchor.sizeDelta.y / 2 + bufferDistance);
Vector2 newPosition = new Vector2(anchor.position.x, tooltipY);
StringBuilder sb = new StringBuilder(weapon.GetName()).AppendLine().AppendLine();
Dictionary<string, object> properties = weapon.GetProperties();
foreach (KeyValuePair<string, object> entry in properties)
{
sb.Append(entry.Key).Append(separator).Append(entry.Value).AppendLine();
}
text.text = sb.AppendLine().Append(weapon.GetDescription()).ToString();
rectTransform.pivot = showAbove ? new Vector2(.5f, 0) : new Vector2(.5f, 1);
rectTransform.position = newPosition;
canvasGroup.alpha = 1;
}
示例2: getIDForWeapon
/** -------------------------------- Calculate-Methods ------------------------*/
public int getIDForWeapon(Weapon weapon) {
IWeapon searchWeapon = null;
//Search in Small
foreach(IWeapon w in getSmallWeaponList()) {
if (((Inventory)w).GetName().Equals(weapon.GetName())) {
searchWeapon = w;
}
}
if(searchWeapon != null) {
if (getSmallWeaponList().Contains((Inventory)searchWeapon)) {
return getSmallWeaponList().IndexOf((Inventory)searchWeapon);
}
}
//Search in Middle
foreach (IWeapon w in getMiddleWeaponList()) {
if (((Inventory)w).GetName().Equals(weapon.GetName())) {
searchWeapon = w;
}
}
if (searchWeapon != null) {
if (getMiddleWeaponList().Contains((Inventory)searchWeapon)) {
return (getSmallWeaponList().Count + getMiddleWeaponList().IndexOf((Inventory)searchWeapon));
}
}
//Search in Big
foreach (IWeapon w in getBigWeaponList()) {
if (((Inventory)w).GetName().Equals(weapon.GetName())) {
searchWeapon = w;
}
}
if (searchWeapon != null) {
if (getBigWeaponList().Contains((Inventory)searchWeapon)) {
return (getSmallWeaponList().Count + getMiddleWeaponList().Count + getBigWeaponList().IndexOf((Inventory)searchWeapon));
}
}
Debug.Log("Weapon not Found");
return -1;
}
示例3: WeaponDbInsert
public static int WeaponDbInsert(Weapon _weap)
{
string _fill = "', '";
string _name, _dmgt, _elet, _weapt;
int _range, _dmga, _elea, _dura, _wght;
_name = _weap.GetName();
_range = _weap.GetRange();
_dmgt = _weap.GetDmgType().ToString();
_elet = _weap.GetEleDmgType().ToString();
_weapt = _weap.GetWeapType().ToString();
_dmga = _weap.GetPhysDmgAmt();
_elea = _weap.GetEleDmgAmt();
_dura = _weap.GetDura();
_wght = _weap.GetWeight();
string values = "('" + _name + _fill + _range + _fill + _elet + _fill + _dmgt + _fill + _elea + _fill + _dmga + _fill + _weapt + _fill + _dura + _fill + _wght + "')";
string locations = "(WeaponName, WeaponRange, EleDmgType, DmgType, EleDmgAmt, DmgAmt, WeapType, Durability, Weight)";
string cmdText = "INSERT INTO weapons " + locations + " VALUES" + values;
MySqlCommand _cmd = _masterConnect.CreateCommand();
_cmd.CommandText = cmdText;
_cmd.ExecuteNonQuery();
_cmd.CommandText = "SELECT * FROM thefellnightprison.weapons Where WeaponName = '" +
_name + "' AND WeaponRange = '" +
_range + "' AND DmgType = '" +
_dmgt + "' AND EleDmgType = '" +
_elet + "' AND DmgAmt = '" +
_dmga + "' AND EleDmgAmt = '" +
_elea + "' AND Durability = '" +
_dura + "' AND Weight = '" +
_wght + "'";
MySqlDataReader _reader = _cmd.ExecuteReader();
_reader.Read();
string thing = _reader["idWeapons"].ToString();
_reader.Close();
return Convert.ToInt32(thing);
}