예제 #1
0
    public void ApplyLocalScale(Platform platform)
    {
        if (localScalePerPlatform != null)
        {
            foreach (LocalScalePerPlatform pair in localScalePerPlatform)
            {
                if (isCompatiblePlatform(platform, pair.platform))
                {
                    transform.localScale = pair.localScale;
                    break;
                }
            }
        }

        if (Platforms.IsPlatformAspectBased(platform.ToString()) && localScalePerAspectRatio != null)
        {
            foreach (LocalScalePerAspectRatio pair in localScalePerAspectRatio)
            {
                if (AspectRatios.GetAspectRatio() == pair.aspectRatio)
                {
                    transform.localScale = pair.localScale;
                    break;
                }
            }
        }
    }
예제 #2
0
    public void ApplyLocalPosition(Platform platform)
    {
        if (localPositionPerPlatform != null)
        {
            foreach (LocalPositionPerPlatform pair in localPositionPerPlatform)
            {
                if (platform == pair.platform)
                {
                    transform.localPosition = pair.localPosition;
                    break;
                }
            }
        }

        if (Platforms.IsPlatformAspectBased(platform.ToString()) && localPositionPerAspectRatio != null)
        {
            foreach (LocalPositionPerAspectRatio pair in localPositionPerAspectRatio)
            {
                if (AspectRatios.GetAspectRatio() == pair.aspectRatio)
                {
                    transform.localPosition = pair.localPosition;
                    break;
                }
            }
        }
    }
예제 #3
0
    public void SetRadtioScale_AD()
    {
        m_fRatioAD_Y     = 0.0f;
        m_fRatioAD_Y     = 50.0f;
        m_stRatioScale.z = 1.0f;
        switch (AspectRatios.GetAspectRatio())
        {
        case AspectRatio.Aspect4by3:            //! 옵티머스뷰
            m_stRatioScale.x = 0.92f;
            m_stRatioScale.y = 1.34f;
            break;

        case AspectRatio.Aspect5by4:
            m_stRatioScale.x = 0.92f;
            m_stRatioScale.y = 1.43f;
            break;

        case AspectRatio.Aspect16by9:
            m_stRatioScale.x = 0.92f;
            m_stRatioScale.y = 1.0f;

            break;

        case AspectRatio.Aspect16by10:
            m_stRatioScale.x = 0.92f;
            m_stRatioScale.y = 1.11f;
            break;

        case AspectRatio.Aspect3by2:
            m_stRatioScale.x = 0.92f;
            m_stRatioScale.y = 1.2f;
            break;

        case AspectRatio.AspectCustom1280x752:
            m_stRatioScale.x = 0.92f;
            m_stRatioScale.y = 1.05f;
            break;

        case AspectRatio.AspectCustom1024x600:
            m_stRatioScale.x = 0.92f;
            m_stRatioScale.y = 1.05f;
            break;

        case AspectRatio.AspectCustom800x480:
            m_stRatioScale.x = 0.92f;
            m_stRatioScale.y = 1.07f;
            break;

        case AspectRatio.AspectOthers:
            m_stRatioScale.x = 0.92f;
            m_stRatioScale.y = 1.0f;
            break;
        }

        float fTemp = m_stRatioScale.x;

        m_stRatioScale.x = m_stRatioScale.y;
        m_stRatioScale.y = fTemp;
    }
예제 #4
0
    public void ShowDebug()
    {
        if (m_bDebugMode == false)
        {
            return;
        }

        Debug.Log("Current DeviceName : " + m_pConfig.m_sDeviceName);
        Debug.Log("Current RAspectRatio : " + AspectRatios.GetAspectRatio());
    }
예제 #5
0
    public void ApplyLocalScale(Platform platform)
    {
                #if UNITY_4_6
        var rectTransform = GetComponent <RectTransform>();
                #endif

        if (localScalePerPlatform != null)
        {
            foreach (LocalScalePerPlatform pair in localScalePerPlatform)
            {
                if (isCompatiblePlatform(platform, pair.platform))
                {
                                        #if UNITY_4_6
                    if (rectTransform != null)
                    {
                        rectTransform.localScale = pair.localScale;
                    }
                    else
                    {
                        transform.localScale = pair.localScale;
                    }
                                        #else
                    transform.localScale = pair.localScale;
                                        #endif
                    break;
                }
            }
        }

        if (Platforms.IsPlatformAspectBased(platform.ToString()) && localScalePerAspectRatio != null)
        {
            foreach (LocalScalePerAspectRatio pair in localScalePerAspectRatio)
            {
                if (AspectRatios.GetAspectRatio() == pair.aspectRatio)
                {
                                        #if UNITY_4_6
                    if (rectTransform != null)
                    {
                        rectTransform.localScale = pair.localScale;
                    }
                    else
                    {
                        transform.localScale = pair.localScale;
                    }
                                        #else
                    transform.localScale = pair.localScale;
                                        #endif
                    break;
                }
            }
        }
    }
