public static string GenerateReturnMethod(FlowSystemEditorWindow flowEditor, FlowWindow exitWindow) { var file = Resources.Load("UI.Windows/Functions/Templates/TemplateReturnMethod") as TextAsset; if (file == null) { Debug.LogError("Functions Template Loading Error: Could not load template 'TemplateReturnMethod'"); return(string.Empty); } var data = FlowSystem.GetData(); if (data == null) { return(string.Empty); } var result = string.Empty; var part = file.text; var functionContainer = exitWindow.GetFunctionContainer(); var functionName = functionContainer.title; var functionCallName = functionContainer.directory; var classNameWithNamespace = Tpl.GetNamespace(exitWindow) + "." + Tpl.GetDerivedClassName(exitWindow); result += part.Replace("{FUNCTION_NAME}", functionName) .Replace("{FUNCTION_CALL_NAME}", functionCallName) .Replace("{CLASS_NAME_WITH_NAMESPACE}", classNameWithNamespace); return(result); }
public override string OnCompilerTransitionGeneration(FlowWindow window) { var functionContainer = window.GetFunctionContainer(); if (functionContainer != null) { var exit = FlowSystem.GetWindow(functionContainer.functionExitId); if (exit != null && exit.id == window.id) { return(FlowFunctionsTemplateGenerator.GenerateReturnMethod(this.flowEditor, exit)); } } return(base.OnCompilerTransitionGeneration(window)); }