public virtual bool ShowSelectMeshPopupWindow(Object selObj)
	{
		m_LoadPrefabType		= NgEnum.PREFAB_TYPE.All;
		m_SelectMeshComponent	= selObj as Component;
		m_OldSelectMesh			= NgSerialized.GetMesh(m_SelectMeshComponent, true) as Mesh;
		m_CaptionName			= "Select Mesh - " + m_LoadPrefabType.ToString();
		m_PrefsName				= "SelectMesh";

		SetShowOption(m_SelectMeshComponent.transform, DIALOG_TYPE.SELECT, true);
		return base.ShowPopupWindow(m_SelectMeshComponent.transform, false);
	}
	// Property -------------------------------------------------------------------------
	public virtual bool ShowPrefabPopupWindow(Transform selTrans, bool bSaveDialog)
	{
		m_LoadPrefabType = NgEnum.PREFAB_TYPE.All;
		if (bSaveDialog)
		{
			m_CaptionName		= "Save Prefab - " + m_LoadPrefabType.ToString();
			m_PrefsName			= "SavePrefab";
			SetShowOption(selTrans, DIALOG_TYPE.SAVE, false);
		} else {
			m_CaptionName		= "Add Prefab - " + m_LoadPrefabType.ToString();
			m_PrefsName			= "AddPrefab";
			SetShowOption(selTrans, DIALOG_TYPE.ADD, false);
		}

		return base.ShowPopupWindow(selTrans, bSaveDialog);
	}
Ejemplo n.º 3
0
    // Control Function -----------------------------------------------------------------
    GameObject GetAttachPrefab()
    {
        m_LoadPrefabType = NgEnum.PREFAB_TYPE.All;
        if (m_BaseSelectPrefab is NcAttachPrefab)
        {
            return((m_BaseSelectPrefab as NcAttachPrefab).m_AttachPrefab);
        }
        if (m_BaseSelectPrefab is NcParticleSystem)
        {
            return((m_BaseSelectPrefab as NcParticleSystem).m_AttachPrefab);
        }
        if (m_BaseSelectPrefab is NcSpriteFactory)
        {
//          if (m_SelectnSubArgIndex == 0)
            return((m_BaseSelectPrefab as NcSpriteFactory).m_SpriteList[m_SelectnArgIndex].m_EffectPrefab);
        }
        if (m_BaseSelectPrefab is NcSpriteTexture)
        {
            m_LoadPrefabType = NgEnum.PREFAB_TYPE.NcSpriteFactory;
            return((m_BaseSelectPrefab as NcSpriteTexture).m_NcSpriteFactoryPrefab);
        }
        if (m_BaseSelectPrefab is NcSpriteAnimation)
        {
            m_LoadPrefabType = NgEnum.PREFAB_TYPE.NcSpriteFactory;
            return((m_BaseSelectPrefab as NcSpriteAnimation).m_NcSpriteFactoryPrefab);
        }
        if (m_BaseSelectPrefab is NcParticleSpiral)
        {
            m_LoadPrefabType = NgEnum.PREFAB_TYPE.LegacyParticle;
            return((m_BaseSelectPrefab as NcParticleSpiral).m_ParticlePrefab);
        }
        if (m_BaseSelectPrefab is NcParticleEmit)
        {
            m_LoadPrefabType = NgEnum.PREFAB_TYPE.ParticleSystem;
            return((m_BaseSelectPrefab as NcParticleEmit).m_ParticlePrefab);
        }
        if (m_BaseSelectPrefab is FxmInfoBackground)
        {
            return(null);
        }
        Debug.LogError("GetAttachPrefab() error");
        return(null);
    }
