Exemple #1
0
 /// <inheritdoc />
 public bool Equals(GeneratedImplementationTypeIdentifier other)
 {
     return
         (BaseClassType == other.BaseClassType &&
          InterfaceTypes.OrderBy(i => i.Name).SequenceEqual(other.InterfaceTypes.OrderBy(i => i.Name)) &&
          Options == other.Options);
 }
 ComponentRegistrationBuilder(
     Type implementationType,
     Lifetime lifetime,
     List <Type> interfaceTypes = null)
     : base(implementationType, lifetime, interfaceTypes)
 {
     InterfaceTypes = InterfaceTypes ?? new List <Type>();
     InterfaceTypes.Add(typeof(MonoBehaviour));
     InterfaceTypes.Add(ImplementationType);
 }
Exemple #3
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked
     {
         return
             (((BaseClassType != null ? BaseClassType.GetHashCode() : 0) * 397) ^
              ((InterfaceTypes != null ? InterfaceTypes.Aggregate(17, (result, interfaceType) => (result * 23) + interfaceType.GetHashCode()) : 0) * 397) ^
              ((int)Options * 397));
     }
 }
 internal SystemRegistrationBuilder(
     Type implementationType,
     string worldName,
     List <Type> interfaceTypes = null)
     : base(implementationType, default, interfaceTypes)
 {
     this.worldName = worldName;
     InterfaceTypes = InterfaceTypes ?? new List <Type>();
     InterfaceTypes.Add(typeof(ComponentSystemBase));
     InterfaceTypes.Add(ImplementationType);
 }
 public FormItem(string label, string property, InterfaceTypes interfaceType = InterfaceTypes.Text, List <ValueItem> items = null, bool isRequired = false, string helpText = "", string extraCSSClasses = "", int tagId = 0)
 {
     Label           = label;
     Property        = property;
     InterfaceType   = interfaceType;
     IsRequired      = isRequired;
     Items           = items;
     HelpText        = helpText;
     ExtraCssClasses = extraCSSClasses;
     TagId           = tagId;
 }
        protected override void ProcessNetMessage(string interfaceType, string messageType, string message)
        {
            InterfaceTypes type = NetMessageUtils.GetInterfaceType(interfaceType);

            switch (type)
            {
            case InterfaceTypes.Connection:
                ProcessConnectionMessages(messageType, message);
                break;

            case InterfaceTypes.Lobby:
                ProcessLobbyMessages(messageType, message);
                break;
            }
        }
Exemple #7
0
        public static List <Type> GetImplementationTypes(Type InterfaceType)
        {
            string name = InterfaceType.Name;

            if (!InterfaceTypes.ContainsKey(name))
            {
                lock (_lock)
                {
                    if (!InterfaceTypes.ContainsKey(name))
                    {
                        var types = Lib.Reflection.AssemblyLoader.LoadTypeByInterface(InterfaceType);
                        InterfaceTypes[name] = types;
                    }
                }
            }
            return(InterfaceTypes[name]);
        }
        static Type FindGenericType(Type type)
        {
            return(InterfaceTypes.GetOrAdd(type, key =>
            {
                Type[] genericTypes = type.GetInterfaces();

                if (genericTypes != null)
                {
                    for (int i = 0; i < genericTypes.Length; i++)
                    {
                        var genericType = genericTypes[i];
                        if (genericType.IsGenericType && GenericIListType.IsAssignableFrom(genericType.GetGenericTypeDefinition()))
                        {
                            return genericType.GetGenericArguments()[0];
                        }
                    }
                }
                return ObjectType;
            }));
        }
        //TODO: change to property
        public List <string> GetNamespaces()
        {
            var namespaces = new List <string>();

            namespaces.AddRange(
                Metadatas.Select(m => m.Namespace).SelectMany(a => a).ToList());

            namespaces.AddRange(
                Properties.Select(p => p.Namespaces).SelectMany(a => a).ToList());

            if (BaseType != null)
            {
                namespaces.Add(BaseType.Namespace);
            }

            namespaces.AddRange(
                InterfaceTypes.Select(i => i.Namespace));

            namespaces.AddRange(
                Enums.Select(e => e.Namespace));

            return(namespaces.Distinct().ToList());
        }