Exemple #1
0
 /// <summary>
 /// 移除子UI,如果子UI不存在返回false
 /// </summary>
 public bool Subtract(PowerUIElement child)
 {
     if (children.Contains(child))
     {
         child.parent = null;
         return(children.Remove(child));
     }
     return(false);
 }
Exemple #2
0
 public override void Draw(SpriteBatch spriteBatch)
 {
     if (MyTexture != null)
     {
         PowerUIElement p = this;
         p.Draw(spriteBatch);
     }
     else
     {
         Terraria.Utils.DrawInvBG(spriteBatch, MyPosition.X - MyCenterFix.X, MyPosition.Y - MyCenterFix.Y, MySize.X, MySize.Y, Helper.GetCloserColor(MyColor * (255f / MyColor.A), Color.White, SizeFix - 1, 0.65f) * (MyColor.A / 255f));
     }
     DrawChildren(spriteBatch);
 }
Exemple #3
0
 public PowerUIElement()
 {
     ShouldActive    = true;
     UseMouseFix     = true;
     parent          = null;
     MyPosition      = Vector2.Zero;
     MySize          = Vector2.Zero;
     MyTexture       = null;
     MyID            = -1;
     MyCunstomData   = null;
     MyCenterType    = CenterType.TopLeft;
     MouseClickMe   += Upon;
     MouseUponMe    += Upon;
     MouseNotUponMe += NotUpon;
     CanFocusMe      = true;
     First           = true;
 }
Exemple #4
0
 /// <summary>
 /// 附加子UI
 /// </summary>
 public void Append(PowerUIElement child)
 {
     child.parent = this;
     children.Add(child);
 }