Exemplo n.º 1
0
    IEnumerator _searchHandle_plus(string _string)
    {
        yield return(new WaitForEndOfFrame());

        if (ok)
        {
            MoreButton.gameObject.SetActive(true);
            HelloText.gameObject.SetActive(false);
            AnimationImage.gameObject.SetActive(true);
            // maskPanel
            var mask_panel_bottom = (float)(65.5 / 667.0) * Display.main.systemHeight;
            var mask_panel_height = (float)(Display.main.systemHeight - mask_panel_bottom - Mathf.Abs(ScorllPanel.GetComponent <RectTransform>().anchoredPosition3D.y));
            MaskPanel.GetComponent <RectTransform>().sizeDelta = new Vector2(Display.main.systemWidth, mask_panel_height);
            // scorll panel
            ScorllPanel.GetComponent <RectTransform>().anchoredPosition3D = new Vector3(Display.main.systemWidth, ScorllPanel.GetComponent <RectTransform>().anchoredPosition3D.y, 0);
            try
            {
                DataHelper.Instance.Query_Plus(_string);
            }
            catch
            {
                Debug.Log(" 程序有异常!");
            }
        }
    }
Exemplo n.º 2
0
 void _ui_events()
 {
     InputField.keyboardType = TouchScreenKeyboardType.NamePhonePad;
     ScorllPanel.SetActive(false);
     AnimationImage.gameObject.SetActive(false);
     BackButton.onClick.AddListener(_back);
     InputField.onEndEdit.AddListener((str) => { searchHandle_plus(str); });
     SearchButton.onClick.AddListener(_searchButtonClick);
     MoreButton.onClick.AddListener(() => {
         MoreButton.gameObject.SetActive(false);
         MaskPanel.GetComponent <RectTransform>().sizeDelta = new Vector2(Display.main.systemWidth, Display.main.systemHeight - Mathf.Abs(ScorllPanel.GetComponent <RectTransform>().anchoredPosition3D.y));
     });
     ScorllPanel.GetComponent <ScrollRect>().onValueChanged.AddListener((v2) => {
         if (MoreButton.gameObject.activeSelf && v2.y < 1.0f)
         {
             ScorllPanel.GetComponent <ScrollRect>().normalizedPosition = new Vector2(0, 1);
         }
     });
 }
