Package project1

Examples of project1.Exercise06_17


      );
      mobPanel.add(
        new sButton(
          "Reveal",
          c.getRevealSound(),
          BugList.exists(new Bug("Sound", "Mob", c.getID().toString(), "Reveal"))
        )
      );
      mobPanel.add(
        new sButton(
          "MisMatch",
          c.getMisMatchSound(),
          BugList.exists(new Bug("Sound", "Mob", c.getID().toString(), "MisMatch"))
        )
      );
      mobPanel.add(
        new sButton(
          "Match",
          c.getMatchSound(),
          BugList.exists(new Bug("Sound", "Mob", c.getID().toString(), "Match"))
        )
      );
    }
   
    // Create clip panel
    clipPanel = new JPanel();
    clipPanel.setLayout(new GridLayout(1, 0));
   
    // Add the clip sounds to the testing window
    pane.add(new JLabel("Misc. Clips"));
    pane.add(clipPanel);
   
    // Add the sound buttons
    for (Map.Entry<String, OggClip> c : Card.Clips.entrySet()) {
      clipPanel.add(
        new sButton(
          c.getKey(),
          c.getValue(),
          BugList.exists(new Bug("Sound", "Clip", c.getKey()))
        )
      );
    }
   
    // Set the instance variable
View Full Code Here


    Board = new CardButton[BoardSize][BoardSize];
    LinkedList<CardButton> Pool = new LinkedList<CardButton>();
    LinkedList<Integer> Considered = new LinkedList<Integer>();
   
    // Every board should have two creepers :)
    Pool.add(new CardButton(Card.getByID(Card.CREEPER)));
    Pool.add(new CardButton(Card.getByID(Card.CREEPER)));
    Considered.add(Card.CREEPER);
   
    // If the board is big, add Herobrine ;)
    if (BoardSize > Options.toInt(GameSize.C6)) {
      Considered.add(Card.HEROBRINE);
      Pool.add(new CardButton(Card.getByID(Card.HEROBRINE)));
     
      // If the board is bigger, add another Herobrine ;)
      if (BoardSize == Options.toInt(GameSize.C8)) {
        Pool.add(new CardButton(Card.getByID(Card.HEROBRINE)));
      }
    }
   
    // Fill the rest of the pool randomly
    Random rand = new Random(); int randInt;
    while (Pool.size() < Math.pow(BoardSize, 2)) {
      // Randomized range of size-1 because this doesn't include Herobrine
      // Helps limit excess loops, even if just a little :)
      randInt = rand.nextInt(Card.Collection.size() - 1);
      if (!Considered.contains(randInt)) {
        Pool.add(new CardButton(Card.getByID(randInt)));
        Pool.add(new CardButton(Card.getByID(randInt)));
        Considered.add(randInt);
      }
    }
   
    // Shuffle the pool in
View Full Code Here

        System.exit(0);
      }
    }
    else if (e.getSource() == RulesMenuItem) {
      if (GameHandbook.get() == null) {
        new GameHandbook();
      }
      else {
        GameHandbook.get().setVisible(true);
      }
    }
View Full Code Here

        GameHandbook.get().setVisible(true);
      }
    }
    else if (e.getSource() == SoundMenuItem) {
      if (SoundTester.get() == null) {
        new SoundTester();
      }
      else {
        SoundTester.get().setVisible(true);
      }
    }
View Full Code Here

    catch (FileNotFoundException e) { dataError("File Not Found Error", e); }
    catch (IOException e) { dataError("File Read Error", e); }
    catch (JSONException e) { dataError("JSON Parse Error", e); }
   
    // Instantiate the GUI components
    new MainFrame();
   
    // Start a game
    new Game();
  }
View Full Code Here

      if (confirmQuit("New Game")) {
        new Game();
      }
    }
    else if (e.getSource() == OptionsMenuItem) {
      new OptionsDialog();
    }
    else if (e.getSource() == ExitMenuItem) {
      if (confirmQuit("Exit")) {
        System.exit(0);
      }
View Full Code Here

      // Populate a list of Cards with data from the file
      Card.Collection = new LinkedList<Card>();
      JSONArray objects = imgMap.getJSONArray("Objects");
      for (int i = 0; i < objects.length(); ++i) {
        JSONObject obj = objects.getJSONObject(i);
        Card.Collection.add(new Card(obj));
      }
     
      // Load other utility clips
      Card.Clips = new HashMap<String, OggClip>();
      Card.Clips.put("Start", Card.makeOGG("ogg/start.ogg"));
View Full Code Here

        if (JOptionPane.NO_OPTION == Confirmation) {
          Options.Size = newSize;
        }
        else if (JOptionPane.YES_OPTION == Confirmation) {
          Options.Size = newSize;
          new Game();
        }
      }
    }
    else {
      int Confirmation = JOptionPane.showConfirmDialog(this, "Start a new game?", "Options Confirmation", JOptionPane.YES_NO_OPTION);
     
      if (JOptionPane.YES_OPTION == Confirmation) {
        new Game();
      }
    }
  }
View Full Code Here

 
  // ActionListener
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == NewGameMenuItem) {
      if (confirmQuit("New Game")) {
        new Game();
      }
    }
    else if (e.getSource() == OptionsMenuItem) {
      new OptionsDialog();
    }
View Full Code Here

   
    // Instantiate the GUI components
    new MainFrame();
   
    // Start a game
    new Game();
  }
View Full Code Here

TOP

Related Classes of project1.Exercise06_17

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.