public void Initialize(RealWorldPhotoScriptableObject newPhoto) { photo = newPhoto; image.sprite = newPhoto.photo; aspectRatioFitter.aspectRatio = (float)newPhoto.photo.rect.width / (float)newPhoto.photo.rect.height; }
public void ShowPhoto(RealWorldPhotoScriptableObject photo) { itemRight.SetActive(false); skinRight.SetActive(false); realWorldPhotoRight.SetActive(true); realWorldPhotoNameText.text = photo.name; realWorldPhotoDescriptionText.text = photo.description; realWorldPhotoPreview.sprite = photo.photo; // Reset the aspect of the preview image container // to fit the aspect ratio of the photo. var aspect = (float)photo.photo.rect.width / photo.photo.rect.height; realWorldPhotoPreview.GetComponent <AspectRatioFitter>().aspectRatio = aspect; currentSelectedPhoto = photo; }
public void AddPhoto(RealWorldPhotoScriptableObject photo) { var photoDisplay = InstantiateDisplayAndAddToContainer(realWorldPhotoDisplayPrefab); photoDisplay.GetComponent <RealWorldPhotoDisplay>().Initialize(photo); LogNotificationCenter.Instance.Post( "你刚刚获得了照片:<color=orange>" + photo.name + "</color>" ); var flagName = SaveSystem.GetRealWorldPhotoFlagName(photo); if (!FlagBag.Instance.HasFlag(flagName)) { FlagBag.Instance.AddFlag(flagName); } }
public static string GetRealWorldPhotoFlagName(RealWorldPhotoScriptableObject r) { return("ItemPanel.HasRealWorldPhoto" + r.name); }