本文整理汇总了C#中Level.setPhysics方法的典型用法代码示例。如果您正苦于以下问题:C# Level.setPhysics方法的具体用法?C# Level.setPhysics怎么用?C# Level.setPhysics使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Level
的用法示例。
在下文中一共展示了Level.setPhysics方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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))
{
FileStream fs = File.OpenRead(path);
try
{
GZipStream gs = new GZipStream(fs, CompressionMode.Decompress);
byte[] ver = new byte[2];
gs.Read(ver, 0, ver.Length);
ushort version = BitConverter.ToUInt16(ver, 0);
ushort[] vars = new ushort[6];
byte[] rot = new byte[2];
if (version == 1874)
{
byte[] header = new byte[16]; gs.Read(header, 0, header.Length);
vars[0] = BitConverter.ToUInt16(header, 0);
vars[1] = BitConverter.ToUInt16(header, 2);
vars[2] = BitConverter.ToUInt16(header, 4);
vars[3] = BitConverter.ToUInt16(header, 6);
vars[4] = BitConverter.ToUInt16(header, 8);
vars[5] = BitConverter.ToUInt16(header, 10);
rot[0] = header[12];
rot[1] = header[13];
//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];
//.........这里部分代码省略.........
示例2: ParseProperty
static void ParseProperty(Level level, string key, string value) {
switch (key)
{
case "theme":
level.theme = value;
break;
case "physics":
level.setPhysics(int.Parse(value));
break;
case "physics speed":
level.speedPhysics = int.Parse(value);
break;
case "physics overload":
level.overload = int.Parse(value);
break;
case "finite mode":
level.finite = bool.Parse(value);
break;
case "animal ai":
level.ai = bool.Parse(value);
break;
case "edge water":
level.edgeWater = bool.Parse(value);
break;
case "survival death":
level.Death = bool.Parse(value);
break;
case "fall":
level.fall = int.Parse(value);
break;
case "drown":
level.drown = int.Parse(value);
break;
case "motd":
level.motd = value;
break;
case "jailx":
level.jailx = ushort.Parse(value);
break;
case "jaily":
level.jaily = ushort.Parse(value);
break;
case "jailz":
level.jailz = ushort.Parse(value);
break;
case "unload":
level.unload = bool.Parse(value);
break;
case "worldchat":
level.worldChat = bool.Parse(value);
break;
case "perbuild":
level.permissionbuild = GetPerm(value);
break;
case "pervisit":
level.permissionvisit = GetPerm(value);
break;
case "perbuildmax":
level.perbuildmax = GetPerm(value);
break;
case "pervisitmax":
level.pervisitmax = GetPerm(value);
break;
case "guns":
level.guns = bool.Parse(value);
break;
case "loadongoto":
level.loadOnGoto = bool.Parse(value);
break;
case "leafdecay":
level.leafDecay = bool.Parse(value);
break;
case "randomflow":
level.randomFlow = bool.Parse(value);
break;
case "growtrees":
level.growTrees = bool.Parse(value);
break;
case "weather":
level.weather = byte.Parse(value);
break;
case "texture":
level.textureUrl = value;
break;
}
}