コード例 #1
0
    private GLexTexture(Texture2D texture) : base()
    {
        mTexture  = texture;
        mImporter = (TextureImporter)AssetImporter.GetAtPath(OriginalURL);

        // texture need to be readable for export
        if (!mImporter.isReadable)
        {
            Debug.LogWarning("GLexTexture.Construct: Setting texture " + Name + " as Readable, or export will fail!");

            mImporter.isReadable = true;
            AssetDatabase.ImportAsset(OriginalURL);
            mImporter = (TextureImporter)AssetImporter.GetAtPath(OriginalURL);
        }

        if (IsARGB32orRGB24)
        {
            _dataBytes = mTexture.EncodeToPNG();
        }
        else
        {
            _dataBytes = new JPGEncoder(mTexture, GLexConfig.JPEGQuality).GetBytes();
        }
        _dataBinaryKeystring = NamesUtil.GenerateBinaryId(_dataBytes, GLex.Instance.UserName);

        mTextures.Add(this);
    }
コード例 #2
0
    public GLexSound(AudioClip pClip, float pVolume, bool pLooping) : base()
    {
        mComponent = pClip;
        mImporter  = (AudioImporter)AssetImporter.GetAtPath(OriginalURL);

        _volume = pVolume;
        _loops  = pLooping;

        _dataBytes    = File.ReadAllBytes(AssetDatabase.GetAssetPath(mComponent));
        _dataBinaryId = NamesUtil.GenerateBinaryId(_dataBytes, GLex.Instance.UserName);
    }