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

📄 eventwindow.java

📁 国外人写的操作感挺好的一款滑雪游戏.结构也比较清楚
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
private static final int STRING_SELECT_SCORE = 8;
private static final int STRING_SELECT_NEW_SCORE = 9;
private static final int STRING_ONLINE_SEARCH = 10;
private static final int STRING_NOT_FOUND = 11;
private static final int STRING_NO_ONLINE_RECORDS = 12;
private static final int STRING_CHANGE_ONLINE_NAME = 13;
private static final int STRING_LOCAL_TOP_TEN = 14;
private static final int STRING_ONLINE_TOP_TEN = 15;
private static final int STRING_LOCAL_GAME = 16;
private static final int STRING_ONLINE_GAME = 17;
private static final int STRING_NETWORK_ERROR = 18;
private static final int STRING_SETTING_NAME = 19;
private static final int STRING_GETTING_NAME = 20;
private static final int STRING_GETTING_SCORES = 21;
private static final int STRING_GETTING_SCORE = 22;
private static final int STRING_SENDING_SCORE = 23;
private static final int STRING_GETTING_RANK = 24;
private static final int STRING_NEW_HIGH_SCORE = 25;
private static final int STRING_NOT_YOUR_BEST = 26;
private static final int STRING_TRY_AGAIN = 27;
private static final int STRING_NO_LOCAL_RECORDS = 28;
private static final int STRING_NEW_LOCAL_RECORD = 29;
private static final int STRING_SELECT_COUNTRY = 30;
private static final int STRING_QUIT_COMPETITION = 31;
private static final int STRING_ABOUT = 32;
private static final int STRING_HELP = 33;
private static final int STRING_RECORDS = 34;
private static final int STRING_EXIT = 35;
private static final int STRING_MISS = 36;
private static final int STRING_ENTER_NAME = 37;
private static final int STRING_SELECT_EVENT = 38;
private static final int STRING_EVENT_RESULTS = 39;
private static final int STRING_PLAY = 40;
private static final int STRING_INSTRUCTIONS = 41;
private static final int STRING_SETTINGS = 42;
private static final int STRING_SELECT_NEW_EVENT = 43;
private static final int STRING_EVENT0 = 44;
private static final int STRING_EVENT1 = 45;
private static final int STRING_EVENT2 = 46;
private static final int STRING_MEDAL_CEREMONY = 47;
private static final int STRING_HELPTEXT_EVENT0 = 48;
private static final int STRING_HELPTEXT_EVENT1 = 49;
private static final int STRING_HELPTEXT_EVENT2 = 50;
private static final int STRING_HELPTEXT_MAIN = 51;
private static final int STRING_RANK = 52;
private static final int STRING_SOUND = 53;
private static final int STRING_RESET_RECORDS = 54;
private static final int STRING_CANCEL_MRC = 55;
private static final int STRING_ON = 56;
private static final int STRING_OFF = 57;
private static final int STRING_TIPS = 58;
private static final int STRING_ARE_YOU_SURE = 59;
private static final int STRING_NEXT_UP = 60;
private static final int STRING_SELECT_PLAYERS = 61;
private static final int STRING_PLAYER = 62;
private static final int STRING_PLAYERS = 63;
private static final int STRING_FIRSTATTEMPT = 64;
private static final int STRING_SECONDATTEMPT = 65;
private static final int STRING_THIRDATTEMPT = 66;
private static final int STRING_SCORE = 67;
private static final int STRING_DISTANCE = 68;
private static final int STRING_STYLE = 69;
private static final int STRING_OUCH = 70;
private static final int STRING_FIRSTPLACE = 71;
private static final int STRING_SECONDPLACE = 72;
private static final int STRING_THIRDPLACE = 73;
private static final int STRING_READY = 74;
private static final int STRING_SET = 75;
private static final int STRING_GO = 76;
private static final int STRING_EMPTY = 77;
private static final int STRING_BOLT_OPEN = 78;
private static final int STRING_LOADED = 79;
private static final int STRING_FAULT = 80;
private static final int STRING_YES = 81;
private static final int STRING_NO = 82;
private static final int STRING_DIFFICULTY = 83;
private static final int STRING_EASY = 84;
private static final int STRING_NORMAL = 85;
private static final int STRING_HARD = 86;
private static final int STRING_NATION0 = 87;
private static final int STRING_NATION1 = 88;
private static final int STRING_NATION2 = 89;
private static final int STRING_NATION3 = 90;
private static final int STRING_NATION4 = 91;
private static final int STRING_NATION5 = 92;
private static final int STRING_NATION6 = 93;
private static final int STRING_NATION7 = 94;
private static final int STRING_NATION8 = 95;
private static final int STRING_NATION9 = 96;
private static final int STRING_NATION10 = 97;
private static final int STRING_ATHLETE0 = 98;
private static final int STRING_ATHLETE1 = 99;
private static final int STRING_ATHLETE2 = 100;
private static final int STRING_ATHLETE3 = 101;
private static final int STRING_ATHLETE4 = 102;
private static final int STRING_ATHLETE5 = 103;
private static final int STRING_ATHLETE6 = 104;
private static final int STRING_ATHLETE7 = 105;
private static final int STRING_ATHLETE8 = 106;
private static final int STRING_ATHLETE9 = 107;
private static final int STRING_ATHLETE10 = 108;
private static final int STRING_GAME_TITLE = 109;
private static final int STRING_VERSION = 110;
private static final int STRING_COPYRIGHT_TEXT = 111;
private static final int STRING_CREDITS = 112;
private static final int STRING_SELECT_LANGUAGE = 113;
private static final int STRING_LANG0 = 114;
private static final int STRING_LANG1 = 115;
private static final int STRING_LANG2 = 116;
private static final int STRING_LANG3 = 117;
private static final int STRING_LANG4 = 118;
private static final int STRING_GAME_IN_PROGRESS = 119;
private static final int STRING_RESUME_GAME = 120;
private static final int STRING_ABORT_GAME = 121;
private static final int STRING_BACK = 122;
private static final int STRING_OK = 123;
private static final int STRING_CANCEL = 124;
private static final int STRING_MENU = 125;
private static final int STRING_LOADING = 126;
private static final int STRING_GUEST = 127;
private static final int STRING_LOGGING_IN = 128;
private static final int STRING_GAME_LOBBY = 129;
private static final int STRING_RATE_GAME = 130;
private static final int STRING_LEADERBOARD = 131;
private static final int STRING_REGISTER_ON = 132;
private static final int STRING_GAME_LOBBY_Q = 133;
private static final int STRING_TO_GAME_LOBBY = 134;
private static final int STRING_WELCOME = 135;
private static final int RESFILE_COMMON = 136;
private static final int RESFILE_COUNTRY = 137;
private static final int RESFILE_GFX = 138;
private static final int RESFILE_AUDIO = 139;



