Beispiel #1
0
 /// <summary>
 /// 自适应背景
 /// </summary>
 void AdaptBg()
 {
     UISprite[] sprs = m_TopAnchor.GetComponentsInChildren <UISprite>();
     for (int i = 0; i < sprs.Length; i++)
     {
         sprs[i].height = UIRootAdapter.GetLogicHeight() - 320;
     }
 }
Beispiel #2
0
    // Use this for initialization
    void OnEnable()
    {
        UIRoot root = gameObject.GetComponent <UIRoot>();

        if (null != root)
        {
            root.manualHeight = UIRootAdapter.GetLogicHeight();
        }
    }
Beispiel #3
0
    void InitBackgroundWidth()
    {
        /*// iphone5
         * if (Screen.width % 1136 == 0)
         * {
         *  m_StoryDialogTopBG.GetComponent<UIWidget>().width = 1346;
         *  m_StoryDialogBottomBG.GetComponent<UIWidget>().width = 1346;
         * }
         * // ipad
         * else if (Screen.height % 768 == 0)
         * {
         *  m_StoryDialogTopBG.GetComponent<UIWidget>().width = 1034;
         *  m_StoryDialogBottomBG.GetComponent<UIWidget>().width = 1034;
         * }
         * // iphone4
         * else
         * {
         *  m_StoryDialogTopBG.GetComponent<UIWidget>().width = 1032;
         *  m_StoryDialogBottomBG.GetComponent<UIWidget>().width = 1032;
         * }*/

        int logicWidth = UIRootAdapter.GetLogicWidth();

        m_StoryDialogTopBG.GetComponent <UIWidget>().width = logicWidth;// +100;
        //UI修改,暂时删除自适应方案
        //m_StoryDialogBottomBG.GetComponent<UIWidget>().width = (int)(logicWidth * 0.8f);// +100;
        //m_StoryDialogBottomBG.transform.localPosition = new Vector3(-logicWidth * 0f,5f,0f);
        //if (m_StoryDialogBottomBG2) {
        //	m_StoryDialogBottomBG2.GetComponent<UIWidget> ().width = (int)(logicWidth);
        //	m_StoryDialogBottomBG2.transform.localPosition = new Vector3 (0, 61f, 0f);
        //}
        m_StoryDialogBottomRole.transform.localPosition = new Vector3(-logicWidth * 0.5f, -9, 0);
        m_RolePicPosition = m_StoryDialogBottomRole.transform.localPosition;

        //m_SpeakerName.transform.localPosition = new Vector3(165f - logicWidth * 0.5f, 21, 0);

        //m_StoryDialogBottomLabel.width = logicWidth - 496;
        //m_StoryDialogBottomLabel.height = 90;
        //m_StoryDialogBottomLabel.transform.localPosition = new Vector3(-(logicWidth * 0.5f - 327), 61);

        if (m_NextLabel)
        {
            m_NextLabel.transform.localPosition = new Vector3(logicWidth * 0.5f - 80f, 23, 0);
        }

        //if (m_MingziBG) {
        //	m_MingziBG.transform.localPosition = new Vector3 (-logicWidth * 0.5f + 149f, 32, 0);
        //}
    }
Beispiel #4
0
    void ResetFocusTrans()
    {
        int     logicW = UIRootAdapter.GetLogicWidth() / 2;
        int     logicH = UIRootAdapter.GetLogicHeight() / 2;
        Vector3 offset = m_NewPlayerGuideOffSet.transform.localPosition;

        focusTrans[0].localPosition = new Vector3(logicW + 1, logicH) - offset;
        focusTrans[1].localPosition = new Vector3(-logicW, logicH + 1) - offset;
        focusTrans[2].localPosition = new Vector3(-logicW - 1, -logicH) - offset;
        focusTrans[3].localPosition = new Vector3(logicW, -logicH - 1) - offset;
        for (int i = 0; i < 4; i++)
        {
            focusTwPos[i].from = focusTrans[i].localPosition;
        }
    }