|
|
|
@ -196,7 +196,7 @@ namespace Fungus
|
|
|
|
|
// Configure the portrait image |
|
|
|
|
Image portraitImage = portraitObj.GetComponent<Image>(); |
|
|
|
|
portraitImage.preserveAspect = true; |
|
|
|
|
portraitImage.sprite = character.ProfileSprite; |
|
|
|
|
portraitImage.overrideSprite = character.ProfileSprite; |
|
|
|
|
portraitImage.color = new Color(1f, 1f, 1f, 0f); |
|
|
|
|
|
|
|
|
|
// LeanTween doesn't handle 0 duration properly |
|
|
|
@ -455,7 +455,7 @@ namespace Fungus
|
|
|
|
|
float duration = (options.fadeDuration > 0f) ? options.fadeDuration : float.Epsilon; |
|
|
|
|
|
|
|
|
|
// Fade out a duplicate of the existing portrait image |
|
|
|
|
if (options.character.State.portraitImage != null && options.character.State.portraitImage.sprite != null) |
|
|
|
|
if (options.character.State.portraitImage != null && options.character.State.portraitImage.overrideSprite != null) |
|
|
|
|
{ |
|
|
|
|
GameObject tempGO = GameObject.Instantiate(options.character.State.portraitImage.gameObject); |
|
|
|
|
tempGO.transform.SetParent(options.character.State.portraitImage.transform, false); |
|
|
|
@ -463,7 +463,7 @@ namespace Fungus
|
|
|
|
|
tempGO.transform.localScale = options.character.State.position.localScale; |
|
|
|
|
|
|
|
|
|
Image tempImage = tempGO.GetComponent<Image>(); |
|
|
|
|
tempImage.sprite = options.character.State.portraitImage.sprite; |
|
|
|
|
tempImage.overrideSprite = options.character.State.portraitImage.overrideSprite; |
|
|
|
|
tempImage.preserveAspect = true; |
|
|
|
|
tempImage.color = options.character.State.portraitImage.color; |
|
|
|
|
|
|
|
|
@ -473,10 +473,10 @@ namespace Fungus
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Fade in the new sprite image |
|
|
|
|
if (options.character.State.portraitImage.sprite != options.portrait || |
|
|
|
|
if (options.character.State.portraitImage.overrideSprite != options.portrait || |
|
|
|
|
options.character.State.portraitImage.color.a < 1f) |
|
|
|
|
{ |
|
|
|
|
options.character.State.portraitImage.sprite = options.portrait; |
|
|
|
|
options.character.State.portraitImage.overrideSprite = options.portrait; |
|
|
|
|
options.character.State.portraitImage.color = new Color(1f, 1f, 1f, 0f); |
|
|
|
|
LeanTween.alpha(options.character.State.portraitImage.rectTransform, 1f, duration).setEase(stage.FadeEaseType).setRecursive(false); |
|
|
|
|
} |
|
|
|
|