1111
1212import javax .swing .JFrame ;
1313import javax .swing .JOptionPane ;
14- import javax .swing .UIManager ;
1514
1615import org .apache .commons .lang3 .text .WordUtils ;
1716
2423import com .redomar .game .lib .Font ;
2524import com .redomar .game .lib .Music ;
2625import com .redomar .game .lib .Time ;
26+ import com .redomar .game .menu .Menu ;
2727import com .redomar .game .net .GameClient ;
2828import com .redomar .game .net .GameServer ;
2929import com .redomar .game .net .packets .Packet00Login ;
3030import com .redomar .game .script .Printing ;
31- import com .thehowtotutorial .splashscreen .JSplash ;
3231
33- public class Game extends Canvas implements Runnable {
3432
33+ public class Game extends Canvas implements Runnable {
34+
35+ // Setting the size and name of the frame/canvas
3536 private static final long serialVersionUID = 1L ;
3637 private static final String game_Version = "v1.6.1 Alpha" ;
37-
38- // Setting the size and name of the frame/canvas
3938 private static final int WIDTH = 160 ;
4039 private static final int HEIGHT = (WIDTH / 3 * 2 );
4140 private static final int SCALE = 3 ;
@@ -127,7 +126,7 @@ public void init() {
127126 public void setMap (String Map_str ) {
128127 setLevel (new LevelHandler (Map_str ));
129128 setPlayer (new PlayerMP (getLevel (), 100 , 100 , input ,
130- Jdata_UserName , null , -1 ));
129+ getJdata_UserName () , null , -1 ));
131130 level .addEntity (player );
132131 }
133132
@@ -148,12 +147,12 @@ public synchronized void start() {
148147 running = true ;
149148 new Thread (this , "GAME" ).start ();
150149
151- if (Jdata_Host == 0 ) {
150+ if (getJdata_Host () == 0 ) {
152151 socketServer = new GameServer (this );
153152 socketServer .start ();
154153 }
155154
156- setSocketClient (new GameClient (this , Jdata_IP ));
155+ setSocketClient (new GameClient (this , getJdata_IP () ));
157156 getSocketClient ().start ();
158157 }
159158
@@ -309,51 +308,7 @@ public void render() {
309308 }
310309
311310 public static void main (String [] args ) {
312- play ();
313- }
314-
315- public static void play (){
316- try {
317- JSplash splash = new JSplash (Game .class .getResource ("/splash/splash.png" ), true , true , false , game_Version , null , Color .RED , Color .ORANGE );
318- splash .toFront ();
319- splash .requestFocus ();
320- splash .splashOn ();
321- splash .setProgress (10 , "Initializing Game" );
322- Thread .sleep (250 );
323- splash .setProgress (25 , "Loading Classes" );
324- Thread .sleep (125 );
325- splash .setProgress (35 , "Applying Configurations" );
326- Thread .sleep (125 );
327- splash .setProgress (40 , "Loading Sprites" );
328- Thread .sleep (250 );
329- splash .setProgress (50 , "Loading Textures" );
330- Thread .sleep (125 );
331- splash .setProgress (60 , "Loading Map" );
332- Thread .sleep (500 );
333- splash .setProgress (80 , "Configuring Map" );
334- Thread .sleep (125 );
335- splash .setProgress (90 , "Pulling InputPanes" );
336- Thread .sleep (250 );
337- splash .setProgress (92 , "Aquring data: Multiplayer" );
338- Thread .sleep (125 );
339- UIManager .setLookAndFeel (UIManager .getSystemLookAndFeelClassName ());
340- Jdata_Host = JOptionPane .showConfirmDialog (getGame (), "Do you want to be the HOST?" );
341- if (Jdata_Host == 1 ){
342- Jdata_IP = JOptionPane .showInputDialog (getGame (), "Enter the name \n leave blank for local" );
343- }
344- Thread .sleep (125 );
345- splash .setProgress (95 , "Aquring data: Username" );
346- Thread .sleep (125 );
347- splash .setProgress (96 , "Initalizing as Server:Host" );
348- Jdata_UserName = JOptionPane .showInputDialog (getGame (), "Enter a name" );
349- splash .setProgress (97 , "Connecting as" + Jdata_UserName );
350- Thread .sleep (250 );
351- splash .splashOff ();
352- new Game ().start ();
353- // new Menu().start();
354- } catch (Exception e ) {
355- e .printStackTrace ();
356- }
311+ new Menu ().start ();
357312 }
358313
359314 public JFrame getFrame () {
@@ -460,4 +415,32 @@ public void setDummy(Dummy dummy) {
460415 this .dummy = dummy ;
461416 }
462417
418+ public static String getJdata_IP () {
419+ return Jdata_IP ;
420+ }
421+
422+ public static void setJdata_IP (String jdata_IP ) {
423+ Jdata_IP = jdata_IP ;
424+ }
425+
426+ public static int getJdata_Host () {
427+ return Jdata_Host ;
428+ }
429+
430+ public static void setJdata_Host (int jdata_Host ) {
431+ Jdata_Host = jdata_Host ;
432+ }
433+
434+ public static String getJdata_UserName () {
435+ return Jdata_UserName ;
436+ }
437+
438+ public static void setJdata_UserName (String jdata_UserName ) {
439+ Jdata_UserName = jdata_UserName ;
440+ }
441+
442+ public static String getGameVersion () {
443+ return game_Version ;
444+ }
445+
463446}
0 commit comments