Пример #1
0
void Player::ResponseLoad(int pid, float x, float y, float z, bool valid, wchar_t* name, wchar_t* comment)
{
	mPlayerId = pid;
	mPosX = x;
	mPosY = y;
	mPosZ = z;
	mIsValid = valid;

	wcscpy_s(mPlayerName, name);
	wcscpy_s(mComment, comment);

	//TODO: 아래는 나중에 로그로...
	wprintf_s(L"PID[%d], X[%f] Y[%f] Z[%f] NAME[%s] COMMENT[%s]\n", mPlayerId, mPosX, mPosY, mPosZ, mPlayerName, mComment);
	
	MyPacket::LoginResult loginResult;
	loginResult.set_playerid(mPlayerId);
	loginResult.set_playername("TEST_LogonSuccess");

	MyPacket::Position* pos = loginResult.mutable_playerpos();
	pos->set_x(mPosX);
	pos->set_y(mPosY);
	pos->set_z(mPosZ);

	mSession->SendRequest(MyPacket::PKT_SC_LOGIN, loginResult);

	DoSyncAfter(HEART_BEAT, &Player::OnTick);
}
Пример #2
0
void Player::RequestMove(float x, float y, float z)
{
	MyPacket::MoveRequest moveRequest;
	
	moveRequest.set_playerid(mPlayerId);
	MyPacket::Position* newPos = new MyPacket::Position();
	newPos->set_x(x);
	newPos->set_y(y);
	newPos->set_z(z);
	moveRequest.set_allocated_playerpos(newPos);

	mSession->SendRequest(MyPacket::PKT_CS_MOVE, moveRequest);
}