public RainbowSpinnerColorFadeTrigger(EntityData data, Vector2 offset) : base(data, offset)
        {
            // instantiate the controllers.
            EntityData dataA = new EntityData();

            dataA.Values = new Dictionary <string, object>()
            {
                { "colors", data.Attr("colorsA") },
                { "gradientSize", data.Float("gradientSizeA") },
                { "loopColors", data.Bool("loopColorsA") },
                { "centerX", data.Float("centerXA") },
                { "centerY", data.Float("centerYA") },
                { "gradientSpeed", data.Float("gradientSpeedA") },
                { "persistent", data.Bool("persistent") }
            };
            controllerA = new RainbowSpinnerColorController(dataA, Vector2.Zero);

            EntityData dataB = new EntityData();

            dataB.Values = new Dictionary <string, object>()
            {
                { "colors", data.Attr("colorsB") },
                { "gradientSize", data.Float("gradientSizeB") },
                { "loopColors", data.Bool("loopColorsB") },
                { "centerX", data.Float("centerXB") },
                { "centerY", data.Float("centerYB") },
                { "gradientSpeed", data.Float("gradientSpeedB") },
                { "persistent", data.Bool("persistent") }
            };
            controllerB = new RainbowSpinnerColorController(dataB, Vector2.Zero);

            // initialize other parameters.
            positionMode = data.Enum <PositionModes>("direction");
        }
示例#2
0
 public ColorGradeFadeTrigger(EntityData data, Vector2 offset) : base(data, offset)
 {
     colorGradeA = data.Attr("colorGradeA");
     colorGradeB = data.Attr("colorGradeB");
     direction   = data.Enum <PositionModes>("direction");
     evenDuringReflectionFall = data.Bool("evenDuringReflectionFall", true); // true by default for backwards compatibility
 }
示例#3
0
    //public virtual void FromXML(XmlNode node, CameraPath cameraPath)
    //{
    //    if (node["customName"].HasChildNodes)
    //        customName = node["customName"].FirstChild.Value;
    //    index = int.Parse(node["index"].FirstChild.Value);
    //    positionModes = (PositionModes)System.Enum.Parse(typeof(PositionModes), node["positionModes"].FirstChild.Value);

    //    if (node["point"] != null)
    //        point = cameraPath[int.Parse(node["point"].FirstChild.Value)];
    //    if (node["cpointA"] != null)
    //        cpointA = cameraPath[int.Parse(node["cpointA"].FirstChild.Value)];
    //    if (node["cpointB"] != null)
    //        cpointB = cameraPath[int.Parse(node["cpointB"].FirstChild.Value)];

    //    _percent = float.Parse(node["_percent"].FirstChild.Value);
    //    _animationPercentage = float.Parse(node["_animationPercentage"].FirstChild.Value);
    //    curvePercentage = float.Parse(node["curvePercentage"].FirstChild.Value);
    //    worldPosition.x = float.Parse(node["worldPositionX"].FirstChild.Value);
    //    worldPosition.y = float.Parse(node["worldPositionY"].FirstChild.Value);
    //    worldPosition.z = float.Parse(node["worldPositionZ"].FirstChild.Value);
    //    lockPoint = bool.Parse(node["lockPoint"].FirstChild.Value);
    //}

    public virtual void FromXML(XMLNode node, CameraPath cameraPath)
    {
        if (node.GetValue("customName>0>_text") != null)
        {
            customName = node.GetValue("customName>0>_text");
        }
        index         = int.Parse(node.GetValue("index>0>_text"));
        positionModes = (PositionModes)System.Enum.Parse(typeof(PositionModes), node.GetValue("positionModes>0>_text"));

        if (node.GetValue("point>0>_text") != null)
        {
            point = cameraPath[int.Parse(node.GetValue("point>0>_text"))];
        }
        if (node.GetValue("cpointA>0>_text") != null)
        {
            cpointA = cameraPath[int.Parse(node.GetValue("cpointA>0>_text"))];
        }
        if (node.GetValue("cpointB>0>_text") != null)
        {
            cpointB = cameraPath[int.Parse(node.GetValue("cpointB>0>_text"))];
        }

        _percent             = float.Parse(node.GetValue("_percent>0>_text"));
        _animationPercentage = float.Parse(node.GetValue("_animationPercentage>0>_text"));
        curvePercentage      = float.Parse(node.GetValue("curvePercentage>0>_text"));
        worldPosition.x      = float.Parse(node.GetValue("worldPositionX>0>_text"));
        worldPosition.y      = float.Parse(node.GetValue("worldPositionY>0>_text"));
        worldPosition.z      = float.Parse(node.GetValue("worldPositionZ>0>_text"));
        lockPoint            = bool.Parse(node.GetValue("lockPoint>0>_text"));
    }
