Exemple #1
0
        public override Rectangle GetBounds(RingEntry rng)
        {
            S2RingEntry rng2 = (S2RingEntry)rng;

            switch (rng2.Direction)
            {
            case Direction.Horizontal:
                return(new Rectangle(rng2.X + spr.X, rng2.Y + spr.Y, ((rng2.Count - 1) * spacing) + spr.Width, spr.Height));

            case Direction.Vertical:
                return(new Rectangle(rng2.X + spr.X, rng2.Y + spr.Y, spr.Width, ((rng2.Count - 1) * spacing) + spr.Height));
            }
            return(Rectangle.Empty);
        }
Exemple #2
0
        public override List <RingEntry> ReadLayout(byte[] rawdata, out bool startterm, out bool endterm)
        {
            startterm = false;
            endterm   = false;
            List <RingEntry> rings = new List <RingEntry>();

            for (int i = 0; i < rawdata.Length; i += S2RingEntry.Size)
            {
                if (ByteConverter.ToUInt16(rawdata, i) == 0xFFFF)
                {
                    endterm = true; break;
                }
                S2RingEntry ent = new S2RingEntry(rawdata, i);
                rings.Add(ent);
            }
            return(rings);
        }
Exemple #3
0
        public override Sprite GetSprite(RingEntry rng)
        {
            S2RingEntry   rng2 = (S2RingEntry)rng;
            List <Sprite> sprs = new List <Sprite>();

            for (int i = 0; i < rng2.Count; i++)
            {
                Sprite tmp = new Sprite(spr);
                switch (rng2.Direction)
                {
                case Direction.Horizontal:
                    tmp.Offset(i * spacing, 0);
                    break;

                case Direction.Vertical:
                    tmp.Offset(0, i * spacing);
                    break;
                }
                sprs.Add(tmp);
            }
            return(new Sprite(sprs.ToArray()));
        }
Exemple #4
0
        public override Sprite GetSprite(RingEntry rng)
        {
            S2RingEntry   rng2 = (S2RingEntry)rng;
            List <Sprite> sprs = new List <Sprite>();

            for (int i = 0; i < rng2.Count; i++)
            {
                switch (rng2.Direction)
                {
                case Direction.Horizontal:
                    sprs.Add(new Sprite(spr.Image, new Point(spr.X + (i * spacing), spr.Y)));
                    break;

                case Direction.Vertical:
                    sprs.Add(new Sprite(spr.Image, new Point(spr.X, spr.Y + (i * spacing))));
                    break;
                }
            }
            Sprite result = new Sprite(sprs.ToArray());

            result.Offset = new Point(spr.X + rng2.X, spr.Y + rng2.Y);
            return(result);
        }