Example #1
0
 public static void Process()
 {
     if (!done)
     {
         var sr = ExitButton.GetComponent <SpriteRenderer>();
         AssetsManager.Register(Ressources.Button.Name, sr.sprite);
         done = true;
     }
 }
Example #2
0
    private void Initialize_UI()
    {
        Title.sizeDelta          = new Vector2(Screen.height * 0.6f, Screen.height * 0.2f);
        Title.transform.position = new Vector2(Screen.width / 2, Screen.height * 0.85f);

        StartButton.sizeDelta                      = new Vector2(Screen.height / 1.5f, Screen.height / 9);
        StartButton.transform.position             = new Vector2(Screen.width / 2, Screen.height * 0.55f);
        StartButton.GetComponent <Text>().fontSize = (int)Screen.height / 17;

        OptionButton.sizeDelta                      = new Vector2(Screen.height / 1.5f, Screen.height / 9);
        OptionButton.transform.position             = new Vector2(Screen.width / 2, Screen.height * 0.39f);
        OptionButton.GetComponent <Text>().fontSize = (int)Screen.height / 17;

        ExitButton.sizeDelta                      = new Vector2(Screen.height / 1.5f, Screen.height / 9);
        ExitButton.transform.position             = new Vector2(Screen.width / 2, Screen.height * 0.23f);
        ExitButton.GetComponent <Text>().fontSize = (int)Screen.height / 17;

        LevelButton[0].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[0].transform.position = new Vector2(Screen.width * 0.1f, Screen.height * 0.65f);

        LevelButton[1].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[1].transform.position = new Vector2(Screen.width * 0.3f, Screen.height * 0.65f);

        LevelButton[2].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[2].transform.position = new Vector2(Screen.width * 0.5f, Screen.height * 0.65f);

        LevelButton[3].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[3].transform.position = new Vector2(Screen.width * 0.7f, Screen.height * 0.65f);

        LevelButton[4].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[4].transform.position = new Vector2(Screen.width * 0.9f, Screen.height * 0.65f);

        LevelButton[5].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[5].transform.position = new Vector2(Screen.width * 0.1f, Screen.height * 0.35f);

        LevelButton[6].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[6].transform.position = new Vector2(Screen.width * 0.3f, Screen.height * 0.35f);

        LevelButton[7].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[7].transform.position = new Vector2(Screen.width * 0.5f, Screen.height * 0.35f);

        LevelButton[8].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[8].transform.position = new Vector2(Screen.width * 0.7f, Screen.height * 0.35f);

        LevelButton[9].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[9].transform.position = new Vector2(Screen.width * 0.9f, Screen.height * 0.35f);

        BackButton.sizeDelta                      = new Vector2(Screen.height / 2.5f, Screen.height / 5);
        BackButton.transform.position             = new Vector2(Screen.height / 5, Screen.height - Screen.height / 10);
        BackButton.GetComponent <Text>().fontSize = (int)Screen.height / 20;

        for (int i = 0; i < 9; i++)
        {
            LevelButton[i].GetChild(0).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.height / 10, Screen.height / 10);
        }
        LevelButton[9].GetChild(0).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.height / 5, Screen.height / 5);
    }
Example #3
0
    public void DoHelp()
    {
        PlayButton.GetComponent <Image> ().raycastTarget   = false;
        OptionButton.GetComponent <Image> ().raycastTarget = false;
        HelpButton.GetComponent <Image> ().raycastTarget   = false;
        ExitButton.GetComponent <Image> ().raycastTarget   = false;

        Instantiate(HelpPrefab, gameObject.transform.parent);
    }
Example #4
0
 void _ui_events()
 {
     AppNameText.text = Application.productName;
     BgButton.onClick.AddListener(() => {
         if (!canHide && !canShow)
         {
             canHide = true;
         }
     });
     ExitButton.GetComponent <Button>().onClick.AddListener(() => {
         Application.Quit();
     });
     UserButton.GetComponent <Button>().onClick.AddListener(() => {
         Debug.Log(" 点击了用户指南按钮!");
         GuidePanel.SetActive(true);
     });
     AboutButton.GetComponent <Button>().onClick.AddListener(() => {
         Debug.Log(" 点击了关于我们按钮!");
         AboutPanel.SetActive(true);
     });
 }
Example #5
0
 public void FadeOut()
 {
     StartButton.GetComponent <CanvasGroup>().DOFade(1f, 0.8f);  //solgun açılıri, belirginleşme efekti verilir.
     ExitButton.GetComponent <CanvasGroup>().DOFade(1f, 0.8f).SetDelay(0.5f);
 }
