Пример #1
0
 public void OnUiWidthChange()
 {
     if (UiWidth != ViewRect.rect.width)
     {
         UiWidth = ViewRect.rect.width;
         float Ratio = UiWidth / 500f;
         PlayBtn.GetComponent <RectTransform>().sizeDelta                       = new Vector2(60 * Ratio, 30);
         PlayBtn.GetComponent <RectTransform>().anchoredPosition                = new Vector2(10 * Ratio, 0);
         PauseBtn.GetComponent <RectTransform>().sizeDelta                      = new Vector2(60 * Ratio, 30);
         PauseBtn.GetComponent <RectTransform>().anchoredPosition               = new Vector2(80 * Ratio, 0);
         StopBtn.GetComponent <RectTransform>().sizeDelta                       = new Vector2(60 * Ratio, 30);
         StopBtn.GetComponent <RectTransform>().anchoredPosition                = new Vector2(150 * Ratio, 0);
         SwitchModeBtn.GetComponent <RectTransform>().sizeDelta                 = new Vector2(120 * Ratio, 30);
         SwitchModeBtn.GetComponent <RectTransform>().anchoredPosition          = new Vector2(220 * Ratio, 0);
         CurrentModeText.GetComponent <RectTransform>().sizeDelta               = new Vector2(90 * Ratio, 30);
         CurrentModeText.GetComponent <RectTransform>().anchoredPosition        = new Vector2(340 * Ratio, 0);
         ResetBtn.GetComponent <RectTransform>().sizeDelta                      = new Vector2(50 * Ratio, 30);
         ResetBtn.GetComponent <RectTransform>().anchoredPosition               = new Vector2(480 * Ratio, 0);
         FixTimeBtn.GetComponent <RectTransform>().sizeDelta                    = new Vector2(100 * Ratio, 30);
         FixTimeBtn.GetComponent <RectTransform>().anchoredPosition             = new Vector2(210 * Ratio, 0);
         OffsetLabel.GetComponent <RectTransform>().sizeDelta                   = new Vector2(60 * Ratio, 30);
         OffsetLabel.GetComponent <RectTransform>().anchoredPosition            = new Vector2(315 * Ratio, 0);
         OffsetInputField.GetComponent <RectTransform>().sizeDelta              = new Vector2(100 * Ratio, 30);
         OffsetInputField.GetComponent <RectTransform>().anchoredPosition       = new Vector2(380 * Ratio, 0);
         PreciseControllerLabel.GetComponent <RectTransform>().sizeDelta        = new Vector2(190 * Ratio, 30);
         PreciseControllerLabel.GetComponent <RectTransform>().anchoredPosition = new Vector2(10 * Ratio, 0);
     }
 }