当前位置: 首页>>代码示例>>C#>>正文


C# Player.SendRawMap方法代码示例

本文整理汇总了C#中System.Net.Player.SendRawMap方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SendRawMap方法的具体用法?C# Player.SendRawMap怎么用?C# Player.SendRawMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Net.Player的用法示例。


在下文中一共展示了Player.SendRawMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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))
            {
                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.");
            }
        }
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:61,代码来源:CmdMuseum.cs


注:本文中的System.Net.Player.SendRawMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。