private void LoadBuiltinMessages()
        {
            IEnumerable <Type> types = MirageModule.GetTypes().Where(t => t.GetCustomAttribute <NetworkMessageAttribute>() != null);

            foreach (Type type in types)
            {
                TypeReference typeReference = module.ImportReference(type);
                writers.TryGetFunction(typeReference, null);
                readers.TryGetFunction(typeReference, null);
                messages.Add(typeReference);
            }
        }
Exemple #2
0
        /// <summary>
        /// Generates serialization methods for synclists
        /// </summary>
        /// <param name="td">The synclist class</param>
        /// <param name="mirrorBaseType">the base SyncObject td inherits from</param>
        private void GenerateReadersAndWriters(TypeReference tr)
        {
            if (tr is GenericInstanceType genericInstance)
            {
                foreach (var argument in genericInstance.GenericArguments)
                {
                    if (!argument.IsGenericParameter)
                    {
                        readers.TryGetFunction(argument, null);
                        writers.TryGetFunction(argument, null);
                    }
                }
            }

            if (tr != null)
            {
                GenerateReadersAndWriters(tr.Resolve().BaseType);
            }
        }