Esempio n. 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="type">Guard cost type</param>
 /// <param name="permission">Whether to restrict or deny access</param>
 /// <param name="eligibleKin">Which kins to apply the permission to.  All kin have access by default.  By supplying any Allow permissions will automatically restrict all other kins, and vice-versa</param>
 public KinFactionGuardTypeAttribute(KinFactionGuardCostTypes type, PermissionType permission, IOBAlignment[] eligibleKin)
 {
     m_Type = type;
     if (eligibleKin != null)
     {
         if (permission == PermissionType.Allow)
         {
             m_EligibleKin.Clear();
             m_EligibleKin.AddRange(eligibleKin);
         }
         else
         {
             //allow everyone but these.
             foreach (string current in Enum.GetNames(typeof(IOBAlignment)))
             {
                 bool found = false;
                 foreach (IOBAlignment iob in eligibleKin)
                 {
                     if (current.Equals(iob.ToString()))
                     {
                         found = true;
                         break;
                     }
                 }
                 if (!found)
                 {
                     //Add this to the list
                     m_EligibleKin.Add((IOBAlignment)Enum.Parse(typeof(IOBAlignment), current));
                 }
             }
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="type">Guard cost type</param>
 public KinFactionGuardTypeAttribute(KinFactionGuardCostTypes type) : this(type, PermissionType.Allow, null)
 {
 }
		/// <summary>
		/// 
		/// </summary>
		/// <param name="type">Guard cost type</param>
		public KinFactionGuardTypeAttribute( KinFactionGuardCostTypes type) : this ( type, PermissionType.Allow, null )
		{
			
		}
		/// <summary>
		/// 
		/// </summary>
		/// <param name="type">Guard cost type</param>
		/// <param name="permission">Whether to restrict or deny access</param>
		/// <param name="eligibleKin">Which kins to apply the permission to.  All kin have access by default.  By supplying any Allow permissions will automatically restrict all other kins, and vice-versa</param>
		public KinFactionGuardTypeAttribute(KinFactionGuardCostTypes type, PermissionType permission, IOBAlignment[] eligibleKin )
		{
			m_Type = type;
			if (eligibleKin != null)
			{
				if (permission == PermissionType.Allow)
				{
					m_EligibleKin.Clear();
					m_EligibleKin.AddRange(eligibleKin);
				}
				else
				{		
					
					//allow everyone but these.
					foreach( string current in Enum.GetNames( typeof(IOBAlignment) ))
					{
						bool found = false;
						foreach( IOBAlignment iob in eligibleKin )
						{
							if( current.Equals(iob.ToString()))
							{
								found = true;
								break;
							}
						}
						if (!found)
						{
							//Add this to the list
							m_EligibleKin.Add((IOBAlignment)Enum.Parse(typeof(IOBAlignment), current));
						}
						
					}
				}

			}
			
		}