예제 #1
0
  /** Default constructor */
  public LoginScreen() {
    String respath = System.getProperty("res.path");
    if (respath == null) respath = "";
    try {
      InputStream f;
      //			m_bgColor = new Color(255, 255, 255, 70);
      List<String> translated = new ArrayList<String>();
      translated = Translator.translate("_LOGIN");
      /*
       * Load the background image
       * NOTE: Months start at 0, not 1
       */
      Calendar cal = Calendar.getInstance();
      if (cal.get(Calendar.MONTH) == 1) {
        if (cal.get(Calendar.DAY_OF_MONTH) >= 7 && cal.get(Calendar.DAY_OF_MONTH) <= 14) {
          /* Valentines day! */
          f = new FileInputStream(respath + "res/pokenet_valentines.png");
        } else {
          f = new FileInputStream(respath + "res/pokenet_venonat.png");
        }
      } else if (cal.get(Calendar.MONTH) == 2 && cal.get(Calendar.DAY_OF_MONTH) > 14) {
        /* If second half of March, show Easter login */
        f = new FileInputStream(respath + "res/pokenet_easter.png");
      } else if (cal.get(Calendar.MONTH) == 3 && cal.get(Calendar.DAY_OF_MONTH) < 26) {
        /* If before April 26, show Easter login */
        f = new FileInputStream(respath + "res/pokenet_easter.png");
      } else if (cal.get(Calendar.MONTH) == 9) {
        /* Halloween */
        f = new FileInputStream(respath + "res/pokenet_halloween.png");
      } else if (cal.get(Calendar.MONTH) == 11) {
        /* Christmas! */
        f = new FileInputStream(respath + "res/pokenet_xmas.png");
      } else if (cal.get(Calendar.MONTH) == 0) {
        /* January - Venonat Time! */
        f = new FileInputStream(respath + "res/pokenet_venonat.png");
      } else if (cal.get(Calendar.MONTH) >= 5 && cal.get(Calendar.MONTH) <= 7) {
        /* Summer login */
        f = new FileInputStream(respath + "res/pokenet_summer.png");
      } else {
        /* Show normal login screen */
        f = new FileInputStream(respath + "res/pokenet_normal.png");
      }
      m_bg = new Label(new Image(f, "bg", false));
      m_bg.pack();
      m_bg.setLocation(0, 0);
      m_bg.setVisible(true);
      this.add(m_bg);

      /*
       * Create the server selector container
       */
      m_select = new ServerDialog();
      this.add(m_select);
      /*
       * Create the language selector container
       */
      m_lang = new LanguageDialog();
      this.add(m_lang);

      /*
       * Create the login container
       */
      m_login = new LoginDialog();
      this.add(m_login);

      m_register = new RegisterDialog();
      this.add(m_register);

      m_about = new AboutDialog();
      this.add(m_about);

      m_terms = new ToSDialog();
      this.add(m_terms);

      m_openAbout = new Button(translated.get(3));
      m_openAbout.setSize(64, 32);
      m_openAbout.setLocation(800 - 64 - 8, 8);
      m_openAbout.setVisible(false);
      m_openAbout.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
              showAbout();
            }
          });
      this.add(m_openAbout);

      m_openToS = new Button(translated.get(4));
      m_openToS.setSize(64, 32);
      m_openToS.setLocation(800 - 64 - 8, 40);
      m_openToS.setVisible(false);
      m_openToS.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
              showToS();
            }
          });
      this.add(m_openToS);

      setClientRevision();

      m_serverRev = new Label("Server Version: ?");
      m_serverRev.setFont(GameClient.getFontSmall());
      m_serverRev.setForeground(new Color(255, 255, 255));
      m_serverRev.pack();
      m_serverRev.setLocation(m_clientRev.getX() + m_clientRev.getWidth() + 16, m_clientRev.getY());
      m_serverRev.setVisible(true);
      this.add(m_serverRev);

      this.setLocation(0, 0);
      this.setSize(800, 600);
      this.setVisible(true);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
예제 #2
0
 /**
  * Sets the server version to be displayed
  *
  * @param rev
  */
 public void setServerRevision(String rev) {
   m_serverRev.setText("Server Version: r" + rev);
   m_serverRev.pack();
   m_serverRev.setLocation(m_clientRev.getX() + m_clientRev.getWidth() + 16, m_clientRev.getY());
 }