Esempio n. 1
0
            internal NodeCanvas AddNode(NodeCanvas nodecanvas)
            {
                if (this.runners.Count == 0)
                {
                    //init node runtime
                    ConnectionPortStyles.FetchConnectionPortStyles();
                    NodeTypes.FetchNodeTypes();
                    NodeCanvasManager.FetchCanvasTypes();
                    ConnectionPortManager.FetchNodeConnectionDeclarations();
                    ImportExportManager.FetchIOFormats();

                    // Setup Callback system
                    NodeEditorCallbacks.SetupReceivers();
                    NodeEditorCallbacks.IssueOnEditorStartUp();
                }

                if (nodecanvas == null)
                {
                    return(null);
                }

                NodeCanvas copycanvas = NodeEditorSaveManager.CreateWorkingCopy(nodecanvas, true);

                //push copy to runners
                runners.Add(copycanvas);

                Restart(copycanvas);
                return(copycanvas);
            }
Esempio n. 2
0
    public static void InitCanvases()
    {
        interactionOverrides = new Dictionary <string, Stack <UnityAction> >();
        traversers           = new List <DialogueTraverser>();
        NodeCanvasManager.FetchCanvasTypes();
        NodeTypes.FetchNodeTypes();
        ConnectionPortManager.FetchNodeConnectionDeclarations();

        if (Instance)
        {
            Instance.ClearCanvases();
        }

        var XMLImport = new XMLImportExport();

        for (int i = 0; i < dialogueCanvasPaths.Count; i++)
        {
            string finalPath = System.IO.Path.Combine(Application.streamingAssetsPath, dialogueCanvasPaths[i]);
            //Debug.Log("Dialogue Canvas path [" + i + "] = " + finalPath);
            var canvas = XMLImport.Import(finalPath) as DialogueCanvas;
            //Debug.Log(canvas);
            if (canvas != null)
            {
                traversers.Add(new DialogueTraverser(canvas));
            }
        }

        initialized = true;
    }
Esempio n. 3
0
    public static void InitCanvases()
    {
        interactionOverrides = new Dictionary <string, Stack <UnityAction> >();
        traversers           = new List <DialogueTraverser>();
        NodeCanvasManager.FetchCanvasTypes();
        NodeTypes.FetchNodeTypes();
        ConnectionPortManager.FetchNodeConnectionDeclarations();

        if (Instance)
        {
            Instance.ClearCanvases();
        }

        var XMLImport = new XMLImportExport();

        if (Entity.OnEntitySpawn != null)
        {
            Entity.OnEntitySpawn += startDialogueGraph;
        }
        else
        {
            Entity.OnEntitySpawn = startDialogueGraph;
        }

        OnDialogueCancel = null;
        OnDialogueEnd    = null;
        StartDialogueNode.dialogueCanvasNode = null;
        StartDialogueNode.missionCanvasNode  = null;
        initialized = true;
    }
Esempio n. 4
0
    void initCanvases(bool forceReInit)
    {
        if (initialized && !forceReInit)
        {
            return;
        }
        traversers       = new List <MissionTraverser>();
        sectorTraversers = new List <SectorTraverser>();
        NodeCanvasManager.FetchCanvasTypes();
        NodeTypes.FetchNodeTypes();
        ConnectionPortManager.FetchNodeConnectionDeclarations();

        if (Instance)
        {
            Instance.ClearCanvases(true);
        }


        var XMLImport = new XMLImportExport();

        for (int i = 0; i < questCanvasPaths.Count; i++)
        {
            string finalPath = System.IO.Path.Combine(Application.streamingAssetsPath, questCanvasPaths[i]);

            if (finalPath.Contains(".taskdata"))
            {
                var canvas = XMLImport.Import(finalPath) as QuestCanvas;

                if (canvas != null)
                {
                    traversers.Add(new MissionTraverser(canvas));
                }
            }
            else if (finalPath.Contains(".sectordata"))
            {
                var canvas = XMLImport.Import(finalPath) as SectorCanvas;

                if (canvas != null)
                {
                    sectorTraversers.Add(new SectorTraverser(canvas));
                }
            }
        }

        // reset all static condition variables
        SectorLimiterNode.LimitedSector      = "";
        Entity.OnEntityDeath                 = null;
        UsePartCondition.OnPlayerReconstruct = new UnityEvent();
        WinBattleCondition.OnBattleWin       = null;

        initialized = true;
    }
Esempio n. 5
0
    void initCanvases(bool forceReInit)
    {
        if (initialized && !forceReInit)
        {
            return;
        }

        traversers       = new List <MissionTraverser>();
        sectorTraversers = new List <SectorTraverser>();
        NodeCanvasManager.FetchCanvasTypes();
        NodeTypes.FetchNodeTypes();
        ConnectionPortManager.FetchNodeConnectionDeclarations();

        if (Instance)
        {
            Instance.ClearCanvases(true);
        }


        var XMLImport = new XMLImportExport();

        for (int i = 0; i < questCanvasPaths.Count; i++)
        {
            string finalPath = System.IO.Path.Combine(Application.streamingAssetsPath, questCanvasPaths[i]);

            if (finalPath.Contains(".taskdata"))
            {
                if (SaveHandler.instance?.GetSave()?.missions != null)
                {
                    var missionName = $"{System.IO.Path.GetFileNameWithoutExtension(finalPath)}";
                    var mission     = SaveHandler.instance.GetSave().missions.Find(m => m.name == missionName);
                    if (mission != null)
                    {
                        if (mission.status == Mission.MissionStatus.Complete)
                        {
                            continue;
                        }
                        if (mission.prerequisites != null && SaveHandler.instance.GetSave().missions.Exists(m =>
                                                                                                            mission.prerequisites.Contains(m.name) &&
                                                                                                            m.status != Mission.MissionStatus.Complete))
                        {
                            offloadingMissions.Add(missionName, finalPath);
                            continue;
                        }
                    }
                }

                var canvas = XMLImport.Import(finalPath) as QuestCanvas;

                if (canvas != null)
                {
                    traversers.Add(new MissionTraverser(canvas));
                }
            }
        }

        // reset all static condition variables
        SectorLimiterNode.LimitedSector      = "";
        Entity.OnEntityDeath                 = null;
        UsePartCondition.OnPlayerReconstruct = new UnityEvent();
        WinBattleCondition.OnBattleWin       = null;
        WinBattleCondition.OnBattleLose      = null;
        SectorManager.SectorGraphLoad       += startSectorGraph;

        initialized = true;
    }