Exemplo n.º 1
0
void GameOverLayer::realDouble()
{
	// then double the gold
	auto playerData = m_pGameMediator->getPlayerData();
	int m_nFromGoldNumber = playerData->getGoldNumber();
	int m_nToGoldNumber = m_nFromGoldNumber * 2;
	float duration = 0.5f;
	m_pTextGoldNumber->runAction(Sequence::create(
		CSCClass::TextNumChange::create(duration, m_nFromGoldNumber, m_nToGoldNumber),
		DelayTime::create(0.5f),
		CallFuncN::create(CC_CALLBACK_1(GameOverLayer::menuCallback_MainMenu, this)),
		NULL));
	playerData->doublePlayerGoldNumber();

	// disable all buttons
	m_pButtonRetry->setEnabled(false);
	m_pButtonMainMenu->setEnabled(false);
	m_pButtonRevive->setEnabled(false);
	m_pButtonDoubleCoin->setEnabled(false);

    // update GameCenter Achievement
    long long doubleNum = playerData->getDoubleNumber();
	CSCClass::CSC_IOSHelper::GameCenter_checkAndUnlockAchievement("com.reallycsc.endlesslove.double1");
    if (doubleNum > 1)
	    CSCClass::CSC_IOSHelper::GameCenter_unlockAchievementPercent("com.reallycsc.endlesslove.double10", doubleNum * 10);
    if (doubleNum > 10)
	    CSCClass::CSC_IOSHelper::GameCenter_unlockAchievementPercent("com.reallycsc.endlesslove.double50", doubleNum * 2);
    if (doubleNum > 50)
	    CSCClass::CSC_IOSHelper::GameCenter_unlockAchievementPercent("com.reallycsc.endlesslove.double100", doubleNum);
}
void LinkItGPS::parseGPGGA(const char* GPGGAstr) {
	/* Refer to http://www.gpsinformation.org/dale/nmea.htm#GGA
	* Sample data: $GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47
	* Where:
	*  GGA          Global Positioning System Fix Data
	*  123519       Fix taken at 12:35:19 UTC
	*  4807.038,N   Latitude 48 deg 07.038' N
	*  01131.000,E  Longitude 11 deg 31.000' E
	*  1            Fix quality: 0 = invalid
	*                            1 = GPS fix (SPS)
	*                            2 = DGPS fix
	*                            3 = PPS fix
	*                            4 = Real Time Kinematic
	*                            5 = Float RTK
	*                            6 = estimated (dead reckoning) (2.3 feature)
	*                            7 = Manual input mode
	*                            8 = Simulation mode
	*  08           Number of satellites being tracked
	*  0.9          Horizontal dilution of position
	*  545.4,M      Altitude, Meters, above mean sea level
	*  46.9,M       Height of geoid (mean sea level) above WGS84
	*                   ellipsoid
	*  (empty field) time in seconds since last DGPS update
	*  (empty field) DGPS station ID number
	*  *47          the checksum data, always begins with *
	*/
	double latitude;
	double longitude;
	int tmp;
	int num;
	if (GPGGAstr[0] == '$') {
		strcpy(view[S_ALL], GPGGAstr);

		second_last = second;
		tmp = getComma(GPGGA_TIME, GPGGAstr);
		hour = (GPGGAstr[tmp + 0] - '0') * 10 + (GPGGAstr[tmp + 1] - '0');
		minute = (GPGGAstr[tmp + 2] - '0') * 10 + (GPGGAstr[tmp + 3] - '0');
		second = (GPGGAstr[tmp + 4] - '0') * 10 + (GPGGAstr[tmp + 5] - '0');
		sprintf(view[S_TIME_LAST], "%s", view[S_TIME]);
		sprintf(view[S_TIME_ALT], "%2d:%02d:%02d", hour, minute, second);
		hour += 10;
		if (hour > 23) hour %= 24;
		if (hour < 12) {
			pm = 0;
		} else {
			pm = 1;
			if (hour > 12) hour -= 12;
		}
		sprintf(view[S_TIME], "%2d:%02d:%02d", hour, minute, second);
		tmp = getComma(GPGGA_LATITUDE, GPGGAstr);
		latitude = getDoubleNumber(&GPGGAstr[tmp]);
		tmp = getComma(GPGGA_LONGITUDE, GPGGAstr);
		longitude = getDoubleNumber(&GPGGAstr[tmp]);
		tmp = getComma(GPGGA_LATITUDE_DIR, GPGGAstr);
		sprintf(view[S_LATITUDE], "Lat: %10.4f %c ", latitude, GPGGAstr[tmp]);
		tmp = getComma(GPGGA_LONGITUDE_DIR, GPGGAstr);
		sprintf(view[S_LONGITUDE], "Lon: %10.4f %c ", longitude, GPGGAstr[tmp]);
		tmp = getComma(GPGGA_FIX, GPGGAstr);
		num = getIntNumber(&GPGGAstr[tmp]);
		fix = num;
		sprintf(view[S_FIX], "%d", num);
		strcpy(view[S_SAT_LAST], view[S_SAT]);
	  return;
		tmp = getComma(GPGGA_SAT, GPGGAstr);
		num = getIntNumber(&GPGGAstr[tmp]);
//		sprintf(view[S_SAT], "Sat: %d ", num);
		sprintf(view[S_SAT], "%d ", num);
	}
}