本文整理汇总了C#中System.Net.Player.ClearBlockchange方法的典型用法代码示例。如果您正苦于以下问题:C# Player.ClearBlockchange方法的具体用法?C# Player.ClearBlockchange怎么用?C# Player.ClearBlockchange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Player
的用法示例。
在下文中一共展示了Player.ClearBlockchange方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Blockchange1
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
}
示例2: Blockchange1
public void Blockchange1(Player p, ushort x, ushort y,ushort z,byte Type)
{
//get the pos of first block
p.ClearBlockchange();
byte t = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, t);
//undone change
blox[0].x = x;
blox[0].y = y;
blox[0].z = z;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
}
示例3: Use
public override void Use(Player p, string message)
{
if (!Directory.Exists("extra/images/")) { Directory.CreateDirectory("extra/images/"); }
layer = false;
popType = 1;
if (message == "") { Help(p); return; }
if (message.IndexOf(' ') != -1) //Yay parameters
{
string[] parameters = message.Split(' ');
for (int i = 0; i < parameters.Length; i++)
{
if (parameters[i] == "layer" || parameters[i] == "l") layer = true;
else if (parameters[i] == "1" || parameters[i] == "2color") popType = 1;
else if (parameters[i] == "2" || parameters[i] == "1color") popType = 2;
else if (parameters[i] == "3" || parameters[i] == "2gray") popType = 3;
else if (parameters[i] == "4" || parameters[i] == "1gray") popType = 4;
else if (parameters[i] == "5" || parameters[i] == "bw") popType = 5;
else if (parameters[i] == "6" || parameters[i] == "gray") popType = 6;
}
message = parameters[parameters.Length - 1];
}
if (message.IndexOf('/') == -1 && message.IndexOf('.') != -1)
{
}
else if (message.IndexOf('.') != -1)
{
}
else
{
bitmaplocation = message;
}
if (!File.Exists("extra/images/" + bitmaplocation + ".bmp")) { Player.SendMessage(p, "The URL entered was invalid!"); return; }
CatchPos cpos;
cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
Player.SendMessage(p, "Place two blocks to determine direction.");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
}
示例4: Blockchange2
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
{
working = true;
p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
Bitmap myBitmap = new Bitmap("extra/images/" + bitmaplocation + ".bmp");
myBitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
CatchPos cpos = (CatchPos)p.blockchangeObject;
if (x == cpos.x && z == cpos.z) { Player.SendMessage(p, "No direction was selected"); return; }
int direction;
if (Math.Abs(cpos.x - x) > Math.Abs(cpos.z - z))
{
direction = 0;
if (x <= cpos.x)
{
direction = 1;
}
}
else
{
direction = 2;
if (z <= cpos.z)
{
direction = 3;
}
}
if (layer)
{
if (popType == 1) popType = 2;
if (popType == 3) popType = 4;
}
List<FindReference.ColorBlock> refCol = FindReference.popRefCol(popType);
FindReference.ColorBlock colblock;
p.SendMessage("" + direction);
Thread printThread = new Thread(new ThreadStart(delegate
{
double[] distance = new double[refCol.Count]; // Array of distances between color pulled from image to the referance colors.
int position; // This is the block selector for when we find which distance is the shortest.
for (int k = 0; k < myBitmap.Width; k++)
{
for (int i = 0; i < myBitmap.Height; i++)
{
if (layer)
{
colblock.y = cpos.y;
if (direction <= 1)
{
if (direction == 0) { colblock.x = (ushort)(cpos.x + k); colblock.z = (ushort)(cpos.z - i); }
else { colblock.x = (ushort)(cpos.x - k); colblock.z = (ushort)(cpos.z + i); }
//colblock.z = (ushort)(cpos.z - i);
}
else
{
if (direction == 2) { colblock.z = (ushort)(cpos.z + k); colblock.x = (ushort)(cpos.x + i); }
else { colblock.z = (ushort)(cpos.z - k); colblock.x = (ushort)(cpos.x - i); }
//colblock.x = (ushort)(cpos.x - i);
}
}
else
{
colblock.y = (ushort)(cpos.y + i);
if (direction <= 1)
{
if (direction == 0) colblock.x = (ushort)(cpos.x + k);
else colblock.x = (ushort)(cpos.x - k);
colblock.z = cpos.z;
}
else
{
if (direction == 2) colblock.z = (ushort)(cpos.z + k);
else colblock.z = (ushort)(cpos.z - k);
colblock.x = cpos.x;
}
}
colblock.r = myBitmap.GetPixel(k, i).R;
colblock.g = myBitmap.GetPixel(k, i).G;
colblock.b = myBitmap.GetPixel(k, i).B;
colblock.a = myBitmap.GetPixel(k, i).A;
if (popType == 6)
{
if ((colblock.r + colblock.g + colblock.b) / 3 < (256 / 4))
{
colblock.type = Block.obsidian;
}
else if (((colblock.r + colblock.g + colblock.b) / 3) >= (256 / 4) && ((colblock.r + colblock.g + colblock.b) / 3) < (256 / 4) * 2)
{
colblock.type = Block.darkgrey;
}
//.........这里部分代码省略.........
示例5: Use
public override void Use(Player p, string message)
{
if (!Directory.Exists("extra/images/")) { Directory.CreateDirectory("extra/images/"); }
layer = false;
popType = 1;
if (message == "") { Help(p); return; }
if (message.IndexOf(' ') != -1) //Yay parameters
{
string[] parameters = message.Split(' ');
for (int i = 0; i < parameters.Length; i++)
{
if (parameters[i] == "layer" || parameters[i] == "l") layer = true;
else if (parameters[i] == "1" || parameters[i] == "2color") popType = 1;
else if (parameters[i] == "2" || parameters[i] == "1color") popType = 2;
else if (parameters[i] == "3" || parameters[i] == "2gray") popType = 3;
else if (parameters[i] == "4" || parameters[i] == "1gray") popType = 4;
else if (parameters[i] == "5" || parameters[i] == "bw") popType = 5;
else if (parameters[i] == "6" || parameters[i] == "gray") popType = 6;
}
message = parameters[parameters.Length - 1];
}
if (message.IndexOf('/') == -1 && message.IndexOf('.') != -1)
{
try
{
using (WebClient web = new WebClient())
{
Player.SendMessage(p, "Downloading IMGUR file from: &fhttp://www.imgur.com/" + message);
web.DownloadFile("http://www.imgur.com/" + message, "extra/images/tempImage_" + p.name + ".bmp");
}
Player.SendMessage(p, "Download complete.");
bitmaplocation = "tempImage_" + p.name;
message = bitmaplocation;
}
catch { }
}
else if (message.IndexOf('.') != -1)
{
try
{
using (WebClient web = new WebClient())
{
if (message.Substring(0, 4) != "http")
{
message = "http://" + message;
}
Player.SendMessage(p, "Downloading file from: &f" + message + Server.DefaultColor + ", please wait.");
web.DownloadFile(message, "extra/images/tempImage_" + p.name + ".bmp");
}
Player.SendMessage(p, "Download complete.");
bitmaplocation = "tempImage_" + p.name;
}
catch { }
}
else
{
bitmaplocation = message;
}
if (!File.Exists("extra/images/" + bitmaplocation + ".bmp")) { Player.SendMessage(p, "The URL entered was invalid!"); return; }
CatchPos cpos;
cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
Player.SendMessage(p, "Place two blocks to determine direction.");
p.ClearBlockchange();
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
}
示例6: Use
//.........这里部分代码省略.........
//level.permissionvisit = (LevelPermission)header[14];
//level.permissionbuild = (LevelPermission)header[15];
}
else
{
byte[] header = new byte[12]; gs.Read(header, 0, header.Length);
vars[0] = version;
vars[1] = BitConverter.ToUInt16(header, 0);
vars[2] = BitConverter.ToUInt16(header, 2);
vars[3] = BitConverter.ToUInt16(header, 4);
vars[4] = BitConverter.ToUInt16(header, 6);
vars[5] = BitConverter.ToUInt16(header, 8);
rot[0] = header[10];
rot[1] = header[11];
}
Level level = new Level(name, vars[0], vars[2], vars[1], "empty");
level.setPhysics(0);
level.spawnx = vars[3];
level.spawnz = vars[4];
level.spawny = vars[5];
level.rotx = rot[0];
level.roty = rot[1];
byte[] blocks = new byte[level.width * level.height * level.depth];
gs.Read(blocks, 0, blocks.Length);
level.blocks = blocks;
gs.Close();
level.backedup = true;
level.permissionbuild = LevelPermission.Admin;
level.jailx = (ushort)(level.spawnx * 32); level.jaily = (ushort)(level.spawny * 32); level.jailz = (ushort)(level.spawnz * 32);
level.jailrotx = level.rotx; level.jailroty = level.roty;
p.Loading = true;
foreach (Player pl in Player.players) if (p.level == pl.level && p != pl) p.SendDie(pl.id);
foreach (PlayerBot b in PlayerBot.playerbots) if (p.level == b.level) p.SendDie(b.id);
Player.GlobalDie(p, true);
p.level = level;
p.SendMotd();
p.SendRaw(2);
byte[] buffer = new byte[level.blocks.Length + 4];
BitConverter.GetBytes(IPAddress.HostToNetworkOrder(level.blocks.Length)).CopyTo(buffer, 0);
//ushort xx; ushort yy; ushort zz;
for (int i = 0; i < level.blocks.Length; ++i)
buffer[4 + i] = Block.Convert(level.blocks[i]);
buffer = buffer.GZip();
int number = (int)Math.Ceiling(((double)buffer.Length) / 1024);
for (int i = 1; buffer.Length > 0; ++i)
{
short length = (short)Math.Min(buffer.Length, 1024);
byte[] send = new byte[1027];
Player.HTNO(length).CopyTo(send, 0);
Buffer.BlockCopy(buffer, 0, send, 2, length);
byte[] tempbuffer = new byte[buffer.Length - length];
Buffer.BlockCopy(buffer, length, tempbuffer, 0, buffer.Length - length);
buffer = tempbuffer;
send[1026] = (byte)(i * 100 / number);
p.SendRaw(3, send);
Thread.Sleep(10);
} buffer = new byte[6];
Player.HTNO((short)level.width).CopyTo(buffer, 0);
Player.HTNO((short)level.depth).CopyTo(buffer, 2);
Player.HTNO((short)level.height).CopyTo(buffer, 4);
p.SendRaw(4, buffer);
ushort x = (ushort)((0.5 + level.spawnx) * 32);
ushort y = (ushort)((1 + level.spawny) * 32);
ushort z = (ushort)((0.5 + level.spawnz) * 32);
p.aiming = false;
Player.GlobalSpawn(p, x, y, z, level.rotx, level.roty, true);
p.ClearBlockchange();
p.Loading = false;
if (message.IndexOf(' ') == -1)
level.name = "&cMuseum " + Server.DefaultColor + "(" + message.Split(' ')[0] + ")";
else
level.name = "&cMuseum " + Server.DefaultColor + "(" + message.Split(' ')[0] + " " + message.Split(' ')[1] + ")";
if (!p.hidden)
{
Player.GlobalMessage(p.color + p.prefix + p.name + Server.DefaultColor + " went to the " + level.name);
}
}
catch (Exception ex) { Player.SendMessage(p, "Error loading level."); Server.ErrorLog(ex); return; }
finally { fs.Close(); }
}
else { Player.SendMessage(p, "Level or backup could not be found."); return; }
}
示例7: Use
public override void Use(Player p, string message)
{
string path;
if (message.Split(' ').Length == 1) path = "levels/" + message + ".lvl";
else if (message.Split(' ').Length == 2) try { path = @Server.backupLocation + "/" + message.Split(' ')[0] + "/" + int.Parse(message.Split(' ')[1]) + "/" + message.Split(' ')[0] + ".lvl"; }
catch { Help(p); return; }
else { Help(p); return; }
if (File.Exists(path))
{
try
{
Level level = LvlFile.Load(name, path);
level.setPhysics(0);
level.backedup = true;
level.permissionbuild = LevelPermission.Admin;
level.jailx = (ushort)(level.spawnx * 32);
level.jaily = (ushort)(level.spawny * 32);
level.jailz = (ushort)(level.spawnz * 32);
level.jailrotx = level.rotx; level.jailroty = level.roty;
p.Loading = true;
foreach (Player pl in Player.players) if (p.level == pl.level && p != pl) p.SendDie(pl.id);
foreach (PlayerBot b in PlayerBot.playerbots) if (p.level == b.level) p.SendDie(b.id);
Player.GlobalDie(p, true);
p.level = level;
p.SendMotd();
if (!p.SendRawMap(level))
return;
ushort x = (ushort)((0.5 + level.spawnx) * 32);
ushort y = (ushort)((1 + level.spawny) * 32);
ushort z = (ushort)((0.5 + level.spawnz) * 32);
p.aiming = false;
Player.GlobalSpawn(p, x, y, z, level.rotx, level.roty, true);
p.ClearBlockchange();
p.Loading = false;
if (message.IndexOf(' ') == -1)
level.name = "&cMuseum " + Server.DefaultColor + "(" + message.Split(' ')[0] + ")";
else
level.name = "&cMuseum " + Server.DefaultColor + "(" + message.Split(' ')[0] + " " + message.Split(' ')[1] + ")";
if (!p.hidden)
{
Player.GlobalMessage(p.color + p.prefix + p.name + Server.DefaultColor + " went to the " + level.name);
}
} catch (Exception ex) {
Player.SendMessage(p, "Error loading level.");
Server.ErrorLog(ex);
}
} else {
Player.SendMessage(p, "Level or backup could not be found.");
}
}