コード例 #1
0
 public DesignPattern()
 {
     for (int i = 0; i < 15; i++)
     {
         Palette[i] = new DesignColor();
     }
 }
コード例 #2
0
        private SolidColorBrush GetDesignColorBrush(DesignColor color)
        {
            var palette = new PaletteHelper().QueryPalette();
            Hue hue;

            switch (color)
            {
            case DesignColor.PrimaryLight:
                hue = palette.PrimarySwatch.PrimaryHues.ToArray()[palette.PrimaryLightHueIndex];
                break;

            case DesignColor.PrimaryMid:
                hue = palette.PrimarySwatch.PrimaryHues.ToArray()[palette.PrimaryMidHueIndex];
                break;

            case DesignColor.PrimaryDark:
                hue = palette.PrimarySwatch.PrimaryHues.ToArray()[palette.PrimaryDarkHueIndex];
                break;

            case DesignColor.Accent:
                hue = palette.AccentSwatch.AccentHues.ToArray()[palette.AccentHueIndex];
                break;

            default:
                hue = palette.PrimarySwatch.PrimaryHues.ToArray()[palette.PrimaryMidHueIndex];
                break;
            }
            return(new SolidColorBrush(hue.Color));
        }
コード例 #3
0
        public DesignPattern(int idx)
        {
            Index = idx;
            var save    = MainSaveFile.Singleton();
            var offsets = GetOffsetsFromRevision();

            Offset = offsets.BaseOffset + idx * offsets.Size;

            Name       = save.ReadString(Offset + offsets.Name, 20);
            PersonalID = save.ReadStruct <PersonalID>(Offset + offsets.PersonalID);

            for (int i = 0; i < 15; i++)
            {
                Palette[i] = new DesignColor(Offset + offsets.Palette + i * 3);
            }

            this.Pixels = save.ReadArray <byte>(Offset + offsets.Image, this.Pixels.Length);
        }
コード例 #4
0
        public DesignPattern(ISaveFile saveFile, int idx)
        {
            SaveFile = saveFile;
            Index    = idx;
            var offsets = MainOffsets.GetOffsets(SaveFile.GetRevision());

            Offset = offsets.Offset_Patterns + idx * offsets.Pattern_Size;

            Name       = SaveFile.ReadString(Offset + offsets.Pattern_Name, 20);
            PersonalID = SaveFile.ReadStruct <PersonalID>(Offset + offsets.Pattern_PersonalID);

            for (int i = 0; i < 15; i++)
            {
                Palette[i] = new DesignColor(saveFile, Offset + offsets.Pattern_Palette + i * 3);
            }

            Pixels = SaveFile.ReadArray <byte>(Offset + offsets.Pattern_ImageData, Pixels.Length);
        }
コード例 #5
0
        public DesignPattern(int idx, bool proDesign = false)
        {
            IsPro = proDesign;
            Index = idx;
            var save    = MainSaveFile.Singleton();
            var offsets = proDesign ? GetProDesignOffsetsFromRevision() : GetOffsetsFromRevision();

            Offset = offsets.BaseOffset + idx * offsets.Size;

            Type       = (TypeEnum)save.ReadU8(Offset + offsets.Type);
            Name       = save.ReadString(Offset + offsets.Name, 20);
            PersonalID = save.ReadStruct <PersonalID>(Offset + offsets.PersonalID);

            for (int i = 0; i < 15; i++)
            {
                Palette[i] = new DesignColor(Offset + offsets.Palette + i * 3);
            }

            if (this.Type == TypeEnum.SimplePattern)
            {
                this.Pixels = save.ReadArray <byte>(Offset + offsets.Image, (this.Width / 2) * this.Height);
            }
            else
            {
                // create one big picture
                var pixels = save.ReadArray <byte>(Offset + offsets.Image, (this.Width / 2) * this.Height);
                this.Pixels = new byte[this.Width / 2 * this.Height];
                for (int y = 0; y < this.Height; y++)
                {
                    for (int x = 0; x < this.Width / 2; x++)
                    {
                        var offset = (x >= this.Width / 4 ? 0x200 : 0x0) + (y >= this.Height / 2 ? 0x400 : 0x0);
                        this.Pixels[x + y * this.Width / 2] = pixels[offset + x % (this.Width / 4) + (y % (this.Height / 2)) * (this.Width / 4)];
                    }
                }
            }
        }