예제 #1
0
        public static BluetoothDisconnectedIcon FromJson(SkinManifestJson json, Image <Argb32>[] images)
        {
            var a = new BluetoothDisconnectedIcon();

            a.Image = images.Pick(json.Status.Bluetooth.ImageIndexOff);
            a.X     = json.Status.Bluetooth.Coordinates.X;
            a.Y     = json.Status.Bluetooth.Coordinates.Y;

            return(a);
        }
예제 #2
0
        public static LockIcon FromJson(SkinManifestJson json, Image <Argb32>[] images)
        {
            var a = new LockIcon();

            a.Image = images.Pick(json.Status.Lock.ImageIndexOn);
            a.X     = json.Status.Lock.Coordinates.X;
            a.Y     = json.Status.Lock.Coordinates.Y;

            return(a);
        }
예제 #3
0
        public static IconGroup FromJson(SkinManifestJson json, Image <Argb32>[] images)
        {
            var ig = new IconGroup()
            {
                Lock      = LockIcon.FromJson(json, images),
                Alarm     = AlarmIcon.FromJson(json, images),
                Bluetooth = BluetoothDisconnectedIcon.FromJson(json, images)
            };

            return(ig);
        }
예제 #4
0
        public static DayOfWeek FromJson(SkinManifestJson json, Image <Argb32>[] images)
        {
            var ret = new DayOfWeek
            {
                Numbers = images.Slice(json.Date.WeekDay.ImageIndex, json.Date.WeekDay.ImagesCount),
                x       = json.Date.WeekDay.X,
                y       = json.Date.WeekDay.Y
            };

            return(ret);
        }
예제 #5
0
        public void LoadAssets(string dirPath)
        {
            this.skinDirPath = dirPath;
            var files = Directory.EnumerateFiles(this.skinDirPath).ToArray();

            this.images = files
                          .Where(n => n.EndsWith(".png", StringComparison.OrdinalIgnoreCase) && int.TryParse(Path.GetFileNameWithoutExtension(n), out int _))
                          .OrderBy(n => int.Parse(Path.GetFileNameWithoutExtension(n)))
                          .Select(Image.Load <Argb32>)
                          .ToArray();
            this.json = SkinManifestJson.FromJson(File.ReadAllText(files.First(n => n.EndsWith(".json", StringComparison.OrdinalIgnoreCase))));

            this.LoadElements();
        }
예제 #6
0
        public static FlexDate FromJson(SkinManifestJson json, Image <Argb32>[] images)
        {
            var s = json.Date.MonthAndDay.OneLine;
            var d = new FlexDate
            {
                Numbers = images.Slice(s.Number.ImageIndex, s.Number.ImagesCount),
                Divider = images.Pick(s.DelimiterImageIndex),
                x       = s.Number.TopLeftX,
                y       = s.Number.TopLeftY,
                Spacing = s.Number.Spacing
            };

            return(d);
        }
        public static SeparatedClock FromJson(SkinManifestJson json, Image <Argb32>[] images)
        {
            var s = json.Time;
            var c = new SeparatedClock
            {
                HourTensNumbers   = images.Slice(s.Hours.Tens.ImageIndex, s.Hours.Tens.ImagesCount),
                HourOnesNumbers   = images.Slice(s.Hours.Ones.ImageIndex, s.Hours.Ones.ImagesCount),
                MinuteTensNumbers = images.Slice(s.Minutes.Tens.ImageIndex, s.Minutes.Tens.ImagesCount),
                MinuteOnesNumbers = images.Slice(s.Minutes.Ones.ImageIndex, s.Minutes.Ones.ImagesCount),

                HourTenX   = s.Hours.Tens.X,
                HourTenY   = s.Hours.Tens.Y,
                HourOneX   = s.Hours.Ones.X,
                HourOneY   = s.Hours.Ones.Y,
                MinuteTenX = s.Minutes.Tens.X,
                MinuteTenY = s.Minutes.Tens.Y,
                MinuteOneX = s.Minutes.Ones.X,
                MinuteOneY = s.Minutes.Ones.Y,
            };

            return(c);
        }