@Override
 public void Draw(GameTime gameTime) {
   _sprites.get(0).Draw((SpriteBatch) Game().GetService("SpriteBatch"), _position, Color.WHITE);
   Clicked.occur(!_isPanelButtonAdded);
   if (_isPanelButtonAdded) {
     _itemPanel.Draw(gameTime);
   }
   super.Draw(gameTime);
 }
  @Override
  public void Update(GameTime gameTime) {
    _delayTime = TimeSpan.Add(_delayTime, gameTime.ElapsedGameTime());

    if (_delayTime.miliseconds() <= 100) return;
    _delayTime = TimeSpan.Zero();
    if (_isClicked) {
      _sprites.get(0).Update();

      if (_sprites.get(0).FrameIndex() == 0) {
        Clicked.Add(DoClick.GetInstance(this));
        _isClicked = false;
      }
    }

    super.Update(gameTime);
  }
  @Override
  public void Initialize() {
    int id = Factory.getResourceID(_path, ResourceType.xml);
    XmlResourceParser xrp = _game.Resource().getXml(id);
    String tagName = "";
    String value = "";
    int numFrame;
    int frameWidth;
    int frameHeight;
    int xCenterPoint;
    int yCenterPoint;
    int bitmapResID;
    boolean isVertical;
    try {
      while (xrp.getEventType() != XmlResourceParser.END_DOCUMENT) {
        if (xrp.getEventType() == XmlResourceParser.START_TAG) {
          tagName = xrp.getName();

          if (tagName.equals("Definition")) {
            numFrame = xrp.getAttributeIntValue(null, "NumFrame", 0);

            frameWidth = xrp.getAttributeIntValue(null, "FrameWidth", 0);

            frameHeight = xrp.getAttributeIntValue(null, "FrameHeight", 0);

            xCenterPoint = xrp.getAttributeIntValue(null, "XCenterPoint", 0);

            yCenterPoint = xrp.getAttributeIntValue(null, "YCenterPoint", 0);

            bitmapResID = xrp.getAttributeResourceValue(null, "SheetName", 0);

            isVertical = xrp.getAttributeBooleanValue(null, "IsVertical", false);

            Bitmap bmp = BitmapFactory.decodeResource(Game().Resource(), bitmapResID);
            _sprites.add(
                new Sprite(
                    null,
                    bmp,
                    numFrame,
                    new Vector2(frameWidth, frameHeight),
                    new Vector2(xCenterPoint, yCenterPoint),
                    isVertical));
          }
        }

        if (xrp.getEventType() == XmlResourceParser.TEXT) {
          if (tagName.equals("Panel")) {
            value = xrp.getText();
            if (value != "") {
              _itemPanel = new PanelButton(_game, _owner, value);
            }
          }
        }
        xrp.next();
      }
      xrp.close();
    } catch (XmlPullParserException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }

    super.Initialize();
  }
  @Override
  public void Initialize() {
    String tagName = new String();

    int frameWidth = 0;
    int frameHeight = 0;
    int numFrame = 0;
    int XCenterPoint = 0;
    int YCenterPoint = 0;
    int bitmapResID = 0;

    XmlResourceParser xrp = Game().getResources().getXml(_xmlResID);

    try {
      while (xrp.getEventType() != XmlResourceParser.END_DOCUMENT) {

        if (xrp.getEventType() == XmlResourceParser.START_TAG) {

          tagName = xrp.getName();

          if (tagName.equals("Definition")) {

            numFrame = xrp.getAttributeIntValue(null, "NumFrame", 0);

            frameWidth = xrp.getAttributeIntValue(null, "FrameWidth", 0);

            frameHeight = xrp.getAttributeIntValue(null, "FrameHeight", 0);

            XCenterPoint = xrp.getAttributeIntValue(null, "XCenterPoint", 0);

            YCenterPoint = xrp.getAttributeIntValue(null, "YCenterPoint", 0);

            bitmapResID = xrp.getAttributeResourceValue(null, "SheetName", 0);
          }
        } else if (xrp.getEventType() == XmlResourceParser.END_TAG) {

          // Chinh tham so Bitmap Factory de tranh loi Out of Memory khi kich thuoc bitmap qua lon
          BitmapFactory.Options bfOption = new BitmapFactory.Options();
          bfOption.inDither = false; // Disable Dithering mode
          bfOption.inPurgeable =
              true; // Tell to gc (Garbage Collection) that whether it needs free memory, the Bitmap
                    // can be cleared
          bfOption.inInputShareable =
              true; // Which kind of reference will be used to recover the Bitmap data after being
                    // clear, when it will be used in the future
          bfOption.inTempStorage = new byte[32 * 1024];

          Sprite sprite =
              new Sprite(
                  null,
                  BitmapFactory.decodeResource(Game().getResources(), bitmapResID, bfOption),
                  numFrame,
                  new Vector2(frameWidth, frameHeight),
                  new Vector2(XCenterPoint, YCenterPoint),
                  true);

          _sprites.add(sprite);

        } else if (xrp.getEventType() == XmlResourceParser.TEXT) {

        }

        xrp.next();
      }
      xrp.close();
    } catch (XmlPullParserException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    super.Initialize();
  }
 @Override
 public void Draw(GameTime gameTime) {
   _sprites.get(0).Draw((SpriteBatch) Game().GetService("SpriteBatch"), _position, Color.WHITE);
   super.Draw(gameTime);
 }
 @Override
 public void Update(GameTime gameTime) {
   super.Update(gameTime);
 }