Ejemplo n.º 4
0
    public static ArrayList GetResourceFiles <TT>(string strDir, string containFileName, int nMaxFile, bool bAsyncLoad, NgEnum.PREFAB_TYPE prefabType, out int nOutFindFile) where TT : Object
    {
#if UNITY_WEBPLAYER
        Debug.LogError("In WEB_PLAYER mode, you cannot run the FXMaker.");
        Debug.Break();
        nOutFindFile = 0;
        return(null);
#else
        if (strDir[strDir.Length - 1] != '/' && strDir[strDir.Length - 1] != '\\')
        {
            strDir = strDir + "/";
        }
        strDir = NgFile.PathSeparatorNormalize(strDir);

        NgUtil.LogDevelop("GetPrefabList() - LoadDir - " + strDir);
        ArrayList retArray = new ArrayList();

        {
            DirectoryInfo dir = new DirectoryInfo(strDir);

            // CheckDir
            if (dir.Exists == false)
            {
                Debug.LogError("Directory not found - " + strDir);
            }

            FileInfo[] info = dir.GetFiles();

            foreach (FileInfo fileInfo in info)
            {
                if (0 < nMaxFile && nMaxFile <= retArray.Count)
                {
                    Debug.LogWarning("GetPrefabList - Over MaxCount!!!");
                    break;
                }
                if (containFileName != null)
                {
                    if (fileInfo.Name.Contains(containFileName) == false)
                    {
                        continue;
                    }
                }

//	            TT obj	= (TT)Resources.LoadAssetAtPath(strDir + fileInfo.Name, typeof(TT));
                TT obj = null;
//				if (fileInfo.Name.Contains(".prefab"))
//				if (fileInfo.Name.Contains(".prefab") || fileInfo.Name.Contains(".png"))
                string compareName = NgFile.GetFileExt(fileInfo.Name).ToLower();
                if (typeof(TT) == typeof(GameObject))
                {
                    if (compareName == "mat")
                    {
                        continue;
                    }
                    if (compareName == "png")
                    {
                        continue;
                    }
                    if (compareName == "tga")
                    {
                        continue;
                    }
                    if (compareName == "jpg")
                    {
                        continue;
                    }
                    if (compareName == "psd")
                    {
                        continue;
                    }
                    if (compareName == "tif")
                    {
                        continue;
                    }
                    if (compareName == "wav")
                    {
                        continue;
                    }
                    if (bAsyncLoad && (compareName == "prefab"))
                    {
                        retArray.Add(strDir + fileInfo.Name);
                        continue;
                    }
                }
                else
                if (typeof(TT) == typeof(Texture))
                {
                    if (compareName == "mat")
                    {
                        continue;
                    }
                    if (compareName == "prefab")
                    {
                        continue;
                    }
                    if (compareName == "fbx")
                    {
                        continue;
                    }
                    if (compareName == "wav")
                    {
                        continue;
                    }
                    if (bAsyncLoad && (compareName == "png" || compareName == "tga" || compareName == "jpg" || compareName == "psd" || compareName == "tif"))
                    {
                        retArray.Add(strDir + fileInfo.Name);
                        continue;
                    }
                }
                else
                if (typeof(TT) == typeof(Material))
                {
                    if (compareName != "mat")
                    {
                        continue;
                    }
                    if (bAsyncLoad && (compareName == "mat"))
                    {
                        retArray.Add(strDir + fileInfo.Name);
                        continue;
                    }
                }
                else
                if (typeof(TT) == typeof(AudioClip))
                {
                    if (compareName == "mat")
                    {
                        continue;
                    }
                    if (compareName == "png")
                    {
                        continue;
                    }
                    if (compareName == "tga")
                    {
                        continue;
                    }
                    if (compareName == "jpg")
                    {
                        continue;
                    }
                    if (compareName == "psd")
                    {
                        continue;
                    }
                    if (compareName == "tif")
                    {
                        continue;
                    }
                    if (compareName == "prefab")
                    {
                        continue;
                    }
                    if (compareName == "fbx")
                    {
                        continue;
                    }
                }

                // 싱크 로드
                obj = (TT)AssetDatabase.LoadAssetAtPath(strDir + fileInfo.Name, typeof(TT));
//              Debug.Log(strDir + fileInfo.Name);
//              Debug.Log(AssetDatabase.GetAssetPath(obj));


                if (typeof(TT) == typeof(GameObject) && prefabType != NgEnum.PREFAB_TYPE.All)
                {
                    GameObject chkObj = obj as GameObject;
                    if (chkObj == null)
                    {
                        continue;
                    }
//                  Debug.Log(prefabType);
//                  Debug.Log(chkObj.GetComponent<ParticleEmitter>());
//                  Debug.Log(chkObj.GetComponent<ParticleSystem>());
                    if (prefabType == NgEnum.PREFAB_TYPE.ParticleSystem && (chkObj.GetComponent <ParticleEmitter>() == null && chkObj.GetComponent <ParticleSystem>() == null))
                    {
                        continue;
                    }
                    if (prefabType == NgEnum.PREFAB_TYPE.NcSpriteFactory && (chkObj.GetComponent <NcSpriteFactory>() == null))
                    {
                        continue;
                    }
                    if (prefabType == NgEnum.PREFAB_TYPE.LegacyParticle && (chkObj.GetComponent <ParticleEmitter>() == null))
                    {
                        continue;
                    }
                }

                if (obj != null)
                {
                    retArray.Add(obj);
                }
            }

            NgUtil.LogDevelop("GetPrefabList() - nCount - " + retArray.Count);
            nOutFindFile = retArray.Count;
            return(retArray);
        }
#endif
    }
