示例#1
0
        //TODO: Store in file
        static public LayoutDescriptionEx GenerateDefault()
        {
            List <LineDescriptionEx> courseLD = new LineDescriptionEx[16].ToList();
            List <LineDescriptionEx> secretLD = new LineDescriptionEx[16].ToList();

            int[]    linesForSecrets     = { 0, 1, 2, 3, 9, 5, 6, 7, 13, 14, 15, 11 };
            int[]    offsetForSecrets    = { 0, 0xb, 0xb, 0, 0, 0xb, 0xb, 0xb, 0, 0, 0, 0 };
            byte[]   highlightForSecrets = { 0, 1 << 4 | 1 << 6, 1 << 5 | 1 << 7, 0, 0, 1 << 2, 1 << 1, 1 << 3, 0, 0, 0, 0 };
            string[] namesForSecrets     = { "--", "B1", "B2", "B3", "Sl", "MC", "WC", "VC", "S1", "S2", "S3", "OW" };

            courseLD[0] = new TextOnlyLineDescription("Main Courses");
            for (int course = 1; course <= 15; course++)
            {
                string drawString = course.ToString("D2");
                courseLD[course] = new StarsLineDescription(drawString, 255, course + 11, 0, 0);
            }

            for (int course = 1; course <= 10; course++) //Secret course
            {
                secretLD[linesForSecrets[course]] = new StarsLineDescription(namesForSecrets[course], 255, course + 26, highlightForSecrets[course], offsetForSecrets[course]);
            }
            secretLD[linesForSecrets[11]] = new StarsLineDescription(namesForSecrets[11], 255, 8, 0, 0);

            secretLD[0]  = new TextOnlyLineDescription("Bowser Courses");
            secretLD[4]  = new TextOnlyLineDescription("Cap Levels");
            secretLD[8]  = new TextOnlyLineDescription("Slide");
            secretLD[10] = new TextOnlyLineDescription("Overworld Stars");
            secretLD[12] = new TextOnlyLineDescription("Secret Stars");

            return(new LayoutDescriptionEx(courseLD, secretLD, Resource.gold_star, "182", 7));
        }
        public LayoutDescriptionEx(LineDescription[] courseDescriptionOut, LineDescription[] secretDescriptionOut, Bitmap star, string starAmount)
        {
            starsShown = 7;

            courseDescription = new List <LineDescriptionEx>();
            secretDescription = new List <LineDescriptionEx>();

            foreach (LineDescription lined in courseDescriptionOut)
            {
                LineDescriptionEx lde = null;

                if (lined != null)
                {
                    if (lined.isTextOnly)
                    {
                        lde = new TextOnlyLineDescription(lined.text);
                    }
                    else
                    {
                        byte highlightStarMask   = 0;
                        int  highlightStarOffset = 0;

                        if (lined.text == "WC")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 1;
                        }

                        if (lined.text == "MC")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 2;
                        }

                        if (lined.text == "VC")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 3;
                        }

                        if (lined.text == "B1")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 4 | 1 << 6;
                        }

                        if (lined.text == "B2")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 5 | 1 << 7;
                        }

                        lde = new StarsLineDescription(lined.text, (byte)((lined.starMask >> 1) | 1 << 7), lined.offset + 8, highlightStarMask, highlightStarOffset);
                    }
                }

                courseDescription.Add(lde);
            }

            foreach (LineDescription lined in secretDescriptionOut)
            {
                LineDescriptionEx lde = null;

                if (lined != null)
                {
                    if (lined.isTextOnly)
                    {
                        lde = new TextOnlyLineDescription(lined.text);
                    }
                    else
                    {
                        byte highlightStarMask   = 0;
                        int  highlightStarOffset = 0;

                        if (lined.text == "WC")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 1;
                        }

                        if (lined.text == "MC")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 2;
                        }

                        if (lined.text == "VC")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 3;
                        }

                        if (lined.text == "B1")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 4 | 1 << 6;
                        }

                        if (lined.text == "B2")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 5 | 1 << 7;
                        }

                        lde = new StarsLineDescription(lined.text, (byte)(lined.starMask >> 1 | (1 << 7)), lined.offset + 8, highlightStarMask, highlightStarOffset);
                    }
                }

                secretDescription.Add(lde);
            }

            this.starAmount = starAmount;

            Trim();

            goldStar = star;
            darkStar = new Bitmap(goldStar.Width, goldStar.Height);
            if (goldStar.Width != 20 || goldStar.Height != 20)
            {
                Compress();
            }

            GenerateDarkStar();
            GenerateOutline();
        }
