Exemple #1
0
    /// <summary>
    /// 从win10中导入movie播放
    /// </summary>
    private void ImportMovie()
    {
        transform.Find(ConstTable.Instance.R_TextInfo).GetComponent <Text>().text = "";
        OpenFileName pth = new OpenFileName();

        pth.structSize = Marshal.SizeOf(pth);
        //pth.filter = "All files (*.*)|*.*";
        pth.filter = "WAV files (*.wav)\0*.wav";
        //pth.filter = "Excel文件(*.xlsx)\0*.xlsx";
        pth.file         = new string(new char[256]);
        pth.maxFile      = pth.file.Length;
        pth.fileTitle    = new string(new char[64]);
        pth.maxFileTitle = pth.fileTitle.Length;
        pth.initialDir   = Application.dataPath.Replace("/", "\\") + "\\Resources"; //默认路径
        pth.title        = "打开项目";
        pth.defExt       = "dat";
        pth.flags        = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;

        string filePath = "";

        if (LocalDialog.GetOpenFileName(pth))
        {
            filePath = pth.file; //选择的文件路径;
            //Debug.Log(filePath);
        }
        if (filePath != "")
        {
            _isPlay = true;
            _isDraw = true;
            WAVReader wav = new WAVReader();
            wav.ReadWavFile(filePath);

            InvalidOtherBtn();
            //Debug.Log("载入");
            Invoke("DrawWavData", 0.5f);
        }
    }