예제 #1
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;
                }
            }
        }
    }
예제 #2
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;
                }
            }
        }
    }
예제 #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
 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);
     }
 }
예제 #7
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();
    }
예제 #8
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);
    }
예제 #9
0
 // Update is called once per frame
 void Update()
 {
     ui_Label.text = "Ratio : " + AspectRatios.GetAspectRatio();
 }
예제 #10
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;
            }
        }
    }