Exemplo n.º 1
0
        internal CELTransportBox clone()
        {
            CELTransportBox t = new CELTransportBox
            {
                m_iType     = m_iType,
                m_idInst    = m_idInst,
                m_idSrcInst = m_idSrcInst,
                m_iLevelLmt = m_iLevelLmt,
                tm_vPos     = tm_vPos,
                m_vExts     = m_vExts,
                m_vTarge    = m_vTarge
            };

            return(t);
        }
Exemplo n.º 2
0
        public bool ReadFile(string path)
        {
            try
            {
                teleports = new List <CELTransportBox>();
                regions   = new List <RegionStructure>();
                string line = "";
                using (FileStream fr = File.OpenRead(path))
                {
                    using (StreamReader sr = new StreamReader(fr))
                    {
                        while ((line = sr.ReadLine()) != null)
                        {
                            if (line.Contains("version") && !line.StartsWith("//"))
                            {
                                encoding    = sr.CurrentEncoding;
                                dwVersion   = uint.Parse(line.GetNumbers());
                                dwTimeStamp = int.Parse(sr.ReadLine().GetNumbers());
                            }

                            if (line.Contains("[trans]") && !line.StartsWith("//"))
                            {
                                CELTransportBox teleport = new CELTransportBox();
                                string[]        heder    = sr.ReadLine().Split(null).CleanArray();
                                int             x        = 0;

                                teleport.m_idInst = int.Parse(heder[x].GetNumbers());
                                x++;
                                if (dwVersion >= 3)
                                {
                                    teleport.m_idSrcInst = int.Parse(heder[x].GetNumbers());
                                    x++;
                                }
                                if (dwVersion >= 5)
                                {
                                    teleport.m_iLevelLmt = int.Parse(heder[x].GetNumbers());
                                    x++;
                                }

                                teleport.tm_vPos  = new Vector3(sr.ReadLine(), ',');
                                teleport.m_vExts  = new Vector3(sr.ReadLine(), ',');
                                teleport.m_vTarge = new Vector3(sr.ReadLine(), ',');
                                teleports.Add(teleport);
                            }
                            if (line.Contains("[region]") && !line.StartsWith("//"))
                            {
                                RegionStructure region = new RegionStructure();
                                string          name   = sr.ReadLine().Replace('"', ' ').Trim();
                                string[]        heder  = sr.ReadLine().Split(null).CleanArray();
                                region.name       = name;
                                region.Type       = 0;
                                region.IdInstance = int.Parse(heder[0].GetNumbers());
                                int ZoneCount = int.Parse(heder[1].GetNumbers());
                                region.Zones = new List <Vector3>();
                                if (dwVersion > 5)
                                {
                                    region.Strategy = int.Parse(sr.ReadLine().GetNumbers());// sr.ReadLine();
                                }
                                for (int i = 0; i < ZoneCount; i++)
                                {
                                    region.Zones.Add(new Vector3(sr.ReadLine()));
                                }
                                regions.Add(region);
                            }
                        }
                    }
                }
                return(true);
            }
            catch { }
            return(false);
        }