예제 #1
0
 public static void OnWillCreateAsset(string path)
 {
     if (path == null || !path.EndsWith(".asset"))
     {
         return;
     }
     if (path.EndsWith("Entity Type.asset") || path.Contains("EntityType.asset"))
     {
         AssetInfoLists.RefreshList(typeof(EntityType));
     }
     else if (path.EndsWith("Faction.asset"))
     {
         AssetInfoLists.RefreshList(typeof(Faction));
     }
     else if (path.EndsWith("Drive.asset"))
     {
         AssetInfoLists.RefreshList(typeof(Drive));
     }
     else if (path.EndsWith("Urgency Function.asset") || path.Contains("UrgencyFunction.asset"))
     {
         AssetInfoLists.RefreshList(typeof(UrgencyFunction));
     }
     else if (path.EndsWith("Action.asset"))
     {
         AssetInfoLists.RefreshList(typeof(PixelCrushers.QuestMachine.Action));
     }
     else if (path.EndsWith("Entity Specifier.asset") || path.Contains("EntitySpecifier.asset"))
     {
         AssetInfoLists.RefreshList(typeof(EntitySpecifier));
     }
     else if (path.EndsWith("Domain Specifier.asset") || path.Contains("DomainSpecifier.asset"))
     {
         AssetInfoLists.RefreshList(typeof(DomainSpecifier));
     }
 }
예제 #2
0
        protected virtual void DeleteAsset(List <AssetInfo> assetInfoList, int indexToDelete)
        {
            if (!(assetInfoList != null && 0 <= indexToDelete && indexToDelete < assetInfoList.Count))
            {
                return;
            }
            var assetInfo = assetInfoList[indexToDelete];

            AssetDatabase.DeleteAsset(assetInfo.assetPath);
            AssetInfoLists.RefreshList(AssetType);
        }
예제 #3
0
        public static AssetMoveResult OnWillMoveAsset(string oldPath, string newPath)
        {
            if (!oldPath.EndsWith(".asset"))
            {
                return(AssetMoveResult.DidNotMove);
            }
            var asset = AssetDatabase.LoadAssetAtPath(oldPath, typeof(UnityEngine.Object));

            if (asset != null)
            {
                AssetInfoLists.RefreshList(asset.GetType());
            }
            return(AssetMoveResult.DidNotMove);
        }
예제 #4
0
        public static AssetDeleteResult OnWillDeleteAsset(string path, RemoveAssetOptions removeAssetOptions)
        {
            if (!path.EndsWith(".asset"))
            {
                return(AssetDeleteResult.DidNotDelete);
            }
            var asset = AssetDatabase.LoadAssetAtPath(path, typeof(UnityEngine.Object));

            if (asset != null)
            {
                AssetInfoLists.RefreshList(asset.GetType());
            }
            return(AssetDeleteResult.DidNotDelete);
        }
예제 #5
0
        protected virtual void DrawTopInfo(List <AssetInfo> assetInfoList)
        {
            var createNew = false;

            try
            {
                GUILayout.BeginHorizontal();
                if (Icon != null)
                {
                    GUILayout.Box(Icon, GUILayout.Width(48), GUILayout.Height(48));
                }
                EditorGUILayout.HelpBox(HelpText, MessageType.None, true);
                try
                {
                    GUILayout.BeginVertical(GUILayout.Width(ButtonWidth));
                    if (GUILayout.Button(new GUIContent("Refresh", "Rescan the project for " + AssetType.Name + " assets."), GUILayout.Width(ButtonWidth)))
                    {
                        AssetInfoLists.RefreshList(AssetType);
                    }
                    if (GUILayout.Button(new GUIContent("New", "Create a new " + AssetType.Name + "."), GUILayout.Width(ButtonWidth)))
                    {
                        createNew = true;
                    }
                }
                finally
                {
                    GUILayout.EndVertical();
                }
            }
            finally
            {
                GUILayout.EndHorizontal();
            }
            if (createNew)
            {
                CreateNewAsset(assetInfoList);
            }
        }