/// <summary>
        /// Renders a node graph system
        /// </summary>
        /// <param name="objectExportSnippet">Object export snippet</param>
        /// <param name="flexFieldObject">Flex field object</param>
        /// <returns>Node graph render result</returns>
        private ExportNodeGraphRenderResult RenderNodeGraph(ObjectExportSnippet objectExportSnippet, FlexFieldObject flexFieldObject)
        {
            if (objectExportSnippet == null || objectExportSnippet.ScriptNodeGraph == null)
            {
                return(new ExportNodeGraphRenderResult());
            }

            if (_renderedNodeGraphs.ContainsKey(objectExportSnippet.Id))
            {
                return(_renderedNodeGraphs[objectExportSnippet.Id]);
            }

            ExportNodeGraphRenderResult renderResult;

            try
            {
                _errorCollection.CurrentErrorContext = _localizer["ExportSnippetErrorContext", objectExportSnippet.SnippetName].Value;
                _nodeGraphExporter.SetErrorCollection(_errorCollection);
                _nodeGraphExporter.SetNodeGraphFunctionGenerator(_exportSnippetNodeGraphGenerator);
                _nodeGraphExporter.SetNodeGraphRenderer(_nodeGraphRenderer);
                renderResult = _nodeGraphExporter.RenderNodeGraph(objectExportSnippet.ScriptNodeGraph, flexFieldObject).Result;
                _renderedNodeGraphs.Add(objectExportSnippet.Id, renderResult);
            }
            finally
            {
                _errorCollection.CurrentErrorContext = string.Empty;
            }
            return(renderResult);
        }
Exemple #2
0
        /// <summary>
        /// Renders a node graph system
        /// </summary>
        /// <param name="dailyRoutineEvent">Daily routine event</param>
        /// <param name="npc">Npc</param>
        /// <param name="errorCollection">Error collection</param>
        /// <returns>Node graph render result</returns>
        private ExportNodeGraphRenderResult RenderNodeGraph(KortistoNpcDailyRoutineEvent dailyRoutineEvent, KortistoNpc npc, ExportPlaceholderErrorCollection errorCollection)
        {
            if (dailyRoutineEvent == null || dailyRoutineEvent.ScriptNodeGraph == null)
            {
                return(new ExportNodeGraphRenderResult());
            }

            if (_renderedEvents.ContainsKey(dailyRoutineEvent.EventId))
            {
                return(_renderedEvents[dailyRoutineEvent.EventId]);
            }

            _nodeGraphExporter.SetErrorCollection(errorCollection);
            _nodeGraphExporter.SetNodeGraphFunctionGenerator(_dailyRoutineNodeGraphFunctionGenerator);
            _nodeGraphExporter.SetNodeGraphRenderer(_dailyRoutineNodeGraphRenderer);
            ExportNodeGraphRenderResult renderResult = _nodeGraphExporter.RenderNodeGraph(dailyRoutineEvent.ScriptNodeGraph, npc).Result;

            _renderedEvents.Add(dailyRoutineEvent.EventId, renderResult);
            return(renderResult);
        }