Exemplo n.º 1
0
 protected override void initProperties()
 {
     X         = 0f;
     Y         = 0f;
     Sprite    = new Sprite("Untitled-1.png", new Vector(1f, 1f), new Vector(0f, 0f), 0.5f, new Color(255, 255, 255, 255), 0f);
     Light     = new Light(new Vector(0f, 0f), new Color(255, 255, 255, 255), 512f, false);
     Shadows   = new ShadowProperties(false, true, false, 1f, 100f);
     Name      = "???";
     Active    = true;
     HudObject = false;
     IsDebug   = false;
 }
Exemplo n.º 2
0
 protected override void initProperties()
 {
     X         = 0f;
     Y         = 0f;
     Sprite    = new Sprite("__PIXEL__", new Vector(100f, 100f), new Vector(0f, 0f), 0.2f, new Color(71, 82, 120, 255), 0f);
     Light     = new Light(new Vector(0f, 0f), new Color(255, 255, 255, 255), 512f, false);
     Shadows   = new ShadowProperties(false, true, false, 1f, 100f);
     Name      = "???";
     Active    = true;
     HudObject = false;
     IsDebug   = false;
     Target    = "Player";
 }
Exemplo n.º 3
0
 protected override void initProperties()
 {
     X         = 0f;
     Y         = 0f;
     Sprite    = new Sprite("__PIXEL__", new Vector(1f, 1f), new Vector(0f, 0f), 0.5f, new Color(0, 0, 255, 128), 0f);
     Light     = new Light(new Vector(0f, 0f), new Color(255, 255, 255, 255), 512f, false);
     Shadows   = new ShadowProperties(false, true, false, 1f, 100f);
     Name      = "???";
     Active    = true;
     HudObject = false;
     IsDebug   = true;
     Layer     = null;
     Sink      = false;
 }
Exemplo n.º 4
0
        private bool ShouldSerializeAutoScaleBaseSize()
        {
            // Never serialize this unless AutoScale is turned

            // on

#pragma warning disable 618

            return(initializing ? false

             : ((Form)Component).AutoScale && ShadowProperties.Contains("AutoScaleBaseSize"));

#pragma warning restore 618
        }
Exemplo n.º 5
0
        public override void configure()
        {
            TypeVal rt  = this.getTypeValOfName("Sprite");
            Sprite  spr = (Sprite)rt.Value;

            spr.Depth = .3f;
            spr.Color = Color.Black;
            spr.Scale = Vector.One * 50;

            ShadowProperties shadowProps = getTypeValOfName("Shadows").Value as ShadowProperties;

            shadowProps.CastsShadows = true;

            base.configure();
        }
Exemplo n.º 6
0
 protected override void initProperties()
 {
     X         = 0f;
     Y         = 0f;
     Sprite    = new Sprite("Tracer.png", new Vector(1f, 1f), new Vector(0f, 0f), 0.5f, new Color(255, 255, 255, 255), 0f);
     Light     = new Light(new Vector(0f, 0f), new Color(255, 255, 255, 255), 512f, false);
     Shadows   = new ShadowProperties(false, true, false, 1f, 100f);
     Name      = "???";
     Active    = true;
     HudObject = false;
     IsDebug   = false;
     Layer     = null;
     Decay     = 9;
     Dir       = new Vector(0f, 0f);
     Speed     = 0.1f;
 }
        private static ShadowProperties GetShadowProperties(int index)
        {
            for (var i = cachedShadowProperties.Count; i <= index; i++)
            {
                var properties = new ShadowProperties();
                var prefix     = "_Shadow" + (i + 1);

                properties.Texture = Shader.PropertyToID(prefix + "Texture");
                properties.Matrix  = Shader.PropertyToID(prefix + "Matrix");
                properties.Ratio   = Shader.PropertyToID(prefix + "Ratio");

                cachedShadowProperties.Add(properties);
            }

            return(cachedShadowProperties[index]);
        }
Exemplo n.º 8
0
 protected override void initProperties()
 {
     X         = 0f;
     Y         = 0f;
     Sprite    = new Sprite("__PIXEL__", new Vector(60f, 60f), new Vector(0f, 0f), 0.5f, new Color(255, 128, 0, 255), 0f);
     Light     = new Light(new Vector(0f, 0f), new Color(255, 255, 255, 255), 512f, false);
     Shadows   = new ShadowProperties(false, true, false, 1f, 100f);
     Name      = "???";
     Active    = true;
     HudObject = false;
     IsDebug   = false;
     Layer     = null;
     Velocity  = new Vector(0f, 1f);
     Speed     = 1f;
     Target    = "Player1";
 }
