Exemple #1
0
        public static Portal GetPortal(int portalId)
        {
            PortalCluster Cluster = PortalList.Find(delegate(PortalCluster lCluster)
            {
                if (lCluster.PortalList.ContainsKey(portalId))
                {
                    return(true);
                }
                return(false);
            });

            return(Cluster[portalId]);
        }
Exemple #2
0
        public static void Load(string fileName)
        {
            if (PortalList.Count > 0)
            {
                return;
            }
            using (Stream s = File.OpenRead(fileName))
            {
                using (BitReader read = new BitReader(s))
                {
                    int count = read.ReadInt();
                    for (int i = 0; i < count; i++)
                    {
                        PortalCluster Cluster = new PortalCluster();
                        Cluster.Count = read.ReadInt();

                        for (int h = 0; h < Cluster.Count; h++)
                        {
                            Portal portal = new Portal();
                            portal.PortalId = read.ReadInt();

                            for (int j = 0; j < portal.uInts1.Length; j++)
                            {
                                portal.uInts1[j] = read.ReadInt();
                            }

                            portal.MapId = read.ReadInt();

                            for (int j = 0; j < portal.uInts2.Length; j++)
                            {
                                portal.uInts2[j] = read.ReadInt();
                            }

                            Cluster.Add(portal);
                        }
                        PortalList.Add(Cluster);
                    }
                }
            }
            Console.WriteLine("[PortalDB] Loaded {0} portals", PortalList.Count);
        }
Exemple #3
0
        public static void Load(string fileName)
        {
            if (PortalList.Count > 0) return;
            using (Stream s = File.OpenRead(fileName))
            {
                using (BitReader read = new BitReader(s))
                {

                    int count = read.ReadInt();
                    for (int i = 0; i < count; i++)
                    {
                        PortalCluster Cluster = new PortalCluster();
                        Cluster.Count = read.ReadInt();

                        for (int h = 0; h < Cluster.Count; h++)
                        {
                            Portal portal = new Portal();
                            portal.PortalId = read.ReadInt();

                            for (int j = 0; j < portal.uInts1.Length; j++)
                                portal.uInts1[j] = read.ReadInt();

                            portal.MapId = read.ReadInt();

                            for (int j = 0; j < portal.uInts2.Length; j++)
                                portal.uInts2[j] = read.ReadInt();

                            Cluster.Add(portal);
                        }
                        PortalList.Add(Cluster);
                    }
                }
            }
            Console.WriteLine("[PortalDB] Loaded {0} portals", PortalList.Count);
        }