示例#4
0
    public virtual void FromXML(XmlNode node, CameraPath cameraPath)
    {
        if (node["customName"].HasChildNodes)
        {
            customName = node["customName"].FirstChild.Value;
        }
        index         = int.Parse(node["index"].FirstChild.Value);
        positionModes = (PositionModes)System.Enum.Parse(typeof(PositionModes), node["positionModes"].FirstChild.Value);

        if (node["point"] != null)
        {
            point = cameraPath[int.Parse(node["point"].FirstChild.Value)];
        }
        if (node["cpointA"] != null)
        {
            cpointA = cameraPath[int.Parse(node["cpointA"].FirstChild.Value)];
        }
        if (node["cpointB"] != null)
        {
            cpointB = cameraPath[int.Parse(node["cpointB"].FirstChild.Value)];
        }

        _percent             = float.Parse(node["_percent"].FirstChild.Value);
        _animationPercentage = float.Parse(node["_animationPercentage"].FirstChild.Value);
        curvePercentage      = float.Parse(node["curvePercentage"].FirstChild.Value);
        worldPosition.x      = float.Parse(node["worldPositionX"].FirstChild.Value);
        worldPosition.y      = float.Parse(node["worldPositionY"].FirstChild.Value);
        worldPosition.z      = float.Parse(node["worldPositionZ"].FirstChild.Value);
        lockPoint            = bool.Parse(node["lockPoint"].FirstChild.Value);
    }
 public SmoothCameraOffsetTrigger(EntityData data, Vector2 offset) : base(data, offset)
 {
     // parse the trigger attributes. Multiplying X dimensions by 48 and Y ones by 32 replicates the vanilla offset trigger behavior.
     offsetFrom   = new Vector2(data.Float("offsetXFrom") * 48f, data.Float("offsetYFrom") * 32f);
     offsetTo     = new Vector2(data.Float("offsetXTo") * 48f, data.Float("offsetYTo") * 32f);
     positionMode = data.Enum <PositionModes>("positionMode");
     onlyOnce     = data.Bool("onlyOnce");
 }
 public ExtendedVariantFadeTrigger(EntityData data, Vector2 offset) : base(data, offset)
 {
     variantChange = data.Enum("variantChange", ExtendedVariantsModule.Variant.Gravity);
     valueA        = data.Int("valueA", 10);
     valueB        = data.Int("valueB", 10);
     positionMode  = data.Enum("positionMode", PositionModes.LeftToRight);
     revertOnDeath = data.Bool("revertOnDeath", true);
 }
示例#7
0
        public MusicLayerFadeTrigger(EntityData data, Vector2 offset)
            : base(data, offset)
        {
            // parse the "layers" attribute (for example "1,3,4") as an int array.
            string[] layersAsStrings = data.Attr("layers").Split(',');
            layers = new int[layersAsStrings.Length];
            for (int i = 0; i < layers.Length; i++)
            {
                layers[i] = int.Parse(layersAsStrings[i]);
            }

            // parse the other parameters for the trigger
            fadeA     = data.Float("fadeA", 0f);
            fadeB     = data.Float("fadeB", 1f);
            direction = data.Enum("direction", PositionModes.LeftToRight);
        }
