/// <summary>
        /// Gets the random decorator.
        /// </summary>
        /// <param name="theShape">The shape.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public ShapeSprite GetRandomDecorator(Shape theShape, int width, int height)
        {
            Decorators randomDecorator = this.determineRandomDecorator();

            ShapeSprite decorator = null;

            switch (randomDecorator)
            {
            case Decorators.HorizontalBar:
                decorator = new HorizontalBarDecorator(theShape, width, height);
                break;

            case Decorators.VerticalBar:
                decorator = new VerticalBarDecorator(theShape, width, height);
                break;

            case Decorators.Spot:
                decorator = new SpotDecorator(theShape, width, height);
                break;
            }
            return(decorator);
        }
        private void buttonCellAnimation_Click(object sender, EventArgs e)
        {
            object modelObject = this.olvSimple.GetModelObject(Math.Min(5, this.olvSimple.GetItemCount()));

            if (modelObject == null || this.olvSimple.Columns.Count < 2)
            {
                Coordinator.ShowMessage("There aren't any cells to be animated");
                return;
            }

            AnimatedDecoration animatedDecoration = new AnimatedDecoration(this.olvSimple, modelObject, this.olvSimple.GetColumn(1));
            Animation          animation          = animatedDecoration.Animation;

            ShapeSprite sprite = ShapeSprite.RoundedRectangle(5.0f, Color.Firebrick, Color.FromArgb(48, Color.Firebrick));

            sprite.Opacity        = 0.0f;
            sprite.CornerRounding = 14;
            sprite.FixedBounds    = Locators.AnimationBounds(3, 3);
            sprite.Add(0, 4500, Effects.Blink(3));
            animation.Add(0, sprite);

            animation.Start();
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="TestShapeSprites" /> class.
        /// </summary>
        public TestShapeSprites()
        {
            var cirlce = new Circle();

            this.circleSprite = new CircleSprite(cirlce, 100, 100);
        }
Example #4
0
        private static Dictionary <int, SHAPEntry> ReadSHAP(BinaryReaderEx br, bool dsr, Dictionary <int, string> strings, int shprOffset)
        {
            ReadSectionHeader(br, "SHAP", out int entrySize, out int entryCount);

            int startPosition = (int)br.Position;
            Dictionary <int, SHAPEntry> shapEntries = new Dictionary <int, SHAPEntry>();

            for (int i = 0; i < entryCount; i++)
            {
                int offset          = (int)br.Position - startPosition;
                int typeOffset      = br.ReadInt32();
                int shprEntryOffset = br.ReadInt32();
                int restorePosition = (int)br.Position;

                SHAPEntry entry;
                string    type = strings[typeOffset];
                br.Position = shprOffset + shprEntryOffset;

                if (type == "Null")
                {
                    entry = new ShapeNull(br);
                }
                else if (type == "Dialog")
                {
                    entry = new ShapeDialog(br);
                }
                else if (type == "ScrollText")
                {
                    entry = new ShapeScrollText(br);
                }
                else if (type == "Text")
                {
                    entry = new ShapeText(br);
                }
                else if (type == "Sprite")
                {
                    entry = new ShapeSprite(br, dsr);
                }
                else if (type == "MonoRect")
                {
                    entry = new ShapeMonoRect(br);
                }
                else if (type == "GouraudRect")
                {
                    entry = new ShapeGouraudRect(br);
                }
                else if (type == "MonoFrame")
                {
                    entry = new ShapeMonoFrame(br);
                }
                else if (type == "GouraudSprite")
                {
                    entry = new ShapeGouraudSprite(br);
                }
                else if (type == "Mask")
                {
                    entry = new ShapeMask(br);
                }
                else
                {
                    throw null;
                }

                entry.Offset        = shprOffset + shprEntryOffset;
                shapEntries[offset] = entry;
                br.Position         = restorePosition;
            }

            br.Pad(0x10);
            return(shapEntries);
        }