⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jmps.java

📁 一个j2me的滑雪游戏
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
/*
--  http://www2.r-force.co.jp/iapp/java/047/
--  http://www2.r-force.co.jp/iapp/java/JMP/
--
*/

import java.util.Random;
import com.nttdocomo.ui.*;
import com.nttdocomo.io.*;
import java.io.*;
import javax.microedition.io.*;

public class JMPS extends Canvas
{

//	private static int Ver = 0x2041;
//	private static int len = 9653;
//	of = 8744;

  private	static com.nttdocomo.io.HttpConnection conn;
  private	static byte buf[];
  private	static DataOutputStream out;
  private	static DataInputStream in;

//	private final static int KL = ( 1 << Display.KEY_1 | 1 << Display.KEY_4 | 1 << Display.KEY_7 | 1 << Display.KEY_LEFT );// KL 65682
//	private final static int KR = ( 1 << Display.KEY_3 | 1 << Display.KEY_6 | 1 << Display.KEY_9 | 1 << Display.KEY_RIGHT );// KR 262728
//	private final static int KU = ( 1 << Display.KEY_2 | 1 << Display.KEY_UP );// KU 131076
//	private final static int KD = ( 1 << Display.KEY_8 | 1 << Display.KEY_DOWN );// KD 524544
//	private final static int KC = ( 1 << Display.KEY_5 | 1 << Display.KEY_SELECT );// KC Com[4]
//	private final static int SL = ( 1 << Display.KEY_SOFT1 );// SL:2097152
//	private final static int SR = ( 1 << Display.KEY_SOFT2 );// SR:4194304


	// 僼僅儞僩愝掕
	private static Font 		NF;
	private static Image[] 		I;
	private static Random 		R;
	private static Dialog 		d;



	// 僎乕儉拞偺埬撪暥帤楍
	private static String[] 	Sys;


	// 僎乕儉儌乕僪
	private static int 		GM;


	private static int 		nSel;

	private static int 		ResCnt;
	private static int 		nStage;
	private static int 		Frame;
	private static int 		LineX, LineY, LineOY;//, RedLine;// 僎儗儞僨儔僀儞
	private static int		nScroll;// 僎儗儞僨偺僗僋儘乕儖嫍棧
	private static int 		CVY;// 僉儍儔懍搙倄
	private static int		Pow;
	private static int		Wind, WindPow, WindTime, WindUD, WindLR, WindLRPow;// 晽偺岦偒丄晽偺嫮偝丄僞僀儈儞僌丄忋壓曽岦丄嵍塃曽岦椡
	private static int		Kaisuu;// 乣杮栚
	private static int		Kyori, Hikyori, Hikei, RedPoint;// 旘嫍棧丄旘宆揰
	private static int 		FirstKyori, HowTo;
	private static int		PXY, JX, OffJP;
	private static int		fClear;// 僋儕傾乕僼儔僌
//	private static int		cR, cG, cB;// 怓
	// 僗僋儕乕儞僆僼僙僢僩
	private static int[] 		Scr;
	// 僇儔乕
	private static int[] 		C;
	private static int[] 		Key;
	private static int[] 		WCur;
	private static int[]		nScore;
	private static int[]		Head;



	private static int[] 		VSList;// VS 儕僗僩
	private static int[] 		icList;
	private static int[]		CupTime;
	private static int[]		CpuScore;
	private static int[]		Meter;// 僶儔儞僗儊乕僞
	private static int[]		Power;// MaxPower
	private static int[]		WindSpeed;// 僶儔儞僗僗僺乕僪
	private static int[]		Ending;// 僄儞僨傿儞僌
	private static int[]		Temp;



