示例#1
0
    public static ExplorationSpace Decode(
        SpaceData data,
        IEventLibrary library)
    {
        List<ExplorationNode> nodes = new List<ExplorationNode>();

        // Recreate the nodes
        Dictionary<uint, ExplorationNode> idToNode;
        List<ExplorationNode> newNodes =
            DecodeNodes(data.Nodes, out idToNode);
        nodes.AddRange(newNodes);

        // Recreate the edges
        Dictionary<uint, ExplorationEdge> idToEdge;
        List<ExplorationEdge> newEdges =
            DecodeEdges(library, idToNode, data.Edges, out idToEdge);

        // Link the instantiated edges to the instantiated nodes
        for (int i = 0; i < data.Nodes.Length; i++)
        {
            NodeData nodeData = data.Nodes[i];
            ExplorationNode node = nodes[i];
            AssignEdgesToNode(idToEdge, nodeData, node);
        }

        return new ExplorationSpace(nodes);
    }
示例#2
0
 protected AutomationBase(IPropertyLibray propertyLibrary, IEventLibrary eventLibrary, IPatternLibrary patternLibrary)
 {
     PropertyLibrary  = propertyLibrary;
     EventLibrary     = eventLibrary;
     PatternLibrary   = patternLibrary;
     ConditionFactory = new ConditionFactory(propertyLibrary);
     OverlayManager   = new OverlayManager();
 }
示例#3
0
 protected AutomationBase(IPropertyLibrary propertyLibrary, IEventLibrary eventLibrary, IPatternLibrary patternLibrary)
 {
     PropertyLibrary  = propertyLibrary;
     EventLibrary     = eventLibrary;
     PatternLibrary   = patternLibrary;
     ConditionFactory = new ConditionFactory(propertyLibrary);
     OverlayManager   = new WinFormsOverlayManager();
     // Make sure all pattern ids are initialized
     var unused = PatternLibrary.AllForCurrentFramework;
 }
示例#4
0
        protected AutomationBase(IPropertyLibray propertyLibrary, IEventLibrary eventLibrary, IPatternLibrary patternLibrary)
        {
            this.PropertyLibrary  = propertyLibrary;
            this.EventLibrary     = eventLibrary;
            this.PatternLibrary   = patternLibrary;
            this.ConditionFactory = new ConditionFactory(propertyLibrary);

            // Make sure all pattern ids are initialized
            var unused = this.PatternLibrary.AllForCurrentFramework;
        }
示例#5
0
 protected AutomationBase(IPropertyLibray propertyLibrary, IEventLibrary eventLibrary, IPatternLibrary patternLibrary)
 {
     PropertyLibrary  = propertyLibrary;
     EventLibrary     = eventLibrary;
     PatternLibrary   = patternLibrary;
     ConditionFactory = new ConditionFactory(propertyLibrary);
     OverlayManager   = new WinFormsOverlayManager();
     // Make sure all pattern ids are initialized
     var allPatterns = PatternLibrary.AllSupportedPatterns;
 }
示例#6
0
 private static ExplorationEdge Decode(
     EdgeData data,
     Dictionary<uint, ExplorationNode> idToNode,
     IEventLibrary library)
 {
     return new ExplorationEdge(
         idToNode[data.IdFrom],
         idToNode[data.IdTo],
         RecreateStoryEvents(data, library));
 }
示例#7
0
        /// <summary>
        /// Creates a new <see cref="AutomationBase"/> instance.
        /// </summary>
        /// <param name="propertyLibrary">The property library to use.</param>
        /// <param name="eventLibrary">The event library to use.</param>
        /// <param name="patternLibrary">The pattern library to use.</param>
        /// <param name="textAttributeLibrary">The text attribute library to use.</param>
        protected AutomationBase(IPropertyLibrary propertyLibrary, IEventLibrary eventLibrary, IPatternLibrary patternLibrary, ITextAttributeLibrary textAttributeLibrary)
        {
            PropertyLibrary      = propertyLibrary;
            EventLibrary         = eventLibrary;
            PatternLibrary       = patternLibrary;
            TextAttributeLibrary = textAttributeLibrary;
            ConditionFactory     = new ConditionFactory(propertyLibrary);
#if NETSTANDARD
            OverlayManager = new NullOverlayManager();
#else
            OverlayManager = new WinFormsOverlayManager();
#endif
            // Make sure all pattern ids are initialized
            var unused = PatternLibrary.AllForCurrentFramework;
        }
示例#8
0
    private static TransitionEvent[] RecreateStoryEvents(
        EdgeData data,
        IEventLibrary library)
    {
        TransitionEvent[] events =
            new TransitionEvent[data.EventNames.Length];

        for (int i = 0; i < events.Length; i++)
        {
            EventDescriptor evtDesc =
                library.GetDescriptor(data.EventNames[i]);
            DebugUtil.Assert(evtDesc != null);
            events[i] =
                new TransitionEvent(evtDesc, data.EventParticipants[i]);
        }

        return events;
    }
示例#9
0
 private static List<ExplorationEdge> DecodeEdges(
     IEventLibrary library,
     Dictionary<uint, ExplorationNode> idToNode,
     IEnumerable<EdgeData> edgeData,
     out Dictionary<uint, ExplorationEdge> idToEdge)
 {
     List<ExplorationEdge> newEdges = new List<ExplorationEdge>();
     idToEdge = new Dictionary<uint, ExplorationEdge>();
     foreach (EdgeData data in edgeData)
     {
         ExplorationEdge newEdge = Decode(data, idToNode, library);
         idToEdge[data.EdgeId] = newEdge;
         newEdges.Add(newEdge);
     }
     return newEdges;
 }