本文整理汇总了C#中TagData.GetModifier方法的典型用法代码示例。如果您正苦于以下问题:C# TagData.GetModifier方法的具体用法?C# TagData.GetModifier怎么用?C# TagData.GetModifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagData
的用法示例。
在下文中一共展示了TagData.GetModifier方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Handle
public override TemplateObject Handle(TagData data)
{
long eid;
string input = data.GetModifier(0).ToLowerFast();
if (long.TryParse(input, out eid))
{
Entity e = TheServer.GetEntity(eid);
if (e != null && e is LivingEntity)
{
return new LivingEntityTag((LivingEntity)e).Handle(data.Shrink());
}
}
else
{
foreach (PlayerEntity p in TheServer.Players)
{
if (p.Name.ToLowerFast() == input)
{
return new LivingEntityTag(p).Handle(data.Shrink());
}
}
}
data.Error("Invalid living entity '" + TagParser.Escape(input) + "'!");
return new NullTag();
}
示例2: Handle
/// <summary>
/// Handles the 'ternary' tag.
/// </summary>
/// <param name="data">The data to be handled.</param>
public override string Handle(TagData data)
{
bool basevalue = data.GetModifier(0).ToLower() == "true";
data.Shrink();
if (data.Input.Count == 0)
{
return "&null";
}
// <--[tag]
// @Name TernaryPassTag.pass[<TextTag>]
// @Group Text Comparison
// @ReturnType TernaryFailTag
// @Returns a step in the ternary pass/fail tag.
// Used as a part of the <@link tag Ternary[<TextTag>]>Ternary<@/link> tag.
// -->
if (data.Input[0] != "pass")
{
return new TextTag("&null").Handle(data);
}
string result = "";
if (basevalue)
{
result = data.GetModifier(0);
}
data.Shrink();
if (data.Input.Count == 0)
{
return "&null";
}
// <--[tag]
// @Name TernaryFailTag.fail[<TextTag>]
// @Group Text Comparison
// @ReturnType TextTag
// @Returns a step in the ternary pass/fail tag.
// Used as a part of the <@link tag Ternary[<TextTag>]>Ternary<@/link> tag.
// -->
if (data.Input[0] != "fail")
{
return new TextTag("&null").Handle(data);
}
if (!basevalue)
{
result = data.GetModifier(0);
}
return new TextTag(result).Handle(data.Shrink());
}
示例3: Handle
public override TemplateObject Handle(TagData data)
{
EffectAssetTag atag = EffectAssetTag.For(data.GetModifier(0));
if (atag == null)
{
return new TextTag("&{NULL}").Handle(data.Shrink());
}
return atag.Handle(data.Shrink());
}
示例4: Handle
public override TemplateObject Handle(TagData data)
{
OfflinePlayerTag ptag = OfflinePlayerTag.For(Utilities.StringToULong(data.GetModifier(0)));
if (ptag == null)
{
return new TextTag("&{NULL}").Handle(data.Shrink());
}
return ptag.Handle(data.Shrink());
}
示例5: Handle
public override TemplateObject Handle(TagData data)
{
string pname = data.GetModifier(0);
PlayerTag ptag = PlayerTag.For(pname);
if (ptag == null)
{
return new TextTag("&{NULL}").Handle(data.Shrink());
}
return ptag.Handle(data.Shrink());
}
示例6: Handle
public override TemplateObject Handle(TagData data)
{
string iname = data.GetModifier(0);
WorldObjectAssetTag itag = WorldObjectAssetTag.For(iname);
if (itag == null)
{
return new TextTag("&{NULL}").Handle(data.Shrink());
}
return itag.Handle(data.Shrink());
}
示例7: Handle
public override TemplateObject Handle(TagData data)
{
string lname = data.GetModifier(0);
LocationTag ltag = LocationTag.For(lname);
if (ltag == null)
{
return new TextTag("&{NULL}").Handle(data.Shrink());
}
return ltag.Handle(data.Shrink());
}
示例8: Handle
public override TemplateObject Handle(TagData data)
{
string modif = data.GetModifier(0);
EntityTag itag = EntityTag.For(modif);
if (itag == null)
{
data.Error("Invalid entity!");
return new NullTag().Handle(data.Shrink());
}
return itag.Handle(data.Shrink());
}
示例9: Handle
public override TemplateObject Handle(TagData data)
{
string cname = data.GetModifier(0);
ColorTag ctag = ColorTag.For(cname);
if (ctag == null)
{
data.Error("Invalid color '" + TagParser.Escape(cname) + "'!");
return new NullTag();
}
return ctag.Handle(data.Shrink());
}
示例10: Handle
public override TemplateObject Handle(TagData data)
{
string rname = data.GetModifier(0);
World w = TheServer.GetWorld(rname);
if (w != null)
{
return new WorldTag(w);
}
data.Error("Invalid world '" + TagParser.Escape(rname) + "'!");
return new NullTag();
}
示例11: Handle
public override TemplateObject Handle(TagData data)
{
string lname = data.GetModifier(0);
LocationTag ltag = LocationTag.For(TheServer, data, lname);
if (ltag == null)
{
data.Error("Invalid location '" + TagParser.Escape(lname) + "'!");
return new NullTag();
}
return ltag.Handle(data.Shrink());
}
示例12: Handle
public override TemplateObject Handle(TagData data)
{
string modif = data.GetModifier(0);
if (modif.StartsWith("e:"))
{
modif = modif.Substring("e:".Length);
}
AnimalTag atag = AnimalTag.For(Utilities.StringToInt(modif));
if (atag == null)
{
return new TextTag("&{NULL}").Handle(data.Shrink());
}
return atag.Handle(data.Shrink());
}
示例13: Handle
public override TemplateObject Handle(TagData data)
{
string input = data.GetModifier(0).ToLowerFast();
try
{
Material mat = MaterialHelpers.FromNameOrNumber(input);
return new MaterialTag(mat).Handle(data.Shrink());
}
catch (Exception ex)
{
Utilities.CheckException(ex);
data.Error("Invalid material '" + TagParser.Escape(input) + "'!");
return new NullTag();
}
}
示例14: Handle
public override TemplateObject Handle(TagData data)
{
long eid;
string input = data.GetModifier(0).ToLowerFast();
if (long.TryParse(input, out eid))
{
Entity e = TheServer.GetEntity(eid);
if (e != null && e is ModelEntity)
{
return new ModelEntityTag((ModelEntity)e).Handle(data.Shrink());
}
}
data.Error("Invalid model entity '" + TagParser.Escape(input) + "'!");
return new NullTag();
}
示例15: Handle
public override string Handle(TagData data)
{
string modif = data.GetModifier(0).ToLower();
if (data.Variables != null)
{
TemplateObject value;
if (data.Variables.TryGetValue(modif, out value))
{
data.Shrink();
if (data.Input.Count == 0)
{
return value.ToString();
}
// <--[tag]
// @Name VariableTag.exists
// @Group Variables
// @ReturnType TextTag
// @Returns whether the specified variable exists.
// Specifically for the tag <@link tag var[<TextTag>]><{var[<TextTag>]}><@/link>.
// -->
if (data.Input[0] == "exists")
{
return new TextTag(true).Handle(data.Shrink());
}
else
{
return value.Handle(data);
}
}
}
data.Shrink();
if (data.Input.Count > 0 && data.Input[0] == "exists")
{
return new TextTag(false).Handle(data.Shrink());
}
else
{
return new TextTag("").Handle(data);
}
}