Beispiel #1
0
        private static ICodeBlock GetAllFactoryMethods(string factoryClassName, string baseClassName, int numberToPreAllocate, bool poolObjects)
        {
            string className = factoryClassName.Substring(0, factoryClassName.Length - "Factory".Length);

            ICodeBlock codeBlock = new CodeDocument();

            codeBlock.Line("public static FlatRedBall.Math.Axis? SortAxis { get; set;}");

            GetCreateNewFactoryMethod(codeBlock, factoryClassName, poolObjects, baseClassName);
            codeBlock._();
            GetInitializeFactoryMethod(codeBlock, className, poolObjects, "mScreenListReference");
            codeBlock._();

            GetDestroyFactoryMethod(codeBlock, factoryClassName);
            codeBlock._();
            GetFactoryInitializeMethod(codeBlock, factoryClassName, numberToPreAllocate);
            codeBlock._();
            GetMakeUnusedFactory(codeBlock, factoryClassName, poolObjects);
            codeBlock._();


            string whereClass = className;

            if (!string.IsNullOrEmpty(baseClassName))
            {
                whereClass = baseClassName.Replace("\\", ".");
            }
            AddAddListMethod(codeBlock, whereClass);
            AddRemoveListMethod(codeBlock, whereClass);
            AddClearListsToAddTo(codeBlock);

            return(codeBlock);
        }