Esempio n. 1
0
        public static void RegisterFilePathRetreiver(IIocImpl iocImpl, string actionName)
        {
            string actName = actionName.ToLowerInvariant();

            switch (actName)
            {
            case "all":
                iocImpl.Register <IPathHandler, AllFilePathHandler>();
                break;

            case "cpp":
                iocImpl.Register <IPathHandler>(new ExtentionFilterPathHandler(".cpp"));
                break;

            case "reversed1":
                iocImpl.Register <IPathHandler, Reversed1FilePathHandler>();
                break;

            case "reversed2":
                iocImpl.Register <IPathHandler, Reversed2FilePathHandler>();
                break;
            }
            IPathHandler pathHandler = iocImpl.Resolve <IPathHandler>();

            iocImpl.Register <IFilePathRetreiver>(new FilePathRetriever(pathHandler));
        }
Esempio n. 2
0
        public void Recycle()
        {
            var bld = builder;

            Pool <RetainedGizmos.Builder> .Recycle(ref bld);

            builder   = null;
            debugData = null;
        }
Esempio n. 3
0
 public override void BakeGraph2Handler(IPathHandler handler)
 {
     if (handler.SearchType == AlgorithmType.AStar)
     {
         PathNode.Bake(handler, this);
     }
     else if (handler.SearchType == AlgorithmType.AStarWithJPS)
     {
         JPSPathNode.Bake(handler, this);
     }
 }
Esempio n. 4
0
 public Hasher(NavSystem active)
 {
     hash         = 0;
     debugHandler = active.debugHandler;
     //Todo: Debug Mode
     includePathSearchInfo = debugHandler != null;
     includeAreaInfo       = false;
     //AddHash((int)active.debugMode);
     //AddHash(active.debugFloor.GetHashCode());
     //AddHash(active.debugRoof.GetHashCode());
     AddHash(AStarColor.ColorHash());
 }
Esempio n. 5
0
 public void Init(NavSystem active, RetainedGizmos.Hasher hasher, RetainedGizmos gizmos)
 {
     if (active != null)
     {
         debugData      = active.debugHandler;
         debugPathID    = active.debugPathID;
         debugFloor     = active.debugFloor;
         debugRoof      = active.debugRoof;
         showSearchTree = active.showSearchTree && debugData != null;
     }
     this.gizmos = gizmos;
     this.hasher = hasher;
     builder     = Pool <RetainedGizmos.Builder> .Allocate();
 }
        public static string DecodePath(SolutionEntityItem item, string path)
        {
            IPathHandler ph = item.GetItemHandler() as IPathHandler;

            if (ph != null)
            {
                return(ph.DecodePath(path));
            }
            else
            {
                string basePath = Path.GetDirectoryName(item.FileName);
                return(FileService.AbsoluteToRelativePath(basePath, path));
            }
        }
Esempio n. 7
0
        public virtual void Open(Path path, IPathHandler pathHandler)
        {
            NavNode node = Node,
                    tmpNode;
            IPathHandler handler = Handler;

            node.GetNeighbor(m_Neighbors);
            for (int i = 0; i < m_Neighbors.Count; i++)
            {
                tmpNode = m_Neighbors[i];
                if (tmpNode == null)
                {
                    continue;
                }
                IPathNode tmpPN = handler.GetPathnode(tmpNode);
                int       cost  = node.GetNeighborCost(i);
                if (PathID != tmpPN.PathID)
                {
                    tmpPN.Parent = this;
                    tmpPN.PathID = PathID;
                    tmpPN.Cost   = cost;
                    tmpPN.H      = path.CalculateHScore(tmpNode);
                    tmpPN.UpdateG();
                    handler.Heap.Enqueue(tmpPN, tmpPN.F);
                }
                else
                {
                    if (g + cost < tmpPN.G)
                    {
                        tmpPN.Parent = this;
                        tmpPN.Cost   = cost;
                        tmpPN.UpdateG();
                        handler.Heap.Enqueue(tmpPN, tmpPN.F);
                    }
                }
            }
        }
        IPathHandler GetHandler(IPathHandler handler, string subPath, out string outSubPath)
        {
            outSubPath = null;
            var ss = subPath.Split(new char[] { '(' }, 2);

            if (ss.Length == 1)
            {
                if (handler.FileExists(subPath))
                {
                    outSubPath = subPath;
                    return(handler);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                var ending      = ss[1].Split(')')[0];
                var nextSubPath = ss[1].Substring(ending.Length + 2);
                // Otherwise we have a zip file in the path (i.e. C:/MyStuff|.zip/something)
                // The rule then is that if C:/MyStuff/something exists, we go for that
                var rawPath = ss[0] + "/" + nextSubPath;
                var h       = GetHandler(handler, rawPath, out outSubPath);
                if (h != null)
                {
                    return(h);
                }
                else
                {
                    // Otherwise we go for the zip file
                    return(GetHandler(handler.OpenZipFile(ss[0] + ending), nextSubPath, out outSubPath));
                }
            }
        }
Esempio n. 9
0
 public static bool InSearchTree(NavNode node, IPathHandler handler, int pathID)
 {
     return(handler.GetPathnode(node).PathID == pathID);
 }
Esempio n. 10
0
 public abstract void BakeGraph2Handler(IPathHandler handler);
Esempio n. 11
0
 public PositionHandler(IPositionChecker positionChecker, IField field, IPathHandler pathHandler)
 {
     _positionChecker = positionChecker;
     _field           = field;
     _pathHandler     = pathHandler;
 }
Esempio n. 12
0
 public override void Open(Path path, IPathHandler pathHandler)
 {
 }
Esempio n. 13
0
 public new static void Bake(IPathHandler handler, GridGraph graph)
 {
     //Todo: Deal with map
 }
Esempio n. 14
0
 public FilePathRetriever(IPathHandler pathHandler)
 {
     _pathHandler = pathHandler;
 }
Esempio n. 15
0
 public void PrepareBase(IPathHandler handler)
 {
     Handler = handler;
     Handler.Init(this);
 }
 IPathHandler GetHandler(IPathHandler handler, string subPath, out string outSubPath)
 {
     outSubPath = null;
     var ss = subPath.Split(new char[] { '(' }, 2);
     if (ss.Length == 1)
     {
         if (handler.FileExists(subPath))
         {
             outSubPath = subPath;
             return handler;
         }
         else
             return null;
     }
     else
     {
         var ending = ss[1].Split(')')[0];
         var nextSubPath = ss[1].Substring(ending.Length + 2);
         // Otherwise we have a zip file in the path (i.e. C:/MyStuff|.zip/something)
         // The rule then is that if C:/MyStuff/something exists, we go for that
         var rawPath = ss[0] + "/" + nextSubPath;
         var h = GetHandler(handler, rawPath, out outSubPath);
         if (h != null) return h;
         else
         {
             // Otherwise we go for the zip file
             return GetHandler(handler.OpenZipFile(ss[0] + ending), nextSubPath, out outSubPath);
         }
     }
 }