Пример #1
0
        void SetSize(ImageSequencePopUpDataModel imageSequencePopUpDataModel)
        {
            var size = imageSequencePopUpDataModel.popUpSetting.size;

            switch (imageSequencePopUpDataModel.popUpSetting.sizeOption)
            {
            case SizeOption.FixedContentSize:
                size = imageSequencePopUpDataModel.popUpSetting.backgroundSprites[0].sprite.rect.size;
                break;

            case SizeOption.FixedPercentage:
                var rect = transform.GetComponentInParent <Canvas>().GetComponent <RectTransform>().sizeDelta;

                float height = rect.y * ((float)imageSequencePopUpDataModel.popUpSetting.percentage / 100.0f);
                float width  = (rect.x / rect.y) * height - 100;   //100 referes control panel width

                size = new Vector2(width, height);

                break;
            }

            contentRect.GetComponent <VerticalLayoutGroup>().padding = imageSequencePopUpDataModel.popUpSetting.padding;
            SetContentSize(size);

            PlacePopUp(rectTransform);
        }
Пример #2
0
        public void Init(ImageSequencePopUpDataModel popupDataModel)
        {
            this.imageSequencePopUpDataModel = popupDataModel;

            SetCloseButtonImage(imageCloseButton, popupDataModel.popUpSetting); //Set Close Button

            SetImageProperty(imageMain, popupDataModel.popUpSetting.backgroundSprites[0], ImageEnum.None);
            //Set image property for Border
            SetImageProperty(imageBorder, popupDataModel.popUpSetting.border, ImageEnum.None);

            if (popupDataModel.popUpSetting.customButtons)
            {
                SetImageProperty(imageNextButton, popupDataModel.popUpSetting.nextButton, ImageEnum.NextButton);
                SetImageProperty(imagePreviousButton, popupDataModel.popUpSetting.previousButton, ImageEnum.PreviousButton);
            }

            imageCloseButton.gameObject.SetActive(popupDataModel.popUpSetting.controlPanelStyle == ControlPanelStyle.Full || popupDataModel.popUpSetting.controlPanelStyle == ControlPanelStyle.ForwardAndClose);
            imagePreviousButton.gameObject.SetActive(popupDataModel.popUpSetting.controlPanelStyle == ControlPanelStyle.Full || popupDataModel.popUpSetting.controlPanelStyle == ControlPanelStyle.ForwardAndBack);

            SetSize(popupDataModel);
        }