|
|
@ -53,7 +53,7 @@ namespace Fungus |
|
|
|
waitUntilFinished = false; |
|
|
|
waitUntilFinished = false; |
|
|
|
onComplete = null; |
|
|
|
onComplete = null; |
|
|
|
|
|
|
|
|
|
|
|
// Special values that can be overriden |
|
|
|
// Special values that can be overridden |
|
|
|
fadeDuration = 0.5f; |
|
|
|
fadeDuration = 0.5f; |
|
|
|
moveDuration = 1f; |
|
|
|
moveDuration = 1f; |
|
|
|
this.useDefaultSettings = useDefaultSettings; |
|
|
|
this.useDefaultSettings = useDefaultSettings; |
|
|
@ -112,6 +112,7 @@ namespace Fungus |
|
|
|
void Awake() |
|
|
|
void Awake() |
|
|
|
{ |
|
|
|
{ |
|
|
|
stage = GetComponentInParent<Stage>(); |
|
|
|
stage = GetComponentInParent<Stage>(); |
|
|
|
|
|
|
|
stage.CachePositions(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
@ -394,11 +395,13 @@ namespace Fungus |
|
|
|
options.moveDuration = moveDuration; |
|
|
|
options.moveDuration = moveDuration; |
|
|
|
options.waitUntilFinished = waitUntilFinished; |
|
|
|
options.waitUntilFinished = waitUntilFinished; |
|
|
|
|
|
|
|
|
|
|
|
DoMoveTween(CleanPortraitOptions(options)); |
|
|
|
DoMoveTween(options); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void DoMoveTween(PortraitOptions options) |
|
|
|
public void DoMoveTween(PortraitOptions options) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CleanPortraitOptions(options); |
|
|
|
|
|
|
|
|
|
|
|
// LeanTween doesn't handle 0 duration properly |
|
|
|
// LeanTween doesn't handle 0 duration properly |
|
|
|
float duration = (options.moveDuration > 0f) ? options.moveDuration : float.Epsilon; |
|
|
|
float duration = (options.moveDuration > 0f) ? options.moveDuration : float.Epsilon; |
|
|
|
|
|
|
|
|
|
|
@ -422,7 +425,7 @@ namespace Fungus |
|
|
|
options.character = character; |
|
|
|
options.character = character; |
|
|
|
options.fromPosition = options.toPosition = stage.GetPosition(position); |
|
|
|
options.fromPosition = options.toPosition = stage.GetPosition(position); |
|
|
|
|
|
|
|
|
|
|
|
Show(CleanPortraitOptions(options)); |
|
|
|
Show(options); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
@ -441,7 +444,7 @@ namespace Fungus |
|
|
|
options.toPosition = stage.GetPosition(toPosition); |
|
|
|
options.toPosition = stage.GetPosition(toPosition); |
|
|
|
options.move = true; |
|
|
|
options.move = true; |
|
|
|
|
|
|
|
|
|
|
|
Show(CleanPortraitOptions(options)); |
|
|
|
Show(options); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
@ -453,7 +456,7 @@ namespace Fungus |
|
|
|
/// <param name="optionsTable">Moonsharp Table</param> |
|
|
|
/// <param name="optionsTable">Moonsharp Table</param> |
|
|
|
public void Show(Table optionsTable) |
|
|
|
public void Show(Table optionsTable) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Show(CleanPortraitOptions(PortraitUtil.ConvertTableToPortraitOptions(optionsTable, stage))); |
|
|
|
Show(PortraitUtil.ConvertTableToPortraitOptions(optionsTable, stage)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
@ -462,6 +465,8 @@ namespace Fungus |
|
|
|
/// <param name="options"></param> |
|
|
|
/// <param name="options"></param> |
|
|
|
public void Show(PortraitOptions options) |
|
|
|
public void Show(PortraitOptions options) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
options = CleanPortraitOptions(options); |
|
|
|
|
|
|
|
|
|
|
|
if (options.shiftIntoPlace) |
|
|
|
if (options.shiftIntoPlace) |
|
|
|
{ |
|
|
|
{ |
|
|
|
options.fromPosition = Instantiate(options.toPosition) as RectTransform; |
|
|
|
options.fromPosition = Instantiate(options.toPosition) as RectTransform; |
|
|
@ -507,9 +512,12 @@ namespace Fungus |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Fade in the new sprite image |
|
|
|
// Fade in the new sprite image |
|
|
|
options.character.state.portraitImage.sprite = options.portrait; |
|
|
|
if (options.character.state.portraitImage.sprite != 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); |
|
|
|
options.character.state.portraitImage.sprite = 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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DoMoveTween(options); |
|
|
|
DoMoveTween(options); |
|
|
|
|
|
|
|
|
|
|
@ -548,7 +556,7 @@ namespace Fungus |
|
|
|
options.fromPosition = options.toPosition = character.state.position; |
|
|
|
options.fromPosition = options.toPosition = character.state.position; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Show(CleanPortraitOptions(options)); |
|
|
|
Show(options); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
@ -560,7 +568,7 @@ namespace Fungus |
|
|
|
PortraitOptions options = new PortraitOptions(true); |
|
|
|
PortraitOptions options = new PortraitOptions(true); |
|
|
|
options.character = character; |
|
|
|
options.character = character; |
|
|
|
|
|
|
|
|
|
|
|
Hide(CleanPortraitOptions(options)); |
|
|
|
Hide(options); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
@ -575,7 +583,7 @@ namespace Fungus |
|
|
|
options.toPosition = stage.GetPosition(toPosition); |
|
|
|
options.toPosition = stage.GetPosition(toPosition); |
|
|
|
options.move = true; |
|
|
|
options.move = true; |
|
|
|
|
|
|
|
|
|
|
|
Hide(CleanPortraitOptions(options)); |
|
|
|
Hide(options); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
@ -587,7 +595,7 @@ namespace Fungus |
|
|
|
/// <param name="optionsTable">Moonsharp Table</param> |
|
|
|
/// <param name="optionsTable">Moonsharp Table</param> |
|
|
|
public void Hide(Table optionsTable) |
|
|
|
public void Hide(Table optionsTable) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Hide(CleanPortraitOptions(PortraitUtil.ConvertTableToPortraitOptions(optionsTable, stage))); |
|
|
|
Hide(PortraitUtil.ConvertTableToPortraitOptions(optionsTable, stage)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
@ -596,6 +604,8 @@ namespace Fungus |
|
|
|
/// <param name="options"></param> |
|
|
|
/// <param name="options"></param> |
|
|
|
public void Hide(PortraitOptions options) |
|
|
|
public void Hide(PortraitOptions options) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CleanPortraitOptions(options); |
|
|
|
|
|
|
|
|
|
|
|
if (options.character.state.display == DisplayType.None) |
|
|
|
if (options.character.state.display == DisplayType.None) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return; |
|
|
|
return; |
|
|
|