本文整理汇总了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);
}
示例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],
//.........这里部分代码省略.........
示例3: CanBeSeen
public bool CanBeSeen(NetworkClient client)
{
return client.HasAllPermissions(ShowPermissions);
}
示例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);
}
示例5: CanBeCalled
public bool CanBeCalled(NetworkClient client)
{
return client.HasAllPermissions(UsePermissions);
}