	private static byte		Pallete[][];
	private static byte 		header[][];
	private static byte 		img[][];
	private static boolean[] 	GF;

/*
					0.弶夞
					0-9.昤夋
					10.夋憸儘乕僪僼儔僌
					11.憡庤慖傃
					12.僥儗億乕僘
					13.塅拡恖僙儗僋僩
					14.How To
					15.How To
					16.How To
					17.夋憸儘乕僪
*/

//############################################################## 僐儞僗僩儔僋僞 ##########################################################################
  public JMPS()
  {
//      try
//      {

      System.gc();
	Scr = new int[3];
	Sys = new String[5 + 106];
	C = new int[6];
	Key = new int[4];
	WCur = new int[6];
	nScore = new int[4 + 8];// 0-3.僎乕儉拞丄 4.旘嫍棧丄5.摼揰丄6.嵟崅旘嫍棧丄7.嵟崅摼揰丄8.嫍棧偺崙丄9.摼揰偺崙, 10.嵟崅摼揰崙丄11.嵟崅旘嫍棧崙
	Head = new int[16];

	VSList = new int[8];
//	SaveList = new int[8];
	CupTime = new int[11];
	CpuScore = new int[60];
//	SSave = new int[3];
	Meter = new int[12];
	Power = new int[8];
	WindSpeed = new int[24];
	Ending = new int[9];
	Temp = new int[11];
	GF = new boolean[19];
	Pallete = new byte[8][21];

  // 夋柺偺僆僼僙僢僩抣
  Scr[0] = ( Display.getWidth() - 120) / 2;

  Scr[1] = ( Display.getHeight() - 120) / 2;


	C[0] = Graphics.getColorOfRGB( 255, 255, 255 );// 敀
	C[1] = Graphics.getColorOfRGB( 255, 166,  49 );// 烌
	C[2] = Graphics.getColorOfRGB( 181, 202, 255 );// 敄偄惵
	C[3] = Graphics.getColorOfRGB( 255,  95,  63 );// 榞侾
	C[4] = Graphics.getColorOfRGB( 255,  63,  95 );// 榞俀
//	C[5] = Graphics.getColorOfRGB( 255,   0,   0 );// 愒



  // 杴梖彂懱
      NF = Font.getFont( Font.FACE_SYSTEM | Font.STYLE_BOLD | Font.SIZE_SMALL );

  // 僔僗僥儉暥帤楍//
  Sys[0] = "scratchpad:///0";
	Sys[2] = "";
//	Sys[3]; // 僟僀傾儘僌傔偭偣乕偠
	Sys[4] = ";pos=";


	GM = -10;
	R = new Random( new java.util.Date().getTime() );
  }


//############################################################## 弶婜壔 ##########################################################################
	public void initAll( String URL )
	{
		int i, j, n, hc;//, cnt;
//	        MediaImage mimg;
		//	boolean fFirst = false;

		Sys[1] = URL;
		GF[1] = true;

		// 僗僋儔僢僠僷僢僪傊偺僨乕僞憲怣仌撉傒崬傒
		try
		{
			in = Connector.openDataInputStream( Sys[0] );

			if ( in.readShort() != 0x2041 ) //僗僋儔僢僠僷僢僪僿僢僟
			{
				GF[0] = true;
				Draw();
				in.close();

				// 愙懕
				conn = (com.nttdocomo.io.HttpConnection)Connector.open( URL + "JMP.spf", Connector.READ, true);

				// 儊僜僢僪僎僢僩
				conn.setRequestMethod( com.nttdocomo.io.HttpConnection.GET );

				// 愙懕
				conn.connect();

				System.gc();
				// 僨乕僞挿偝僎僢僩
				j = (int)conn.getLength();
				// 僨乕僞僎僢僩
				System.gc();
				buf = new byte[j];
//				InputStream indata;
				in = conn.openDataInputStream();
				in.read(buf);
				in.close();
				conn.close();



				if( 0 != ResCnt )
				throw new Exception();


				System.gc();
				out = Connector.openDataOutputStream( Sys[0] );

				out.write( buf );

				// 僗僐傾偺僋儕傾乕
				System.gc();
				buf = new byte[25];
				out.write( buf );

				out.close();

			}else in.close();

			System.gc();
			in = Connector.openDataInputStream( Sys[0] );


//			in.readShort();// 僿僢僟
			in.readInt();// 僿僢僟
			in.readInt();// 嬻偒

//			len = in.readShort();
//				System.err.println( len );


			//僶僀僫儕僨乕僞僆僼僙僢僩
			hc = in.readShort();

			//僀儊乕僕僨乕僞僽儘僢僋偺撉傒弌偟
			//僿僢僟悢
			hc = in.readByte();
			header = new byte[ hc ][];
			icList = new int[ hc ];


			//憤僀儊乕僕悢
			i = in.readByte();


			img = new byte[ i ][];
			I = new Image[ i ];
			n = 0;

			for( j = 0; j < hc; j++ )
			{
				System.gc();
				//嫟捠僿僢僟晹
				i = in.readShort();
				header[ j ] = new byte[ i ];
				

				in.read( header[j] );

				//僀儊乕僕悢
				icList[j] = in.readByte();
//				System.err.println( "icList[" + j + "] = " + icList[j] );
				//僀儊乕僕僨乕僞儘乕僪
				for(i=0; i<icList[j]; i++)
				{
					System.gc();
					img[n] = new byte[in.readShort()];
					in.read(img[n++]);
				}
//				System.err.println(  );
			}

			in.readShort();

			// 暥帤楍傪撉傒崬傒侓
			j = in.readShort();
			for( i = 0; i < j; i++ ){
				System.gc();
				buf = new byte[in.readByte()];
				in.read( buf );
				System.gc();
				Sys[5 + i] = new String( buf );
//				System.err.println( "Sys[" + ( 5 + i ) + "] = " + Sys[5 + i] );
			}


			// 僶僀僫儕僨乕僞
			for( i = 0; i < 6; i++ ) WCur[i] = in.readByte();	// 崙婙偺嵗昗
			for( i = 0; i < 11; i++ ) CupTime[i] = in.readByte();	// 儔僀僶儖僉儍儔偺塀偟埵抲
			for( i = 0; i < 60; i++ ) CpuScore[i] = in.readByte();	// 儔僀僶儖僉儍儔偺僗僐傾
			for( i = 0; i < 16; i++ ) Head[i] = in.readByte();	// 摢嵗昗
			for( i = 0; i < 12; i++ ) Meter[i] = in.readByte();	// 僶儔儞僗儊乕僞乕偺嵗昗偲暆
			for( i = 0; i < 8; i++ ) Power[i] = in.readByte();	// 崙暿偺MAX僷儚乕
			for( i = 0; i < 24; i++ ) WindSpeed[i] = in.readByte();	// 崙暿偺僶儔儞僗僶乕偺怳傝僗僺乕僪
			for( i = 0; i < 9; i++ ) Ending[i] = in.readByte();	// 僄儞僨傿儞僌揾傝偮傇偟嵗昗
			for( i = 0; i < 8; i++ ) in.read( Pallete[i] );		// 崙暿僷儗僢僩


			// 僙乕僽僗僐傾
			nScore[4] = in.readInt( );// 嫍棧			4
			nScore[5] = in.readInt( );// 摼揰			8
			nScore[6] = in.readInt( );// 嵟嫮旘嫍棧			12
			nScore[7] = in.readInt( );// 嵟崅摼揰			16
			nScore[8] = in.readByte( );// 嫍棧崙			17
			nScore[9] = in.readByte( );// 摼揰崙			18
			nScore[10] = in.readByte( );// 嵟崅嫍棧崙		17
			nScore[11] = in.readByte( );// 嵟崅摼揰崙		18
			fClear = in.readByte( );// 僋儕傾乕僼儔僌		19

//		for( i = 0; i < 8; i++ ) System.err.println( nScore[4 + i] );

			in.close();


			i = URL.indexOf( Sys[20] ) + 5;// java/047/
			Sys[1] = URL.substring( 0, i );

			if( GF[0] ){

				i = URL.indexOf( Sys[21] ) + 1;// /java
				conn = (com.nttdocomo.io.HttpConnection)Connector.open( URL.substring( 0, i ) + Sys[6], Connector.READ, true);

				// 儊僜僢僪僎僢僩
				conn.setRequestMethod( com.nttdocomo.io.HttpConnection.GET );
				// 愙懕
				conn.connect();
				// 挿偝偺庢摼
				i = (short)conn.getLength();
				System.gc();
				// 暥帤楍挿偝傪僎僢僩
				buf = new byte[i];
				// 僨乕僞傪奐偔
				in = conn.openDataInputStream();
				// 僶僀僩暥偺僨乕僞傪撉傓
				in.read( buf );
				// 僼傽僀儖傪暵偠傞
				in.close();
				// 愙懕傪偒傞
				conn.close();

				if( 0 != ResCnt )
				throw new Exception();

				// 儊僢僙乕僕傪摼傞
				Sys[3] = new String(buf);

			
				if( Sys[3].startsWith( Sys[8] ))// 儊儞僥 NG-1
				{
					Sys[3] = Sys[19];//Sys[62];
					DrawD();
					IApplication.getCurrentApp().terminate();
				}
				if( Sys[3].startsWith( Sys[9] ) )// 儅僀儊僯儏乕僠僃僢僋
				{
					Sys[3] = Sys[17];//Sys[62];
					DrawD();
					IApplication.getCurrentApp().terminate();
				}





				// 僱僢僩儚乕僋僗僐傾偺庢摼
				System.gc();
				conn = (com.nttdocomo.io.HttpConnection)Connector.open( Sys[1] + Sys[24], Connector.READ, true);

				conn.setRequestMethod( com.nttdocomo.io.HttpConnection.GET );
				conn.connect();
				System.gc();
				buf = new byte[ (int)conn.getLength() ];
				in = conn.openDataInputStream();
				in.read( buf );
				in.close();
				conn.close();

				if( 0 != ResCnt )
					throw new Exception();

				Sys[3] = new String(buf);

				if( Sys[3].startsWith( Sys[8] ))// 儊儞僥 NG-1
				{
					Sys[3] = Sys[19];//Sys[62];
					DrawD();
					IApplication.getCurrentApp().terminate();
				}
				// 儅僀儊僯儏乕僠僃僢僋
				if( Sys[3].startsWith( Sys[9] ) )// 儅僀儊僯儏乕僠僃僢僋
				{
					Sys[3] = Sys[17];//Sys[62];
					DrawD();
					IApplication.getCurrentApp().terminate();
				}

				Sys[3] = Sys[3].substring( 3 );


				for( i = 0; i < 7; i++ ){
					// 帺暘僗僐傾
					nScore[4 + i] = Integer.parseInt( Sys[3].substring( 0, Sys[3].indexOf( " " ) ).trim() );// 
					Sys[3] = Sys[3].substring( Sys[3].indexOf( " " ) + 1 );
				}
//				nScore[4 + i] = Integer.parseInt( Sys[3].substring( Sys[3].indexOf( " " ) + 1 ) );// 
				nScore[4 + i] = Integer.parseInt( Sys[3] );// 

				Save();




				// 僿僢僟偺彂偒姺偊
				System.gc();
				out = Connector.openDataOutputStream( Sys[0] );

				out.writeShort( 0x2041 );
				out.close();


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -