/// <summary> /// Goes to the specified position. /// </summary> /// <param name="pos">The position to go to.</param> public void GoTo(Vector2Object pos) { Rectangle OriginalValue = rect; this.rect = ConvertToRectangle(pos, this.rect); RectChanged(OriginalValue); }
public Sprite(Vector2Object pos, string load_name, World world) { this.game = world.game; this.world = world; this.pictures[0] = Texture2D.FromStream(game.GraphicsDevice, System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(load_name)); this.rect = pos.ConvertToRectangle(picture); this.world = world; SetDefaults(); }
public Sprite(Vector2Object pos, Texture2D picture, World world) { this.game = world.game; this.world = world; this.pictures[0] = picture; this.rect = pos.ConvertToRectangle(picture); this.world = world; SetDefaults(); }
public Sprite(Vector2Object pos, List <string> load_names, World world) { this.game = world.game; this.world = world; foreach (String s in load_names) { this.pictures.Add(Texture2D.FromStream(game.GraphicsDevice, System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(s))); } this.rect = pos.ConvertToRectangle(picture); this.world = world; SetDefaults(); }
public Sprite(Vector2Object pos, List <Texture2D> pictures, World world) { this.game = world.game; this.world = world; foreach (Texture2D t in pictures) { this.pictures.Add(t); } this.rect = pos.ConvertToRectangle(picture); this.world = world; SetDefaults(); }
public override void OnBind() { base.OnBind(); vector2List = (IList <Vector2>)list; if (vector2List != null) { drawLabel = false; height = 30; c = new Vector2Object(vector2List, index); } else { height = 30; c = new Vector2Object(memberInfo, item); } if (rangeAttribute != null && rangeAttribute.min is float && rangeAttribute.max is float) { max = (float)rangeAttribute.max; min = (float)rangeAttribute.min; } if (incrementAttribute != null && incrementAttribute.increment is float) { increment = (float)incrementAttribute.increment; } int order = 0; foreach (PropertyFieldWrapper variable in ConfigManager.GetFieldsAndProperties(c)) { var wrapped = UIModConfig.WrapIt(this, ref height, variable, c, order++); // Can X and Y inherit range and increment automatically? Pass in "fake PropertyFieldWrapper" to achieve? Real one desired for label. if (wrapped.Item2 is FloatElement floatElement) { floatElement.min = min; floatElement.max = max; floatElement.increment = increment; floatElement.drawTicks = Attribute.IsDefined(memberInfo.MemberInfo, typeof(DrawTicksAttribute)); } if (vector2List != null) { wrapped.Item1.Left.Pixels -= 20; wrapped.Item1.Width.Pixels += 20; } } }
internal static Rectangle ConvertToRectangle(Vector2Object vec2, Rectangle from_size) { return(new Rectangle(vec2.x, vec2.y, from_size.Width, from_size.Height)); }