本文整理汇总了C#中LevelPermission类的典型用法代码示例。如果您正苦于以下问题:C# LevelPermission类的具体用法?C# LevelPermission怎么用?C# LevelPermission使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LevelPermission类属于命名空间,在下文中一共展示了LevelPermission类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Group
// Constructor
public Group(string name, string color, GroupEnum g, bool chat, LevelPermission permission, Int32 _cuboidLimit)
{
blnChat = chat;
groupLevel = g;
lvlPermission = permission;
strColor = color;
strName = name;
mCuboidLimit = _cuboidLimit;
}
示例2: Group
public Group(LevelPermission Perm, int maxB, string fullName, char newColor, string file)
{
Permission = Perm;
maxBlocks = maxB;
trueName = fullName;
name = trueName.ToLower();
color = "&" + newColor;
fileName = file;
if (name != "nobody")
playerList = PlayerList.Load(fileName, this);
else
playerList = new PlayerList();
}
示例3: Group
/// <summary>
/// Create a new group object
/// </summary>
/// <param name="Perm">The permission of the group</param>
/// <param name="maxB">The maxblocks this group can cuboid</param>
/// <param name="maxUn">The max undo this group can do</param>
/// <param name="fullName">The group full name</param>
/// <param name="newColor">The color of the group (Not including the &)</param>
/// <param name="motd">the custom MOTD for the group</param>
/// <param name="file">The file path where the current players of this group are stored</param>
public Group(LevelPermission Perm, int maxB, long maxUn, string fullName, char newColor, string motd, string file) {
Permission = Perm;
maxBlocks = maxB;
maxUndo = maxUn;
trueName = fullName;
name = trueName.ToLower();
color = "&" + newColor;
MOTD = motd;
fileName = file;
//playerList = name != "nobody" ? PlayerList.Load(fileName, this) : new PlayerList();
//if(OnGroupLoaded != null)
//OnGroupLoaded(this);
//OnGroupLoadedEvent.Call(this);
}
示例4: LavaSurvival
// Constructors
public LavaSurvival()
{
maps = new List<string>();
voted = new List<string>();
votes = new Dictionary<string, int>();
announceTimer = new Timer(60000);
announceTimer.AutoReset = true;
announceTimer.Elapsed += new ElapsedEventHandler(delegate
{
AnnounceTimeLeft(true, false);
});
startOnStartup = false;
sendAfkMain = true;
voteCount = 2;
voteTime = 2;
setupRank = LevelPermission.Operator;
LoadSettings();
}
示例5: LavaSurvival
// Constructors
public LavaSurvival()
{
maps = new List<string>();
voted = new List<string>();
votes = new Dictionary<string, int>();
deaths = new Dictionary<string, int>();
announceTimer = new Timer(60000);
announceTimer.AutoReset = true;
announceTimer.Elapsed += delegate
{
if (!flooded) AnnounceTimeLeft(true, false);
};
startOnStartup = false;
sendAfkMain = true;
voteCount = 2;
voteTime = 2;
lifeNum = 3;
setupRank = LevelPermission.Admin;
controlRank = LevelPermission.Operator;
LoadSettings();
}
示例6: fillLowest
private void fillLowest(ref TextBox txtBox, ref LevelPermission toChange)
{
if (txtBox.Text != "")
{
txtBox.Text = txtBox.Text.Trim().ToLower();
int foundPerm = -100;
try
{
foundPerm = int.Parse(txtBox.Text);
}
catch
{
Group foundGroup = Group.Find(txtBox.Text);
if (foundGroup != null) foundPerm = (int)foundGroup.Permission;
else { Server.s.Log("Could not find " + txtBox.Text); }
}
txtBox.Text = "";
if (foundPerm < -99) txtBox.Text = (int)toChange + "";
else txtBox.Text = foundPerm + "";
toChange = (LevelPermission)Convert.ToInt16(txtBox.Text);
}
}
示例7: AddCommands
public static void AddCommands(out CommandList commands, LevelPermission perm)
{
commands = new CommandList();
foreach (rankAllowance aV in allowedCommands)
if ((aV.lowestRank <= perm && !aV.disallow.Contains(perm)) || aV.allow.Contains(perm)) commands.Add(Command.all.Find(aV.commandName));
}
示例8: findPerm
public static Group findPerm(LevelPermission Perm)
{
foreach (Group grp in GroupList)
{
if (grp.Permission == Perm) return grp;
}
return null;
}
示例9: findPerm
/// <summary>
/// Find the group with the permission /Perm/
/// </summary>
/// <param name="Perm">The level permission to search for</param>
/// <returns>The group object with that level permission</returns>
public static Group findPerm(LevelPermission Perm)
{
return GroupList.FirstOrDefault(grp => grp.Permission == Perm);
}
示例10: canPlace
public static bool canPlace(LevelPermission givenPerm, byte givenBlock)
{
foreach (Blocks b in BlockList)
{
if (givenBlock == b.type)
{
if ((b.lowestRank <= givenPerm && !b.disallow.Contains(givenPerm)) || b.allow.Contains(givenPerm)) return true;
return false;
}
}
return false;
}
示例11: PermissionToName
public static string PermissionToName(LevelPermission perm)
{
Group foundGroup = Group.findPerm(perm);
if (foundGroup != null)
return foundGroup.name;
else
return ((int)perm).ToString();
}
示例12: PermissionToName
public static string PermissionToName(LevelPermission perm)
{
string strPermission = "Null";
switch (perm)
{
case LevelPermission.Guest:
strPermission = "Guest";
break;
case LevelPermission.Builder:
strPermission = "Builder";
break;
case LevelPermission.AdvBuilder:
strPermission = "AdvBuilder";
break;
case LevelPermission.Moderator:
strPermission = "Moderator";
break;
case LevelPermission.Operator:
strPermission = "Operator";
break;
case LevelPermission.Admin:
strPermission = "Admin";
break;
}
return strPermission;
}
示例13: GetName
static string GetName(LevelPermission perm) {
string permName = Level.PermissionToName(perm).ToLower();
return Group.Exists(permName) ? permName :
Level.PermissionToName(LevelPermission.Nobody);
}
示例14: LoadSettings
public void LoadSettings()
{
if (!File.Exists("properties/lavasurvival.properties"))
{
SaveSettings();
return;
}
foreach (string line in File.ReadAllLines("properties/lavasurvival.properties"))
{
try
{
if (line[0] != '#')
{
string value = line.Substring(line.IndexOf(" = ") + 3);
switch (line.Substring(0, line.IndexOf(" = ")).ToLower())
{
case "start-on-startup":
startOnStartup = bool.Parse(value);
break;
case "send-afk-to-main":
sendAfkMain = bool.Parse(value);
break;
case "vote-count":
voteCount = (byte)MathHelper.Clamp(decimal.Parse(value), 2, 10);
break;
case "vote-time":
voteTime = double.Parse(value);
break;
case "lives":
lifeNum = int.Parse(value);
break;
case "setup-rank":
if (Group.Find(value.ToLower()) != null)
setupRank = Group.Find(value.ToLower()).Permission;
break;
case "control-rank":
if (Group.Find(value.ToLower()) != null)
controlRank = Group.Find(value.ToLower()).Permission;
break;
case "maps":
foreach (string mapname in value.Split(','))
if(!String.IsNullOrEmpty(mapname) && !maps.Contains(mapname)) maps.Add(mapname);
break;
}
}
}
catch (Exception e) { Server.ErrorLog(e); }
}
}
示例15: LoadSettings
public void LoadSettings()
{
if (!File.Exists("properties/lavasurvival.properties"))
{
SaveSettings();
return;
}
foreach (string line in File.ReadAllLines("properties/lavasurvival.properties"))
{
try
{
if (line[0] != '#')
{
string value = line.Substring(line.IndexOf(" = ") + 3);
switch (line.Substring(0, line.IndexOf(" = ")).ToLower())
{
case "start-on-startup":
startOnStartup = bool.Parse(value);
break;
case "send-afk-to-main":
sendAfkMain = bool.Parse(value);
break;
case "vote-count":
voteCount = (byte)NumberClamp(decimal.Parse(value), 2, 10);
break;
case "vote-time":
voteTime = double.Parse(value);
break;
case "setup-rank":
setupRank = Level.PermissionFromName(value.ToLower());
break;
case "maps":
foreach (string mapname in value.Split(','))
if(!maps.Contains(mapname)) maps.Add(mapname);
break;
}
}
}
catch (Exception e) { Server.ErrorLog(e); }
}
}