Example #6
0
    void _ui()
    {
        // bgPanel
        float bg_panel_width = (float)(317 / 375.0) * Display.main.systemWidth;

        BgPanel.GetComponent <RectTransform>().sizeDelta = new Vector2(bg_panel_width, Display.main.systemHeight);
        // topPanel
        float top_panel_height = (float)(176 / 667.0) * Display.main.systemHeight;

        TopPanel.GetComponent <RectTransform>().sizeDelta = new Vector2(TopPanel.GetComponent <RectTransform>().sizeDelta.x, top_panel_height);
        // Panel
        float panel_height = Display.main.systemHeight - top_panel_height;

        Panel.GetComponent <RectTransform>().sizeDelta = new Vector2(Panel.GetComponent <RectTransform>().sizeDelta.x, panel_height);
        // logoImage
        float logo_image_posy   = -(float)(35 / 667.0) * Display.main.systemHeight,
              logo_image_width  = (float)(57 / 375.0) * Display.main.systemWidth,
              logo_image_height = (float)(74.5 / 57) * logo_image_width;

        logoImage.rectTransform.sizeDelta          = new Vector2(logo_image_width, logo_image_height);
        logoImage.rectTransform.anchoredPosition3D = new Vector3(0, logo_image_posy, 0);
        // topPanel text
        float logo_panel_text_posy   = (float)(33.5 / 667.0) * Display.main.systemHeight,
              logo_panel_text_height = (float)(20 / 667.0) * Display.main.systemHeight;

        AppNameText.rectTransform.sizeDelta          = new Vector2(AppNameText.rectTransform.sizeDelta.x, logo_panel_text_height);
        AppNameText.rectTransform.anchoredPosition3D = new Vector3(0, logo_panel_text_posy, 0);
        // userButton、aboutButton
        float user_about_button_height   = (float)(60 / 667.0) * Display.main.systemHeight,
              about_button_posy          = -user_about_button_height,
              user_button_image_posx     = (float)(25 / 375.0) * Display.main.systemWidth,
              user_button_image_width    = (float)(17.8 / 375.0) * Display.main.systemWidth,
              user_button_text_left      = (float)(60 / 375.0) * Display.main.systemWidth,
              user_button_text_height    = (float)(20 / 667.0) * Display.main.systemHeight,
              user_button_bgImage_left   = (float)(16 / 375.0) * Display.main.systemWidth,
              user_button_bgImage_height = Display.main.systemWidth > 375 ? (float)(1 / 375.0) * Display.main.systemWidth : 1f,
              about_button_image_width   = (float)(17.5 / 375.0) * Display.main.systemWidth,
              about_button_image_height  = (float)(16.9 / 17.5) * about_button_image_width;

        // userButton
        UserButton.GetComponent <RectTransform>().sizeDelta = new Vector2(UserButton.GetComponent <RectTransform>().sizeDelta.x, user_about_button_height);
        // userButton_image
        UserButton_Image.rectTransform.anchoredPosition3D = new Vector3(user_button_image_posx, 0, 0);
        UserButton_Image.rectTransform.sizeDelta          = new Vector2(user_button_image_width, user_button_image_width);
        // userButton_bgIamge
        UserButton_BgImage.rectTransform.sizeDelta = new Vector2(UserButton_BgImage.rectTransform.sizeDelta.x, user_button_bgImage_height);
        UserButton_BgImage.rectTransform.offsetMin = new Vector2(user_button_bgImage_left, UserButton_BgImage.rectTransform.offsetMin.y);
        UserButton_BgImage.rectTransform.offsetMax = new Vector2(user_button_bgImage_left, UserButton_BgImage.rectTransform.offsetMax.y);
        // userButton_text
        UserButton_Text.rectTransform.sizeDelta = new Vector2(UserButton_Text.rectTransform.sizeDelta.x, user_button_text_height);
        UserButton_Text.rectTransform.offsetMin = new Vector2(user_button_text_left, UserButton_Text.rectTransform.offsetMin.y);
        // aboutButton
        AboutButton.GetComponent <RectTransform>().anchoredPosition3D = new Vector3(0, about_button_posy, 0);
        AboutButton.GetComponent <RectTransform>().sizeDelta          = new Vector2(AboutButton.GetComponent <RectTransform>().sizeDelta.x, user_about_button_height);
        // aboutButton_Image
        AboutButton_Iamge.rectTransform.sizeDelta          = new Vector2(about_button_image_width, about_button_image_height);
        AboutButton_Iamge.rectTransform.anchoredPosition3D = new Vector3(user_button_image_posx, 0, 0);
        // aboutButton_bgImage
        AboutButton_BgImage.rectTransform.sizeDelta = new Vector2(AboutButton_BgImage.rectTransform.sizeDelta.x, user_button_bgImage_height);
        AboutButton_BgImage.rectTransform.offsetMin = new Vector2(user_button_bgImage_left, AboutButton_BgImage.rectTransform.offsetMin.y);
        AboutButton_BgImage.rectTransform.offsetMax = new Vector2(user_button_bgImage_left, AboutButton_BgImage.rectTransform.offsetMax.y);
        // aboutButton_text
        AboutButton_Text.rectTransform.sizeDelta = new Vector2(AboutButton_Text.rectTransform.sizeDelta.x, user_button_text_height);
        AboutButton_Text.rectTransform.offsetMin = new Vector2(user_button_text_left, AboutButton_Text.rectTransform.offsetMin.y);
        // exitButton
        float exit_button_height      = (float)(50 / 667.0) * Display.main.systemHeight,
              exit_button_text_height = (float)(27 / 667.0) * Display.main.systemHeight;

        ExitButton.GetComponent <RectTransform>().sizeDelta = new Vector2(ExitButton.GetComponent <RectTransform>().sizeDelta.x, exit_button_height);
        ExitButton_Text.rectTransform.sizeDelta             = new Vector2(ExitButton_Text.rectTransform.sizeDelta.x, exit_button_text_height);
        //
        AboutPanel.SetActive(false);
        GuidePanel.SetActive(false);
    }