Ejemplo n.º 1
0
public class InventoryList extends JPanel {
  public static final int EQUIPMENT = 3;
  public static final int STORE = 13;
  public static final int HOME = 6;
  public static final ImageIcon PCI = ImageLoader.getImageIcon("images/pci.png");
  public static final ImageIcon FOLDER = ImageLoader.getImageIcon("images/folderBig.png");
  public static final ImageIcon TEXT = ImageLoader.getImageIcon("images/textfile.png");
  public static final ImageIcon FIREWALL = ImageLoader.getImageIcon("images/firewallHome.png");
  public static final ImageIcon SCRIPT = ImageLoader.getImageIcon("images/scriptHome.png");
  private int x = 2, y = 5, last = 0, count = EQUIPMENT;
  private boolean paint = true;

  public InventoryList() {
    setLayout(null);
  }

  // public void setInventory(

  public void addInventory(Inventory inv) {
    add(inv);
    inv.setBounds(x, y, 47, 42);
    if (last != count) {
      x += 50;
      last += 1;
    } else {
      x = 2;
      y += 50;
      last = 0;
    }
    setPreferredSize(new Dimension(82 * count, y + 30));
  }

  public void setPaint(boolean paint) {
    this.paint = paint;
  }

  public void setCount(int count) {
    this.count = count;
  }

  public void reset() {
    removeAll();
    x = 2;
    y = 5;
    last = 0;
    repaint();
  }

  public void paintComponent(Graphics g) {
    if (paint) {
      try {
        Rectangle vis = getVisibleRect();
        File fi = ImageLoader.getFile("images/inventoryback.png");
        BufferedImage bg = ImageIO.read(fi.toURL());
        g.drawImage(bg, vis.x, vis.y, null);
      } catch (Exception e) {
      }
    }
  }
}
Ejemplo n.º 2
0
 public void paintComponent(Graphics g) {
   if (paint) {
     try {
       Rectangle vis = getVisibleRect();
       File fi = ImageLoader.getFile("images/inventoryback.png");
       BufferedImage bg = ImageIO.read(fi.toURL());
       g.drawImage(bg, vis.x, vis.y, null);
     } catch (Exception e) {
     }
   }
 }
