Пример #1
0
        private void onImagePrefabLoaded(string path, GameObject prefab)
        {
            DImagePopup dImagePopup = new DImagePopup();

            dImagePopup.ImageContentKey = item.DataModel.PopupImageContentKey;
            dImagePopup.Text            = "";
            GameObject gameObject = Object.Instantiate(prefab);
            ImagePopup component  = gameObject.GetComponent <ImagePopup>();

            if (component != null)
            {
                if (item.DataModel.PopupImageContentKey != null && !string.IsNullOrEmpty(item.DataModel.PopupImageContentKey.Key))
                {
                    component.SetData(dImagePopup);
                }
                component.EnableCloseButtons(closeButtonEnabled: false, fullScreenButtonEnabled: true);
                component.ShowBackground = true;
            }
            Service.Get <EventDispatcher>().DispatchEvent(new PopupEvents.ShowPopup(gameObject, destroyPopupOnBackPressed: false, scaleToFit: true, "Accessibility.Popup.Title.QuestItem"));
        }
        private void onPrefabLoaded(string path, GameObject prefab)
        {
            DImagePopup dImagePopup = new DImagePopup();

            dImagePopup.ImageContentKey = new SpriteContentKey(ImageAssetPath);
            dImagePopup.ImageOffset     = ImageOffset;
            dImagePopup.ImageScale      = ImageScale;
            if (!HasText)
            {
                dImagePopup.Text = "";
            }
            else if (string.IsNullOrEmpty(i18nText))
            {
                dImagePopup.Text = Text;
            }
            else
            {
                dImagePopup.Text = i18nText;
            }
            dImagePopup.TextStyle     = TextStyle;
            dImagePopup.TextAlignment = TextAlignment;
            dImagePopup.TextOffset    = TextOffset;
            popup      = Object.Instantiate(prefab);
            imagePopup = popup.GetComponent <ImagePopup>();
            if (imagePopup != null)
            {
                imagePopup.SetData(dImagePopup);
                imagePopup.EnableCloseButtons(ShowCloseButton, FullScreenClose);
                imagePopup.ShowBackground = ShowBackground;
                imagePopup.OpenDelay      = OpenDelay;
                imagePopup.DoneClose     += onPopupClosed;
            }
            Service.Get <EventDispatcher>().DispatchEvent(new PopupEvents.ShowPopup(popup));
            if (!WaitForPopupComplete)
            {
                Finish();
            }
        }