コード例 #1
0
ファイル: ReactGenerator.cs プロジェクト: simonwittber/react
 public static string GetClass(ReactCandidateClass rcc)
 {
     outputPath = System.IO.Path.GetDirectoryName(AssetDatabase.GUIDToAssetPath(AssetDatabase.FindAssets("t:TextAsset React_CLASSES")[0]));
     if (rcc.propertyType != null)
     {
         return(CreatePropertyClass(rcc.className, rcc.type, rcc.propertyType, rcc.isStatic, rcc.name, rcc.prefix, rcc.template));
     }
     else
     {
         return(CreateClass(rcc.className, rcc.type, rcc.name, rcc.parameters, rcc.isStatic, rcc.prefix, rcc.template));
     }
 }
コード例 #2
0
        static void AddCandidateClass(Type type, Type propertyType, string name, ParameterInfo[] parameters, bool isStatic, string prefix, string template)
        {
            var className = "";

            if (propertyType == null)
            {
                className = prefix + "_" + type.Name + "_" + name + "_";
                var signature = "";
                if (parameters != null)
                {
                    signature = string.Join("_", (from i in parameters
                                                  select i.Name).ToArray());
                }
                className += signature;
            }
            else
            {
                className = prefix + "_" + type.Name + "_" + name + "";
            }

            if (ReactTypeRegister.Find(className) == null)
            {
                var candidate = new ReactCandidateClass()
                {
                    type         = type,
                    propertyType = propertyType,
                    name         = name,
                    parameters   = parameters,
                    isStatic     = isStatic,
                    prefix       = prefix,
                    template     = template,
                    className    = className
                };
                candidates.Add(candidate);
                List <ReactCandidateClass> clist;
                if (!typeMap.TryGetValue(type, out clist))
                {
                    typeMap[type] = clist = new List <ReactCandidateClass>();
                }
                clist.Add(candidate);
            }
        }