Ejemplo n.º 3
0
  public NetworkMapPanel(Hacker hacker, MapPanel mapPanel) {

    Dimension mapsize = mapPanel.networkPanel.getSize();
    double h = mapsize.getHeight();
    System.out.println(h);
    float multi = 400;
    HashMap<String, NetworkButton> networks = new HashMap<String, NetworkButton>();
    networks.put(
        "UGOPNet",
        new NetworkButton(
            "UGOPNet",
            3.0f,
            2.25f,
            1.1f,
            new Color(0, 0, 204),
            "images/browserhome.png",
            hacker,
            multi));
    networks.put(
        "SubNet",
        new NetworkButton(
            "SubNet", 3.0f, 3.5f, 1, new Color(0, 0, 150), "images/down.png", hacker, multi));
    networks.put(
        "ProgNet",
        new NetworkButton(
            "ProgNet", 3.5f, 3.0f, 1, new Color(0, 0, 150), "images/script.png", hacker, multi));
    networks.put(
        "DarkNet",
        new NetworkButton(
            "DarkNet", 3.0f, 4.0f, 0.9f, new Color(50, 50, 50), "images/exit.png", hacker, multi));
    networks.put(
        "LunarMicrosystems",
        new NetworkButton(
            "LunarMicrosystems",
            2,
            4.5f,
            1,
            new Color(0, 153, 255),
            "images/cpu.png",
            hacker,
            multi));
    networks.put(
        "DoSC",
        new NetworkButton(
            "DoSC", 2.25f, 3.25f, 1, new Color(0, 0, 204), "images/firewall.png", hacker, multi));
    networks.put(
        "DTNet",
        new NetworkButton(
            "DTNet",
            2.0f,
            2.0f,
            1,
            new Color(100, 100, 100),
            "images/ducttape.png",
            hacker,
            multi));
    networks.put(
        "GeNet",
        new NetworkButton(
            "GeNet",
            1.0f,
            2.0f,
            1,
            new Color(100, 100, 100),
            "images/germanium.png",
            hacker,
            multi));
    networks.put(
        "SiNet",
        new NetworkButton(
            "SiNet", 1.0f, 3.0f, 1, new Color(100, 100, 100), "images/silicon.png", hacker, multi));
    networks.put(
        "YBCONet",
        new NetworkButton(
            "YBCONet", 0.5f, 2.5f, 1, new Color(100, 100, 100), "images/YBCO.png", hacker, multi));
    networks.put(
        "PuNet",
        new NetworkButton(
            "PuNet",
            0,
            2.0f,
            0.8f,
            new Color(100, 100, 100),
            "images/plutonium.png",
            hacker,
            multi));
    networks.put(
        "UND",
        new NetworkButton(
            "UND", 3.5f, 3.5f, 1, new Color(0, 0, 204), "images/firewall.png", hacker, multi));
    networks.put(
        "UniversityNet",
        new NetworkButton(
            "UniversityNet",
            4.5f,
            2.0f,
            1.0f,
            new Color(0, 0, 204),
            "images/browser.png",
            hacker,
            multi));
    networks.put(
        "DoSCDataBank",
        new NetworkButton(
            "DoSCDatabank",
            1.75f,
            2.5f,
            1.3f,
            new Color(0, 0, 204),
            "images/compile.png",
            hacker,
            multi));
    networks.put(
        "DoSCBank",
        new NetworkButton(
            "DoSCBank", 2.5f, 2.0f, 1, new Color(0, 0, 204), "images/bank.png", hacker, multi));
    networks.put(
        "ArenaNet",
        new NetworkButton(
            "ArenaNet", 4.5f, 3.0f, 1, new Color(204, 0, 0), "images/attack.png", hacker, multi));
    networks.put(
        "TheArena",
        new NetworkButton(
            "TheArena", 4.0f, 4.0f, 1, new Color(204, 0, 0), "images/attack.png", hacker, multi));
    networks.put(
        "LunarCreditUnion",
        new NetworkButton(
            "LunarCreditUnion",
            2.5f,
            4,
            1,
            new Color(0, 153, 255),
            "images/pettycash.png",
            hacker,
            multi));
    networks.put(
        "SpyNet",
        new NetworkButton(
            "SpyNet",
            3.0f,
            4.0f,
            1,
            new Color(200, 200, 200),
            "images/watchIcon.png",
            hacker,
            multi));
    networks.put(
        "LunarDatabank",
        new NetworkButton(
            "LunarDatabank",
            1.0f,
            4.5f,
            1.4f,
            new Color(0, 153, 255),
            "images/bank.png",
            hacker,
            multi));
    networks.put(
        "LunarCorporate",
        new NetworkButton(
            "LunarCorporate", 0, 6.0f, 1, new Color(0, 153, 255), "images/hd.png", hacker, multi));
    networks.put(
        "LunarLabs",
        new NetworkButton(
            "LunarLabs",
            2.5f,
            5.0f,
            1,
            new Color(0, 153, 255),
            "images/repair.png",
            hacker,
            multi));
    networks.put(
        "LunarSpecOps",
        new NetworkButton(
            "LunarSpecOps",
            1f,
            6.0f,
            1,
            new Color(0, 153, 255),
            "images/watchIcon.png",
            hacker,
            multi));
    networks.put(
        "LunarSat",
        new NetworkButton(
            "LunarSat", 0.25f, 5.0f, 1, new Color(0, 153, 255), "images/scan.png", hacker, multi));
    networks.put(
        "LunarColonies",
        new NetworkButton(
            "LunarColonies",
            1.0f,
            5.5f,
            1,
            new Color(0, 153, 255),
            "images/new.png",
            hacker,
            multi));
    networks.put(
        "UGoPIntranet",
        new NetworkButton(
            "UGoPIntranet", 2.5f, 1, 1, new Color(0, 0, 204), "images/http.png", hacker, multi));
    networks.put(
        "UGoPCorporate",
        new NetworkButton(
            "UGoPCorporate", 3.0f, 0, 1, new Color(0, 0, 204), "images/hd.png", hacker, multi));
    networks.put(
        "UGoPDatabank",
        new NetworkButton(
            "UGoPDatabank",
            2.75f,
            1.5f,
            1.2f,
            new Color(0, 0, 204),
            "images/compile.png",
            hacker,
            multi));
    networks.put(
        "UGoPVault",
        new NetworkButton(
            "UGoPVault", 3.0f, 1.0f, 1, new Color(0, 0, 204), "images/bank.png", hacker, multi));
    networks.put(
        "TerrorNet",
        new NetworkButton(
            "TerrorNet",
            5.5f,
            5.0f,
            0.9f,
            new Color(204, 0, 0),
            "images/refresh.png",
            hacker,
            multi));
    networks.put(
        "TerrorStash",
        new NetworkButton(
            "TerrorStash", 4.5f, 4.5f, 1, new Color(204, 0, 0), "images/bank.png", hacker, multi));
    networks.put(
        "TerrorWeaponsNet",
        new NetworkButton(
            "TerrorWeaponsNet",
            5.0f,
            4.0f,
            1,
            new Color(204, 0, 0),
            "images/attack.png",
            hacker,
            multi));
    networks.put(
        "TerrorLeaders",
        new NetworkButton(
            "TerrorLeaders",
            6,
            6.0f,
            0.75f,
            new Color(204, 0, 0),
            "images/firewall.png",
            hacker,
            multi));
    networks.put(
        "InnerCircle",
        new NetworkButton(
            "InnerCircle",
            6,
            0,
            0.5f,
            new Color(150, 0, 100),
            "images/decompile.png",
            hacker,
            multi));
    networks.put(
        "LawNet",
        new NetworkButton(
            "LawNet",
            4.0f,
            1.5f,
            0.75f,
            new Color(150, 0, 100),
            "images/redirect.png",
            hacker,
            multi));
    networks.put(
        "GroundZero",
        new NetworkButton(
            "GroundZero",
            3.0f,
            5.5f,
            1,
            new Color(200, 200, 200),
            "images/ports.png",
            hacker,
            multi));
    networks.put(
        "Wastelands",
        new NetworkButton(
            "Wastelands",
            3.5f,
            4.5f,
            1.2f,
            new Color(204, 0, 0),
            "images/attack.png",
            hacker,
            multi));
    networks.put(
        "JuniperPenetentiary",
        new NetworkButton(
            "JuniperPenetentiary",
            7,
            0,
            0.75f,
            new Color(150, 0, 100),
            "images/firewall.png",
            hacker,
            multi));

    this.nodeList = networks;
    this.hacker = hacker;
    this.mapPanel = mapPanel;
    try {
      back = ImageLoader.getImage("images/NetMapFull.png");
    } catch (Exception e) {
    }
    setLayout(null);
    setBackground(MapPanel.NETWORK_INFO_BACKGROUND);
    setPreferredSize(new Dimension(back.getWidth(), back.getHeight()));

    populate();
  }