diff --git a/Assets/Fungus/Scripts/Components/PortraitController.cs b/Assets/Fungus/Scripts/Components/PortraitController.cs index 3e300bb1..15b6945e 100644 --- a/Assets/Fungus/Scripts/Components/PortraitController.cs +++ b/Assets/Fungus/Scripts/Components/PortraitController.cs @@ -10,10 +10,53 @@ using Fungus.Utils; namespace Fungus { + /// + /// Types of display operations supported by portraits. + /// + public enum DisplayType + { + /// Do nothing. + None, + /// Show the portrait. + Show, + /// Hide the portrait. + Hide, + /// Replace the existing portrait. + Replace, + /// Move portrait to the front. + MoveToFront + } + + /// + /// Directions that character portraits can face. + /// + public enum FacingDirection + { + /// Unknown direction + None, + /// Facing left. + Left, + /// Facing right. + Right + } + + /// + /// Offset direction for position. + /// + public enum PositionOffset + { + /// Unknown offset direction. + None, + /// Offset applies to the left. + OffsetLeft, + /// Offset applies to the right. + OffsetRight + } + /// /// Controls the Portrait sprites on stage /// - public class PortraitController : MonoBehaviour, IPortraitController + public class PortraitController : MonoBehaviour { // Timer for waitUntilFinished functionality protected float waitTimer; @@ -249,8 +292,13 @@ namespace Fungus } } - #region IPortraitController implentation + #region Public methods + /// + /// Using all portrait options available, run any portrait command. + /// + /// Portrait Options + /// The function that will run once the portrait command finishes public virtual void RunPortraitCommand(PortraitOptions options, Action onComplete) { waitTimer = 0f; @@ -301,6 +349,9 @@ namespace Fungus } } + /// + /// Moves Character in front of other characters on stage + /// public virtual void MoveToFront(Character character) { PortraitOptions options = new PortraitOptions(true); @@ -309,6 +360,9 @@ namespace Fungus MoveToFront(CleanPortraitOptions(options)); } + /// + /// Moves Character in front of other characters on stage + /// public virtual void MoveToFront(PortraitOptions options) { options.character.State.portraitImage.transform.SetSiblingIndex(options.character.State.portraitImage.transform.parent.childCount); @@ -316,6 +370,11 @@ namespace Fungus FinishCommand(options); } + /// + /// Shows character at a named position in the stage + /// + /// + /// Named position on stage public virtual void Show(Character character, string position) { PortraitOptions options = new PortraitOptions(true); @@ -325,6 +384,13 @@ namespace Fungus Show(options); } + /// + /// Shows character moving from a position to a position + /// + /// + /// + /// Where the character will appear + /// Where the character will move to public virtual void Show(Character character, string portrait, string fromPosition, string toPosition) { PortraitOptions options = new PortraitOptions(true); @@ -337,11 +403,22 @@ namespace Fungus Show(options); } + /// + /// From lua, you can pass an options table with named arguments + /// example: + /// stage.show{character=jill, portrait="happy", fromPosition="right", toPosition="left"} + /// Any option available in the PortraitOptions is available from Lua + /// + /// Moonsharp Table public virtual void Show(Table optionsTable) { Show(PortraitUtil.ConvertTableToPortraitOptions(optionsTable, stage)); } + /// + /// Show portrait with the supplied portrait options + /// + /// public virtual void Show(PortraitOptions options) { options = CleanPortraitOptions(options); @@ -416,6 +493,11 @@ namespace Fungus options.character.State.position = options.toPosition; } + /// + /// Simple show command that shows the character with an available named portrait + /// + /// Character to show + /// Named portrait to show for the character, i.e. "angry", "happy", etc public virtual void ShowPortrait(Character character, string portrait) { PortraitOptions options = new PortraitOptions(true); @@ -434,6 +516,10 @@ namespace Fungus Show(options); } + /// + /// Simple character hide command + /// + /// Character to hide public virtual void Hide(Character character) { PortraitOptions options = new PortraitOptions(true); @@ -442,6 +528,11 @@ namespace Fungus Hide(options); } + /// + /// Move the character to a position then hide it + /// + /// Character to hide + /// Where the character will disapear to public virtual void Hide(Character character, string toPosition) { PortraitOptions options = new PortraitOptions(true); @@ -452,11 +543,21 @@ namespace Fungus Hide(options); } + /// + /// From lua, you can pass an options table with named arguments + /// example: + /// stage.hide{character=jill, toPosition="left"} + /// Any option available in the PortraitOptions is available from Lua + /// + /// Moonsharp Table public virtual void Hide(Table optionsTable) { Hide(PortraitUtil.ConvertTableToPortraitOptions(optionsTable, stage)); } + /// + /// Hide portrait with provided options + /// public virtual void Hide(PortraitOptions options) { CleanPortraitOptions(options); @@ -487,6 +588,9 @@ namespace Fungus FinishCommand(options); } + /// + /// Sets the dimmed state of a character on the stage. + /// public virtual void SetDimmed(Character character, bool dimmedState) { if (character.State.dimmed == dimmedState) diff --git a/Assets/Fungus/Scripts/Interfaces/IPortraitController.cs b/Assets/Fungus/Scripts/Interfaces/IPortraitController.cs deleted file mode 100644 index e6254a10..00000000 --- a/Assets/Fungus/Scripts/Interfaces/IPortraitController.cs +++ /dev/null @@ -1,139 +0,0 @@ -// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus). -// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) - -using MoonSharp.Interpreter; -using Fungus.Utils; - -namespace Fungus -{ - /// - /// Types of display operations supported by portraits. - /// - public enum DisplayType - { - /// Do nothing. - None, - /// Show the portrait. - Show, - /// Hide the portrait. - Hide, - /// Replace the existing portrait. - Replace, - /// Move portrait to the front. - MoveToFront - } - - /// - /// Directions that character portraits can face. - /// - public enum FacingDirection - { - /// Unknown direction - None, - /// Facing left. - Left, - /// Facing right. - Right - } - - /// - /// Offset direction for position. - /// - public enum PositionOffset - { - /// Unknown offset direction. - None, - /// Offset applies to the left. - OffsetLeft, - /// Offset applies to the right. - OffsetRight - } - - /// - /// Controls the Portrait sprites on stage - /// - public interface IPortraitController - { - /// - /// Using all portrait options available, run any portrait command. - /// - /// Portrait Options - /// The function that will run once the portrait command finishes - void RunPortraitCommand(PortraitOptions options, System.Action onComplete); - - /// - /// Moves Character in front of other characters on stage - /// - void MoveToFront(Character character); - - /// - /// Moves Character in front of other characters on stage - /// - void MoveToFront(PortraitOptions options); - - /// - /// Shows character at a named position in the stage - /// - /// - /// Named position on stage - void Show(Character character, string position); - - /// - /// Shows character moving from a position to a position - /// - /// - /// - /// Where the character will appear - /// Where the character will move to - void Show(Character character, string portrait, string fromPosition, string toPosition); - - /// - /// From lua, you can pass an options table with named arguments - /// example: - /// stage.show{character=jill, portrait="happy", fromPosition="right", toPosition="left"} - /// Any option available in the PortraitOptions is available from Lua - /// - /// Moonsharp Table - void Show(Table optionsTable); - - /// - /// Show portrait with the supplied portrait options - /// - /// - void Show(PortraitOptions options); - - /// - /// Simple show command that shows the character with an available named portrait - /// - /// Character to show - /// Named portrait to show for the character, i.e. "angry", "happy", etc - void ShowPortrait(Character character, string portrait); - - /// - /// Simple character hide command - /// - /// Character to hide - void Hide(Character character); - - /// - /// Move the character to a position then hide it - /// - /// Character to hide - /// Where the character will disapear to - void Hide(Character character, string toPosition); - - /// - /// From lua, you can pass an options table with named arguments - /// example: - /// stage.hide{character=jill, toPosition="left"} - /// Any option available in the PortraitOptions is available from Lua - /// - /// Moonsharp Table - void Hide(Table optionsTable); - - /// - /// Hide portrait with provided options - /// - void Hide(PortraitOptions options); - } -} \ No newline at end of file diff --git a/Assets/Fungus/Scripts/Interfaces/IPortraitController.cs.meta b/Assets/Fungus/Scripts/Interfaces/IPortraitController.cs.meta deleted file mode 100644 index d25bf761..00000000 --- a/Assets/Fungus/Scripts/Interfaces/IPortraitController.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 51067f95c67324a0ba05a260dced682f -timeCreated: 1473685101 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: