예제 #1
0
 public void startApp() {
   this.gameCanvas = new MobileBoard();
   this.t = new Thread(gameCanvas);
   t.start();
   d = Display.getDisplay(this);
   d.setCurrent(gameCanvas);
 }
예제 #2
0
  public PlanetMap(String s, ChildForm parent, GameProxy gameProxy) {
    // super(false);
    this.parent = parent;
    this.gameProxy = gameProxy;
    // System.out.println("my p " + myPlanet);
    this.addCommand(cmdBack);
    // this.addCommand(cmdBuild);
    this.setCommandListener(this);
    setFullScreenMode(true);
    System.out.println("11111");
    en = Ground.getEnvironment(gameProxy.getMap(), gameProxy.getSaveName());
    System.out.println("21111");
    System.out.println(en);
    ENV = en;
    cm = new CurserManager(en, getHeight(), getWidth(), gameProxy);
    um = new UnitManager(en, getHeight(), getWidth());
    System.out.println("##1");
    cm.setUm(um);
    exec = true;
    myThread = new Thread(this);
    System.out.println("##2");

    try {
      JCageConfigurator.scoreTable = new Hashtable();
      System.out.println("Starting...");
      myThread.start();
      System.out.println("started...");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  public void commandAction(Command c, Displayable d) {
    if (c == startCmd) {
      form.deleteAll();
      form.removeCommand(startCmd);
      form.addCommand(byeCmd);

      Thread t =
          new Thread() {

            public void run() {
              startSession();
            }
          };
      t.start();

      //	    startSession();
      return;
    } else if (c == exitCmd) {
      destroyApp(true);
      return;
    } else if (c == byeCmd) {
      form.removeCommand(byeCmd);
      form.addCommand(restartCmd);
      sendBYE();
      return;
    } else if (c == restartCmd) {
      stopListener();
      form.removeCommand(restartCmd);
      form.addCommand(startCmd);
      form.deleteAll();
      form.append(address);
      return;
    }
  }
예제 #4
0
 public SplashScreen(MIDletExiter me) {
   m = me;
   try {
     img = Image.createImage("/hipoqihSplash.PNG");
   } catch (Exception e) {
   }
   Thread th = new Thread(this);
   th.start();
 }
예제 #5
0
  /**
   * Called by a system to indicated that a command has been invoked on a particular displayable.
   *
   * @param command the Command that was invoked
   * @param displayable the Displayable where the command was invoked
   */
  public void commandAction(
      Command command, Displayable displayable) { // GEN-END:|7-commandAction|0|7-preCommandAction
    // write pre-action user code here
    if (displayable == LoginForm) { // GEN-BEGIN:|7-commandAction|1|65-preAction
      if (command == CreateAgentandJoin) { // GEN-END:|7-commandAction|1|65-preAction
        // write pre-action user code here
        String name = UserAgentNameTF.getString();
        String strAgentClassName = "au.edu.latrobe.placecomm.agents.MobileUserAgent";
        try {
          MicroRuntime.startAgent(name, strAgentClassName, null);
          // write post-action user code here
        } catch (Exception ex) {
          ex.printStackTrace();
        }
        // GEN-LINE:|7-commandAction|2|65-postAction
        // write post-action user code here
      } else if (command == CreateContainer) { // GEN-LINE:|7-commandAction|3|63-preAction
        // write pre-action user code here

        Thread t =
            new Thread() {
              public void run() {
                myStartGoOnline();
              }
            };
        t.start();

        // GEN-LINE:|7-commandAction|4|63-postAction
        // write post-action user code here
      } else if (command == OfflineMode) { // GEN-LINE:|7-commandAction|5|28-preAction
        // write pre-action user code here
        // GEN-LINE:|7-commandAction|6|28-postAction
        // write post-action user code here
      } else if (command == exitCommand) { // GEN-LINE:|7-commandAction|7|17-preAction
        // write pre-action user code here
        exitMIDlet(); // GEN-LINE:|7-commandAction|8|17-postAction
        // write post-action user code here
      } else if (command == okCommand) { // GEN-LINE:|7-commandAction|9|20-preAction
        // write pre-action user code here
        // GEN-LINE:|7-commandAction|10|20-postAction
        // write post-action user code here
      } // GEN-BEGIN:|7-commandAction|11|7-postCommandAction
    } // GEN-END:|7-commandAction|11|7-postCommandAction
    // write post-action user code here
  } // GEN-BEGIN:|7-commandAction|12|
예제 #6
0
  /**
   * Konstruktor obiektu klasy MainCanvas
   *
   * @throws IOException
   */
  public MainCanvas() throws IOException {
    super(true);

    soundPlayer = new SoundPlayer(); // uruchomienie watku odpowiedzialnego za odtwarzanie dzwiekow
    new Thread(soundPlayer).start();

    screenWidth = getWidth();
    screenHeight = getHeight();
    fontHeight = Font.getDefaultFont().getHeight();

    mediaLibrarySelectedItemOnScreen = 0;
    mediaLibraryItemsNumberOnScreen = (screenHeight - 16) / (fontHeight + 5);

    buttonsLocation = 70;

    loadResources(); // utworzenie obiektow warstwy tla i tekstur

    bluetoothPlayer = new BluetoothPlayer();
    Thread appThread =
        new Thread(this); // uruchomienie watku odpowiedzialnego za wyswietlanie grafiki
    appThread.start();
  }
예제 #7
0
 // 程式執行
 public void start() {
   thread = new Thread(this);
   thread.start();
 }