Esempio n. 1
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));
        }
Esempio n. 2
0
        static GenericEntity()
        {
            var instance = new GenericEntity();

            GeneratorWindow.RegisterAdditionalOptionRenderDelegate(LayerType.Entity, instance);
            GeneratorWindow.RegisterAdditionalStructureExtensionDelegate(LayerType.Entity, instance);
        }
Esempio n. 3
0
 public override void OnGUI()
 {
     base.OnGUI();
     CurrentSceneNameIndex = EditorGUILayout.Popup("Scene Name", CurrentSceneNameIndex, GeneratorWindow.SceneNameList.ToArray());
     ClassName             = EditorGUILayout.TextField("Class Name", ClassName);
     GeneratorWindow.GetAdditionalOptionRenderDelegateList(LayerType)?.ToList().ForEach(x => x());
 }
Esempio n. 4
0
        public override void Generate(bool overwrite)
        {
            var parameter = new Parameter()
            {
                ParentLayerType = ParentLayerType.Presentation,
                LayerType       = LayerType.View,
                ClassName       = "Controller",
                SceneName       = GeneratorWindow.SceneNameList[CurrentSceneNameIndex],
                Overwrite       = overwrite,
            };

            parameter.Namespace = CreateNamespace(parameter);

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

            parameter.UsingList.Add("CAFU.Core.Presentation.View");
            parameter.UsingList.Add($"{this.CreateNamespacePrefix()}{ParentLayerType.ToString()}.{LayerType.Presenter.ToString()}");

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

            generator.Generate(CreateOutputPath(parameter));

            new Presenter(CurrentSceneNameIndex, HasPresenterFactory).Generate(overwrite);
        }