Beispiel #1
0
        protected override void SubtypeWrite(DSBinaryWriter bin)
        {
            bin.Write(SubUnk1);
            bin.Write(SUB_CONST_1);
            bin.Write(SUB_CONST_2);
            bin.Write(SUB_CONST_3);

            Match match = Regex.Match(MapName.ToLower(), @"^m(\d\d|xx)_(\d\d|xx)_(\d\d|xx)_(\d\d|xx)$");

            if (!match.Success)
            {
                InvalidNameException();
            }

            string ms1 = match.Groups[1].Value.ToUpper();
            string ms2 = match.Groups[2].Value.ToUpper();
            string ms3 = match.Groups[3].Value.ToUpper();
            string ms4 = match.Groups[4].Value.ToUpper();

            sbyte m1 = (sbyte)(ms1 == "XX" ? -1 : sbyte.Parse(ms1));
            sbyte m2 = (sbyte)(ms2 == "XX" ? -1 : sbyte.Parse(ms2));
            sbyte m3 = (sbyte)(ms3 == "XX" ? -1 : sbyte.Parse(ms3));
            sbyte m4 = (sbyte)(ms4 == "XX" ? -1 : sbyte.Parse(ms4));

            bin.Write(m1);
            bin.Write(m2);
            bin.Write(m3);
            bin.Write(m4);

            bin.Write(SUB_CONST_4);
            bin.Write(SUB_CONST_5);
        }
Beispiel #2
0
    private MapDataType GetMapFileTypeFromEnum(MapName mapName)
    {
        switch (mapName)
        {
        case MapName.canyonTestHigh:
            return(MapDataType.ASCIIGrid);

        case MapName.canyonTestLow:
            return(MapDataType.ASCIIGrid);

        case MapName.testData:
            return(MapDataType.ASCIIGrid);

        case MapName.fromMapCreator:
            return(MapDataType.Binary);

        case MapName.canyonTestBinary:
            return(MapDataType.Binary);

        case MapName.nuuksio:
            return(MapDataType.Binary);

        case MapName.nuuksioSmall:
            return(MapDataType.Binary);

        default:
            Debug.LogError("Error! Invalid map file name value!");
            return(MapDataType.Binary);
        }
    }
Beispiel #3
0
        // how to improve this? Make the parts of the map name into an array?
        private void CheckMapNames(MapName i_mapName, int i_level)
        {
            if (i_mapName.Prefix.PieceType != MapPieceTypes.Prefix)
            {
                IntegrationTest.Fail("Map name test failed: Prefix piece type was " + i_mapName.Prefix.PieceType + " and not " + MapPieceTypes.Prefix);
            }

            if (!i_mapName.Prefix.LevelRestriction.DoesPass(i_level))
            {
                IntegrationTest.Fail("Map name test failed: Prefix level not valid");
            }

            if (i_mapName.Terrain.PieceType != MapPieceTypes.Terrain)
            {
                IntegrationTest.Fail("Map name test failed: Terrain piece type was " + i_mapName.Terrain.PieceType + " and not " + MapPieceTypes.Terrain);
            }

            if (!i_mapName.Terrain.LevelRestriction.DoesPass(i_level))
            {
                IntegrationTest.Fail("Map name test failed: Terrain level not valid");
            }

            if (i_mapName.Suffix.PieceType != MapPieceTypes.Suffix)
            {
                IntegrationTest.Fail("Map name test failed: Suffix piece type was " + i_mapName.Suffix.PieceType + " and not " + MapPieceTypes.Suffix);
            }

            if (!i_mapName.Suffix.LevelRestriction.DoesPass(i_level))
            {
                IntegrationTest.Fail("Map name test failed: Suffix level not valid");
            }
        }