示例#8
0
        public void DrawImage(Graphics graphics, ImageSizeHelper imageSize, PositionModes positionMode, Image imageObject)
        {
            #region Draw Base Image
            try
            {
                Rectangle rect = new Rectangle();

                double W = (double)imageSize.Width     // Result Width
                , H      = (double)imageSize.Height    // Result Heigth
                , w      = (double)imageObject.Width   // Source Width
                , h      = (double)imageObject.Height; // Source Height

                double RWH = W / H;                    // Result Ratio Width In Height
                double rwh = w / h;                    // Source Ratio Width In Height
                int    Wi  = (int)((H * w) / h);       // image width after fit
                int    Hi  = (int)((W * h) / w);       // image heigth after fit
                int    Li  = (int)((W - Wi) / 2);      // image Left after fit
                int    Ti  = (int)((H - Hi) / 2);

                switch (positionMode)
                {
                case PositionModes.Stretch:
                {
                    rect = new Rectangle(0, 0, imageSize.Width, imageSize.Height);
                    break;
                }

                case PositionModes.Title:
                {
                    rect = new Rectangle(0, 0, imageSize.Width, imageSize.Height);
                    graphics.FillRectangle(new TextureBrush(imageObject, System.Drawing.Drawing2D.WrapMode.Tile), rect);
                    return;
                }

                case PositionModes.Fit:
                {
                    if (RWH > rwh)         // V Mode
                    {
                        rect = new Rectangle(Li, 0, Wi, imageSize.Height);
                    }
                    else                   // H Mode
                    {
                        rect = new Rectangle(0, Ti, imageSize.Width, Hi);
                    }

                    break;
                }

                case PositionModes.Fill:
                {
                    if (RWH < rwh)         // V Mode
                    {
                        rect = new Rectangle(Li, 0, Wi, imageSize.Height);
                    }
                    else                   // H Mode
                    {
                        rect = new Rectangle(0, Ti, imageSize.Width, Hi);
                    }

                    break;
                }

                case PositionModes.Center:
                {
                    rect = new Rectangle((int)(((double)imageSize.Width - (double)imageObject.Width) / 2)
                                         , (int)(((double)imageSize.Height - (double)imageObject.Height) / 2), imageObject.Width, imageObject.Height);
                    break;
                }
                }
                graphics.SmoothingMode      = SmoothingMode.Default;
                graphics.InterpolationMode  = InterpolationMode.HighQualityBicubic;
                graphics.PixelOffsetMode    = PixelOffsetMode.HighQuality;
                graphics.CompositingQuality = CompositingQuality.HighQuality;
                graphics.DrawImage(imageObject, rect);
            }
            catch
            {
            }
            #endregion
        }
