Ejemplo n.º 1
0
 void SetAspectMode(RawImage destImage)
 {
     if (destImage == null)
     {
         destImage = _DefaluImgVideo;
     }
     GNewUITools.SetAspectMode(destImage != null ? destImage.gameObject : null, _RenderTexture.width / (float)_RenderTexture.height, (int)AspectRatioFitter.AspectMode.EnvelopeParent);
 }
Ejemplo n.º 2
0
    void PreprareRawImage(GameObject go)
    {
        if (go == null)
        {
            return;
        }

        RawImage rawImage = go.GetComponent <RawImage>();

        if (rawImage != null)
        {
            rawImage.texture = _AlphaTexture;
#if UNITY_IPHONE || UNITY_TVOS || UNITY_EDITOR || UNITY_STANDALONE
            rawImage.uvRect = new Rect(0, 1, 1, -1);        //翻转
#else
            rawImage.uvRect = new Rect(0, 0, 1, 1);
#endif
        }

        int width  = _SizeMode == SizeMode.CG ? VideoSizeConfig.STANDARD_VIDEO_WIDTH : VideoSizeConfig.STANDARD_VIDEO_WIDTH_UI;
        int height = _SizeMode == SizeMode.CG ? VideoSizeConfig.STANDARD_VIDEO_HEIGHT : VideoSizeConfig.STANDARD_VIDEO_HEIGHT_UI;
        GNewUITools.SetAspectMode(go, (float)width / (float)height, (int)AspectRatioFitter.AspectMode.EnvelopeParent);
    }