Beispiel #4
0
 public override Task Write(SourceBufferWriter buf, SourceDemo demo)
 {
     buf.WriteInt16(Protocol);
     buf.WriteInt32(ServerCount);
     buf.WriteBoolean(IsHltv);
     buf.WriteBoolean(IsDedicated);
     buf.WriteInt32(ClientCrc);
     buf.WriteUInt16(MaxClasses);
     buf.WriteInt32(MapCrc);
     buf.WriteByte(PlayerSlot);
     buf.WriteByte(MaxClients);
     if (Unk.HasValue)
     {
         if (demo.Protocol == 4)
         {
             buf.WriteInt32(Unk.Value);
         }
         else if (demo.NetworkProtocol == 24)
         {
             buf.WriteInt32(Unk.Value);
         }
     }
     buf.WriteString(GameDir.AsSpan());
     buf.WriteString(MapName.AsSpan());
     buf.WriteString(SkyName.AsSpan());
     buf.WriteString(HostName.AsSpan());
     return(Task.CompletedTask);
 }
Beispiel #5
0
    public void ChangeScene()
    {
        Vector3 vector    = ChangePos.transform.position;
        MapName changeMap = ChangePos.GetComponent <Portal>().GetProtalMapName();

        LevelManager.ChangeScene(vector, changeMap);
    }
Beispiel #6
0
    private string GetMapFileNameFromEnum(MapName mapName)
    {
        switch (mapName)
        {
        case MapName.canyonTestHigh:
            return("CanyonTestHigh");

        case MapName.canyonTestLow:
            return("CanyonTestLow");

        case MapName.fromMapCreator:
            return("heightfile0");

        case MapName.testData:
            return("testData");

        case MapName.canyonTestBinary:
            return("CanyonTestBinary");

        case MapName.nuuksio:
            return("Nuuksio");

        case MapName.nuuksioSmall:
            return("nuuksioSmall");

        default:
            Debug.LogError("Error! Invalid map file name value!");
            return("");
        }
    }
Beispiel #7
0
 public IEnumerable <MapName> GetMapNames(string searchFor = null, int startPosition = 0, int?count = null)
 {
     if (!string.IsNullOrEmpty(searchFor))
     {
         searchFor.ToLower();
     }
     return(WZ.Resolve("String/Map").Children
            .SelectMany(c => c.Children)
            .Where(c =>
     {
         int mapId = 0;
         if (!int.TryParse(c.NameWithoutExtension, out mapId))
         {
             return false;
         }
         string eightDigitId = mapId.ToString("D8");
         string nineDigitId = mapId.ToString("D9");
         WZProperty eightDigits = WZ.Resolve($"Map/Map/Map{eightDigitId[0]}");
         WZProperty nineDigits = WZ.Resolve($"Map/Map/Map{nineDigitId[0]}");
         return (eightDigits?.Children?.Any(m => m.NameWithoutExtension.Equals(eightDigitId) || m.NameWithoutExtension.Equals(nineDigitId)) ?? false) || (nineDigits?.Children?.Any(m => m.NameWithoutExtension.Equals(eightDigitId) || m.NameWithoutExtension.Equals(nineDigitId)) ?? false);
     })
            .Where(c => c != null)
            .Select(c => MapName.Parse(c))
            .Where(c => string.IsNullOrEmpty(searchFor) || (!string.IsNullOrEmpty(c.Name) && c.Name.ToLower().Contains(searchFor)) || (!string.IsNullOrEmpty(c.StreetName) && c.StreetName.ToLower().Contains(searchFor)))
            .Skip(startPosition)
            .Take(count ?? int.MaxValue));
 }