Exemplo n.º 9
0
 protected override void initProperties()
 {
     X              = 0f;
     Y              = 0f;
     Sprite         = new Sprite("__PIXEL__", new Vector(256f, 256f), new Vector(0f, 0f), 0.6f, new Color(255, 255, 255, 255), 0f);
     Light          = new Light(new Vector(0f, 0f), new Color(255, 255, 255, 255), 512f, false);
     Shadows        = new ShadowProperties(false, true, false, 1f, 100f);
     Name           = "???";
     Active         = true;
     HudObject      = false;
     IsDebug        = false;
     Velocity       = new Vector(1f, 1f);
     Acceleration   = new Vector(0f, 0f);
     LookAngle      = 0f;
     GunTipPosition = new Vector(1f, 1f);
 }
Exemplo n.º 10
0
 protected override void initProperties()
 {
     X            = 0f;
     Y            = 0f;
     Sprite       = new Sprite("gradient2.png", new Vector(0.5f, 0.5f), new Vector(0f, 0f), 0.5f, new Color(255, 255, 255, 255), 0f);
     Light        = new Light(new Vector(0f, 0f), new Color(255, 255, 255, 255), 512f, false);
     Shadows      = new ShadowProperties(false, true, false, 1f, 100f);
     Name         = "???";
     Active       = true;
     HudObject    = false;
     IsDebug      = false;
     Layer        = null;
     Velocity     = new Vector(0f, 0f);
     Acceleration = new Vector(0f, 0f);
     EffectWater  = false;
 }
Exemplo n.º 11
0
 protected override void initProperties()
 {
     X            = 0f;
     Y            = 0f;
     Sprite       = new Sprite("__PIXEL__", new Vector(220f, 220f), new Vector(0f, 0f), 0.5f, new Color(0, 255, 64, 255), 0f);
     Light        = new Light(new Vector(0f, 0f), new Color(255, 255, 255, 255), 512f, false);
     Shadows      = new ShadowProperties(false, true, false, 1f, 100f);
     Name         = "???";
     Active       = true;
     HudObject    = false;
     IsDebug      = false;
     Layer        = null;
     Target       = "Player";
     HuntRadius   = 1200;
     Velocity     = new Vector(0f, 0f);
     Acceleration = new Vector(0f, 0f);
 }
Exemplo n.º 12
0
 protected override void initProperties()
 {
     X            = 0f;
     Y            = 0f;
     Sprite       = new Sprite("__PIXEL__", new Vector(340f, 340f), new Vector(0f, 0f), 0.5f, new Color(128, 0, 128, 255), 0f);
     Light        = new Light(new Vector(0f, 0f), new Color(255, 255, 255, 255), 512f, false);
     Shadows      = new ShadowProperties(false, true, false, 1f, 100f);
     Name         = "???";
     Active       = true;
     HudObject    = false;
     IsDebug      = false;
     Layer        = null;
     Velocity     = new Vector(0f, 0f);
     Acceleration = new Vector(0f, 0f);
     A            = new Vector(1f, 1f);
     B            = new Vector(1f, 1f);
 }
Exemplo n.º 13
0
 /// <include file='doc\FormDocumentDesigner.uex' path='docs/doc[@for="FormDocumentDesigner.OnComponentAdded"]/*' />
 /// <devdoc>
 ///      Called when a component is added to the design container.
 ///      If the component isn't a control, this will demand create
 ///      the component tray and add the component to it.
 /// </devdoc>
 private void OnComponentAdded(object source, ComponentEventArgs ce)
 {
     if (ce.Component is Menu)
     {
         IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));
         if (host != null && !host.Loading)
         {
             //if it's a MainMenu & we don't have one set for the form yet, then do it...
             //
             if (ce.Component is MainMenu && !ShadowProperties.Contains("Menu"))
             {
                 PropertyDescriptor menuProp = TypeDescriptor.GetProperties(Component)["Menu"];
                 Debug.Assert(menuProp != null, "What the hell happened to the Menu property");
                 menuProp.SetValue(Component, ce.Component);
             }
         }
     }
 }
Exemplo n.º 14
0
 protected override void initProperties()
 {
     X         = 0f;
     Y         = 0f;
     Sprite    = new Sprite("__PIXEL__", new Vector(100f, 100f), new Vector(0f, 0f), 0.5f, new Color(0, 0, 0, 255), 0f);
     Light     = new Light(new Vector(0f, 0f), new Color(255, 255, 255, 255), 512f, false);
     Shadows   = new ShadowProperties(true, true, false, 1f, 100f);
     Name      = "???";
     Active    = true;
     HudObject = false;
     IsDebug   = false;
     Layer     = null;
     EndB      = new Vector(1f, 1f);
     EndA      = new Vector(1f, 1f);
     Speed     = 0f;
     StartOnA  = true;
     Velocity  = new Vector(0f, 0f);
 }
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (value is ShadowProperties || value is bool)
            {
                ShadowProperties b = (ShadowProperties)value;


                if (destinationType == typeof(string))
                {
                    if (b.CastsShadows)
                    {
                        return("true");
                    }
                    else
                    {
                        return("false");
                    }
                }
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
Exemplo n.º 16
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            // show the list box
            if (service != null)
            {
                service.DropDownControl(list);
                ShadowProperties s = (ShadowProperties)value;
                if (list.SelectedItem != null)
                {
                    if (list.SelectedItem.Equals("true"))
                    {
                        s.CastsShadows = true;
                    }
                    else
                    {
                        s.CastsShadows = false;
                    }
                }
            }

            return(value);
        }
Exemplo n.º 17
0
 private bool ShouldSerializeAutoScaleBaseSize()
 {
     return(initializing ? false
         : ShadowProperties.ShouldSerializeValue("AutoScaleBaseSize", true));
 }
Exemplo n.º 18
0
        private string getCodeFor(object val)
        {
            if (val == null)
            {
                return("null");
            }

            string typeName = val.GetType().Name;

            if (typeName.Equals(typeof(int).Name) ||
                typeName.Equals(typeof(string).Name) ||
                typeName.Equals(typeof(bool).Name) ||
                typeName.Equals(typeof(float).Name) ||
                typeName.Equals(typeof(double).Name) ||
                typeName.Equals(typeof(Single).Name) ||
                typeName.Equals(typeof(byte).Name) ||
                typeName.Equals(typeof(Int16).Name) ||
                typeName.Equals(typeof(Int32).Name)
                )
            {
                return(stringify(val));
            }

            else if (typeName.Equals(typeof(Vector).Name))
            {
                Vector vec = (Vector)val;
                return("new Vector(" + vec.X + "f, " + vec.Y + "f)");
            }
            else if (typeName.Equals(typeof(Sprite).Name))
            {
                Sprite spr = (Sprite)val;
                return("new Sprite(" + getCodeFor(spr.ImagePath) + ", " + getCodeFor(spr.Scale) + ", " + getCodeFor(spr.Offset) + ", " + getCodeFor(spr.Depth) + ", " + getCodeFor(spr.Color) + ", " + getCodeFor(spr.Rotation) + ")");
            }
            else if (typeName.Equals(typeof(Light).Name))
            {
                Light light = (Light)val;
                return("new Light(" + getCodeFor(light.Position) + ", " + getCodeFor(light.Color) + ", " + getCodeFor(light.Radius) + ", " + getCodeFor(light.Visible) + ")");
            }
            else if (typeName.Equals(typeof(ShadowProperties).Name))
            {
                ShadowProperties shadows = (ShadowProperties)val;
                return("new ShadowProperties(" + getCodeFor(shadows.CastsShadows) + ", " + getCodeFor(shadows.IncludeLight) + ", " + getCodeFor(shadows.SelfShadows) + ", " + getCodeFor(shadows.Solidness) + ", " + getCodeFor(shadows.Height) + ")");
            }
            else if (typeName.Equals(typeof(Color).Name))
            {
                Color col = (Color)val;
                return("new Color(" + col.R + ", " + col.G + ", " + col.B + ", " + col.A + ")");
            }
            else if (typeName.Equals(typeof(Microsoft.Xna.Framework.Input.Keys).Name))
            {
                Microsoft.Xna.Framework.Input.Keys k = (Microsoft.Xna.Framework.Input.Keys)val;
                return("Microsoft.Xna.Framework.Input.Keys." + k.ToString());
            }

            else
            {
                //assume that the val is an instance desc
                return("null");

                //  throw new WhiskeyException("Property is not of supported type: " + val.GetType().Name);
            }
        }