示例#3
0
        public LayoutDescriptionEx(LayoutAdvanced la)
        {
            courseDescription = new List <LineDescriptionEx>();
            secretDescription = new List <LineDescriptionEx>();
            starsShown        = 7;

            // Unpack advanced layout to a trivialized ex description
            foreach (var group in la.groups)
            {
                List <LineDescriptionEx> descriptions = null;
                switch (group.side)
                {
                case Side.left:
                    descriptions = courseDescription;
                    break;

                case Side.right:
                    descriptions = secretDescription;
                    break;
                }

                if (null == descriptions)
                {
                    continue;
                }

                TextOnlyLineDescription ld = new TextOnlyLineDescription(group.name);
                descriptions.Add(ld);

                foreach (var course in group.courses)
                {
                    if (course.data is object)
                    {
                        // TODO: Hack - restriction of current ex layouts
                        var data = course.data.FirstOrDefault();
                        if (data == null)
                        {
                            continue;
                        }

                        StarsLineDescription sld = new StarsLineDescription(course.name, (byte)data.mask, data.offset, 0, 0);
                        if (sld.starMask > 127)
                        {
                            starsShown = 8;
                        }

                        descriptions.Add(sld);
                    }
                    else
                    {
                        StarsLineDescription sld = new StarsLineDescription(course.name, (byte)course.starMask, course.courseId == 0 ? 0 : (course.courseId + 11), 0, 0);
                        if (sld.starMask > 127)
                        {
                            starsShown = 8;
                        }

                        descriptions.Add(sld);
                    }
                }
            }

            goldStar = la.collectedStarIcon;
            darkStar = la.missingStarIcon;

            GenerateInvertedStar();
            GenerateDarkStar();
            GenerateOutline();

            Trim();
        }
        // Method for converting from old to new Layouts
        public LayoutDescriptionEx(LayoutDescription ld)
        {
            starsShown = 7;

            courseDescription = new List <LineDescriptionEx>();
            secretDescription = new List <LineDescriptionEx>();

            foreach (LineDescription lined in ld.courseDescription)
            {
                LineDescriptionEx lde = null;

                if (lined != null)
                {
                    if (lined.isTextOnly)
                    {
                        lde = new TextOnlyLineDescription(lined.text);
                    }
                    else
                    {
                        byte highlightStarMask   = 0;
                        int  highlightStarOffset = 0;

                        if (lined.text == "WC")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 1;
                        }

                        if (lined.text == "MC")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 2;
                        }

                        if (lined.text == "VC")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 3;
                        }

                        if (lined.text == "B1")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 4 | 1 << 6;
                        }

                        if (lined.text == "B2")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 5 | 1 << 7;
                        }

                        lde = new StarsLineDescription(lined.text, (byte)(lined.starMask >> 1 | (1 << 7)), lined.offset + 8, highlightStarMask, highlightStarOffset);
                    }
                }

                courseDescription.Add(lde);
            }

            foreach (LineDescription lined in ld.secretDescription)
            {
                LineDescriptionEx lde = null;

                if (lined != null)
                {
                    if (lined.isTextOnly)
                    {
                        lde = new TextOnlyLineDescription(lined.text);
                    }
                    else
                    {
                        byte highlightStarMask   = 0;
                        int  highlightStarOffset = 0;

                        if (lined.text == "WC")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 1;
                        }

                        if (lined.text == "MC")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 2;
                        }

                        if (lined.text == "VC")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 3;
                        }

                        if (lined.text == "B1")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 4 | 1 << 6;
                        }

                        if (lined.text == "B2")
                        {
                            highlightStarOffset = 0xB;
                            highlightStarMask   = 1 << 5 | 1 << 7;
                        }

                        lde = new StarsLineDescription(lined.text, (byte)(lined.starMask >> 1 | (1 << 7)), lined.offset + 8, highlightStarMask, highlightStarOffset);
                    }
                }

                secretDescription.Add(lde);
            }

            this.goldStar     = ld.goldStar;
            this.darkStar     = ld.darkStar;
            this.redOutline   = ld.redOutline;
            this.greenOutline = ld.greenOutline;
            this.starAmount   = ld.starAmount;

            Trim();
        }