本文整理汇总了C#中MCForge.Utils.Vector3S.FromString方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3S.FromString方法的具体用法?C# Vector3S.FromString怎么用?C# Vector3S.FromString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCForge.Utils.Vector3S
的用法示例。
在下文中一共展示了Vector3S.FromString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
public void Use(Entity.Player p, string[] args) {
if (args.Length == 1 && args[0] == "stop") {
p.OnPlayerRotate.Normal -= OnPlayerRotate_Normal;
p.OnPlayerMove.Normal -= OnPlayerMove_Normal;
p.OnPlayerBigMove.Normal -= OnPlayerBigMove_Normal;
p.OnPlayerBlockChange.Normal -= OnPlayerBlockChange_Normal;
if (p.ExtraData["Cursor"] != null) {
Vector3S old;
if (p.ExtraData["Cursor"].GetType() == typeof(Vector3S))
old = (Vector3S)p.ExtraData["Cursor"];
else {
old = new Vector3S();
old.FromString((string)p.ExtraData["Cursor"]);
}
p.SendBlockChange((ushort)old.x, (ushort)old.z, (ushort)old.y, p.Level.GetBlock(old));
p.ExtraData["Cursor"] = null;
}
if (p.ExtraData["CursorGlassCenter"] != null) {
Vector3S old;
if (p.ExtraData["CursorGlassCenter"].GetType() == typeof(Vector3S))
old = (Vector3S)p.ExtraData["CursorGlassCenter"];
else {
old = new Vector3S();
old.FromString((string)p.ExtraData["CursorGlassCenter"]);
}
p.ResendBlockChange(surrounder, old);
}
return;
}
p.OnPlayerRotate.Normal += OnPlayerRotate_Normal;
p.OnPlayerMove.Normal += OnPlayerMove_Normal;
p.OnPlayerBigMove.Normal += OnPlayerBigMove_Normal;
p.OnPlayerBlockChange.Normal += OnPlayerBlockChange_Normal;
}
示例2: OnPlayerBlockChange_Normal
void OnPlayerBlockChange_Normal(Player sender, BlockChangeEventArgs args) {
args.Cancel();
if (args.Current == 0 && args.Action == ActionType.Delete) args.Current = 20;
sender.OnPlayerBlockChange.Normal -= OnPlayerBlockChange_Normal;
if (sender.ExtraData["Cursor"] != null) {
Vector3S cursor;
if (sender.ExtraData["Cursor"].GetType() == typeof(Vector3S))
cursor = (Vector3S)sender.ExtraData["Cursor"];
else {
cursor = new Vector3S();
cursor.FromString((string)sender.ExtraData["Cursor"]);
}
if (args.Action == ActionType.Place) {
sender.Click((ushort)cursor.x, (ushort)cursor.z, (ushort)(cursor.y + 1), args.Holding);
}
else {
sender.Click((ushort)cursor.x, (ushort)cursor.z, (ushort)(cursor.y), args.Holding, false);
}
}
sender.OnPlayerBlockChange.Normal += OnPlayerBlockChange_Normal;
Curse(sender);
}
示例3: Curse
void Curse(Player sender) {
if (sender.ExtraData["cursorlocked"] != null && (bool)sender.ExtraData["cursorlocked"]) return;
lock (this) {
sender.ExtraData["cursorlocked"] = true;
if (sender.ExtraData["Cursor"] != null) {
Vector3S old;
if (sender.ExtraData["Cursor"].GetType() == typeof(Vector3S))
old = (Vector3S)sender.ExtraData["Cursor"];
else {
old = new Vector3S();
old.FromString((string)sender.ExtraData["Cursor"]);
}
sender.SendBlockChange((ushort)old.x, (ushort)old.z, (ushort)old.y, sender.Level.GetBlock(old));
}
Vector3S cursor = sender.GetBlockFromView();
if ((object)cursor != null) {
sender.SendBlockChange((ushort)cursor.x, (ushort)cursor.z, (ushort)cursor.y, 21);
}
sender.ExtraData["Cursor"] = cursor;
sender.ExtraData["cursorlocked"] = false;
}
}
示例4: MoveGlass
void MoveGlass(Player sender) {
if (sender.ExtraData["cursormoveglasslocked"] != null && (bool)sender.ExtraData["cursormoveglasslocked"]) return;
lock (this) {
sender.ExtraData["cursormovelocked"] = true;
if (sender.ExtraData["CursorGlassCenter"] != null) {
Vector3S old;
if (sender.ExtraData["CursorGlassCenter"].GetType() == typeof(Vector3S))
old = (Vector3S)sender.ExtraData["CursorGlassCenter"];
else {
old = new Vector3S();
old.FromString((string)sender.ExtraData["CursorGlassCenter"]);
}
sender.ResendBlockChange(surrounder, old);
}
Vector3S pos = new Vector3S((ushort)(sender.Pos.x / 32), (ushort)(sender.Pos.z / 32), (ushort)(sender.Pos.y / 32));
sender.SendBlockChange(surrounder, pos, 20);
sender.ExtraData["CursorGlassCenter"] = pos;
sender.ExtraData["cursormoveglasslocked"] = false;
}
}