// defines from GameData
// we never have more than a few gates on the screen at once
// we're only going to store animation data for a few gates
// we'll pad it a bit to take into account the fact that the
// skier still moves while the gates animate.

//#ifdef _HIRES_GRAPHICS
////#define HURDLE_XOFF					12
////#define HURDLE_HEIGHT				31		// in pixels
////#define SHOOTINGREF_HEIGHT			54
////#define PIXEL_PER_M					24
////#define M_PER_PIXEL					2731
//#else
//#endif


//#define MAX_PLAYERS					4

//#ifndef _MAX_HUMAN_PLAYERS
//#endif



// Virtual key codes


// COLORS (RGB)







//#ifdef _LOW_DETAIL
//#else
////#define COLOR_SKY				0xc1ccf5
//#endif






//#ifdef _MULTI_LANG
////#define LANG_COUNT					5
//#else
//#endif


//#ifndef _LIMITED_EVENTS
//
////#define EVENT_SKI_JUMP				1
////#define EVENT_BIATHLON				2
////#define EVENT_SKIING				3
////#define EVENT_COUNT					4
////#define EVENT_COMPETITION			4
//
//#else


//#endif





//#ifdef _IS_NokiaS40
////	#define SOUND_COUNT				5
//#elif defined(_IS_NokiaS60) && !defined(_MMAPI)
////	#define SOUND_CROWD				5
////	#define SOUND_CRASH				6
////	#define SOUND_COUNT				7
//#elif defined(_LIMITED_SOUNDS)
////	#define SOUND_CRASH				5
////	#define SOUND_COUNT				6
//#else
//#endif


