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


C# NetworkClient.HasAllPermissions方法代码示例

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


在下文中一共展示了NetworkClient.HasAllPermissions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: 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

示例3: CanBeSeen

 public bool CanBeSeen(NetworkClient client)
 {
     return client.HasAllPermissions(ShowPermissions);
 }
开发者ID:umby24,项目名称:Hypercube,代码行数:4,代码来源:CommandHandler.cs

示例4: ClientChangeBlock

        public void ClientChangeBlock(NetworkClient client, short x, short y, short z, byte mode, Block newBlock)
        {
            if (!HCSettings.Building) {
                Chat.SendClientChat(client, "Building is disabled on this map at this time.");
                SendBlock(client, x, y, z, GetBlock(x, y, z));
                return;
            }

            if (!BlockInBounds(x, y, z))
                return;

            var mapBlock = GetBlock(x, y, z);

            if (mode == 0)
                newBlock = ServerCore.Blockholder.GetBlock(0);

            if (newBlock == mapBlock && newBlock != ServerCore.Blockholder.GetBlock(0))
                return;

            if (!client.HasAllPermissions(Buildperms.Values.ToList())) {
                Chat.SendClientChat(client, "§EYou are not allowed to build here.");
                SendBlock(client, x, y, z, mapBlock);
                return;
            }

            if (!client.HasAllPermissions(mapBlock.DeletePermissions.Values.ToList()) && mode == 0) {
                Chat.SendClientChat(client, "§EYou are not allowed to delete this block type.");
                SendBlock(client, x, y, z, mapBlock);
                return;
            }

            if (!client.HasAllPermissions(newBlock.PlacePermissions.Values.ToList()) && mode > 0) {
                Chat.SendClientChat(client, "§EYou are not allowed to place this block type.");
                SendBlock(client, x, y, z, mapBlock);
                return;
            }

            ServerCore.Luahandler.RunFunction("E_BlockChange", client, x, y, z, newBlock);
            BlockChange(client.CS.Id, x, y, z, newBlock, mapBlock, true, true, true, 250);
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:40,代码来源:HypercubeMap.cs

示例5: CanBeCalled

 public bool CanBeCalled(NetworkClient client)
 {
     return client.HasAllPermissions(UsePermissions);
 }
开发者ID:umby24,项目名称:Hypercube,代码行数:4,代码来源:CommandHandler.cs


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