コード例 #1
0
ファイル: DIMenuItems.cs プロジェクト: Handy94/asteroid
 public static void CreateInstaller()
 {
     DIEditorUtilities.AddCSharpClassTemplate("Installer", "NewInstaller",
                                              "using UnityEngine;"
                                              + "\nusing HandyPackage;"
                                              + "\n"
                                              + "\npublic class CLASS_NAME : Installer<CLASS_NAME>"
                                              + "\n{"
                                              + "\n    public override void InstallDependencies()"
                                              + "\n    {"
                                              + "\n    }"
                                              + "\n}");
 }
コード例 #2
0
ファイル: DIMenuItems.cs プロジェクト: Handy94/asteroid
 public static void CreateScriptableObjectInstaller()
 {
     DIEditorUtilities.AddCSharpClassTemplate("Scriptable Object Installer", "NewScriptableObjectInstaller",
                                              "using UnityEngine;"
                                              + "\nusing HandyPackage;"
                                              + "\n"
                                              + "\n[CreateAssetMenu(fileName = \"CLASS_NAME\", menuName = \"Installers/CLASS_NAME\")]"
                                              + "\npublic class CLASS_NAME : ScriptableObjectInstaller"
                                              + "\n{"
                                              + "\n    public override void InstallDependencies()"
                                              + "\n    {"
                                              + "\n    }"
                                              + "\n}");
 }
コード例 #3
0
ファイル: DIMenuItems.cs プロジェクト: Handy94/asteroid
        static void CreateProjectContextInternal(string absoluteDir)
        {
            var assetPath  = DIEditorUtilities.ConvertFullAbsolutePathToAssetPath(absoluteDir);
            var prefabPath = Path.Combine(assetPath, "NewProjectContext.prefab").Replace("\\", "/");

            var gameObject = new GameObject();

            try
            {
                gameObject.AddComponent <ProjectContext>();

#if UNITY_2018_3_OR_NEWER
                var prefabObj = PrefabUtility.SaveAsPrefabAsset(gameObject, prefabPath);
#else
                var prefabObj = PrefabUtility.ReplacePrefab(gameObject, PrefabUtility.CreateEmptyPrefab(prefabPath));
#endif

                Selection.activeObject = prefabObj;
            }
            finally
            {
                GameObject.DestroyImmediate(gameObject);
            }
        }
コード例 #4
0
ファイル: DIMenuItems.cs プロジェクト: Handy94/asteroid
        public static void CreateProjectContext()
        {
            var absoluteDir = DIEditorUtilities.GetCurrentDirectoryAssetPathFromSelection();

            CreateProjectContextInternal(absoluteDir);
        }