2018-11-09 05:48:24 +00:00
|
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
|
using Microsoft.Xna.Framework.Input;
|
2018-11-12 05:05:51 +00:00
|
|
|
|
using RhythmBullet.Zer01HD.Utilities.Camera;
|
2018-11-09 05:48:24 +00:00
|
|
|
|
using RhythmBullet.Zer01HD.Utilities.Input;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace RhythmBullet.Zer01HD.UI.Modular
|
|
|
|
|
{
|
|
|
|
|
public class UIModule : IInputListener
|
|
|
|
|
{
|
|
|
|
|
public Rectangle Bounds;
|
|
|
|
|
public UIModuleGroup Parent;
|
|
|
|
|
public string Name;
|
2018-11-15 07:22:19 +00:00
|
|
|
|
public Color Color = Color.White;
|
2018-11-09 05:48:24 +00:00
|
|
|
|
|
|
|
|
|
public virtual void Update(GameTime gameTime)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-13 00:34:11 +00:00
|
|
|
|
public virtual void Draw(SpriteBatch batch)
|
2018-11-09 05:48:24 +00:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Rectangle ConvertToParentCoordinates(Rectangle bounds)
|
|
|
|
|
{
|
|
|
|
|
if (Parent != null)
|
|
|
|
|
{
|
|
|
|
|
Rectangle parentHitbox = Parent.ConvertToParentCoordinates(bounds);
|
|
|
|
|
int tX = bounds.X + parentHitbox.X;
|
|
|
|
|
int tY = bounds.Y + parentHitbox.Y;
|
|
|
|
|
return new Rectangle(tX, tY, bounds.Width, bounds.Height);
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
return bounds;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveFromParent()
|
|
|
|
|
{
|
|
|
|
|
if (Parent == null)
|
|
|
|
|
{
|
|
|
|
|
throw new InvalidOperationException("Parent is null.");
|
|
|
|
|
}
|
|
|
|
|
Parent.RemoveModule(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual bool KeyboardStateChanged(KeyboardState state)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual bool MouseStateChanged(MouseState state)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|