Ejemplo n.º 5
0
    // ----------------------------------------------------------------------------------------------------------------------------------
    public static ArrayList GetResourceFileRecursively <TT>(string strDir, string containFileName, int nMaxFile, bool bAsyncLoad, NgEnum.PREFAB_TYPE prefabType, out int nOutFindFile) where TT : Object
    {
#if UNITY_WEBPLAYER
        Debug.LogError("In WEB_PLAYER mode, you cannot run the FXMaker.");
        Debug.Break();
        nOutFindFile = 0;
        return(null);
#else
        if (strDir[strDir.Length - 1] != '/' && strDir[strDir.Length - 1] != '\\')
        {
            strDir = strDir + "/";
        }

        DirectoryInfo dir = new DirectoryInfo(strDir);

        // CheckDir
        if (dir.Exists == false)
        {
            Debug.LogError("Directory not found - " + strDir);
        }

        ArrayList       retArray;
        DirectoryInfo[] info = dir.GetDirectories();
        int             nFindFile;

        retArray     = GetResourceFiles <TT>(strDir, containFileName, nMaxFile, bAsyncLoad, prefabType, out nFindFile);
        nOutFindFile = nFindFile;
        if (nMaxFile != 0)
        {
            nMaxFile = nMaxFile - nFindFile;
            if (nMaxFile <= 0)
            {
                return(retArray);
            }
        }

        foreach (DirectoryInfo dirInfo in info)
        {
            retArray.AddRange(GetResourceFileRecursively <TT>(NgFile.CombinePath(strDir, dirInfo.Name), containFileName, nMaxFile, bAsyncLoad, prefabType, out nFindFile));
            nOutFindFile += nFindFile;
            if (nMaxFile != 0)
            {
                nMaxFile = nMaxFile - nFindFile;
                if (nMaxFile <= 0)
                {
                    break;
                }
            }
        }
        return(retArray);
#endif
    }
Ejemplo n.º 6
0
    public static ObjectNode[] GetPrefabList(string strDir, bool bIncludeMesh, bool bRecursively, int nMaxFile, bool bAsyncLoad, NgEnum.PREFAB_TYPE prefabType, out int nOutFindFile)
    {
        ArrayList retArray;
        int       nCount = 0;

        if (bRecursively)
        {
            retArray = GetResourceFileRecursively <GameObject>(strDir, null, nMaxFile, bAsyncLoad, prefabType, out nOutFindFile);
        }
        else
        {
            retArray = GetResourceFiles <GameObject>(strDir, null, nMaxFile, bAsyncLoad, prefabType, out nOutFindFile);
        }
        ObjectNode[] retObjNodes = ArrayListToObjectNodes(retArray);

        if (bIncludeMesh == false)
        {
            while (true)
            {
                if (retObjNodes.Length <= nCount)
                {
                    break;
                }
                if (NgFile.GetFileExt(retObjNodes[nCount].m_AssetPath).ToLower() != "prefab")
                {
//                  Debug.Log(((GameObject)retArray[nCount]).name);
                    ArrayUtility.RemoveAt <ObjectNode>(ref retObjNodes, nCount);
                }
                else
                {
                    nCount++;
                }
            }
            nOutFindFile = retObjNodes.Length;
        }
        return(retObjNodes);
    }
 // Control Function -----------------------------------------------------------------
 GameObject GetAttachPrefab()
 {
     m_LoadPrefabType = NgEnum.PREFAB_TYPE.All;
     if (m_BaseSelectPrefab is NcAttachPrefab)
         return (m_BaseSelectPrefab as NcAttachPrefab).m_AttachPrefab;
     if (m_BaseSelectPrefab is NcParticleSystem)
         return (m_BaseSelectPrefab as NcParticleSystem).m_AttachPrefab;
     if (m_BaseSelectPrefab is NcSpriteFactory)
     {
     // 			if (m_SelectnSubArgIndex == 0)
         return (m_BaseSelectPrefab as NcSpriteFactory).m_SpriteList[m_SelectnArgIndex].m_EffectPrefab;
     }
     if (m_BaseSelectPrefab is NcSpriteTexture)
     {
         m_LoadPrefabType = NgEnum.PREFAB_TYPE.NcSpriteFactory;
         return (m_BaseSelectPrefab as NcSpriteTexture).m_NcSpriteFactoryPrefab;
     }
     if (m_BaseSelectPrefab is NcSpriteAnimation)
     {
         m_LoadPrefabType = NgEnum.PREFAB_TYPE.NcSpriteFactory;
         return (m_BaseSelectPrefab as NcSpriteAnimation).m_NcSpriteFactoryPrefab;
     }
     if (m_BaseSelectPrefab is NcParticleSpiral)
     {
         m_LoadPrefabType = NgEnum.PREFAB_TYPE.LegacyParticle;
         return (m_BaseSelectPrefab as NcParticleSpiral).m_ParticlePrefab;
     }
     if (m_BaseSelectPrefab is NcParticleEmit)
     {
         m_LoadPrefabType = NgEnum.PREFAB_TYPE.ParticleSystem;
         return (m_BaseSelectPrefab as NcParticleEmit).m_ParticlePrefab;
     }
     if (m_BaseSelectPrefab is FxmInfoBackground)
         return null;
     Debug.LogError("GetAttachPrefab() error");
     return null;
 }