コード例 #1
0
ファイル: MapMeta.cs プロジェクト: acsBenceTamas/Everest
        public void Parse(BinaryPacker.Element meta)
        {
            meta.AttrIf("Icon", v => Icon = v);

            meta.AttrIfBool("Interlude", v => Interlude = v);

            meta.AttrIfInt("CassetteCheckpointIndex", v => CassetteCheckpointIndex = v);

            meta.AttrIf("TitleBaseColor", v => TitleBaseColor     = v);
            meta.AttrIf("TitleAccentColor", v => TitleAccentColor = v);
            meta.AttrIf("TitleTextColor", v => TitleTextColor     = v);

            meta.AttrIf("IntroType", v => IntroType = (Player.IntroTypes)Enum.Parse(typeof(Player.IntroTypes), v, true));

            meta.AttrIfBool("Dreaming", v => Dreaming = v);

            meta.AttrIf("ColorGrade", v => ColorGrade = v);

            meta.AttrIf("Wipe", v => Wipe = v);

            meta.AttrIfFloat("DarknessAlpha", (float v) => DarknessAlpha = v);
            meta.AttrIfFloat("BloomBase", (float v) => BloomBase         = v);
            meta.AttrIfFloat("BloomStrength", (float v) => BloomStrength = v);

            meta.AttrIf("Jumpthru", v => Jumpthru = v);

            meta.AttrIf("CoreMode", v => CoreMode = (Session.CoreModes)Enum.Parse(typeof(Session.CoreModes), v, true));

            meta.AttrIf("CassetteNoteColor", v => CassetteNoteColor = v);
            meta.AttrIf("CassetteSong", v => CassetteSong           = v);

            meta.AttrIf("PostcardSoundID", v => PostcardSoundID = v);

            meta.AttrIf("ForegroundTiles", v => ForegroundTiles = v);
            meta.AttrIf("BackgroundTiles", v => BackgroundTiles = v);
            meta.AttrIf("AnimatedTiles", v => AnimatedTiles     = v);
            meta.AttrIf("Sprites", v => Sprites     = v);
            meta.AttrIf("Portraits", v => Portraits = v);
            meta.AttrIfBool("OverrideASideMeta", v => OverrideASideMeta = v);

            BinaryPacker.Element child;

            child = meta.Children?.FirstOrDefault(el => el.Name == "cassettemodifier");
            if (child != null)
            {
                CassetteModifier = new MapMetaCassetteModifier(child);
            }

            Modes = new MapMetaModeProperties[3];
            child = meta.Children?.FirstOrDefault(el => el.Name == "modes");
            if (child != null && child.Children != null)
            {
                for (int i = 0; i < child.Children.Count; i++)
                {
                    Modes[i] = new MapMetaModeProperties(child.Children[i]);
                }
                for (int i = child.Children?.Count ?? 0; i < Modes.Length; i++)
                {
                    Modes[i] = null;
                }
            }
        }