//#endif
	private final static int DEFAULT_TIME_CAP = 150;
	
	/////////Clock////////
	private final static int Flag_Thousandths = 0x0;
	private final static int Flag_Hundredths = 0x1;
	private final static int Flag_Tenths = 0x2;
	
	private final static int Mask_Precision = 0x3;
	
	private final static int Flag_Minutes = 0x4;
	private final static int Flag_Sign = 0x8;
	private final static int Flag_Meters = 0x10;
	private final static int Flag_Unit = 0x20;
	
	private final static int Char_Decimal = 10;
	private final static int Char_Colon = 11;
	private final static int Char_Unit_S = 12;
	private final static int Char_Unit_M = 13;
	private final static int Char_Plus = 14;
	private final static int Char_Minus = 15;
	private final static int Char_Count = 16;
	
	private final static int Sprite_Units = 0;
	private final static int Sprite_Thousandths = 1;
	private final static int Sprite_Hundredths = 2;
	private final static int Sprite_Tenths = 3;
	private final static int Sprite_Decimal = 4;
	private final static int Sprite_Ones = 5;
	private final static int Sprite_Tens = 6;
	private final static int Sprite_Hundreds = 7;
	private final static int Sprite_Colon = 8;
	private final static int Sprite_Minutes = 9;
	private final static int Sprite_Sign = 10;
	private final static int Sprite_Count_Clock = 11;
	
	public EventWindow( TorinoCanvas canvas )
	{				
		super( canvas );
		setDimensions( m_canvas.m_iScreenWidth, m_canvas.getCanvasHeight() );
		m_data = m_canvas.m_gameData;
		m_canvas.initLoader( this );
		m_bPaused = true;
		m_iBaseTime = (-1)/*@TIME_INVALID*/;
		m_iTimeCap = DEFAULT_TIME_CAP;
/*		
		//clock
		for ( int i = 0; i < 2; i++ )
		{
			m_iClockTime[i] = 0;
			m_iClockMaxTime[i] = 0;
			m_iClockFlags[i] = 0;
		
			for(int j=0; j < Sprite_Count_Clock; j++)
				m_aClockDigits[i][j] = null;
		}
		
		//power meter
		m_iPowerMeterLevel = 0;
		m_iPowerMeterX = 0;
		m_iPowerMeterY = 0;
		m_bPowerMeterVisible = true;
*/		
		if (!m_data.bInitialized)
			m_data.iElapsedTime = 0;
			
	}
	
	public void unloadResources()
	{
		// forcibly unload images and sounds
		m_canvas.unloadSoundResources();
				
		m_aSprites = null;
				
		m_sign1 = null;
		m_farTrees = null;
//#ifndef _LOW_DETAIL
//		m_crowd = null;
//		m_sign2 = null;
//		m_sky = null;
//#endif
		m_tree = null;
		
		// unload timing bar resources
		m_timingBarFill = null;
		m_timingBarLeft = null;
		m_timingBarRight = null;
		m_sCursor = null;
		m_sMarker = null;
//#ifndef _SIMPLE_TIMING_BAR
//		m_sTimingBarHiliteL = null;
//		m_sTimingBarHiliteR = null;
//#endif
		m_sMaxHit = null;

//#ifndef _LIMITED_EVENTS	
//		for( int i = 0; i < 4/*@NUM_ARROWS*/; i++ )
//			m_aArrows[i] = null;
//
//		// End of ramp sections
//		for( int i = 0; i < 7; i++ )
//			m_aRampEnd[i] = null;
//		
//		m_sArrowPress = null;
//		
//		m_ramp = null;
//		m_rampBarBack = null;
//		m_rampBarFront = null;
//		m_arrowWrong = null;
//#endif

		m_aTargets = null;
		m_aShots = null;
		m_aDigits = null;		

						
//#ifndef _LOW_DETAIL
//		m_treeShadow = null;
//		m_snowBank = null;
//#endif
		m_farTargets = null;
		m_targetStand = null;
		m_targetEndPiece = null;
		m_crosshair = null;
		m_richochet = null;
		m_uphill = null;

		m_downhill = null;
		m_treeImage = null;
//#ifndef _LOW_DETAIL
//		m_treeShadowImage = null;
//		m_slalomTrackL = null;
//		m_slalomTrackR = null;
//		m_slalomTrackStraight = null;
//#endif
	
		m_label = null;
		m_miss = null;
//#ifndef _NO_GHOST
//		m_ghostName = null;
//#endif
		
		m_compass = null;
		m_aFlags = null;
	
		m_sprite_Sign1 = null;
		m_sprite_Sign2 = null;
		m_treeSprite = null;
//#ifndef _LOW_DETAIL
//		m_treeShadowSprite = null;
//#endif
		
		// spline control points (gate positions)
		m_afpCourseY = null;
						
		removeAll();
	}
	
	public void run( )
	{
		m_canvas.setKeyLabels( (-1)/*@NULL_STRING*/, STRING_MENU );
		
		if (m_data.iGameMode == 3/*@GAMEMODE_CHALLENGE*/ )
		{
//#ifdef _LIMITED_EVENTS
			m_data.aiResults[0][m_data.iEvent] = 0;
//#else
//			m_data.aiResults[0][m_data.iEvent][0] = 0;
//#endif
		}
		
		try
		{
			switch ( m_data.iEvent )
			{
			case 0/*@EVENT_SKATING*/:
				init_skating( );
				break;
//#ifndef _LIMITED_EVENTS
//			case EVENT_SKI_JUMP:
//				init_skiJump( );
//				break;
//#endif
			case 1/*@EVENT_BIATHLON*/:
				init_biathlon( );
				break;
			case 2/*@EVENT_SKIING*/:
				init_skiing( );
				break;
			}
		}
		catch ( Exception e )
		{
//			DUMP_EXCEPTION_MSG(e, "*** Error in SkatingWindow ***");
//#ifdef _DISPLAY_MEM_ERROR
//			m_canvas.m_midlet.m_bCriticalError = true;
//#endif
			m_canvas.m_midlet.exitRequested();
		}
		catch ( OutOfMemoryError e )
		{
//			DEBUG_MSG( "*** OutOfMemoryError ***");
//			DEBUG_MSG( "*** load status = " + m_canvas.m_iLoadStatus + " ***");
//#ifdef _DISPLAY_MEM_ERROR
//			m_canvas.m_midlet.m_bCriticalError = true;
//#endif
			m_canvas.m_midlet.exitRequested();
		}
		
		m_canvas.updateLoadStatus(100);
	}
	
	private void setState( int iState, int iCurrentTime ) throws IOException
	{
		if (m_data.iState == iState)
			return;

		m_data.iState = iState;

		switch ( m_data.iEvent )
		{
		case 0/*@EVENT_SKATING*/:

⌨️ 快捷键说明

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