private static CodeMemberMethod GetGenericResourceListMethod(string name) { var method = new CodeMemberMethod { Name = name, ReturnType = new CodeTypeReference(typeof(List <>), CodeTypeReferenceOptions.GlobalReference) { TypeArguments = { new CodeTypeReference("global::TypeSafe.Resource", new CodeTypeReference("TResource", CodeTypeReferenceOptions.GenericTypeParameter)) } }, TypeParameters = { new CodeTypeParameter("TResource") { Constraints ={ CompilerUtil.GetGlobalScopeTypeReference(typeof(Object)) } } }, Attributes = MemberAttributes.Public | MemberAttributes.Static }; return(method); }
/// <summary> /// Get a CodeTypeReference object to the TypeSafe.Resource[T] class where T is <paramref name="t" />. /// </summary> public static CodeTypeReference GetResourceType(Type t) { if (t == typeof(GameObject)) { return(new CodeTypeReference("global::TypeSafe.PrefabResource")); } return(new CodeTypeReference("global::TypeSafe.Resource", CompilerUtil.GetGlobalScopeTypeReference(t))); }