messageLose method

MenuView messageLose (bool timeout)

This is the view which gets displayed when the user looses a level. If he didn't make it in time, then a different loose message gets displayed as he would get if he looses because his dozer ran into a brick.

Implementation

MenuView messageLose(bool timeout) {
  String msg;
  if (timeout) {
    msg = "Be faster and grow your dozer bigger next time!";
  } else {
    msg = "Your Dozer did not make it, avoid the dangerous bricks next time!";
  }

  DivElement div = DivElement();
  div.setAttribute("id", "button_to_menu");
  div.setAttribute("class", "message");

  div.append(getLogo());
  div.append(HRElement());

  HeadingElement levelTitle = HeadingElement.h2();
  levelTitle.appendText("You Lost!");
  div.append(levelTitle);

  SpanElement msgText = SpanElement();
  msgText.appendText(msg);
  msgText.style.fontStyle = "italic";
  div.append(msgText);

  HRElement hr = HRElement();
  hr.style.marginTop = "3vh";
  div.append(hr);

  ParagraphElement tapToAdvance = ParagraphElement()
    ..setAttribute("class", "tap-me")
    ..appendText("Tap To Continue");
  div.append(tapToAdvance);

  DivElement outerDiv = DivElement();
  outerDiv.append(div);

  this.content = outerDiv;
  return this;
}