示例#1
0
        public void ReleaseLocksWithPrefix(string prefix)
        {
            var removeList = ServerLocks
                             .Where(l => l.Key.StartsWith(prefix) && (l.Value == SettingsSystem.CurrentSettings.PlayerName))
                             .Select(l => l.Key)
                             .ToArray();

            foreach (var removeValue in removeList)
            {
                ReleaseLock(removeValue);
                ServerLocks.Remove(removeValue);
                FireReleaseEvent(SettingsSystem.CurrentSettings.PlayerName, removeValue);
            }
        }
示例#2
0
        /// <summary>
        /// Release the specified control lock excepts the ones you pass.
        /// You must send the full control lock name, not the prefix
        /// </summary>
        public void ReleaseControlLocksExcept(params string[] lockNames)
        {
            var removeList = ServerLocks
                             .Where(l => !lockNames.Contains(l.Key) && l.Key.StartsWith("control-") && (l.Value == SettingsSystem.CurrentSettings.PlayerName))
                             .Select(l => l.Key)
                             .ToArray();

            foreach (var removeValue in removeList)
            {
                ReleaseLock(removeValue);
                ServerLocks.Remove(removeValue);
                FireReleaseEvent(SettingsSystem.CurrentSettings.PlayerName, removeValue);
            }
        }
示例#3
0
 public string[] GetLocksWithPrefix(string lockPrefix)
 {
     return(ServerLocks.Where(l => l.Key.StartsWith(lockPrefix)).Select(l => l.Key).ToArray());
 }
示例#4
0
 public string[] GetPlayerLocksPrefix(string playerName, string lockPrefix)
 {
     return(ServerLocks.Where(l => l.Value == playerName && l.Key.StartsWith(lockPrefix)).Select(l => l.Key).ToArray());
 }
示例#5
0
 public string[] GetPlayerLocks(string playerName)
 {
     return(ServerLocks.Where(l => l.Value == playerName).Select(l => l.Key).ToArray());
 }
示例#6
0
 public string[] GetOwnedLocksPrefix(string lockPrefix)
 {
     return(ServerLocks.Where(l => l.Value == SettingsSystem.CurrentSettings.PlayerName && l.Key.StartsWith(lockPrefix))
            .Select(l => l.Key).ToArray());
 }