Browse Source

Merge pull request #597 from Treiger/master

New "Both" Keymode for Save Point command, use both block name and custom key together.
master
Chris Gregan 8 years ago committed by GitHub
parent
commit
584ab1bf6d
  1. 24
      Assets/Fungus/Scripts/Commands/SavePoint.cs

24
Assets/Fungus/Scripts/Commands/SavePoint.cs

@ -20,7 +20,9 @@ namespace Fungus
/// <summary> 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!</summary> /// <summary> 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!</summary>
UseBlockName, UseBlockName,
/// <summary> 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. </summary> /// <summary> 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. </summary>
Custom Custom,
/// <summary> 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./// </summary>
Both
} }
/// <summary> /// <summary>
@ -43,6 +45,10 @@ namespace Fungus
[Tooltip("A string key which uniquely identifies this save point.")] [Tooltip("A string key which uniquely identifies this save point.")]
[SerializeField] protected string customKey = ""; [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.")] [Tooltip("How the description for this Save Point is defined.")]
[SerializeField] protected DescriptionMode descriptionMode = DescriptionMode.Timestamp; [SerializeField] protected DescriptionMode descriptionMode = DescriptionMode.Timestamp;
@ -73,6 +79,10 @@ namespace Fungus
{ {
return ParentBlock.BlockName; return ParentBlock.BlockName;
} }
else if (keyMode == KeyMode.Both)
{
return ParentBlock.BlockName + keySeparator + customKey;
}
else else
{ {
return customKey; return customKey;
@ -123,6 +133,10 @@ namespace Fungus
{ {
return "key: <Block Name>"; return "key: <Block Name>";
} }
else if (keyMode == KeyMode.Both)
{
return "key: <Block Name>" + keySeparator + customKey;
}
return "key: " + customKey; return "key: " + customKey;
} }
@ -135,7 +149,13 @@ namespace Fungus
public override bool IsPropertyVisible(string propertyName) public override bool IsPropertyVisible(string propertyName)
{ {
if (propertyName == "customKey" && if (propertyName == "customKey" &&
keyMode != KeyMode.Custom) (keyMode != KeyMode.Custom && keyMode != KeyMode.Both))
{
return false;
}
if (propertyName == "keySeparator" &&
keyMode != KeyMode.Both)
{ {
return false; return false;
} }

Loading…
Cancel
Save