Kontakt

Fakturační údaje

IČ: 87189224, BÚ: 1958653063/0800

Contact info in QR code

Siege (Obkličovačka)

Informace

Stáhni a hraj!

  • Spustitelný soubor hry si stáhnou oba hráči
  • Zakladatel hry
    • V nabídce "Game > Create" vytvoří novou hru
    • Pošle protihráči svou IP adresu (zjistí ji v levém dolním rohu okna)
  • Protihráč
    • Jakmile obdrží IP adresu zakladatele hry, v nabídce "Game > Join" se připojí ke hře
  • Cílem je zabrat co nejvíce soupeřových polí.
  • Pozn.: Síťové spojení funguje na LAN (lokální) síťi a na počítačích s veřejnou IP adresou.

Zdrojové kódy (zip)

Zdrojové kódy (prohlížení)

  1: package siege.gui.views;
  2: 
  3: 
  4: import java.awt.ComponentOrientation;
  5: import java.awt.GridBagConstraints;
  6: import java.awt.GridBagLayout;
  7: import javax.swing.JFrame;
  8: import javax.swing.JLayeredPane;
  9: import javax.swing.JMenuBar;
 10: import siege.util.*;
 11: 
 12: 
 13: /**
 14:  * Main window of application
 15:  * 
 16:  * @author Ondrej Macoszek, ondra@macoszek.cz
 17:  */
 18: public class FrontView extends JFrame
 19: {
 20:     /**
 21:      * Shortcuts to menubar, playboard, territories, chat, status, 
 22:      */
 23:     public MainMenuView mainMenu;
 24:     public PlayboardView playboard;
 25:     public TerritoriesView territories;
 26:     public ChatView chat;
 27:     public StatusView status;
 28: 
 29:     /**
 30:      * Singleton instance
 31:      */
 32:     private static FrontView instance;
 33: 
 34:     /**
 35:      * Constructor
 36:      */
 37:     private FrontView()
 38:     {
 39:         setTitle("Siege");
 40:         setResizable(false);
 41:         setDefaultCloseOperation(EXIT_ON_CLOSE);
 42: 
 43:         // set menu bar
 44:         mainMenu = new MainMenuView();
 45:         setJMenuBar(mainMenu);
 46: 
 47:         // activate layering container
 48:         JLayeredPane layeredPane = new JLayeredPane();
 49:         layeredPane.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
 50:         layeredPane.setLayout(new GridBagLayout());
 51: 
 52:         // grid bag layout settings
 53:         GridBagConstraints gbc = new GridBagConstraints();
 54:         gbc.fill = GridBagConstraints.BOTH;
 55:         gbc.ipady = 0;
 56: 
 57:         // playboard goes top left corner, full width
 58:         gbc.gridwidth = 2;
 59:         gbc.weightx = 0;
 60:         gbc.weighty = 3;
 61:         gbc.gridx = 0;
 62:         gbc.gridy = 0;
 63:         playboard = new PlayboardView();
 64:         layeredPane.add(playboard, gbc, 3);
 65:         territories = new TerritoriesView();
 66:         layeredPane.add(territories, gbc, 2);
 67: 
 68:         // status goes down left
 69:         gbc.gridwidth = 1;
 70:         gbc.weightx = 1;
 71:         gbc.weighty = 1;
 72:         gbc.gridx = 0;
 73:         gbc.gridy = 1;
 74:         status = new StatusView();
 75:         layeredPane.add(status, gbc, 0);
 76: 
 77:         // game panel goes down right
 78:         gbc.gridwidth = 1;
 79:         gbc.weightx = 4;
 80:         gbc.weighty = 1;
 81:         gbc.gridx = 1;
 82:         gbc.gridy = 1;
 83:         chat = new ChatView();
 84:         layeredPane.add(chat, gbc, 0);
 85: 
 86:         // use layering instead default content container
 87:         setContentPane(layeredPane);
 88: 
 89:         pack();
 90:         ViewHelper.centerWindow(this);
 91:         setVisible(true);
 92:     }
 93: 
 94:     /**
 95:      * Get singleton instance
 96:      */
 97:     public static FrontView getInstance()
 98:     {
 99:         if(instance == null) {
100:             instance = new FrontView();
101:         }
102:         return instance;
103:     }
104: 
105:     public void initialize()
106:     {
107:         mainMenu.initialize();
108:         playboard.initialize();
109:         territories.initialize();
110:         chat.initialize();
111:         status.initialize();
112:         Log.message(this,"initialize");
113:     }
114: }
115: