1111
1212import javax .swing .JFrame ;
1313import javax .swing .JOptionPane ;
14- import javax .swing .UIManager ;
1514
1615import org .apache .commons .lang3 .text .WordUtils ;
1716
2928import com .redomar .game .net .GameServer ;
3029import com .redomar .game .net .packets .Packet00Login ;
3130import com .redomar .game .script .Printing ;
32- import com .thehowtotutorial .splashscreen .JSplash ;
3331
34- public class Game extends Canvas implements Runnable {
3532
36- private static final long serialVersionUID = 1L ;
37- private static final String game_Version = "v1.5.3 Alpha" ;
33+ public class Game extends Canvas implements Runnable {
3834
3935 // Setting the size and name of the frame/canvas
36+ private static final long serialVersionUID = 1L ;
4037 private static final int WIDTH = 160 ;
4138 private static final int HEIGHT = (WIDTH / 3 * 2 );
4239 private static final int SCALE = 3 ;
@@ -128,7 +125,7 @@ public void init() {
128125 public void setMap (String Map_str ) {
129126 setLevel (new LevelHandler (Map_str ));
130127 setPlayer (new PlayerMP (getLevel (), 100 , 100 , input ,
131- Jdata_UserName , null , -1 ));
128+ getJdata_UserName () , null , -1 ));
132129 level .addEntity (player );
133130 }
134131
@@ -149,12 +146,12 @@ public synchronized void start() {
149146 running = true ;
150147 new Thread (this , "GAME" ).start ();
151148
152- if (Jdata_Host == 0 ) {
149+ if (getJdata_Host () == 0 ) {
153150 socketServer = new GameServer (this );
154151 socketServer .start ();
155152 }
156153
157- setSocketClient (new GameClient (this , Jdata_IP ));
154+ setSocketClient (new GameClient (this , getJdata_IP () ));
158155 getSocketClient ().start ();
159156 }
160157
@@ -310,51 +307,7 @@ public void render() {
310307 }
311308
312309 public static void main (String [] args ) {
313- Menu .main (null );
314- }
315-
316- public static void play (){
317- try {
318- JSplash splash = new JSplash (Game .class .getResource ("/splash/splash.png" ), true , true , false , game_Version , null , Color .RED , Color .ORANGE );
319- splash .toFront ();
320- splash .requestFocus ();
321- splash .splashOn ();
322- splash .setProgress (10 , "Initializing Game" );
323- Thread .sleep (250 );
324- splash .setProgress (25 , "Loading Classes" );
325- Thread .sleep (125 );
326- splash .setProgress (35 , "Applying Configurations" );
327- Thread .sleep (125 );
328- splash .setProgress (40 , "Loading Sprites" );
329- Thread .sleep (250 );
330- splash .setProgress (50 , "Loading Textures" );
331- Thread .sleep (125 );
332- splash .setProgress (60 , "Loading Map" );
333- Thread .sleep (500 );
334- splash .setProgress (80 , "Configuring Map" );
335- Thread .sleep (125 );
336- splash .setProgress (90 , "Pulling InputPanes" );
337- Thread .sleep (250 );
338- splash .setProgress (92 , "Aquring data: Multiplayer" );
339- Thread .sleep (125 );
340- UIManager .setLookAndFeel (UIManager .getSystemLookAndFeelClassName ());
341- Jdata_Host = JOptionPane .showConfirmDialog (getGame (), "Do you want to be the HOST?" );
342- if (Jdata_Host == 1 ){
343- Jdata_IP = JOptionPane .showInputDialog (getGame (), "Enter the name \n leave blank for local" );
344- }
345- Thread .sleep (125 );
346- splash .setProgress (95 , "Aquring data: Username" );
347- Thread .sleep (125 );
348- splash .setProgress (96 , "Initalizing as Server:Host" );
349- Jdata_UserName = JOptionPane .showInputDialog (getGame (), "Enter a name" );
350- splash .setProgress (97 , "Connecting as" + Jdata_UserName );
351- Thread .sleep (250 );
352- splash .splashOff ();
353- new Game ().start ();
354- // new Menu().start();
355- } catch (Exception e ) {
356- e .printStackTrace ();
357- }
310+ new Menu ().start ();
358311 }
359312
360313 public JFrame getFrame () {
@@ -461,4 +414,28 @@ public void setDummy(Dummy dummy) {
461414 this .dummy = dummy ;
462415 }
463416
417+ public static String getJdata_IP () {
418+ return Jdata_IP ;
419+ }
420+
421+ public static void setJdata_IP (String jdata_IP ) {
422+ Jdata_IP = jdata_IP ;
423+ }
424+
425+ public static int getJdata_Host () {
426+ return Jdata_Host ;
427+ }
428+
429+ public static void setJdata_Host (int jdata_Host ) {
430+ Jdata_Host = jdata_Host ;
431+ }
432+
433+ public static String getJdata_UserName () {
434+ return Jdata_UserName ;
435+ }
436+
437+ public static void setJdata_UserName (String jdata_UserName ) {
438+ Jdata_UserName = jdata_UserName ;
439+ }
440+
464441}
0 commit comments