예제 #6
0
        // Called after UI _description available
        private void Render()
        {
            AspectRatios ar = FromSize(_overlaySurface.RenderingMode.PlayerViewportSize.Width, _overlaySurface.RenderingMode.PlayerViewportSize.Height);

            if (ar == AspectRatios.AspectRatio_16x10)
            {
                _videoSurface.ZoomMode = ZoomMode.Stretched;
            }
            else
            {
                _videoSurface.ZoomMode = ZoomMode.Normal;
            }
            Microsoft.MediaCenter.UI.Point startPoint = new Microsoft.MediaCenter.UI.Point(0, 0);

            Bitmap image = new Bitmap(1200, 800, PixelFormat.Format32bppArgb);

            using (Graphics dc = Graphics.FromImage(image))
            {
                ChannelBox current = _description.Lookup(_selectionX, _selectionY);

                if (current == null)
                {
                    return;
                }

                int index = 0;
                foreach (InfoTextFormat icb in _description.InfoTexts)
                {
                    SolidBrush brush = new SolidBrush(System.Drawing.Color.FromName(icb.infoColor));
                    Font       font  = new Font(icb.infoFont, icb.infoFontSize);
                    dc.DrawString(current._infoText[index], font, brush, icb.left, icb.top);
                    index++;
                }

                // Draw the lines around the chosen cell.

                SolidBrush brushText = new SolidBrush(System.Drawing.Color.FromName(_description.InfoTexts[0].infoColor));
                Pen        pen       = new System.Drawing.Pen(brushText, 6);

                dc.DrawLine(pen, current.Left, current.Top, current.Left + _description.CellWidth, current.Top);
                dc.DrawLine(pen, current.Left, current.Top, current.Left, current.Top + _description.CellHeight);
                dc.DrawLine(pen, current.Left, current.Top + _description.CellHeight, current.Left + _description.CellWidth, current.Top + _description.CellHeight);
                dc.DrawLine(pen, current.Left + _description.CellWidth, current.Top, current.Left + _description.CellWidth, current.Top + _description.CellHeight);
            }

            _overlaySurface.BeginRegionUpdates();
            _overlaySurface.UpdateRegion(startPoint, image);
            _overlaySurface.EndRegionUpdates();
        }
예제 #7
0
 public Vector3 GetPopupScale()
 {
     if (AspectRatios.GetAspectRatio() == AspectRatio.Aspect4by3)
     {
         return(new Vector3(0.8f, 0.8f, 0.8f));
     }
     else if (AspectRatios.GetAspectRatio() == AspectRatio.Aspect3by2)
     {
         return(new Vector3(0.95f, 0.95f, 0.95f));
     }
     else
     {
         return(Vector3.one);
     }
 }
예제 #8
0
 /// <summary>
 /// Gets the string representation of <paramref name="aspectRatio"/>.
 /// </summary>
 /// <param name="aspectRatio">The <see cref="AspectRatios"/>.</param>
 /// <returns>The string representation of <paramref name="aspectRatio"/>.</returns>
 public static string ToString(AspectRatios aspectRatio)
 {
     if (aspectRatio == AspectRatios.SixteenByNine)
     {
         return("16by9");
     }
     else if (aspectRatio == AspectRatios.FourByThree)
     {
         return("4by3");
     }
     else
     {
         throw new InvalidOperationException("Invalid AspectRatios");
     }
 }
예제 #9
0
    public void Enter()
    {
        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        Application.runInBackground = m_bRunInBackground;
        Application.targetFrameRate = m_nFrameRate;

        m_stScreenSize.x = Screen.width;
        m_stScreenSize.y = Screen.height;

        m_sDeviceName = SystemInfo.deviceName;

        m_pRatio = AspectRatios.GetAspectRatio();
        SetRadtioScale();
    }
예제 #10
0
    // Use this for initialization
    void Awake()
    {
        if (m_Instance == null)
        {
            m_Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        //////////////////////////////////////////////////////////////////////////
        // 다국어 관련 메모리 할당
        //////////////////////////////////////////////////////////////////////////
        MultiLanguageList = new Dictionary <E_H_MULTILANGUAGE_KIND, List <string> >();

        MessageTextList = new List <string>();
        //////////////////////////////////////////////////////////////////////////

        // 화면비율 계산하기 위해
        Ratio = AspectRatios.GetAspectRatio();
        //SetHRadtio();

        //! 이렇게 하면 화면이 16:10 비율로 나오는군요 아직 버튼은 확인 안해봤어요!
        //! 핸펀이 필요해요^^ 앗 그리고 옛날 핸드폰에서는 SetResolution이 안 먹는군요 이런 된장
        //Screen.SetResolution(1280, (1280 / 16) * 10, true);
        //Screen.SetResolution(800, 480, true);
        //! 절전모드로 안들어가게 함입니다
        Screen.sleepTimeout         = SleepTimeout.NeverSleep;
        Application.runInBackground = bRunInBackground;
        Application.targetFrameRate = nFrameRate;

        nScreenWidth  = Screen.width;
        nScreenHeight = Screen.height;

        InitMultiLanguage();

        DontDestroyOnLoad(this);
    }
예제 #11
0
 // Update is called once per frame
 void Update()
 {
     ui_Label.text = "Ratio : " + AspectRatios.GetAspectRatio();
 }
예제 #12
0
    public void ApplyLocalPosition(Platform platform)
    {
        if (localPositionPerPlatform != null)
        {
            foreach (LocalPositionPerPlatform pair in localPositionPerPlatform)
            {
                if (isCompatiblePlatform(platform, pair.platform))
                {
                    transform.localPosition = pair.localPosition;
                    break;
                }
            }
        }

        if (Platforms.IsPlatformAspectBased(platform.ToString()) && localPositionPerAspectRatio != null)
        {
            foreach (LocalPositionPerAspectRatio pair in localPositionPerAspectRatio)
            {
                if (AspectRatios.GetAspectRatio() == pair.aspectRatio)
                {
                    transform.localPosition = pair.localPosition;
                    break;
                }
            }
        }

        // if an anchor position, it will override others
        if (anchorPositions != null)
        {
            foreach (AnchorPosition pair in anchorPositions)
            {
                // make sure we have a camera to align to
                var cam = pair.alignmentCamera;
                if (cam == null)
                {
                    Debug.LogError("No alignment camera is attached to GameObject: " + gameObject.name);
                    continue;
                }

                // get screen size
                float screenWidth = Screen.width, screenHeight = Screen.height;
                                #if UNITY_EDITOR
                if (UseEditorApplyMode)
                {
                    AspectRatios.getScreenSizeHack(out screenWidth, out screenHeight);
                }
                                #endif

                // get position
                var pos = pair.screenPosition;

                if (pair.positionXAsPercent)
                {
                    pos.x *= screenWidth;                    // * 0.01f;
                }
                if (pair.positionYAsPercent)
                {
                    pos.y *= screenHeight;                    // * 0.01f;
                }
                // global calculations
                var ray        = cam.ScreenPointToRay(pos);
                var planePoint = RayInersectPlane(ray, -cam.transform.forward, transform.position);

                ray = cam.ScreenPointToRay(Vector3.zero);
                var bottomLeft = RayInersectPlane(ray, -cam.transform.forward, transform.position);

                ray = cam.ScreenPointToRay(new Vector3(screenWidth, screenHeight, 0));
                var topRight = RayInersectPlane(ray, -cam.transform.forward, transform.position);

                // get object radius
                float radius = 0;
                if (renderer != null)
                {
                    radius = (renderer.bounds.max - renderer.bounds.min).magnitude * .5f;
                }

                // get new projected width and height
                var screenSize = (topRight - bottomLeft);
                screenWidth  = Vector3.Dot(screenSize, cam.transform.right);
                screenHeight = Vector3.Dot(screenSize, cam.transform.up);

                // horizontal alignment types
                switch (pair.horizontalAlignment)
                {
                case HorizontalAlignments.Left: planePoint += cam.transform.right * (!pair.centerX ? radius : 0); break;

                case HorizontalAlignments.Right: planePoint += cam.transform.right * (screenWidth - (!pair.centerX ? radius : 0)); break;

                case HorizontalAlignments.Center: planePoint += cam.transform.right * (screenWidth * .5f); break;
                }

                // vertical alignment types
                switch (pair.verticalAlignment)
                {
                case VerticalAlignments.Bottom: planePoint += cam.transform.up * (!pair.centerY ? radius : 0); break;

                case VerticalAlignments.Top: planePoint += cam.transform.up * (screenHeight - (!pair.centerY ? radius : 0)); break;

                case VerticalAlignments.Center: planePoint += cam.transform.up * (screenHeight * .5f); break;
                }

                // set final position
                transform.position = planePoint;
            }
        }
    }
예제 #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ResponsiveEmbed" /> class.
 /// </summary>
 public ResponsiveEmbed() : base(HtmlTextWriterTag.Div)
 {
     this.AspectRatio = DEFAULT_ASPECT;
 }