Exemplo n.º 3
0
    void _ui()
    {
        // 整个界面Panel
        float panel_posx   = Display.main.systemWidth,
              panel_width  = Display.main.systemWidth,
              panel_height = Display.main.systemHeight;

        Panel.GetComponent <RectTransform>().sizeDelta          = new Vector2(panel_width, panel_height);
        Panel.GetComponent <RectTransform>().anchoredPosition3D = new Vector3(panel_posx, 0, 0);

        // backButton
        float back_button_posx  = (float)(15 / 375.0) * Display.main.systemWidth,
              back_button_posy  = -(float)(36.5 / 667.0) * Display.main.systemHeight,
              back_button_width = (float)(31.5 / 375.0) * Display.main.systemWidth;

        BackButton.GetComponent <RectTransform>().sizeDelta          = new Vector2(back_button_width, back_button_width);
        BackButton.GetComponent <RectTransform>().anchoredPosition3D = new Vector3(back_button_posx, back_button_posy, 0);
        // helloText
        float hello_text_posy   = -(float)(208.5 / 667.0) * Display.main.systemHeight,
              hello_text_width  = (float)(97 / 375.0) * Display.main.systemWidth,
              hello_text_height = (float)(13 / 97.0) * hello_text_width;

        HelloText.rectTransform.sizeDelta          = new Vector2(hello_text_width, hello_text_height);
        HelloText.rectTransform.anchoredPosition3D = new Vector3(0, hello_text_posy, 0);
        // 输入框
        float input_field_posx   = -(float)(24 / 375.0) * Display.main.systemWidth,
              input_field_posy   = -(float)(37.5 / 667.0) * Display.main.systemHeight,
              input_filed_width  = (float)(294 / 375.0) * Display.main.systemWidth,
              input_filed_height = (float)(30 / 667.0) * Display.main.systemHeight;

        InputField.GetComponent <RectTransform>().sizeDelta          = new Vector2(input_filed_width, input_filed_height);
        InputField.GetComponent <RectTransform>().anchoredPosition3D = new Vector3(input_field_posx, input_field_posy, 0);
        // searchButton、image
        float search_button_width  = (float)(36 / 375.0) * Display.main.systemWidth,
              search_button_height = (float)(34 / 36.0) * search_button_width,
              search_image_posx    = -(float)(6 / 375.0) * Display.main.systemWidth,
              search_image_width   = (float)(19.77 / 375.0) * Display.main.systemWidth,
              search_image_height  = (float)(15.471 / 19.77) * search_image_width;

        SearchButton.GetComponent <RectTransform>().sizeDelta = new Vector2(search_button_width, search_button_height);
        SearchImage.rectTransform.anchoredPosition3D          = new Vector3(search_image_posx, 0, 0);
        SearchImage.rectTransform.sizeDelta = new Vector2(search_image_width, search_image_height);
        // 输入框文本
        float inputfiled_text_posx   = (float)(20 / 375.0) * Display.main.systemWidth,
              inputfiled_text_height = (float)(16 / 667.0) * Display.main.systemHeight;

        InputFieldText.rectTransform.anchoredPosition3D = new Vector3(inputfiled_text_posx, 0, 0);
        InputFieldText.rectTransform.sizeDelta          = new Vector2(InputField.GetComponent <RectTransform>().rect.width - inputfiled_text_posx - SearchButton.GetComponent <RectTransform>().rect.width, inputfiled_text_height);

        // scorllPanel
        float scorll_panel_posy   = -(float)(80 / 667.0) * Display.main.systemHeight,
              scorll_panel_height = Display.main.systemHeight + scorll_panel_posy;

        ScorllPanel.GetComponent <RectTransform>().sizeDelta          = new Vector2(Display.main.systemWidth, scorll_panel_height);
        ScorllPanel.GetComponent <RectTransform>().anchoredPosition3D = new Vector3(0, scorll_panel_posy, 0);

        // moreButton
        var more_button_height      = (float)(44.5 / 667.0) * Display.main.systemHeight;
        var more_button_width       = (float)((375.0 - 25.5 - 24.5) / 375.0) * Display.main.systemWidth;
        var more_button_text_height = (float)(12.5 / 667.0) * Display.main.systemHeight;

        MoreButton.GetComponent <RectTransform>().sizeDelta = new Vector2(more_button_width, more_button_height);
        MoreButton.transform.GetChild(0).GetComponent <Text>().rectTransform.sizeDelta = new Vector2(MoreButton.transform.GetChild(0).GetComponent <Text>().rectTransform.sizeDelta.x, more_button_text_height);
        // maskPanel
        var mask_panel_bottom = (float)(65.5 / 667.0) * Display.main.systemHeight;
        var mask_panel_height = (float)(Display.main.systemHeight - mask_panel_bottom - Mathf.Abs(ScorllPanel.GetComponent <RectTransform>().anchoredPosition3D.y));

        MaskPanel.GetComponent <RectTransform>().sizeDelta = new Vector2(Display.main.systemWidth, mask_panel_height);
        // animation image
        var animation_image_posy = -(float)(Display.main.systemHeight / 4.0);

        if (animation_image_posy > InputField.GetComponent <RectTransform>().anchoredPosition3D.y - InputField.GetComponent <RectTransform>().rect.height)
        {
            animation_image_posy = InputField.GetComponent <RectTransform>().anchoredPosition3D.y - InputField.GetComponent <RectTransform>().rect.height;
        }
        //var animation_image_width = (float)(101 / 375.0) * Display.main.systemWidth;
        //var animation_image_height = (float)(107 / 101.0) * animation_image_width;
        //AnimationImage.rectTransform.sizeDelta = new Vector2(animation_image_width, animation_image_height);
        AnimationImage.rectTransform.anchoredPosition3D = new Vector3(0, animation_image_posy, 0);
    }