/// <summary> /// Create the UI size struct. /// </summary> public UISize(int width, UISizeType widthType, int height, UISizeType heightType) { Width = width; WidthType = widthType; Height = height; HeightType = heightType; }
void Start() { UISizeType uiSizeType = GameManager.Instance.GetUISizeType(); SetUISize(uiSizeType); Invoke("LoadPlayScene", 1.0f); }
public void SetUISize(UISizeType uiSizeType) { if (uiSizeType == UISizeType.phone) { canvas.GetComponent <CanvasScaler>().referenceResolution = new Vector2(canvaswidth_phone, canvasheight); } else if (uiSizeType == UISizeType.tablet) { canvas.GetComponent <CanvasScaler>().referenceResolution = new Vector2(canvaswidth_tablet, canvasheight); } }
public void SetUISize(UISizeType uiSizeType) { if (uiSizeType == UISizeType.phone) { pm.uiManager.canvas.GetComponent <CanvasScaler>().referenceResolution = new Vector2(canvaswidth_phone, canvasheight); pm.cameraController.mainCamera.orthographicSize = pm.cameraController.camerasize_phone; champion_preview.sizeDelta = new Vector2(canvaswidth_phone, canvaswidth_phone); camera_champion.orthographicSize = 3; } else if (uiSizeType == UISizeType.tablet) { pm.uiManager.canvas.GetComponent <CanvasScaler>().referenceResolution = new Vector2(canvaswidth_tablet, canvasheight); pm.cameraController.mainCamera.orthographicSize = pm.cameraController.camerasize_tablet; champion_preview.sizeDelta = new Vector2(canvaswidth_tablet, canvaswidth_tablet); camera_champion.orthographicSize = 4; } }
void Awake() { text_version.text = "Version " + Application.version; uiSizeType = GameManager.Instance.GetUISizeType(); SetUISize(uiSizeType); if (uiSizeType == UISizeType.phone) { image_uisize.sprite = sprite_uisize_phone; text_uisize.text = "UI - Phone"; } else if (uiSizeType == UISizeType.tablet) { image_uisize.sprite = sprite_uisize_tablet; text_uisize.text = "UI - Tablet"; } bool useSound = GameManager.Instance.GetSoundActive(); text_sound.text = "Sound - " + (useSound ? "On" : "Off"); image_sound.sprite = useSound ? sprite_sound_on : sprite_sound_off; bool useEffect = GameManager.Instance.GetEffectActive(); text_effect.text = "Effects - " + (useEffect ? "On" : "Off"); image_effect.sprite = useEffect ? sprite_effect_on : sprite_effect_off; effect_spacecube.gameObject.SetActive(useEffect); sun.shadows = useEffect ? LightShadows.Hard : LightShadows.None; bool usePadding = GameManager.Instance.GetPaddingActive(); text_padding.text = "Padding - " + (usePadding ? "On" : "Off"); image_padding.sprite = usePadding ? sprite_padding_on : sprite_padding_off; AdjustPadding(usePadding); button_back.onClick.AddListener(() => { OnBackButtonClick(); }); button_uisize.onClick.AddListener(() => { OnUISizeButtonClick(); }); button_effect.onClick.AddListener(() => { OnEffectButtonClick(); }); button_padding.onClick.AddListener(() => { OnPaddingButtonClick(); }); button_sound.onClick.AddListener(() => { OnSoundButtonClick(); }); button_credit.onClick.AddListener(() => { OnCreditButtonClick(); }); button_contact.onClick.AddListener(() => { Application.OpenURL("mailto:" + contactEmail); }); }
void OnUISizeButtonClick() { UISizeType targetUISizeType = UISizeType.phone; if (GameManager.Instance.GetUISizeType() == UISizeType.phone) { targetUISizeType = UISizeType.tablet; image_uisize.sprite = sprite_uisize_tablet; text_uisize.text = "UI - Tablet"; } else if (GameManager.Instance.GetUISizeType() == UISizeType.tablet) { targetUISizeType = UISizeType.phone; image_uisize.sprite = sprite_uisize_phone; text_uisize.text = "UI - Phone"; } this.uiSizeType = targetUISizeType; GameManager.Instance.SetUISizeType(targetUISizeType); SetUISize(targetUISizeType); }
public void SetUISizeType(UISizeType uiSizeType) { PlayerPrefs.SetInt("uiSize", (int)uiSizeType); PlayerPrefs.Save(); }
/// <summary> /// Create a column container inside this element. /// Columns are sub elements that takes 100% of height, and arrange themselves automatically based on alignment and other columns. /// For example if you create 3 columns in the sizes of 50, 100, and 150, and they all align left, the last column will have offset of 50 + 100. /// Columns are useful when you want to arrange elements side by side. /// </summary> /// <remarks>To remove the column, use RemoveChild() just like you would do with a regular child element.</remarks> /// <param name="stylesheet">Column stylesheet or null to create empty container.</param> /// <param name="width">Column width.</param> /// <param name="widthType">Column width unit (pixels / percents).</param> /// <param name="alignment">Column alignment, ie which side of the parent element it will stick to.</param> /// <returns>New column element.</returns> public UIElement CreateColumn(string stylesheet, int width, UISizeType widthType = UISizeType.Pixels, UIAlignment alignment = UIAlignment.Left) { return(new UIElement(_BonEngineBind.BON_UIElement_CreateColumn(_handle, stylesheet, width, (int)widthType, (int)alignment))); }