public override BlockReturn Run(BlockReturn param)
        {
            if (graph == null)
            {
                if (graphString != null)
                {
                    string s = graphString.RunAndGetString();
                    if (string.IsNullOrEmpty(s))
                    {
                        Log(LogType.Error, "Graph name/ ident is not set.");
                        return BlockReturn.Error;
                    }

                    if (identType == DiaQIdentType.CutomIdent) graph = DiaQEngine.Instance.graphManager.GetGraphByIdent(s);
                    else graph = DiaQEngine.Instance.graphManager.GetGraphByName(s);

                    if (graph == null)
                    {
                        Log(LogType.Error, string.Format("Graph with {0} = {1} could not be found.", identType, s));
                        return BlockReturn.Error;
                    }
                }
                else
                {
                    if (id == null) id = new UniqueID(graphId.id);
                    graph = DiaQEngine.Instance.graphManager.GetGraph(id);
                    if (graph == null)
                    {
                        Log(LogType.Error, "Could not find the specified Graph. You might have removed it without updating the Block.");
                        return BlockReturn.Error;
                    }
                }
            }

            DiaQEngine.Instance.graphManager.BeginGraph(graph);

            if (!cacheTarget) graph = null;
            return BlockReturn.OK;
        }
Esempio n. 2
0
    // =================================================================================
    protected void Start()
    {
        // find the quest and cache a reference to it so I do not have to look it up
        // each time I want to work with it. Will simply search by its name but there
        // are methods too.
        quest = DiaQEngine.Instance.questManager.GetQuestByName("Sample Quest");

        // will also cache the graph. A graph is the conversation flow of the
        // quest giver's dialogue
        conversation = DiaQEngine.Instance.graphManager.GetGraphByName("Sample Graph");
    }