Beispiel #8
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (MapName.Length != 0)
            {
                hash ^= MapName.GetHashCode();
            }
            if (GridId != 0)
            {
                hash ^= GridId.GetHashCode();
            }
            if (DataId != 0)
            {
                hash ^= DataId.GetHashCode();
            }
            if (Direction != 0F)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Direction);
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Beispiel #9
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (MapName.Length != 0)
            {
                hash ^= MapName.GetHashCode();
            }
            if (GridId != 0)
            {
                hash ^= GridId.GetHashCode();
            }
            if (TerrainId != 0)
            {
                hash ^= TerrainId.GetHashCode();
            }
            if (BuildId != 0)
            {
                hash ^= BuildId.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Beispiel #10
0
    //load game
    public void Load()
    {
        PlayerData playerData = saveLoadPlayer.LoadData();

        if (playerData != null)
        {
            MapName savedMap = (MapName)playerData.map;

            //don't load if the data is for a different map
            if (savedMap == 0 || savedMap.Equals(mapName))
            {
                score = playerData.score;
                PlayerPrefs.SetInt("CurrentScore", score);

                float[] c = playerData.coords;
                coords = new Vector3(c[0], c[1], c[2]);
                player.transform.position = coords;

                var playerMove = player.GetComponent <PlayerMovement>();
                AbilityProcessor.Fetch((PlayerAbilities)playerData.abilityType, playerMove);

                ProjectileProcessor.SetProjectileName((PlayerProjectiles)playerData.projectileType);

                /*
                 * Sample Hierarchy of GameObject Tile
                 * to change the checkpoint image
                 *  Tile
                 *      -> Obstacles
                 *      -> Checkpoint1
                 *          -> CheckpointScript
                 *
                 * Process:
                 *  - Find the child gameobject using the name
                 *  - Call the ChangeState() of the child script
                 */

                //name of the loaded checkpoint
                checkpointTag = playerData.checkpointTag;

                //gets the list its children
                Transform[] childrenObj = tileObject.GetComponentsInChildren <Transform>();

                foreach (Transform obj in childrenObj)
                {
                    //if name matches with checkpointTag, change the state
                    if (obj.name == checkpointTag)
                    {
                        CheckpointScript objScript = obj.GetComponent <CheckpointScript>();
                        objScript.ForceWave();
                        break;
                    }
                }
            }
            else
            {
                Debug.Log("Data is for the different map. Data is not loaded");
            }
        }
    }
Beispiel #11
0
        public MapName GetMapName(int id)
        {
            WZProperty mapName = WZ.Resolve("String/Map").Children
                                 .SelectMany(c => c.Children)
                                 .Where(c => c.NameWithoutExtension == id.ToString())
                                 .FirstOrDefault();
            MapName name = MapName.Parse(mapName);

            return(name);
        }
Beispiel #12
0
        public MapInfo(ByteReader reader)
        {
            MapName = reader.String(12, '\0');
            MapName = MapName.ToLowerInvariant();
            Xs      = reader.UInt16();
            Ys      = reader.UInt16();
            int len = reader.Int32();

            Data = reader.Bytes(len);
        }
Beispiel #13
0
        public static void WriteJson(this MapName value, JsonWriter writer, JsonSerializer serializer)
        {
            switch (value)
            {
            case MapName.DesertMain: serializer.Serialize(writer, "Desert_Main"); break;

            case MapName.ErangelMain: serializer.Serialize(writer, "Erangel_Main"); break;

            case MapName.Empty: serializer.Serialize(writer, ""); break;
            }
        }
 public override void WriteBinary(ESPWriter writer)
 {
     if (Header != null)
     {
         Header.WriteBinary(writer);
     }
     if (ObjectList != null)
     {
         ObjectList.WriteBinary(writer);
     }
     if (MapName != null)
     {
         MapName.WriteBinary(writer);
     }
     if (GrassList != null)
     {
         GrassList.WriteBinary(writer);
     }
     if (MusicType != null)
     {
         MusicType.WriteBinary(writer);
     }
     if (Music != null)
     {
         Music.WriteBinary(writer);
     }
     if (IncidentalMediaSet != null)
     {
         IncidentalMediaSet.WriteBinary(writer);
     }
     if (BattleMediaSets != null)
     {
         foreach (var item in BattleMediaSets)
         {
             item.WriteBinary(writer);
         }
     }
     if (Sounds != null)
     {
         Sounds.WriteBinary(writer);
     }
     if (Weathers != null)
     {
         Weathers.WriteBinary(writer);
     }
     if (Imposters != null)
     {
         Imposters.WriteBinary(writer);
     }
 }
Beispiel #15
0
    // 設置攝影機
    private void SetCamera(MapName map)
    {
        _nowMap = map;

        foreach (GameObject camera in Cameras)
        {
            camera.SetActive(false);
            if (camera.GetComponent <ICamera>()._mapName == map)
            {
                camera.SetActive(true);
                Debug.Log($"打開攝影機{map}");
            }
        }
    }
        public override bool Equals(object obj)
        {
            IStatsData stats = obj as IStatsData;

            if (stats != null)
            {
                return(GameFileID == stats.GameFileID && KillCount == stats.KillCount && TotalKills == stats.TotalKills &&
                       SecretCount == stats.SecretCount && TotalSecrets == stats.TotalSecrets &&
                       ItemCount == stats.ItemCount && TotalItems == stats.TotalItems &&
                       LevelTime == stats.LevelTime &&
                       MapName.ToLower() == stats.MapName.ToLower());
            }

            return(false);
        }
 public virtual Task WriteHeader(SourceBufferWriter buf)
 {
     buf.Write(HeaderId);
     buf.Write(Protocol);
     buf.Write(NetworkProtocol);
     buf.WriteString(ServerName.AsSpan(), 260);
     buf.WriteString(ClientName.AsSpan(), 260);
     buf.WriteString(MapName.AsSpan(), 260);
     buf.WriteString(GameDirectory.AsSpan(), 260);
     buf.Write(PlaybackTime);
     buf.Write(PlaybackTicks);
     buf.Write(PlaybackFrames);
     buf.Write(SignOnLength);
     return(Task.CompletedTask);
 }
Beispiel #18
0
        public Product Map(ProductInfoModel source)
        {
            var destination = new Product();

            MapManufacturer?.Invoke(source, destination);
            MapCountryOfOrigin?.Invoke(source, destination);
            MapImporter?.Invoke(source, destination);
            MapImporterCountry?.Invoke(source, destination);
            MapName?.Invoke(source, destination);
            MapQuantityPerPackage?.Invoke(source, destination);
            MapImage?.Invoke(source, destination);
            MapSize?.Invoke(source, destination);
            MapLogoPath?.Invoke(source, destination);

            return(destination);
        }
Beispiel #19
0
        /// <inheritdoc />
        public override IEnumerable <StringReference> GetStringReferences()
        {
            yield return(Directory);

            foreach (var localizedMapName in MapName.GetReferences())
            {
                yield return(localizedMapName);
            }

            foreach (var mapDescription in MapDescription1.GetReferences())
            {
                yield return(mapDescription);
            }

            foreach (var mapDescription in MapDescription2.GetReferences())
            {
                yield return(mapDescription);
            }

            if (RequirementText != null)
            {
                foreach (var text in RequirementText.GetReferences())
                {
                    yield return(text);
                }
            }

            if (HeroicText != null)
            {
                foreach (var text in HeroicText.GetReferences())
                {
                    yield return(text);
                }
            }

            if (EmptyText2 == null)
            {
                yield break;
            }

            foreach (var text in EmptyText2.GetReferences())
            {
                yield return(text);
            }
        }
Beispiel #20
0
        //String/enum modelName;
        // An object on one or all of the maps loaded when this object is created
        public FbxModel(String name, ContentManager content, MapName mapname, ModelCategory category)
        {
            mapName = mapname;
            this.category = category;

            //Load the model
            model = content.Load<Model>("Models/Maps/" + name);//Takes a long time for large models. estimate 4 seconds per 1MB fbx.

            #if !DEBUG
            Utils.fixNullLightDirections(model);
            #endif

            GC.Collect();

            //sets scale and position of model from fbx file
            transforms = new Matrix[model.Bones.Count];
            model.CopyAbsoluteBoneTransformsTo(transforms);
        }
Beispiel #21
0
        //String/enum modelName;

        // An object on one or all of the maps loaded when this object is created
        public FbxModel(String name, ContentManager content, MapName mapname, ModelCategory category)
        {
            mapName       = mapname;
            this.category = category;

            //Load the model
            model = content.Load <Model>("Models/Maps/" + name);//Takes a long time for large models. estimate 4 seconds per 1MB fbx.

#if !DEBUG
            Utils.fixNullLightDirections(model);
#endif

            GC.Collect();

            //sets scale and position of model from fbx file
            transforms = new Matrix[model.Bones.Count];
            model.CopyAbsoluteBoneTransformsTo(transforms);
        }
Beispiel #22
0
//        public string GetTimeDifferenceText()
//        {
//            TimeSpan difference = DateTime.UtcNow - MatchTime;
//            return StringUtil.GetTimeDifferenceText(difference, false);
//        }

        public string GetSubTypeNameTerm()
        {
            string text = (SubTypeLocTag == null) ? "unknown" : SubTypeLocTag.Split("@".ToCharArray()).First();

            if (text == "unknown")
            {
                GameType gameType = GameType;
                switch (gameType)
                {
                case GameType.Custom:
                    text = "GenericCustom";
                    break;

                case GameType.Practice:
                    text = "GenericPractice";
                    break;

                case GameType.Tutorial:
                    text = "GenericTutorial";
                    break;

                default:
                    switch (gameType)
                    {
                    case GameType.Ranked:
                        text = "GenericRanked";
                        break;

                    case GameType.NewPlayerSolo:
                        text = "GenericNewPlayerSolo";
                        break;
                    }

                    break;
                }
            }

            if (text == "unknown" && MapName.EndsWith("CTF"))
            {
                text = "GenericBriefcase";
            }

            return(text);
        }
        public MapProvider(MapName p_mapName)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Filter = "all files | *.*"; // file types, that will be allowed to upload
            dialog.Multiselect = false; // allow/deny user to upload more than one file at a time
            if (dialog.ShowDialog() == DialogResult.OK) // if user clicked OK
            {
                String path = dialog.FileName; // get name of file

                InitLocations d_InitMapLocations;
                //string directory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                m_map = new Map("Norge", path);
                d_InitMapLocations = InitNorwegianLocations;

                d_InitMapLocations();
            }
            
            
        }
