Package game

Examples of game.Inventory


   * updates the item names, weight, and amounts
   */
  public void update(){
   
    int inventoryLength = World.getWagon().getInventory().getLength();
    Inventory inv = World.getWagon().getInventory();
    int amount, weight;
    String name;
   
    for(int i=0; i<inventoryLength; i++)
    {
      amount = inv.getItem(i).getNumber();
      weight = inv.getItem(i).getWeight();
      name = inv.getItem(i).getName();
     
      lblItemsname[i].setText(name);
      lblItemswt[i].setText(""+weight*amount);
      lblItemsamt[i].setText(""+amount);
      if(amount != 0)
View Full Code Here


    Label lblButton = new Label(this, SWT.NONE);
    lblButton.setText("");
   
   
    int inventoryLength = World.getWagon().getInventory().getLength();
    Inventory inv = World.getWagon().getInventory();
    String name;
    lblItemsname = new Label[inventoryLength];
    lblItemswt = new Label[inventoryLength];
    lblItemsamt = new Label[inventoryLength];
    btnItems = new Button[inventoryLength];
View Full Code Here

   */
  public Wagon() {
    capacity = 3500; //this should just stay here.
    distance = 0;
    totalWeight = 0;
    inventory = new Inventory();
  }
View Full Code Here

    this.capacity = capacity;
    this.leader = leader;
    this.members = members;
    distance = 0;
    totalWeight = 0;
    inventory = new Inventory();
  }
View Full Code Here

  public void update() {
   
    lastIndex = -1;
   
    if(currentStore != null) {
      Inventory tempInv = currentStore.getInventory();
      //System.out.println(tempInv+"\n\n");
      String[] items = new String[tempInv.getLength()];
      for(int x = 0; x < tempInv.getLength(); x++) {
        items[x] = tempInv.getItem(x).getName();
      }
      list.setItems(items);
      lblResponse.setText("Welcome to "+currentStore.getName()+"!");
    }
    else
View Full Code Here

 
  /**
   * reset wagon inventory
   */
  public void resetInventory(){
    inventory = new Inventory();
  }
View Full Code Here

   
    list = new List(this, SWT.BORDER);
    String[] items = defaultItems;
   
    if(currentStore != null) {
      Inventory tempInv = currentStore.getInventory();
      items = new String[tempInv.getLength()];
      for(int x = 0; x < tempInv.getLength(); x++) {
        items[x] = tempInv.getItem(x).getName();
      }
    }
   
    list.setItems(items);
    list.setBounds(33, 10, 141, 229);
View Full Code Here

TOP

Related Classes of game.Inventory

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.