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


C# Weapon.GetName方法代码示例

本文整理汇总了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;
    }
开发者ID:drzaal,项目名称:space-soldier,代码行数:19,代码来源:Tooltip.cs

示例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;   
    }
开发者ID:VtheunforgivenV,项目名称:DigitaleSpiele,代码行数:44,代码来源:ListWeapons.cs

示例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);
    }
开发者ID:pShusta,项目名称:TheFellnightPrison,代码行数:41,代码来源:Database.cs


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