コード例 #1
0
    void LoadScriptList()
    {
        int    nScriptCount;
        int    nFindFolderCount;
        int    nCount    = 0;
        string scriptDir = FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.SCRIPTS);

        // load folder
        string[] groupStrings = NgAsset.GetFolderList(scriptDir, null, "Hide", 0, out nFindFolderCount);
        m_GroupContents = NgConvert.StringsToContents(groupStrings);

        if (m_nGroupIndex < 0 || m_GroupContents.Length <= m_nGroupIndex)
        {
            m_nGroupIndex = 0;
        }
        if (m_GroupContents.Length == 0)
        {
            m_nGroupIndex = -1;
        }

        // load file
        if (m_GroupContents[m_nGroupIndex].text == "Unity")
        {
            List <string> addList = new List <string>();

            // add UnityComponent
            addList.Add("MeshFilter");
            addList.Add("MeshRenderer");
            addList.Add("");
            addList.Add("ParticleSystem");
            addList.Add("ParticleSystemRenderer");
            addList.Add("TrailRenderer");
            addList.Add("LineRenderer");
            addList.Add("");
            addList.Add("EllipsoidParticleEmitter");
            addList.Add("MeshParticleEmitter");
            addList.Add("ParticleAnimator");
            addList.Add("ParticleRenderer");
            addList.Add("");
            addList.Add("Rigidbody");
            addList.Add("BoxCollider");
            addList.Add("SphereCollider");
            addList.Add("CapsuleCollider");
            addList.Add("MeshCollider");
            addList.Add("WorldParticleCollider");
            addList.Add("");
            addList.Add("Animation");
            addList.Add("AudioSource");

            m_ScriptScrings  = new string[addList.Count];
            m_ScriptContents = new GUIContent[addList.Count];

            for (int n = 0; n < addList.Count; n++)
            {
                m_ScriptContents[n] = GetHelpContentScript(addList[n]);
                m_ScriptScrings[n]  = addList[n];
            }
        }
        else
        {
            string   dir           = (m_nGroupIndex < 0 ? scriptDir : NgFile.CombinePath(scriptDir, m_GroupContents[m_nGroupIndex].text + "/"));
            string[] scriptScrings = NgAsset.GetFileList(dir, 0, out nScriptCount);

            m_ScriptScrings  = new string[scriptScrings.Length];
            m_ScriptContents = new GUIContent[scriptScrings.Length];

            for (int n = 0; n < scriptScrings.Length; n++)
            {
//              if (scriptScrings[n].Contains("Behaviour."))
//                  continue;

                string ext = Path.GetExtension(scriptScrings[n]);
                ext = ext.ToLower();
                if (ext == ".cs" || ext == ".js")
                {
                    m_ScriptContents[nCount] = GetHelpContentScript(NgFile.TrimFileExt(scriptScrings[n]));
                    m_ScriptScrings[nCount]  = NgFile.TrimFileExt(scriptScrings[n]);
                    nCount++;
                }
            }
            m_ScriptScrings  = NgConvert.ResizeArray(m_ScriptScrings, nCount);
            m_ScriptContents = NgConvert.ResizeArray(m_ScriptContents, nCount);
        }
    }