Beispiel #24
0
        public Map GetMap(int id, bool followLinks = true)
        {
            MapName    name      = GetMapName(id);
            Map        map       = Map.Parse(id, name, WZ);
            Map        link      = map;
            List <int> triedMaps = new List <int>();

            while (link != null && link.LinksTo != null && followLinks)
            {
                if (triedMaps.Contains(link.LinksTo ?? id))
                {
                    break;
                }
                link = GetMap(link.LinksTo ?? id, false);
                triedMaps.Add(link.Id);
            }
            if (link != map)
            {
                map.ExtendFrom(link);
            }
            return(map);
        }
Beispiel #25
0
 /// <summary>
 /// Get a map by it's name.
 /// </summary>
 /// <param name="mapName">Name of the map</param>
 /// <returns>Map of the name</returns>
 public static Map Get(MapName mapName)
 {
     return m_MapList[mapName];
 }
Beispiel #26
0
        public void MapName(string input, string expected)
        {
            var mapName = new MapName(input);

            Assert.AreEqual(expected, mapName.Name);
        }
Beispiel #27
0
        /// <summary>
        /// Get the highscores for a track and mode, incorporating changes to be made.
        /// </summary>
        /// <param name="trackID">The track to get highscores for</param>
        /// <param name="mode">Either 0 or 1, for TIME_MODE or  POINT_MODE respectively</param>
        public static List<HighScoreEntry> getHighScores(MapName trackID, HighScoreType mode, List<HighScoreEntry> thisRaceValues)
        {
            List<HighScoreEntry> scoreTable = new List<HighScoreEntry>(10);

            if (!(trackID == MapName.CityMap || trackID == MapName.DesertMap || trackID == MapName.SpaceMap))
            {
                throw new ArgumentException("Mode must be a valid track identifier from HighScore.", "trackID");
            }
            if (!(mode == HighScoreType.TimeMode || mode == HighScoreType.PointMode))
            {
                throw new ArgumentException("Mode must be a valid mode identifier from HighScore.", "mode");
            }
            switch (trackID)
            {
                case MapName.CityMap: init(0, mode); break;
                case MapName.DesertMap: init(1, mode); break;
                case MapName.SpaceMap: init(2, mode); break;
            }

            var tempTable = (from item in scoreDoc.Descendants("entry") select new HighScoreEntry(item.Descendants("name").First().Value, long.Parse(item.Descendants("value").First().Value)));
            List<HighScoreEntry> sortedInput;

            int oldID = 0, newID = 0;
            List<HighScoreEntry> results = new List<HighScoreEntry>(10);
            if (mode == HighScoreType.TimeMode)
            {
                scoreTable = tempTable.OrderBy(x => x.value).ToList();
                sortedInput = thisRaceValues.OrderBy(x => x.value).ToList();
                scoreDoc = new XDocument();
                XElement rootNode = new XElement("highScores");
                scoreDoc.Add(rootNode);
                for (int i = 0; i < 10; i++)
                {
                    XElement entry = new XElement("entry");
                    XElement name = new XElement("name");
                    XElement value = new XElement("value");
                    if ((newID >= sortedInput.Count) || (scoreTable[oldID].value < sortedInput[newID].value))
                    {
                        results.Add(scoreTable[oldID]);

                        name.SetValue(scoreTable[oldID].name);
                        value.SetValue(scoreTable[oldID].value);
                        oldID++;
                    }
                    else
                    {
                        results.Add(sortedInput[newID]);

                        name.SetValue(sortedInput[newID].name);
                        value.SetValue(sortedInput[newID].value);
                        newID++;
                    }
                    rootNode.Add(entry);
                    entry.Add(name);
                    entry.Add(value);
                }
            }
            else if (mode == HighScoreType.PointMode)
            {
                scoreTable = tempTable.OrderByDescending(x => x.value).ToList();
                sortedInput = thisRaceValues.OrderByDescending(x => x.value).ToList();
                scoreDoc = new XDocument();
                XElement rootNode = new XElement("highScores");
                scoreDoc.Add(rootNode);
                for (int i = 0; i < 10; i++)
                {
                    XElement entry = new XElement("entry");
                    XElement name = new XElement("name");
                    XElement value = new XElement("value");
                    if ((newID >= sortedInput.Count) || (scoreTable[oldID].value > sortedInput[newID].value))
                    {
                        results.Add(scoreTable[oldID]);

                        name.SetValue(scoreTable[oldID].name);
                        value.SetValue(scoreTable[oldID].value);
                        oldID++;
                    }
                    else
                    {
                        results.Add(sortedInput[newID]);

                        name.SetValue(sortedInput[newID].name);
                        value.SetValue(sortedInput[newID].value);
                        newID++;
                    }
                    rootNode.Add(entry);
                    entry.Add(name);
                    entry.Add(value);
                }
            }

            //for (int i = 0; i < 10; i++)
            //{
            //    System.Diagnostics.Debug.WriteLine("n: " + results[i].name + "   s: " + results[i].value);
            //}

            switch (trackID)
            {
                case MapName.CityMap: saveScores(0, mode); break;
                case MapName.DesertMap: saveScores(1, mode); break;
                case MapName.SpaceMap: saveScores(2, mode); break;
            }

            return results;
        }
