• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Client.NetworkClient类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Hypercube.Client.NetworkClient的典型用法代码示例。如果您正苦于以下问题:C# NetworkClient类的具体用法?C# NetworkClient怎么用?C# NetworkClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NetworkClient类属于Hypercube.Client命名空间,在下文中一共展示了NetworkClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Write

 public void Write(NetworkClient client)
 {
     client.WSock.WriteByte(Id);
         client.WSock.WriteByte(EntityId);
         client.WSock.WriteString(ModelName);
         client.WSock.Purge();
 }
开发者ID:umby24,项目名称:Hypercube,代码行数:7,代码来源:Packets.cs


示例2: BoxHandler

        static void BoxHandler(NetworkClient client, HypercubeMap map, Vector3S location, byte mode, Block block)
        {
            if (mode != 1)
                return;

            switch (client.CS.MyEntity.BuildState) {
                case 0:
                    client.CS.MyEntity.ClientState.SetCoord(location, 0);
                    client.CS.MyEntity.BuildState = 1;
                    break;
                case 1:
                    var coord1 = client.CS.MyEntity.ClientState.GetCoord(0);
                    var blocks = Math.Abs(location.X - coord1.X)*Math.Abs(location.Y - coord1.Y)*
                                 Math.Abs(location.Z - coord1.Z);
                    var replaceBlock = client.CS.MyEntity.ClientState.GetString(0);

                    if (blocks < 50000) {
                        map.BuildBox(client, coord1.X, coord1.Y, coord1.Z, location.X, location.Y, location.Z, block,
                            String.IsNullOrEmpty(replaceBlock)
                                ? ServerCore.Blockholder.UnknownBlock
                                : ServerCore.Blockholder.GetBlock(replaceBlock), false, 1, true, false);

                        Chat.SendClientChat(client, "§SBox created.");
                    }
                    else
                        Chat.SendClientChat(client, "§EBox too large.");

                    client.CS.MyEntity.SetBuildmode("");
                    break;
            }
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:31,代码来源:Buildmodes.cs


示例3: CPEHandshake

        /// <summary>
        /// Sends all server supported extensions to the client.
        /// </summary>
        /// <param name="client"></param>
        public static void CPEHandshake(NetworkClient client)
        {
            var cExtInfo = new ExtInfo {AppName = "Hypercube Server", ExtensionCount = SupportedExtensions};
            client.SendQueue.Enqueue(cExtInfo);

            var cExtEntry = new ExtEntry {ExtName = "CustomBlocks", Version = CustomBlocksVersion};
            client.SendQueue.Enqueue(cExtEntry);

            cExtEntry.ExtName = "EmoteFix";
            cExtEntry.Version = EmoteFixVersion;
            client.SendQueue.Enqueue(cExtEntry);

            cExtEntry.ExtName = "HeldBlock";
            cExtEntry.Version = HeldBlockVersion;
            client.SendQueue.Enqueue(cExtEntry);

            cExtEntry.ExtName = "ClickDistance";
            cExtEntry.Version = ClickDistanceVersion;
            client.SendQueue.Enqueue(cExtEntry);

            cExtEntry.ExtName = "ChangeModel";
            cExtEntry.Version = ChangeModelVersion;
            client.SendQueue.Enqueue(cExtEntry);

            cExtEntry.ExtName = "ExtPlayerList";
            cExtEntry.Version = ExtPlayerListVersion;
            client.SendQueue.Enqueue(cExtEntry);

            cExtEntry.ExtName = "EnvWeatherType";
            cExtEntry.Version = EnvWeatherTypeVersion;
            client.SendQueue.Enqueue(cExtEntry);

            cExtEntry.ExtName = "EnvMapAppearance";
            cExtEntry.Version = EnvMapAppearanceVersion;
            client.SendQueue.Enqueue(cExtEntry);

            cExtEntry.ExtName = "MessageTypes";
            cExtEntry.Version = MessageTypesVersion;
            client.SendQueue.Enqueue(cExtEntry);

            cExtEntry.ExtName = "BlockPermissions";
            cExtEntry.Version = BlockPermissionsVersion;
            client.SendQueue.Enqueue(cExtEntry);

            //CExtEntry.ExtName = "TextHotKey";
            //CExtEntry.Version = TextHotKeyVersion;
            //CExtEntry.Write(Client);

            //CExtEntry.ExtName = "HackControl";
            //CExtEntry.Version = HackControlVersion;
            //CExtEntry.Write(Client);

            cExtEntry.ExtName = "SelectionCuboid";
            cExtEntry.Version = SelectionCuboidVersion;
            client.SendQueue.Enqueue(cExtEntry);

            cExtEntry.ExtName = "EnvColors";
            cExtEntry.Version = EnvColorsVersion;
            client.SendQueue.Enqueue(cExtEntry);
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:64,代码来源:CPE.cs


示例4: Call

        public void Call(NetworkClient client, string[] args, string text1, string text2)
        {
            if (!CanBeCalled(client)) {
                Chat.SendClientChat(client, "§EYou do not have permission to use this command.");
                return;
            }

            if (!string.IsNullOrEmpty(Plugin))
                ServerCore.Luahandler.RunFunction(Plugin, client, args, text1, text2); // -- Run lua plugin for this command.
            else
                Handler(client, args, text1, text2);
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:12,代码来源:CommandHandler.cs


示例5: CreateTPHandler

        static void CreateTPHandler(NetworkClient client, HypercubeMap map, Vector3S location, byte mode, Block block)
        {
            if (mode != 1)
                return;

            var state = client.CS.MyEntity.BuildState;

            switch (state) {
                case 0:
                    client.CS.MyEntity.ClientState.SetCoord(location.X, location.Y, location.Z, 1);
                    client.CS.MyEntity.BuildState = 1;
                    return;
                case 1:
                    var destCoord = client.CS.MyEntity.ClientState.GetCoord(0);
                    var destRot = client.CS.MyEntity.ClientState.GetInt(0);
                    var destLook = client.CS.MyEntity.ClientState.GetInt(1);
                    var startCoord = client.CS.MyEntity.ClientState.GetCoord(1);
                    var endCoord = new Vector3S { X = location.X, Y = location.Y, Z = location.Z };
                    var teleName = client.CS.MyEntity.ClientState.GetString(0);
                    var destMap = HypercubeMap.GetMap(client.CS.MyEntity.ClientState.GetString(1));

                    // -- Move things around so the smaller is the start, the larger being the end.
                    if (startCoord.X > location.X) {
                        endCoord.X = startCoord.X;
                        startCoord.X = location.X;
                    }

                    if (startCoord.Y > location.Y) {
                        endCoord.Y = startCoord.Y;
                        startCoord.Y = location.Y;
                    }

                    if (startCoord.Z > location.Z) {
                        endCoord.Z = startCoord.Z;
                        startCoord.Z = location.Z;
                    }

                    client.CS.CurrentMap.Teleporters.CreateTeleporter(teleName, startCoord, endCoord, destCoord, (byte)destLook, (byte)destRot, destMap);
                    Chat.SendClientChat(client, "§STeleporter created.");
                    client.CS.MyEntity.SetBuildmode("");
                    break;
            }
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:43,代码来源:Buildmodes.cs


示例6: HandleDisconnect

        /// <summary>
        /// Handles a client that is disconnecting
        /// </summary>
        /// <param name="client">The client that has disconnected.</param>
        public void HandleDisconnect(NetworkClient client)
        {
            lock (ClientLock) {
                Clients.Remove(client);
            }

            try {
                client.BaseSocket.Close();
            } catch (IOException) {
            }

            if (!client.CS.LoggedIn)
                return;

            client.CS.LoggedIn = false;

            lock (client.CS.CurrentMap.ClientLock) {
                client.CS.CurrentMap.Clients.Remove(client.CS.Id);
                client.CS.CurrentMap.CreateClientList();
            }

            if (client.CS.MyEntity != null) {
                client.CS.CurrentMap.DeleteEntity(ref client.CS.MyEntity);
                ServerCore.FreeEids.Push((short)client.CS.MyEntity.Id);
            }

            ServerCore.OnlinePlayers -= 1;
            ServerCore.FreeIds.Push(client.CS.NameId);
            LoggedClients.Remove(client.CS.LoginName);
            IntLoggedClients.Remove(client.CS.Id);
            CreateLists();

            var remove = new ExtRemovePlayerName {NameId = client.CS.NameId};

            foreach (var c in ClientList) {
                if (c.CS.CPEExtensions.ContainsKey("ExtPlayerList"))
                    c.SendQueue.Enqueue(remove);
            }

            ServerCore.Logger.Log("Network", "Player " + client.CS.LoginName + " has disconnected.", LogType.Info); // -- Notify of their disconnection.
            ServerCore.Luahandler.RunFunction("E_PlayerDisconnect", client.CS.LoginName);
            Chat.SendGlobalChat(ServerCore.TextFormats.SystemMessage + "Player " + client.CS.FormattedName + ServerCore.TextFormats.SystemMessage + " left.");
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:47,代码来源:NetworkHandler.cs


示例7: RulesHandler

        static void RulesHandler(NetworkClient client, string[] args, string text1, string text2)
        {
            Chat.SendClientChat(client, "&6Server Rules:");

            for (var i = 0; i < ServerCore.Rules.Count; i++)
                Chat.SendClientChat(client, "&6" + (i + 1) + ": " + ServerCore.Rules[i]);
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:7,代码来源:GeneralCommands.cs


示例8: PlayersHandler

        static void PlayersHandler(NetworkClient client, string[] args, string text1, string text2)
        {
            var onlineString = "§SOnline Players: " + ServerCore.Nh.Clients.Count + "<br>";

            foreach (var hm in ServerCore.Maps.Values) {
                onlineString += "§S" + hm.CWMap.MapName + "&f: ";

                foreach(var c in hm.ClientsList)
                    onlineString += c.CS.FormattedName + " §D ";

                onlineString += "<br>";
            }

            Chat.SendClientChat(client, onlineString);
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:15,代码来源:GeneralCommands.cs


示例9: MapsHandler

        static void MapsHandler(NetworkClient client, string[] args, string text1, string text2)
        {
            var mapString = "§SMaps:<br>";

            foreach (var m in ServerCore.Maps.Values) {
                if (client.HasAllPermissions(m.Showperms.Values.ToList()))
                    mapString += "§S" + m.CWMap.MapName + " §D ";
            }

            Chat.SendClientChat(client, mapString);
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:11,代码来源:GeneralCommands.cs


示例10: InfoHandler

 static void InfoHandler(NetworkClient client, string[] args, string text1, string text2)
 {
     Chat.SendClientChat(client, "§SServer Info:");
     Chat.SendClientChat(client, "§SThis server runs the &8Hypercube §SSoftware, by Umby24.");
     Chat.SendClientChat(client, "§SServer Version: " + Assembly.GetExecutingAssembly().GetName().Version + " on .NET " + Environment.Version + " (" + Environment.OSVersion + ")");
     Chat.SendClientChat(client, "§SUptime: " + (DateTime.UtcNow - ServerCore.Uptime).ToString("hh"));
 }
开发者ID:umby24,项目名称:Hypercube,代码行数:7,代码来源:GeneralCommands.cs


示例11: Getrankhandler

        static void Getrankhandler(NetworkClient client, string[] args, string text1, string text2)
        {
            if (args.Length != 1) {
                Chat.SendClientChat(client, "§EIncorrect usage. See /cmdhelp getrank.");
                return;
            }

            args[0] = ServerCore.DB.GetPlayerName(args[0]);

            if (args[0] == "") {
                Chat.SendClientChat(client, "§ECould not find the player.");
                return;
            }

            var playerRanks = RankContainer.SplitRanks(ServerCore.DB.GetDatabaseString(args[0], "PlayerDB", "Rank"));
            var playerSteps = RankContainer.SplitSteps(ServerCore.DB.GetDatabaseString(args[0], "PlayerDB", "RankStep"));
            var playerInfo = "§SRank(s) for " + args[0] + ": ";

            foreach (var r in playerRanks)
                playerInfo += r.Prefix + r.Name + r.Suffix + "(" + playerSteps[playerRanks.IndexOf(r)] + "), ";

            playerInfo = playerInfo.Substring(0, playerInfo.Length - 1); // -- Remove the final comma.
            playerInfo += "<br>";

            Chat.SendClientChat(client, playerInfo);
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:26,代码来源:GeneralCommands.cs


示例12: CmdhelpHandler

        static void CmdhelpHandler(NetworkClient client, string[] args, string text1, string text2)
        {
            if (args.Length == 0) {
                Chat.SendClientChat(client, "§E&fUsage of this command: /cmdhelp [command].");
                return;
            }

            if (ServerCore.Commandholder.CommandDict.ContainsKey("/" + args[0].ToLower()) == false) {
                Chat.SendClientChat(client, "§E&fCommand not found.");
                return;
            }

            if (!ServerCore.Commandholder.CommandDict["/" + args[0]].CanBeSeen(client)) {
                Chat.SendClientChat(client, "§E&fCommand not found.");
                return;
            }

            var thisCommand = ServerCore.Commandholder.CommandDict["/" + args[0].ToLower()];
            Chat.SendClientChat(client, "§S/" + args[0]);
            Chat.SendClientChat(client, thisCommand.Help);
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:21,代码来源:GeneralCommands.cs


示例13: UpdateExtPlayerList

        /// <summary>
        /// Updates a client on everyone's ExtPlayerList (Ex. Client changed maps.)
        /// </summary>
        /// <param name="client">Client that has moved maps.</param>
        public static void UpdateExtPlayerList(NetworkClient client)
        {
            var toUpdate = new ExtAddPlayerName
            {
                NameId = client.CS.NameId,
                ListName = client.CS.FormattedName,
                PlayerName = client.CS.LoginName,
                GroupName = ServerCore.TextFormats.ExtPlayerList + client.CS.CurrentMap.CWMap.MapName,
                GroupRank = 0
            };

            lock (ServerCore.Nh.ClientLock) {
                foreach (var c in ServerCore.Nh.Clients) {
                    if (c.CS.CPEExtensions.ContainsKey("ExtPlayerList"))
                        c.SendQueue.Enqueue(toUpdate);
                }
            }
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:22,代码来源:CPE.cs


示例14: SetupExtPlayerList

        /// <summary>
        /// Does initial setup of ExtPlayerList for a player that is logging in.
        /// </summary>
        /// <param name="client">Client logging in</param>
        public static void SetupExtPlayerList(NetworkClient client)
        {
            var extPlayerListPacket = new ExtAddPlayerName {GroupRank = 0};

            lock (ServerCore.Nh.ClientLock) {
                foreach (var c in ServerCore.Nh.Clients) {
                    if (c != client) {
                        if (c.CS.CPEExtensions.ContainsKey("ExtPlayerList")) {
                            extPlayerListPacket.NameId = client.CS.NameId;
                            extPlayerListPacket.ListName = client.CS.FormattedName;
                            extPlayerListPacket.PlayerName = client.CS.LoginName;
                            extPlayerListPacket.GroupName = ServerCore.TextFormats.ExtPlayerList +
                                                            client.CS.CurrentMap.CWMap.MapName;

                            c.SendQueue.Enqueue(extPlayerListPacket);
                        }

                        if (!client.CS.CPEExtensions.ContainsKey("ExtPlayerList"))
                            continue;

                        extPlayerListPacket.NameId = c.CS.NameId;
                        extPlayerListPacket.ListName = c.CS.FormattedName;
                        extPlayerListPacket.PlayerName = c.CS.LoginName;
                        extPlayerListPacket.GroupName = ServerCore.TextFormats.ExtPlayerList + c.CS.CurrentMap.CWMap.MapName;
                        client.SendQueue.Enqueue(extPlayerListPacket);
                    } else {
                        if (!client.CS.CPEExtensions.ContainsKey("ExtPlayerList"))
                            continue;

                        extPlayerListPacket.NameId = client.CS.NameId;
                        extPlayerListPacket.ListName = client.CS.FormattedName;
                        extPlayerListPacket.PlayerName = client.CS.LoginName;
                        extPlayerListPacket.GroupName = ServerCore.TextFormats.ExtPlayerList +
                                                        client.CS.CurrentMap.CWMap.MapName;
                        client.SendQueue.Enqueue(extPlayerListPacket);
                    }
                }
            }
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:43,代码来源:CPE.cs


示例15: PostMapActions

        /// <summary>
        /// Sends additional packets to clients after sending the map to the client.
        /// </summary>
        /// <param name="client"></param>
        public static void PostMapActions(NetworkClient client)
        {
            int mapAppearance, blockPerms, weatherVer, colorVer;

            // -- EnvMapAppearance
            if (client.CS.CPEExtensions.TryGetValue("EnvMapAppearance", out mapAppearance) &&
                mapAppearance == EnvMapAppearanceVersion) {

                var cpeData = client.CS.CurrentMap.CPESettings;

                var mapApprPacket = new EnvSetMapAppearance {
                    EdgeBlock = cpeData.EdgeBlock,
                    SideBlock = cpeData.SideBlock,
                    SideLevel = cpeData.SideLevel,
                    TextureUrl = cpeData.TextureUrl
                };

                // -- Customblocks compatibility check
                if (mapApprPacket.EdgeBlock > 49) {
                    var mBlock = ServerCore.Blockholder.GetBlock(mapApprPacket.EdgeBlock);

                    if (mBlock.CPELevel > client.CS.CustomBlocksLevel)
                        mapApprPacket.EdgeBlock = (byte)mBlock.CPEReplace;
                }

                if (mapApprPacket.SideBlock > 49) {
                    var mBlock = ServerCore.Blockholder.GetBlock(mapApprPacket.SideBlock);

                    if (mBlock.CPELevel > client.CS.CustomBlocksLevel)
                        mapApprPacket.SideBlock = (byte)mBlock.CPEReplace;
                }

                client.SendQueue.Enqueue(mapApprPacket);
            }

            // -- BlockPermissions

            if (client.CS.CPEExtensions.TryGetValue("BlockPermissions", out blockPerms) &&
                blockPerms == BlockPermissionsVersion) {

                foreach (var block in ServerCore.Blockholder.NumberList) { // -- For every block
                    if (block.CPELevel > client.CS.CustomBlocksLevel) // -- If its within this player's CustomBlock support
                        continue;

                    if (block.Name == "Unknown") // -- If its not an unknown block
                        continue;

                    if (block.Special) // -- If it's not a custom block.
                        continue;

                    var disallowPlace = new SetBlockPermissions { // -- THen set the permissions for the block
                        AllowDeletion = 1,
                        AllowPlacement = 1,
                        BlockType = block.OnClient,
                    };

                    if (!client.HasAllPermissions(block.PlacePermissions)) {
                        disallowPlace.AllowPlacement = 0;
                    }

                    if (!client.HasAllPermissions(block.DeletePermissions))
                        disallowPlace.AllowDeletion = 0;

                    if (disallowPlace.AllowDeletion != 1 || disallowPlace.AllowPlacement != 1) // -- Only send if we're changing permissions though
                        client.SendQueue.Enqueue(disallowPlace);
                }
            }

            // -- EnvWeatherType
            if (client.CS.CPEExtensions.TryGetValue("EnvWeatherType", out weatherVer) &&
                weatherVer == EnvWeatherTypeVersion) {

                var weather = new EnvSetWeatherType {
                    WeatherType = client.CS.CurrentMap.CPESettings.Weather,
                };

                client.SendQueue.Enqueue(weather);
            }

            // -- EnvColors
            if (client.CS.CPEExtensions.TryGetValue("EnvColors", out colorVer) &&
                colorVer == EnvColorsVersion) {

                // -- if envcolors is enabled on the map
                if (client.CS.CurrentMap.CPESettings.EnvColorsVersion > 0) {
                    var skyColor = new EnvSetColor {
                        ColorType = (byte) EnvSetColor.ColorTypes.SkyColor,
                        Red = client.CS.CurrentMap.CPESettings.SkyColor[0],
                        Green = client.CS.CurrentMap.CPESettings.SkyColor[1],
                        Blue = client.CS.CurrentMap.CPESettings.SkyColor[2],
                    };

                    var cloudColor = new EnvSetColor {
                        ColorType = (byte)EnvSetColor.ColorTypes.CloudColor,
                        Red = client.CS.CurrentMap.CPESettings.CloudColor[0],
                        Green = client.CS.CurrentMap.CPESettings.CloudColor[1],
//.........这里部分代码省略.........
开发者ID:umby24,项目名称:Hypercube,代码行数:101,代码来源:CPE.cs


示例16: VerifyClientName

        /// <summary>
        /// Verifys the authenticity of someone logging in.
        /// </summary>
        /// <param name="client">The client to verify</param>
        /// <returns>true if verified, false if not.</returns>
        public bool VerifyClientName(NetworkClient client)
        {
            if (client.CS.Ip == "127.0.0.1" || client.CS.Ip.Substring(0, 7) == "192.168" || ServerCore.Nh.VerifyNames == false)
                return true;

            var md5Creator = MD5.Create();
            var correct = BitConverter.ToString(md5Creator.ComputeHash(Encoding.ASCII.GetBytes(Salt + client.CS.LoginName))).Replace("-", "");

            if (correct.Trim().ToLower() == client.CS.MpPass.Trim().ToLower())
                return true;

            ServerCore.Logger.Log("Heartbeat", correct.Trim() + " != " + client.CS.MpPass.Trim(), LogType.Warning);
            return false;
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:19,代码来源:Heartbeat.cs


示例17: AboutHandler

 static void AboutHandler(NetworkClient client, string[] args, string text1, string text2)
 {
     Chat.SendClientChat(client, "§SServer Software:&f ServerCore");
     Chat.SendClientChat(client, "§SServer Developer:&f Umby24");
     Chat.SendClientChat(client, "§SServer Version:&f 0.0 ALPHA");
     Chat.SendClientChat(client, "§SThis server is written from scratch in C#<br>§Sand supports Lua scripting!");
 }
开发者ID:umby24,项目名称:Hypercube,代码行数:7,代码来源:GeneralCommands.cs


示例18: BindHandler

        static void BindHandler(NetworkClient client, string[] args, string text1, string text2)
        {
            switch (args.Length) {
                case 0:
                    Chat.SendClientChat(client, "§SYour currently bound block is &f" + client.CS.MyEntity.Boundblock.Name + "§S.");
                    Chat.SendClientChat(client, "§SLooking for fCraft style bind? See /cmdhelp bind and /cmdhelp material.");
                    break;
                case 1:
                    // -- Change the Bound block only.
                    var newBlock = ServerCore.Blockholder.GetBlock(text1);

                    if (newBlock == null) {
                        Chat.SendClientChat(client, "§ECouldn't find a block called '" + text1 + "'.");
                        return;
                    }

                    client.CS.MyEntity.Boundblock = newBlock;
                    ServerCore.DB.SetDatabase(client.CS.LoginName, "PlayerDB", "BoundBlock", newBlock.Id);
                    Chat.SendClientChat(client, "§SYour bound block is now " + newBlock.Name);
                    break;
                case 2:
                    var newBlocka = ServerCore.Blockholder.GetBlock(args[0]);

                    if (newBlocka == null) {
                        Chat.SendClientChat(client, "§ECouldn't find a block called '" + args[0] + "'.");
                        return;
                    }

                    var materialBlock = ServerCore.Blockholder.GetBlock(text2);

                    if (materialBlock == null) {
                        Chat.SendClientChat(client, "§ECouldn't find a block called '" + args[1] + "'.");
                        return;
                    }

                    client.CS.MyEntity.Boundblock = newBlocka;
                    ServerCore.DB.SetDatabase(client.CS.LoginName, "PlayerDB", "BoundBlock", newBlocka.Id);
                    Chat.SendClientChat(client, "§SYour bound block is now " + newBlocka.Name);

                    client.CS.MyEntity.BuildMaterial = materialBlock;
                    Chat.SendClientChat(client, "§SYour build material is now " + materialBlock.Name);
                    break;
                default:
                    Chat.SendClientChat(client, "§EWrong number of arguments supplied. See /cmdhelp bind");
                    break;
            }
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:47,代码来源:BuildCommands.cs


示例19: CommandsHandler

        static void CommandsHandler(NetworkClient client, string[] args, string text1, string text2)
        {
            if (args.Length == 0) { // -- List command groups
                Chat.SendClientChat(client, "§SCommand groups:");
                Chat.SendClientChat(client, "&a    All");

                foreach (var a in ServerCore.Commandholder.Groups.Keys)
                    Chat.SendClientChat(client, "&a    " + a);

            } else if (args.Length == 1) { // -- list a group.
                if (!ServerCore.Commandholder.Groups.ContainsKey(args[0]) && args[0].ToLower() != "all") {
                    Chat.SendClientChat(client, "§EGroup '" + args[0] + "' not found.");
                    return;
                }

                var commandString = "§D&f ";
                var currentLen = 5;

                if (args[0].ToLower() == "all") {
                    foreach (var b in ServerCore.Commandholder.CommandDict.Keys) {
                        if (!ServerCore.Commandholder.CommandDict[b].CanBeSeen(client))
                            continue;

                        if ((b.Substring(1, b.Length - 1) + " §D&f ").Length + currentLen >= 59) {
                            commandString += "<br>§D&f " + b.Substring(1, b.Length - 1) + " §D&f ";
                            currentLen = ("§D&f " + b.Substring(1, b.Length - 1) + " §D&f ").Length;
                        } else {
                            commandString += b.Substring(1, b.Length - 1) + " §D&f ";
                            currentLen += (b.Substring(1, b.Length - 1) + " §D&f ").Length;
                        }
                    }

                    Chat.SendClientChat(client, "&aAll Commands:<br>" + commandString);
                    return;
                }

                foreach (var b in ServerCore.Commandholder.Groups[args[0]]) {
                    if (!ServerCore.Commandholder.CommandDict["/" + b].CanBeSeen(client))
                        continue;

                    if ((b.Substring(1, b.Length - 1) + " §D&f ").Length + currentLen >= 59) {
                        commandString += "<br>§D&f " + b + " §D&f ";
                        currentLen = ("§D&f " + b + " §D&f ").Length;
                    } else {
                        commandString += b + " §D&f ";
                        currentLen += (b + " §D&f ").Length;
                    }
                }

                Chat.SendClientChat(client, "&aGroup " + args[0]);
                Chat.SendClientChat(client, commandString);
            } else {
                Chat.SendClientChat(client, "§EWrong number of arguments supplied. See /cmdhelp commands");
            }
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:55,代码来源:GeneralCommands.cs


示例20: BoxHandler

        private static void BoxHandler(NetworkClient client, string[] args, string text1, string text2)
        {
            if (!String.IsNullOrEmpty(text1)) {
                var block = ServerCore.Blockholder.GetBlock(text1);

                if (block == ServerCore.Blockholder.UnknownBlock) {
                    Chat.SendClientChat(client, "§ECould not find a block called '" + text1 + "'.");
                    return;
                }

                client.CS.MyEntity.SetBuildmode("Box");
                client.CS.MyEntity.ClientState.SetString(text1, 0);
                Chat.SendClientChat(client, "§SBuildmode: Box started. Place two blocks to build a box.");
                Chat.SendClientChat(client, "§Replacing: " + block.Name);

                client.CS.MyEntity.BuildState = 0;
                return;
            }

            Chat.SendClientChat(client, "§SBuildmode: Box started. Place two blocks to build a box.");
            client.CS.MyEntity.SetBuildmode("Box");
            client.CS.MyEntity.BuildState = 0;
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:23,代码来源:BuildCommands.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# HypervResource.WmiException类代码示例发布时间:2022-05-26
下一篇:
C# Sqlite.HyenaSqliteCommand类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap