void _ui()
    {
        // topImage
        float top_image_height = (float)(55.5 / 667.0) * Display.main.systemHeight;

        TopImage.rectTransform.sizeDelta = new Vector2(Display.main.systemWidth, top_image_height);
        // logoImage
        float logoImage_posx = (float)(24.5 / 375.0) * Display.main.systemWidth,
              logoImage_posy = -(float)(13 / 667.0) * Display.main.systemHeight,
              logo_width     = (float)(22.5 / 375.0) * Display.main.systemWidth,
              logo_height    = (float)(579 / 453.0) * logo_width;

        LogoImage.rectTransform.sizeDelta          = new Vector2(logo_width, logo_height);
        LogoImage.rectTransform.anchoredPosition3D = new Vector3(logoImage_posx, logoImage_posy, 0);
        // 设置按钮
        float set_button_posx  = -(float)(25 / 375.0) * Display.main.systemWidth,
              set_button_width = (float)(20.5 / 375.0) * Display.main.systemWidth;

        SettingButton.GetComponent <RectTransform>().sizeDelta          = new Vector2(set_button_width, set_button_width);
        SettingButton.GetComponent <RectTransform>().anchoredPosition3D = new Vector3(set_button_posx, 0, 0);
        // 应用文本
        float app_posx   = (float)(34 / 375.0) * Display.main.systemWidth,
              app_width  = Display.main.systemWidth - app_posx - logoImage_posx + set_button_posx - set_button_width,
              app_height = (float)(14 / 667.0) * Display.main.systemHeight;

        AppNameText.rectTransform.sizeDelta          = new Vector2(app_width, app_height);
        AppNameText.rectTransform.anchoredPosition3D = new Vector3(app_posx, 0, 0);
        // 搜索按钮、扫一扫按钮
        float search_button_width = (float)(136 / 375.0) * Display.main.systemWidth,
              search_button_posy  = -(float)(163 / 667.0) * Display.main.systemHeight,
              scan_button_posy    = (float)(149.5 / 667.0) * Display.main.systemHeight;

        ArButton.GetComponent <RectTransform>().sizeDelta              = new Vector2(search_button_width, search_button_width);
        ArButton.GetComponent <RectTransform>().anchoredPosition3D     = new Vector3(0, scan_button_posy, 0);
        SearchButton.GetComponent <RectTransform>().sizeDelta          = new Vector2(search_button_width, search_button_width);
        SearchButton.GetComponent <RectTransform>().anchoredPosition3D = new Vector3(0, search_button_posy, 0);
        // 公司文本
        float com_text_posy   = (float)(23 / 667.0) * Display.main.systemHeight,
              com_text_width  = (float)(128 / 375.0) * Display.main.systemWidth,
              com_text_height = (float)(12.5 / 128.0) * com_text_width;

        ComNameText.rectTransform.sizeDelta          = new Vector2(com_text_width, com_text_height);
        ComNameText.rectTransform.anchoredPosition3D = new Vector3(0, com_text_posy, 0);
        // 线
        float line_posx   = (float)(8.5 / 375.0) * Display.main.systemWidth,
              line_width  = (float)(49 / 375.0) * Display.main.systemWidth,
              line_height = Display.main.systemHeight > 667.0 ? (float)(0.5 / 667.0) * Display.main.systemHeight : 0.5f;

        LeftLineImage.rectTransform.sizeDelta           = new Vector2(line_width, line_height);
        LeftLineImage.rectTransform.anchoredPosition3D  = new Vector3(-line_posx, 0, 0);
        RightLineImage.rectTransform.sizeDelta          = new Vector2(line_width, line_height);
        RightLineImage.rectTransform.anchoredPosition3D = new Vector3(line_posx, 0, 0);
        // 隐藏界面
        SettingCanvas.SetActive(false);
        SearchCanvas.SetActive(false);
        DrugInfoCanvas.SetActive(false);
        UpdateCanvas.SetActive(false);
    }
Ejemplo n.º 2
0
 public void HoverSettingButon()
 {
     SettingButton.GetComponent <Image>().sprite = HighlightedSettingButton;
 }
Ejemplo n.º 3
0
 public void BeNormalSettingButon()
 {
     SettingButton.GetComponent <Image>().sprite = NormalSettingButton;
 }