|
|
|
@ -57,6 +57,9 @@ namespace Fungus
|
|
|
|
|
/// |
|
|
|
|
/// New types created need to be added to the list below and also to AllVariableTypes and |
|
|
|
|
/// AnyVaraibleAndDataPair |
|
|
|
|
/// |
|
|
|
|
/// Note; when using this in a command ensure that RefreshVariableCache is also handled for |
|
|
|
|
/// string var substitution. |
|
|
|
|
/// </summary> |
|
|
|
|
[System.Serializable] |
|
|
|
|
public partial struct AnyVariableData |
|
|
|
@ -121,6 +124,9 @@ namespace Fungus
|
|
|
|
|
/// |
|
|
|
|
/// New types created need to be added to the list below and also to AllVariableTypes and |
|
|
|
|
/// AnyVariableData |
|
|
|
|
/// |
|
|
|
|
/// Note to ensure use of RefreshVariableCacheHelper in commands, see SetVariable for |
|
|
|
|
/// example. |
|
|
|
|
/// </summary> |
|
|
|
|
[System.Serializable] |
|
|
|
|
public class AnyVariableAndDataPair |
|
|
|
@ -243,9 +249,17 @@ namespace Fungus
|
|
|
|
|
(anyVar, setOperator) => anyVar.variable.Apply(setOperator, anyVar.data.spriteData.Value)) }, |
|
|
|
|
{ typeof(StringVariable), |
|
|
|
|
new TypeActions( "stringData", |
|
|
|
|
(anyVar, compareOperator) => {return anyVar.variable.Evaluate(compareOperator, anyVar.data.stringData.Value); }, |
|
|
|
|
(anyVar, compareOperator) => |
|
|
|
|
{ |
|
|
|
|
var subbedRHS = anyVar.variable.GetFlowchart().SubstituteVariables(anyVar.data.stringData.Value); |
|
|
|
|
return anyVar.variable.Evaluate(compareOperator, subbedRHS); |
|
|
|
|
}, |
|
|
|
|
(anyVar) => anyVar.data.stringData.GetDescription(), |
|
|
|
|
(anyVar, setOperator) => anyVar.variable.Apply(setOperator, anyVar.data.stringData.Value)) }, |
|
|
|
|
(anyVar, setOperator) => |
|
|
|
|
{ |
|
|
|
|
var subbedRHS = anyVar.variable.GetFlowchart().SubstituteVariables(anyVar.data.stringData.Value); |
|
|
|
|
anyVar.variable.Apply(setOperator, subbedRHS); |
|
|
|
|
})}, |
|
|
|
|
{ typeof(TextureVariable), |
|
|
|
|
new TypeActions( "textureData", |
|
|
|
|
(anyVar, compareOperator) => {return anyVar.variable.Evaluate(compareOperator, anyVar.data.textureData.Value); }, |
|
|
|
@ -278,6 +292,17 @@ namespace Fungus
|
|
|
|
|
return variable == this.variable || data.HasReference(variable); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if UNITY_EDITOR |
|
|
|
|
public void RefreshVariableCacheHelper(Flowchart f, ref List<Variable> referencedVariables) |
|
|
|
|
{ |
|
|
|
|
if (variable is StringVariable asStringVar && asStringVar != null && !string.IsNullOrEmpty(asStringVar.Value)) |
|
|
|
|
f.DetermineSubstituteVariables(asStringVar.Value, referencedVariables); |
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(data.stringData.Value)) |
|
|
|
|
f.DetermineSubstituteVariables(data.stringData.Value, referencedVariables); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
public string GetDataDescription() |
|
|
|
|
{ |
|
|
|
|
TypeActions ta = null; |
|
|
|
|