示例#9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="imageSize"></param>
        /// <param name="imageStructJsonFormatString">{PositionMode=[Fill|Fit|Stretch|Center|Title],BackColor=#ffff00,ImagePath=FullImagePath}</param>
        public void DrawImage(Graphics graphics, ImageSizeHelper imageSize, string imageStructJsonFormatString, string basePath)
        {
            JsonDictionaryConverter convertor = new JsonDictionaryConverter(imageStructJsonFormatString);

            PositionModes positionMode = PositionModes.Title;

            if (convertor.GetDictionaryItem("PositionMode") != null)
            {
                positionMode = (PositionModes)Enum.Parse(typeof(PositionModes), convertor.GetDictionaryItem("PositionMode"));
            }

            if (convertor.GetDictionaryItem("BackColor") != null)
            {
                graphics.FillRectangle(new SolidBrush(System.Drawing.ColorTranslator.FromHtml(convertor.GetDictionaryItem("BackColor"))), new Rectangle(0, 0, imageSize.Width, imageSize.Height));
            }

            try
            {
                Image img = Image.FromFile(convertor.GetDictionaryItem("ImagePath"));
                DrawImage(graphics, imageSize, positionMode, img);
            }
            catch
            {
                try
                {
                    var   page = System.Web.HttpContext.Current.Handler as System.Web.UI.Page;
                    Image img  = Image.FromFile(page.MapPath("~") + convertor.GetDictionaryItem("ImagePath").Replace("/", "\\"));
                    DrawImage(graphics, imageSize, positionMode, img);
                }
                catch
                {
                    try
                    {
                        System.Text.Encoding enc = new System.Text.UTF8Encoding();
                        string type = "Unknown Type";
                        try { type = System.Web.HttpContext.Current.Request.Files[0].ContentType.Replace("application/", "").Replace("-", " ").Replace("/", " "); }
                        catch { }// convertor.GetDictionaryItem("FileType").Replace("application/", "").Replace("-", " ").Replace("/", " ");
                        var bb = (enc).GetBytes(type).ToList();
                        var by = from x in bb.Cast <byte>()
                                 let i = int.Parse(x.ToString())
                                         select i;

                        byte r = (byte)by.ToList <int>()[0];
                        byte g = (byte)by.ToList <int>()[1];
                        byte b = (byte)by.ToList <int>()[2];

                        Color co = Color.FromArgb(255, r, g, b);
                        Color cf = Color.FromArgb(255, (byte)((int)r + 128), (byte)((int)g + 128), (byte)((int)b + 128));

                        if (type.Length > 20)
                        {
                            type = type.Substring(0, 20);
                        }
                        float fs = (float)type.Length * (-1.3f) + 23.92f;
                        if (fs < 10f)
                        {
                            fs = 10f;
                        }
                        graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.GammaCorrected;
                        graphics.TextRenderingHint  = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;

                        graphics.FillRectangle(new SolidBrush(co), new RectangleF(0f, 0f, (float)imageSize.Width, (float)imageSize.Height));

                        graphics.DrawString(
                            type,
                            new Font("tahoma", fs, FontStyle.Bold, GraphicsUnit.Point),
                            new SolidBrush(cf),
                            new RectangleF(0f, 0f, (float)imageSize.Width, (float)imageSize.Height),
                            new StringFormat()
                        {
                            LineAlignment = StringAlignment.Center, FormatFlags = StringFormatFlags.DisplayFormatControl, Alignment = StringAlignment.Center
                        }
                            );
                    }
                    catch
                    {
                    }
                }
            }
        }
 public AmbienceVolumeTrigger(EntityData data, Vector2 offset) : base(data, offset)
 {
     from         = data.Float("from");
     to           = data.Float("to");
     positionMode = data.Enum("direction", PositionModes.NoEffect);
 }
示例#11
0
    public virtual void FromXML(XmlNode node, CameraPath cameraPath)
    {
        if (node["customName"].HasChildNodes)
            customName = node["customName"].FirstChild.Value;
        index = int.Parse(node["index"].FirstChild.Value);
        positionModes = (PositionModes)System.Enum.Parse(typeof(PositionModes), node["positionModes"].FirstChild.Value);
        
        if(node["point"] != null)
            point = cameraPath[int.Parse(node["point"].FirstChild.Value)];
        if (node["cpointA"] != null)
            cpointA = cameraPath[int.Parse(node["cpointA"].FirstChild.Value)];
        if (node["cpointB"] != null)
            cpointB = cameraPath[int.Parse(node["cpointB"].FirstChild.Value)];

        _percent = float.Parse(node["_percent"].FirstChild.Value);
        _animationPercentage = float.Parse(node["_animationPercentage"].FirstChild.Value);
        curvePercentage = float.Parse(node["curvePercentage"].FirstChild.Value);
        worldPosition.x = float.Parse(node["worldPositionX"].FirstChild.Value);
        worldPosition.y = float.Parse(node["worldPositionY"].FirstChild.Value);
        worldPosition.z = float.Parse(node["worldPositionZ"].FirstChild.Value);
        lockPoint = bool.Parse(node["lockPoint"].FirstChild.Value);
    }
示例#12
0
 public ColorGradeFadeTrigger(EntityData data, Vector2 offset) : base(data, offset)
 {
     colorGradeA = data.Attr("colorGradeA");
     colorGradeB = data.Attr("colorGradeB");
     direction   = data.Enum <PositionModes>("direction");
 }
示例#13
0
 /// <summary>
 /// Positions the specified value.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns>TooltipsBuilder.</returns>
 public TooltipsBuilder Position(PositionModes value)
 {
     _component.Position = value;
     return(this);
 }