Пример #1
0
        public override void Generate(bool overwrite)
        {
            var parameter = new Parameter()
            {
                ParentLayerType = ParentLayerType,
                LayerType       = LayerType,
                ClassName       = $"{GeneratorWindow.SceneNameList[CurrentSceneNameIndex]}{LayerType.ToString()}",
                SceneName       = GeneratorWindow.SceneNameList[CurrentSceneNameIndex],
                Overwrite       = overwrite,
            };

            parameter.Namespace = CreateNamespace(parameter);

            GeneratorWindow.GetAdditionalStructureExtensionDelegateList(LayerType)?.ToList().ForEach(x => x(parameter));

            if (parameter.UsingList.IsEmpty())
            {
                parameter.UsingList.Add("CAFU.Core.Presentation.Presenter");
                parameter.ImplementsInterfaceList.Add("IPresenter");
            }

            if (HasFactory)
            {
                parameter.UsingList.Add("CAFU.Core.Presentation.Presenter");
            }

            var generator = new ScriptGenerator(parameter, CreateTemplatePath(TemplateType.Class, StructureName));

            if (HasFactory)
            {
                generator.AddPartial(Factory.StructureName, GeneratorWindow.GetPartialStructure(Factory.StructureName).Render(parameter));
            }

            generator.Generate(CreateOutputPath(parameter));
        }
Пример #2
0
        public override void Generate(bool overwrite)
        {
            var parameter = new Parameter()
            {
                ParentLayerType = ParentLayerType,
                LayerType       = LayerType,
                InterfaceName   = $"I{ClassName}",
                ClassName       = ClassName,
                IsSingleton     = IsSingleton,
                Overwrite       = overwrite,
            };

            parameter.Namespace = CreateNamespace(parameter);

            GeneratorWindow.GetAdditionalStructureExtensionDelegateList(LayerType)?.ToList().ForEach(x => x(parameter));

            parameter.UsingList.Add("CAFU.Core.Data.DataStore");
            parameter.ImplementsInterfaceList.Add(parameter.InterfaceName);

            var generator = new ScriptGenerator(parameter, CreateTemplatePath(TemplateType.Class, StructureName));

            if (HasFactory)
            {
                generator.AddPartial(Factory.StructureName, GeneratorWindow.GetPartialStructure(Factory.StructureName).Render(parameter));
            }

            generator.Generate(CreateOutputPath(parameter));
        }
Пример #3
0
        public override void Generate(bool overwrite)
        {
            var parameter = new Parameter()
            {
                ParentLayerType = ParentLayerType,
                LayerType       = LayerType,
                ClassName       = ClassName,
                SceneName       = GeneratorWindow.SceneNameList[CurrentSceneNameIndex],
                Overwrite       = overwrite,
            };

            parameter.Namespace = CreateNamespace(parameter);

            GeneratorWindow.GetAdditionalStructureExtensionDelegateList(LayerType)?.ToList().ForEach(x => x(parameter));

            if (parameter.UsingList.IsEmpty())
            {
                parameter.UsingList.Add("UnityEngine");
                parameter.UsingList.Add("CAFU.Core.Presentation.View");
                parameter.ImplementsInterfaceList.Add("IView");
                parameter.BaseClassName = "MonoBehaviour";
            }

            var generator = new ScriptGenerator(parameter, CreateTemplatePath(TemplateType.Class, StructureName));

            generator.AddPartial(StartMethod.StructureName, GeneratorWindow.GetPartialStructure(StartMethod.StructureName).Render(parameter));
            generator.Generate(CreateOutputPath(parameter));
        }