Beispiel #28
0
 public override int GetHashCode()
 {
     return(MapName.GetHashCode() ^ GameModeName.GetHashCode());
 }
Beispiel #29
0
 /// <summary>
 /// Get a map by it's name.
 /// </summary>
 /// <param name="mapName">Name of the map</param>
 /// <returns>Map of the name</returns>
 public static Map Get(MapName mapName)
 {
     return(m_MapList[mapName]);
 }
        public override void ReadBinary(ESPReader reader)
        {
            List <string> readTags = new List <string>();

            while (reader.BaseStream.Position < reader.BaseStream.Length)
            {
                string subTag = reader.PeekTag();

                switch (subTag)
                {
                case "RDAT":
                    if (readTags.Contains("RDAT"))
                    {
                        return;
                    }
                    Header.ReadBinary(reader);
                    break;

                case "RDOT":
                    if (readTags.Contains("RDOT"))
                    {
                        return;
                    }
                    if (ObjectList == null)
                    {
                        ObjectList = new RegionObjectList();
                    }

                    ObjectList.ReadBinary(reader);
                    break;

                case "RDMP":
                    if (readTags.Contains("RDMP"))
                    {
                        return;
                    }
                    if (MapName == null)
                    {
                        MapName = new SimpleSubrecord <String>();
                    }

                    MapName.ReadBinary(reader);
                    break;

                case "RDGS":
                    if (readTags.Contains("RDGS"))
                    {
                        return;
                    }
                    if (GrassList == null)
                    {
                        GrassList = new RegionGrassList();
                    }

                    GrassList.ReadBinary(reader);
                    break;

                case "RDMD":
                    if (readTags.Contains("RDMD"))
                    {
                        return;
                    }
                    if (MusicType == null)
                    {
                        MusicType = new SimpleSubrecord <RegionMusicType>();
                    }

                    MusicType.ReadBinary(reader);
                    break;

                case "RDMO":
                    if (readTags.Contains("RDMO"))
                    {
                        return;
                    }
                    if (Music == null)
                    {
                        Music = new RecordReference();
                    }

                    Music.ReadBinary(reader);
                    break;

                case "RDSI":
                    if (readTags.Contains("RDSI"))
                    {
                        return;
                    }
                    if (IncidentalMediaSet == null)
                    {
                        IncidentalMediaSet = new RecordReference();
                    }

                    IncidentalMediaSet.ReadBinary(reader);
                    break;

                case "RDSB":
                    if (BattleMediaSets == null)
                    {
                        BattleMediaSets = new List <RecordReference>();
                    }

                    RecordReference tempRDSB = new RecordReference();
                    tempRDSB.ReadBinary(reader);
                    BattleMediaSets.Add(tempRDSB);
                    break;

                case "RDSD":
                    if (readTags.Contains("RDSD"))
                    {
                        return;
                    }
                    if (Sounds == null)
                    {
                        Sounds = new RegionSoundList();
                    }

                    Sounds.ReadBinary(reader);
                    break;

                case "RDWT":
                    if (readTags.Contains("RDWT"))
                    {
                        return;
                    }
                    if (Weathers == null)
                    {
                        Weathers = new WeatherList();
                    }

                    Weathers.ReadBinary(reader);
                    break;

                case "RDID":
                    if (readTags.Contains("RDID"))
                    {
                        return;
                    }
                    if (Imposters == null)
                    {
                        Imposters = new FormArray();
                    }

                    Imposters.ReadBinary(reader);
                    break;

                default:
                    return;
                }

                readTags.Add(subTag);
            }
        }
        public override void ReadXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("Header", false, out subEle))
            {
                if (Header == null)
                {
                    Header = new RegionDataHeader();
                }

                Header.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ObjectList", false, out subEle))
            {
                if (ObjectList == null)
                {
                    ObjectList = new RegionObjectList();
                }

                ObjectList.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("MapName", false, out subEle))
            {
                if (MapName == null)
                {
                    MapName = new SimpleSubrecord <String>();
                }

                MapName.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("GrassList", false, out subEle))
            {
                if (GrassList == null)
                {
                    GrassList = new RegionGrassList();
                }

                GrassList.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("MusicType", false, out subEle))
            {
                if (MusicType == null)
                {
                    MusicType = new SimpleSubrecord <RegionMusicType>();
                }

                MusicType.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Music", false, out subEle))
            {
                if (Music == null)
                {
                    Music = new RecordReference();
                }

                Music.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("MediaSet/Incidental", false, out subEle))
            {
                if (IncidentalMediaSet == null)
                {
                    IncidentalMediaSet = new RecordReference();
                }

                IncidentalMediaSet.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("MediaSet/Battle", false, out subEle))
            {
                if (BattleMediaSets == null)
                {
                    BattleMediaSets = new List <RecordReference>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    RecordReference temp = new RecordReference();
                    temp.ReadXML(e, master);
                    BattleMediaSets.Add(temp);
                }
            }
            if (ele.TryPathTo("Sounds", false, out subEle))
            {
                if (Sounds == null)
                {
                    Sounds = new RegionSoundList();
                }

                Sounds.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Weathers", false, out subEle))
            {
                if (Weathers == null)
                {
                    Weathers = new WeatherList();
                }

                Weathers.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Imposters", false, out subEle))
            {
                if (Imposters == null)
                {
                    Imposters = new FormArray();
                }

                Imposters.ReadXML(subEle, master);
            }
        }
        public override void WriteXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (Header != null)
            {
                ele.TryPathTo("Header", true, out subEle);
                Header.WriteXML(subEle, master);
            }
            if (ObjectList != null)
            {
                ele.TryPathTo("ObjectList", true, out subEle);
                ObjectList.WriteXML(subEle, master);
            }
            if (MapName != null)
            {
                ele.TryPathTo("MapName", true, out subEle);
                MapName.WriteXML(subEle, master);
            }
            if (GrassList != null)
            {
                ele.TryPathTo("GrassList", true, out subEle);
                GrassList.WriteXML(subEle, master);
            }
            if (MusicType != null)
            {
                ele.TryPathTo("MusicType", true, out subEle);
                MusicType.WriteXML(subEle, master);
            }
            if (Music != null)
            {
                ele.TryPathTo("Music", true, out subEle);
                Music.WriteXML(subEle, master);
            }
            if (IncidentalMediaSet != null)
            {
                ele.TryPathTo("MediaSet/Incidental", true, out subEle);
                IncidentalMediaSet.WriteXML(subEle, master);
            }
            if (BattleMediaSets != null)
            {
                ele.TryPathTo("MediaSet/Battle", true, out subEle);
                foreach (var entry in BattleMediaSets)
                {
                    XElement newEle = new XElement("MediaSet");
                    entry.WriteXML(newEle, master);
                    subEle.Add(newEle);
                }
            }
            if (Sounds != null)
            {
                ele.TryPathTo("Sounds", true, out subEle);
                Sounds.WriteXML(subEle, master);
            }
            if (Weathers != null)
            {
                ele.TryPathTo("Weathers", true, out subEle);
                Weathers.WriteXML(subEle, master);
            }
            if (Imposters != null)
            {
                ele.TryPathTo("Imposters", true, out subEle);
                Imposters.WriteXML(subEle, master);
            }
        }
Beispiel #33
0
 /// <inheritdoc/>
 public override int GetHashCode() => MapName.GetHashCode();
Beispiel #34
0
 public TestMapNames(MapName i_mapName, int i_level)
 {
     CheckMapNames(i_mapName, i_level);
 }
Beispiel #35
0
 /// <summary>
 /// Returns the previous highscore list for a track and mode.
 /// </summary>
 /// <param name="trackID">The track to get highscores for</param>
 /// <param name="mode">Either 0 or 1, for TIME_MODE or  POINT_MODE respectively</param>
 public static List<HighScoreEntry> getHighScores(MapName trackID, HighScoreType mode)
 {
     return getHighScores(trackID, mode, new List<HighScoreEntry>());
 }