本文整理汇总了C#中TagData.Shrink方法的典型用法代码示例。如果您正苦于以下问题:C# TagData.Shrink方法的具体用法?C# TagData.Shrink怎么用?C# TagData.Shrink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagData
的用法示例。
在下文中一共展示了TagData.Shrink方法的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
public override TemplateObject Handle(TagData data)
{
if (data.Remaining == 0)
{
return this;
}
switch (data[0])
{
// <--[tag]
// @Name MaterialTag.name
// @Group General Information
// @ReturnType TextTag
// @Returns the material's name.
// @Example "stone" .name returns "stone".
// -->
case "name":
return new TextTag(ToString()).Handle(data.Shrink());
// <--[tag]
// @Name MaterialTag.speed_mod
// @Group General Information
// @ReturnType NumberTag
// @Returns the material's speed modification.
// @Example "stone" .speed_mod returns "1.1".
// -->
case "speed_mod":
return new NumberTag(Internal.GetSpeedMod()).Handle(data.Shrink());
// TODO: More tags
default:
return new TextTag(ToString()).Handle(data);
}
}
示例3: Handle
public override TemplateObject Handle(TagData data)
{
if (data.Remaining == 0)
{
return this;
}
switch (data[0])
{
// <--[tag]
// @Name ModelEntityTag.model
// @Group General Information
// @ReturnType TextTag
// @Returns the ModelEntity's model.
// @Example "5" .model could return "cube".
// -->
case "model":
return new TextTag(Internal.model).Handle(data.Shrink());
// <--[tag]
// @Name ModelEntityTag.scale
// @Group General Information
// @ReturnType LocationTag
// @Returns the ModelEntity's scale as a LocationTag.
// @Example "5" .scale could return "(1, 1, 1)".
// -->
case "scale":
return new LocationTag(Internal.scale, null).Handle(data.Shrink());
default:
return new PhysicsEntityTag((PhysicsEntity)Internal).Handle(data);
}
}
示例4: Handle
public override TemplateObject Handle(TagData data)
{
if (data.Remaining == 0)
{
return this;
}
switch (data[0])
{
// <--[tag]
// @Name PhysicsEntityTag.mass
// @Group General Information
// @ReturnType NumberTag
// @Returns the PhysicsEntity's mass.
// @Example "10" .mass could return "40".
// -->
case "mass":
return new NumberTag(Internal.Mass).Handle(data.Shrink());
// <--[tag]
// @Name PhysicsEntityTag.bounciness
// @Group General Information
// @ReturnType NumberTag
// @Returns the PhysicsEntity's bounciness (how much it bounces).
// @Example "10" .bounciness could return "0.5".
// -->
case "bounciness":
return new NumberTag(Internal.GetBounciness()).Handle(data.Shrink());
default:
return new EntityTag((Entity)Internal).Handle(data);
}
}
示例5: Handle
public override TemplateObject Handle(TagData data)
{
if (data.Remaining == 0)
{
return this;
}
switch (data[0])
{
// <--[tag]
// @Name ResourceTag.asset
// @Group General Information
// @ReturnType ResourceAssetTag
// @Returns the resource asset that this resource is based off.
// @Example "2" .asset returns "Bush_Jade".
// -->
case "asset":
return new ResourceAssetTag(Internal.asset).Handle(data.Shrink());
// <--[tag]
// @Name ResourceTag.health
// @Group General Information
// @ReturnType NumberTag
// @Returns the current health of the resource.
// @Example "2" .health returns "1".
// -->
case "health":
return new NumberTag(Internal.health).Handle(data.Shrink());
default:
return new EntityTag(Internal.model.gameObject).Handle(data);
}
}
示例6: Handle
public override TemplateObject Handle(TagData data)
{
if (data.Remaining == 0)
{
return this;
}
switch (data[0])
{
// <--[tag]
// @Name PrimitiveEntityTag.velocity
// @Group General Information
// @ReturnType LocationTag
// @Returns the PrimitiveEntity's velocity as a LocationTag.
// @Example "10" .velocity could return "(40, 10, 0)".
// -->
case "velocity":
return new LocationTag(Internal.GetVelocity(), null).Handle(data.Shrink());
// <--[tag]
// @Name PrimitiveEntityTag.scale
// @Group General Information
// @ReturnType LocationTag
// @Returns the PrimitiveEntity's scale as a LocationTag.
// @Example "5" .scale could return "(1, 1, 1)".
// -->
case "scale":
return new LocationTag(Internal.Scale, null).Handle(data.Shrink());
default:
return new EntityTag((Entity)Internal).Handle(data);
}
}
示例7: Handle
public override TemplateObject Handle(TagData data)
{
if (data.Remaining == 0)
{
return this;
}
switch (data[0])
{
// <--[tag]
// @Name BulletEntityTag.damage
// @Group General Information
// @ReturnType NumberTag
// @Returns the amount of damage the BulletEntity will do, not counting splash or other special damage.
// @Example "10" .damage could return "1".
// -->
case "damage":
return new NumberTag(Internal.Damage).Handle(data.Shrink());
// <--[tag]
// @Name BulletEntityTag.splash_size
// @Group General Information
// @ReturnType NumberTag
// @Returns the radius of the BulletEntity's splash damage area in blocks.
// @Example "10" .splash_size could return "0".
// -->
case "splash_size":
return new NumberTag(Internal.SplashSize).Handle(data.Shrink());
default:
return new PrimitiveEntityTag((PrimitiveEntity)Internal).Handle(data);
}
}
示例8: Handle
public override TemplateObject Handle(TagData data)
{
if (data.Remaining == 0)
{
return this;
}
switch (data[0])
{
// <--[tag]
// @Name AnimalTag.is_alive
// @Group General Information
// @ReturnType BooleanTag
// @Returns whether the animal is still alive.
// @Example "2" .is_alive returns "true".
// -->
case "is_alive":
return new BooleanTag(!Internal.isDead).Handle(data.Shrink());
// <--[tag]
// @Name AnimalTag.name
// @Group General Information
// @ReturnType TextTag
// @Returns the name of the animal's type.
// @Example "2" .name returns "Cow".
// -->
case "name":
return new TextTag(Internal.asset.name).Handle(data.Shrink());
// <--[tag]
// @Name AnimalTag.aid
// @Group General Information
// @ReturnType NumberTag
// @Returns the animal ID number of the animal.
// @Example "2" .aid returns "1".
// -->
case "aid":
return new NumberTag(Internal.index).Handle(data.Shrink());
// <--[tag]
// @Name AnimalTag.health
// @Group General Information
// @ReturnType NumberTag
// @Returns the animal's current health.
// @Example "2" .health returns "96".
// -->
case "health":
return new NumberTag(Internal.health).Handle(data.Shrink());
// <--[tag]
// <--[tag]
// @Name AnimalTag.asset
// @Group General Information
// @ReturnType AnimalAssetTag
// @Returns the animal asset that this animal is based off.
// @Example "2" .asset returns "Cow".
// -->
case "asset":
return new AnimalAssetTag(Internal.asset).Handle(data.Shrink());
default:
return new EntityTag(Internal.gameObject).Handle(data);
}
}
示例9: 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());
}
示例10: Handle
public override TemplateObject Handle(TagData data)
{
if (data.Remaining == 0)
{
return this;
}
switch (data[0])
{
// <--[tag]
// @Name VehicleTag.name
// @Group General Information
// @ReturnType TextTag
// @Returns the name of the vehicle's type.
// @Example "2" .name returns "APC_Forest".
// -->
case "name":
return new TextTag(Internal.asset.name).Handle(data.Shrink());
// <--[tag]
// @Name VehicleTag.vid
// @Group General Information
// @ReturnType NumberTag
// @Returns the vehicle ID number of the vehicle.
// @Example "2" .vid returns "1".
// -->
case "vid":
return new NumberTag(Internal.id).Handle(data.Shrink());
// <--[tag]
// @Name VehicleTag.asset
// @Group General Information
// @ReturnType VehicleAssetTag
// @Returns the vehicle asset that this vehicle is based off.
// @Example "2" .asset returns "APC_Forest".
// -->
case "asset":
return new VehicleAssetTag(Internal.asset).Handle(data.Shrink());
// <--[tag]
// @Name VehicleTag.health
// @Group General Information
// @ReturnType NumberTag
// @Returns the current health of the vehicle.
// @Example "2" .health returns "99".
// -->
case "health":
return new NumberTag(Internal.health).Handle(data.Shrink());
// <--[tag]
// @Name VehicleTag.id
// @Group General Information
// @ReturnType NumberTag
// @Returns the current amount of fuel in the vehicle.
// @Example "2" .fuel returns "67".
// -->
case "fuel":
return new NumberTag(Internal.fuel).Handle(data.Shrink());
default:
return new EntityTag(Internal.gameObject).Handle(data);
}
}
示例11: 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());
}
示例12: 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());
}
示例13: 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());
}
示例14: 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());
}
示例15: 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());
}