Terraria.Ja.GetPrefix C# (CSharp) Method

GetPrefix() public static method

public static GetPrefix ( int l ) : string
l int
return string
        public static string GetPrefix(int l)
        {
            if (language == null) return "";

            // ������擾
            Dictionary<int, string> dic;
            if (language.TryGetValue("prefixs", out dic))
            {
                // �e�L�X�g��擾
                var name = "";
                if (dic.TryGetValue(l, out name))
                {
                    return name;
                }
            }
            return "";
        }

Usage Example

Exemplo n.º 1
0
        public string AffixName()
        {
            // オリジナルのテキストを取得
            var type       = typeof(Terraria.Item);
            var method     = type.GetMethod("_AffixName");
            var str_origin = (string)method.Invoke(this, null);

            // プレフィクスとアイテムのフィールドを取得
            var f_prefix = type.GetField("prefix");
            var f_name   = type.GetField("name");

            // フィールドから値を取得
            var prefix = Ja.GetPrefix((byte)f_prefix.GetValue(this));
            var name   = (string)f_name.GetValue(this);

            // 名前が空でなければ、日本語を返す
            if (name != "")
            {
                if (prefix != "")
                {
                    return(name + "(" + prefix + ")");
                }
                else
                {
                    return(name);
                }
            }

            // 名前が空ならば、元の名前を返す
            return(str_origin);
        }