/*
   * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
   */
  public void init(GameContainer container, StateBasedGame s) throws SlickException {

    bulletDirector =
        new BulletDirector() {
          public SequenceDirectorIterator createIterator() {
            return new BulletSeq();
          }
        };

    bulletDirector.createBullets(1);

    //		for (int i = 0; i < 2000 ; i += 11)
    //		{
    //			int f**k = 10 + new Random ().nextInt (10);
    //			blaTimer += f**k;
    //			if (blaTimer >= 200)
    //			{
    //				blaTimer = f**k;
    //				superBlub = xpos;
    //			}
    //			blub = (( 50f/ 1000f) * (float)blaTimer) ;
    //			xpos = blub + superBlub;
    //			System.out.println ("Correct: " + (60 + xpos) + ":::" + blaTimer + " weg; " + blub);
    //			bulletDirector.update (f**k);
    //		}
    //		System.exit (0);

    container.setAlwaysRender(true);
    container.setShowFPS(true);
    container.setVSync(true);
    // Zeitscheibe auf 20ms
    //		container.setMinimumLogicUpdateInterval (60);
    container.setSmoothDeltas(true);
    //		map = new TiledMap ("maps/BeerMap.tmx");
    map = new TiledMap("maps/iso-test2.tmx");

    world = new GameWorld();
    boolean clientOnly = false;
    world.init(container, clientOnly);
    world.setMap(map);
    server = world.getServer();
    client = world.getClient();
    if (StringTools.isNotTrimEmpty(serverIp)) {
      server.init(serverIp, NumberTools.toInt(serverPort, 9000));
    }

    chatFrame = ChatFrame.getInstance(this);
    getRootPane().add(chatFrame);

    chatFrame.setSize(600, 400);
    chatFrame.setPosition(10, 250);
  }
Esempio n. 2
0
 public void startApp() {
   LogUtil.outMessage("startApp invoked");
   /** Core * */
   version = getAppProperty("MIDlet-Version");
   type = getAppProperty("Type");
   build = getAppProperty("Build");
   /** Main * */
   midletMain = this;
   /** Logger for debugging * */
   LogUtil.initLogger(true, false, "92.36.93.99", 2000, false, "");
   /** Initialize localization support * */
   Localization.initLocalizationSupport();
   /** GUI* */
   screen = new Screen(this);
   /** Loading storage data * */
   Storage.init();
   Storage.load();
   /** Loading settings * */
   Settings.loadAll();
   /** Loading icons * */
   Splitter.splitImage(Settings.IMG_CHAT);
   Splitter.splitImage(Settings.IMG_STATUS);
   Splitter.splitImage(Settings.IMG_SUBSCRIPTION);
   /** Loading theme * */
   Theme.checkForUpSize();
   int[] data = Theme.loadTheme(Settings.themeOfflineResPath);
   if (data != null) {
     Theme.applyData(data);
   }
   /** GUI * */
   mainFrame = new MainFrame();
   chatFrame = new ChatFrame();
   roomsFrame = null;
   /** Frames chain * */
   mainFrame.s_nextWindow = chatFrame;
   chatFrame.s_prevWindow = mainFrame;
   /** Setting up active window * */
   screen.activeWindow = mainFrame;
   /** Showing * */
   screen.show();
   /** Checking for main frame object * */
   if (mainFrame.getGObject().equals(mainFrame.blank)) {
     /** Showing warning * */
     Handler.showWarning("TEST_VERSION");
   }
 }
  /**
   * @see org.newdawn.slick.state.GameState#render(org.newdawn.slick.GameContainer,
   *     org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.Graphics)
   */
  public void update(GameContainer container, StateBasedGame arg1, int delta)
      throws SlickException {
    this.delta = delta;
    world.update(delta);

    blaTimer += delta;
    if (blaTimer >= 200) {
      blaTimer = delta;
      superBlub = xpos;
    }
    blub = ((50f / 1000f) * (float) blaTimer);
    //		System.out.println ("Correct: " + ((blub + superBlub - xpos)));
    xpos = blub + superBlub;
    xxpos += (0.0625f * delta);

    //		bulletDirector.update (delta);

    if (container.getInput().isKeyPressed(Input.KEY_TAB)) {
      chatTabToggle = !chatTabToggle;
      chatFrame.setVisible(chatTabToggle);
    }
  }
 public void localChatText(String text) {
   String[] commands = text.split(" ");
   if (commands[0].equals("client")) {
     if (commands.length == 2) {
       client.init(commands[1], "localhost", 9001, "localhost", 9000);
       chatFrame.appendRow("default", "");
     } else if (commands.length == 6) {
       client.init(
           commands[1],
           commands[2],
           NumberTools.toInt(commands[3], 9005),
           commands[4],
           NumberTools.toInt(commands[5], 9000));
     } else {
       chatFrame.appendRow(
           "default",
           "To start the client enter: client <username> <localip> <localport> <serverip> <serverport>");
       return;
     }
     chatFrame.appendRow("default", ".");
     chatFrame.appendRow("default", "Try to connect...can take a while...");
   } else if (commands[0].equals("server")) {
     if (commands.length == 1) {
       server.init("localhost", 9000);
     } else if (commands.length == 3) {
       server.init(commands[1], NumberTools.toInt(commands[2], 9000));
     } else {
       chatFrame.appendRow(
           "default", "To start the client enter: client <localip> <serverip> <serverport>");
       return;
     }
     chatFrame.appendRow("default", ".");
     chatFrame.appendRow("default", "Server created...");
   } else {
     if (client.getChatService() != null)
       client
           .getChatService()
           .sendMessage(client.getCommonWorld().getUserManager().getAppUser(), text);
   }
 }
Esempio n. 5
0
 public static void UnknwownCommand() {
   ChatFrame.addMessage(
       new Message("Unknown command. Type .help for help.", false, MessageType.SELF));
 }