From c6d95074fdffc29c46aba3e4b56b5aaf6648ff54 Mon Sep 17 00:00:00 2001 From: Wilson Wong Date: Fri, 24 Feb 2017 21:34:03 -0800 Subject: [PATCH] New Keymode, use both block name and custom key. You can now use both the keymodes, which will produce something like _. You can even specify the character that separates the two. --- Assets/Fungus/Scripts/Commands/SavePoint.cs | 24 +++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Assets/Fungus/Scripts/Commands/SavePoint.cs b/Assets/Fungus/Scripts/Commands/SavePoint.cs index c6185a6d..687abee7 100644 --- a/Assets/Fungus/Scripts/Commands/SavePoint.cs +++ b/Assets/Fungus/Scripts/Commands/SavePoint.cs @@ -20,7 +20,9 @@ namespace Fungus /// Use the parent Block's name as the Save Point Key. N.B. If you change the Block name later it will break the save file! UseBlockName, /// Use a custom string for the key. This allows you to use multiple Save Points in the same block and save files will still work if the Block is renamed later. - Custom + Custom, + /// Use both the parent Block's name as well as a custom string for the Save Point key. This allows you to use your custom key every block, provided your Block names are unique./// + Both } /// @@ -43,6 +45,10 @@ namespace Fungus [Tooltip("A string key which uniquely identifies this save point.")] [SerializeField] protected string customKey = ""; + [Tooltip("A string to seperate the block name and custom key when using KeyMode.Both.")] + [SerializeField] + protected string keySeparator = "_"; + [Tooltip("How the description for this Save Point is defined.")] [SerializeField] protected DescriptionMode descriptionMode = DescriptionMode.Timestamp; @@ -73,6 +79,10 @@ namespace Fungus { return ParentBlock.BlockName; } + else if (keyMode == KeyMode.Both) + { + return ParentBlock.BlockName + keySeparator + customKey; + } else { return customKey; @@ -123,6 +133,10 @@ namespace Fungus { return "key: "; } + else if (keyMode == KeyMode.Both) + { + return "key: " + keySeparator + customKey; + } return "key: " + customKey; } @@ -135,7 +149,13 @@ namespace Fungus public override bool IsPropertyVisible(string propertyName) { if (propertyName == "customKey" && - keyMode != KeyMode.Custom) + (keyMode != KeyMode.Custom && keyMode != KeyMode.Both)) + { + return false; + } + + if (propertyName == "keySeparator" && + keyMode != KeyMode.Both) { return false; }