示例#1
0
文件: Label.cs 项目: MyEyes/Igorr
 public Label(UIElement parent, Vector2 position, string text="")
     : base(parent, position)
 {
     if (_font == null)
         _font = ContentInterface.LoadFont("font2");
     _text = text;
 }
示例#2
0
文件: ItemIcon.cs 项目: MyEyes/Igorr
 public ItemIcon(UIElement parent, Vector2 position, Logic.ICollectible item)
     : base(parent, position, new Vector2(32, 32), item != null ? item.Texture : null)
 {
     oldPos = position;
     _item = item;
     backgroundPanel = new Panel(this, new Vector2(-2, -2), new Vector2(40, 40), Content.ContentInterface.LoadTexture("UITest"));
 }
示例#3
0
文件: UIElement.cs 项目: MyEyes/Igorr
 public UIElement(UIElement parent, Vector2 offset)
 {
     _parent = parent;
     _offset = offset;
     _childs = new List<UIElement>();
     depth=minDepth;
     if (parent != null)
         depth = parent.depth + maxDepth - parent.depth / 10.0f;
 }
示例#4
0
文件: Button.cs 项目: MyEyes/Igorr
 public Button(UIElement parent, Vector2 position, Vector2 size, Texture2D buttonTex, Action action, string text="")
     : base(parent, position)
 {
     buttonBorder = new Panel(this, Vector2.Zero, size, buttonTex);
     this.AddChild(buttonBorder);
     _action=action;
     _size = size;
     if (_font == null)
         _font = ContentInterface.LoadFont("font2");
     Text = text;
     _state = UIButtonState.Nothing;
 }
示例#5
0
文件: ItemIcon.cs 项目: MyEyes/Igorr
 public void Drop(UIElement element)
 {
     IDroppable drop = _parent as IDroppable;
     if (_parent != null)
     {
         drop.Remove(this);
     }
     else
     {
         _parent.RemoveChild(this);
     }
 }
示例#6
0
文件: UIElement.cs 项目: MyEyes/Igorr
 public bool TryDrop(UIElement caller, IDraggable obj)
 {
     IDroppable drop = this as IDroppable;
     if(drop!=null && obj.Rect.Intersects(new Rectangle((int)TotalOffset.X,(int)TotalOffset.Y,(int)_size.X,(int)_size.Y)))
     {
         if (drop.Drop(obj))
             return true;
     }
     for (int x = 0; x < _childs.Count; x++)
         if (_childs[x] != caller) if (_childs[x].TryDrop(this, obj)) return true;
     if (_parent!=null && _parent != caller)
         if (_parent.TryDrop(this, obj)) return true;
     return false;
 }
示例#7
0
文件: Panel.cs 项目: MyEyes/Igorr
 //Texture is assumed to be consisting of 3x3 tiles which are 8x8 pixels each, one for each side, one for each corner and the center
 public Panel(UIElement parent, Vector2 offset, Vector2 size, Texture2D texture)
     : base(parent,offset)
 {
     SetSize(size);
     _texture = texture;
 }
示例#8
0
文件: UIElement.cs 项目: MyEyes/Igorr
 public void RemoveChild(UIElement element)
 {
     _childs.Remove(element);
 }
示例#9
0
文件: UIElement.cs 项目: MyEyes/Igorr
 public void AddChild(UIElement element)
 {
     _childs.Add(element);
     element._parent = this;
 }
示例#10
0
 public PictureBox(UIElement parent, Vector2 offset, Vector2 size, Texture2D texture)
     : base(parent, offset)
 {
     _texture = texture;
     _size = size;
 }