Beispiel #1
0
 public static bool AttrIfBool(this BinaryPacker.Element el, string name, Action <bool> value)
 {
     if (el.HasAttr(name))
     {
         value(el.AttrBool(name));
         return(true);
     }
     return(false);
 }
Beispiel #2
0
 public static bool AttrRef(this BinaryPacker.Element el, string name, ref bool value)
 {
     if (el.HasAttr(name))
     {
         value = el.AttrBool(name);
         return(true);
     }
     return(false);
 }
        public static bool TrackableContains(BinaryPacker.Element target)
        {
            if (target.AttrBool("moon", false))
            {
                return(false);
            }

            return(TrackableContains(target.Name));
        }
Beispiel #4
0
        private Backdrop onLoadBackdrop(MapData map, BinaryPacker.Element child, BinaryPacker.Element above)
        {
            if (child.Name.Equals("SpringCollab2020/HeatWaveNoColorGrade", StringComparison.OrdinalIgnoreCase))
            {
                return(new HeatWaveNoColorGrade());
            }
            if (child.Name.Equals("SpringCollab2020/CustomSnow", StringComparison.OrdinalIgnoreCase))
            {
                string[] colorsAsStrings = child.Attr("colors").Split(',');
                Color[]  colors          = new Color[colorsAsStrings.Length];
                for (int i = 0; i < colors.Length; i++)
                {
                    colors[i] = Calc.HexToColor(colorsAsStrings[i]);
                }

                return(new CustomSnow(colors, child.AttrBool("foreground")));
            }
            if (child.Name.Equals("SpringCollab2020/BlackholeCustomColors", StringComparison.OrdinalIgnoreCase))
            {
                return(BlackholeCustomColors.CreateBlackholeWithCustomColors(child));
            }
            return(null);
        }
        private Backdrop onLoadBackdrop(MapData map, BinaryPacker.Element child, BinaryPacker.Element above)
        {
            if (child.Name.Equals("MaxHelpingHand/HeatWaveNoColorGrade", StringComparison.OrdinalIgnoreCase))
            {
                return(new HeatWaveNoColorGrade(child.AttrBool("controlColorGradeWhenActive")));
            }
            if (child.Name.Equals("MaxHelpingHand/BlackholeCustomColors", StringComparison.OrdinalIgnoreCase))
            {
                return(BlackholeCustomColors.CreateBlackholeWithCustomColors(child));
            }
            if (child.Name.Equals("MaxHelpingHand/CustomPlanets", StringComparison.OrdinalIgnoreCase))
            {
                return(new CustomPlanets(child.AttrInt("count", 32), child.Attr("directory", "MaxHelpingHand/customplanets/bigstars"), child.AttrFloat("animationDelay", 0.1f)));
            }
            if (child.Name.Equals("MaxHelpingHand/CustomStars", StringComparison.OrdinalIgnoreCase))
            {
                int?starCount = null;
                if (int.TryParse(child.Attr("starCount", ""), out int starCountParsed))
                {
                    starCount = starCountParsed;
                }
                string tint = child.Attr("tint", "");
                if (child.AttrBool("disableTinting", false))
                {
                    tint = "ffffff"; // approximative backwards compatibility
                }
                return(new CustomStars(starCount, string.IsNullOrEmpty(tint) ? (Color?)null : Calc.HexToColor(tint), child.Attr("spriteDirectory", "bgs/02/stars")));
            }
            if (child.Name.Equals("MaxHelpingHand/SnowCustomColors", StringComparison.OrdinalIgnoreCase))
            {
                string[] colorsAsStrings = child.Attr("colors").Split(',');
                Color[]  colors          = new Color[colorsAsStrings.Length];
                for (int i = 0; i < colors.Length; i++)
                {
                    colors[i] = Calc.HexToColor(colorsAsStrings[i]);
                }

                return(new SnowCustomColors(colors, child.AttrBool("foreground")));
            }
            if (child.Name.Equals("MaxHelpingHand/NorthernLightsCustomColors", StringComparison.OrdinalIgnoreCase))
            {
                string[] colorsAsStrings = child.Attr("colors").Split(',');
                Color[]  colors          = new Color[colorsAsStrings.Length];
                for (int i = 0; i < colors.Length; i++)
                {
                    colors[i] = Calc.HexToColor(colorsAsStrings[i]);
                }

                NorthernLightsCustomColors.GradientColor1 = child.Attr("gradientColor1", "020825");
                NorthernLightsCustomColors.GradientColor2 = child.Attr("gradientColor2", "170c2f");
                NorthernLightsCustomColors.Colors         = colors;

                NorthernLightsCustomColors effect = new NorthernLightsCustomColors(colors, child.AttrBool("displayBackground", true));

                NorthernLightsCustomColors.GradientColor1 = null;
                NorthernLightsCustomColors.GradientColor2 = null;
                NorthernLightsCustomColors.Colors         = null;

                return(effect);
            }
            return(null);
        }