コード例 #1
0
void CharacterCreationThread::update(float fDt)
{
	if (mIsFinished)
		return;

	if (!mRequestManager.update(fDt))
	{
		GetGameManager().getNetworkManager()->removeClient(mClient);
		mIsFinished = true;
	}
}
コード例 #2
0
PlayerCameraOgre::PlayerCameraOgre(Ogre::Camera *cam, Ogre::SceneNode *node, Player *player)
	: CameraOgre(cam, node),
	PlayerCamera(player)
{
	mHudManager = GetGameManager().getHudManager();
	mMouse = GetGameManager().getInputManager()->getMouse();

	mPivotHeight = 2.0f * (float)mPlayer->character().body.size / 3.0f;
	mPivotHeight /= 100.0f;
	mCameraDistance = DEFAULT_CAMERA_DISTANCE;
	setPosition(0, mPivotHeight, 0);

	mInputEventManager.addMouseListener(MouseButtons::RIGHT, this, &PlayerCameraOgre::onRightButtonPressed);
	mInputEventManager.addMouseListener(MouseButtons::SCROLLWHEELUP, this, &PlayerCameraOgre::onScrollWheelUp);
	mInputEventManager.addMouseListener(MouseButtons::SCROLLWHEELDOWN, this, &PlayerCameraOgre::onScrollWheelDown);
	mRightButtonPressedLastFrame = false;

	mRealPosition = getPosition();
	setPositionBehindPlayer();
}
コード例 #3
0
void GameStateCharacterSelection::onCharactersResponse(const mp::ResponseCharacters *response)
{
	for (int i = 0; i < MAX_CHARACTERS; i++)
		mCharacters[i] = response->getCharacter(i);

	if (!mCharacters[0].exists())
	{
		GetGameManager().setNextGameState(new GameStateCharacterCreation(true));
		return;
	}
}
コード例 #4
0
void GameStateCharacterSelection::onStartPressed()
{
	for (int i = 0; i < MAX_CHARACTERS; i++)
	{
		if (mCharacters[i].character().order == 0)
		{
			GetGameManager().setNextGameState(new GameStateIngame(mCharacters[i]));
			break;
		}
	}
}
コード例 #5
0
ファイル: testaarhud.cpp プロジェクト: VRAC-WATCH/deltajug
void TestAARHUD::ProcessMessage(const dtGame::Message& message)
{
   if (message.GetMessageType() == dtGame::MessageType::TICK_LOCAL)
   {
      TickHUD();
   }
   else if (message.GetMessageType() == dtGame::MessageType::INFO_MAP_LOADED)
   {
      GetGameManager()->GetScene().AddDrawable(GetGUIDrawable());
   }
}
コード例 #6
0
   virtual bool HandleKeyPressed(const dtCore::Keyboard* keyboard, int key)
   {
      switch (key)
      {
         case osgGA::GUIEventAdapter::KEY_Escape:
         {

            GetGameManager()->GetApplication().Quit();
            return true;

         }
         case osgGA::GUIEventAdapter::KEY_Space:
         {
            // loop through all component game actors and
            // get their text label components.
            // Toggle flashing property on components
            typedef std::vector<dtDAL::ActorProxy*> PLIST;
            PLIST proxies;
            GetGameManager()->FindActorsByType(*TestActorLibraryRegistry::COMPONENT_GAME_ACTOR_TYPE.get(), proxies);

            // for each game actor
            for(PLIST::iterator i = proxies.begin(); i != proxies.end(); ++i)
            {
               // get the game actor
               ComponentGameActor* actor;
               (*i)->GetActor(actor);

               // get its text label component
               TextLabelComponent* tcomp;
               actor->GetComponent(tcomp);

               // access text label component
               tcomp->SetFlashing(!tcomp->IsFlashing());
               tcomp->SetFlashInterval(0.2f);
            }
            return true;
         }
      }
      return false;
   }
コード例 #7
0
ファイル: RecvThread.cpp プロジェクト: Tyrame/ethnosonline
bool RecvThread::initialize()
{
	mTCPSock = NULL;
	mUDPSock = NULL;
	mNetworkManager = GetGameManager().getNetworkManager();
	mResponseManager.addResponseListener(mp::ResponseType::DISCONNECT, mNetworkManager, &NetworkManager::onDisconnect);
	mResponseManager.addResponseListener(mp::ResponseType::LOGIN, mNetworkManager, &NetworkManager::onLoginResponse);
	mResponseManager.addResponseListener(mp::ResponseType::CHARACTERS, mNetworkManager, &NetworkManager::onCharactersResponse);
	mResponseManager.addResponseListener(mp::ResponseType::CHECK_NAME_AVAILABILITY, mNetworkManager, &NetworkManager::onCheckNameAvailabilityResponse);
	mResponseManager.addResponseListener(mp::ResponseType::CREATE_CHARACTER, mNetworkManager, &NetworkManager::onCreateCharacterResponse);
	mResponseManager.addResponseListener(mp::ResponseType::DELETE_CHARACTER, mNetworkManager, &NetworkManager::onDeleteCharacterResponse);
	mResponseManager.addResponseListener(mp::ResponseType::POSITION_VELOCITY, mNetworkManager, &NetworkManager::onPositionVelocityResponse);
	return true;
}
コード例 #8
0
bool AuthenticationThread::initialize()
{
    mp::Console::debugprintln("Running AuthenticationThread");

    mSQLManager = GetGameManager().getSQLManager();
    mSQLLink = mSQLManager->connect(ETHNOS_SQL_HOST, ETHNOS_SQL_USERNAME, ETHNOS_SQL_PASSWORD);
    if (!mSQLLink)
        return false;
    mSQLManager->selectDatabase(ETHNOS_SQL_DATABASE, mSQLLink);

    mRequestManager.initialize(mClient->tcpSocket(), mClient->udpSocket(), CLIENT_TIMEOUT);
    mRequestManager.addRequestListener(mp::RequestType::LOGIN, this, &AuthenticationThread::onLoginRequest);
    mRequestManager.addRequestListener(mp::RequestType::DISCONNECT, this, &AuthenticationThread::onDisconnectRequest);
    return true;
}
コード例 #9
0
bool CharacterCreationThread::initialize()
{
	mp::Console::debugprintln("Running CharacterCreationThread");

	mSQLManager = GetGameManager().getSQLManager();
	mSQLLink = mSQLManager->connect(ETHNOS_SQL_HOST, ETHNOS_SQL_USERNAME, ETHNOS_SQL_PASSWORD);
	if (!mSQLLink)
		return false;
	mSQLManager->selectDatabase(ETHNOS_SQL_DATABASE, mSQLLink);

	mRequestManager.initialize(mClient->tcpSocket(), mClient->udpSocket(), CLIENT_TIMEOUT);
	mRequestManager.addRequestListener(mp::RequestType::CHECK_NAME_AVAILABILITY, this, &CharacterCreationThread::onCheckNameAvailabilityRequest);
	mRequestManager.addRequestListener(mp::RequestType::CREATE_CHARACTER, this, &CharacterCreationThread::onCreateCharacterRequest);
	mRequestManager.addRequestListener(mp::RequestType::GO_LOGIN, this, &CharacterCreationThread::onGoLoginRequest);
	mRequestManager.addRequestListener(mp::RequestType::GO_SELECTION, this, &CharacterCreationThread::onGoSelectionRequest);
	mRequestManager.addRequestListener(mp::RequestType::DISCONNECT, this, &CharacterCreationThread::onDisconnectRequest);
	return true;
}
コード例 #10
0
void CharacterCreationThread::onDisconnectRequest(const mp::Request *request)
{
	mp::Console::debugprintln("Received Disconnect request");
	GetGameManager().getNetworkManager()->removeClient(mClient);
	mIsFinished = true;
}
コード例 #11
0
int PushConsoleManager::OnCommand(const HashedString& command, const strutil::strvec& parameter_vector) {
	int result = Parent::OnCommand(command, parameter_vector);
	if (result < 0) {
		result = 0;

		CommandClient _command = (CommandClient)TranslateCommand(command);
		switch ((int)_command) {
			case kCommandSetAvatar: {
				if (parameter_vector.size() == 1) {
					((PushManager*)GetGameManager())->SelectAvatar(parameter_vector[0]);
				} else {
					log_.Warningf("usage: %s <avatar>", command.c_str());
					result = 1;
				}
			} break;
			case kCommandSetAvatarEnginePower: {
				if (parameter_vector.size() == 2) {
					log_debug("Setting avatar engine power.");
					int aspect = 0;
					strutil::StringToInt(parameter_vector[0], aspect);
					double power;
					strutil::StringToDouble(parameter_vector[1], power);
					if (!((PushManager*)GetGameManager())->SetAvatarEnginePower(aspect, (float)power)) {
						log_.Error("Could not set avatar engine power!");
						result = 1;
					}
				} else {
					log_.Warningf("usage: %s <aspect> <power>", command.c_str());
					result = 1;
				}
			} break;
#if defined(LEPRA_DEBUG) && defined(LEPRA_WINDOWS)
			case kCommandBuildData: {
				const cure::GameObjectId avatar_id = ((PushManager*)GetGameManager())->GetAvatarInstanceId();
				if (!avatar_id) {
					break;
				}
				const str avatar_type = GetGameManager()->GetContext()->GetObject(avatar_id)->GetClassId();
				((PushManager*)GetGameManager())->Logout();
				Thread::Sleep(0.5);
				GetResourceManager()->ForceFreeCache();
				const str current_dir = SystemManager::GetCurrentDirectory();
				::SetCurrentDirectoryA(astrutil::Encode(Path::GetParentDirectory(current_dir)).c_str());
				::system("c:/Program/Python31/python.exe -B Tools/build/rgo.py builddata");
				::SetCurrentDirectoryA(astrutil::Encode(current_dir).c_str());
				const str user_name = v_slowget(GetVariableScope(), kRtvarLoginUsername, EmptyString);
				const str server = v_slowget(GetVariableScope(), kRtvarNetworkServeraddress, EmptyString);
				wstr pw(L"CarPassword");
				const cure::LoginId login_id(wstrutil::Encode(user_name), cure::MangledPassword(pw));
				((PushManager*)GetGameManager())->RequestLogin(server, login_id);
				((PushManager*)GetGameManager())->ToggleConsole();
				ExecuteCommand("wait-login");
				((PushManager*)GetGameManager())->SelectAvatar(avatar_type);
			} break;
#endif // Debug & Windows
			default: {
				result = -1;
			} break;
		}
	}
	return (result);
}
コード例 #12
0
void GameStateCharacterSelection::onCreatePressed()
{
	GetGameManager().setNextGameState(new GameStateCharacterCreation());
}
コード例 #13
0
void GameStateCharacterSelection::onReloginPressed()
{
	GetGameManager().setNextGameState(new GameStateLogin());
}
コード例 #14
0
ファイル: Player.cpp プロジェクト: Tyrame/ethnosonline
Player::Player()
{
    mSQLManager = GetGameManager().getSQLManager();
    mSQLLink = NULL;
    mSpeed = 1;
}
コード例 #15
0
ファイル: testaarhud.cpp プロジェクト: VRAC-WATCH/deltajug
void TestAARHUD::UpdateHighDetailData(int baseWidth, float& curYPos)
{
   if (*mHUDState == HUDState::MAXIMUM)
   {
      char clin[HUDCONTROLMAXTEXTSIZE]; // general buffer to print
      char lastTagStr[HUDCONTROLMAXTEXTSIZE];
      char numTagsStr[HUDCONTROLMAXTEXTSIZE];
      char lastFrameStr[HUDCONTROLMAXTEXTSIZE];
      char numFramesStr[HUDCONTROLMAXTEXTSIZE];

      // Determine num tags, num frames, etc...
      if (dtGame::LogStateEnumeration::LOGGER_STATE_IDLE == mLogController->GetLastKnownStatus().GetStateEnum())
      {
         snprintf(numTagsStr, HUDCONTROLMAXTEXTSIZE, "Num Tags: NA");
         snprintf(lastTagStr, HUDCONTROLMAXTEXTSIZE, "  (Last: NA)");
         snprintf(numFramesStr, HUDCONTROLMAXTEXTSIZE, "Num Frames: NA");
         snprintf(lastFrameStr, HUDCONTROLMAXTEXTSIZE, "  (Last: NA)");
      }
      else // compute data needed for both LOGGER_STATE_PLAYBACK or LOGGER_STATE_RECORD
      {
         // TAGS - num tags and last tag
         const std::vector<dtGame::LogTag> tags = mLogController->GetLastKnownTagList();
         snprintf(numTagsStr, HUDCONTROLMAXTEXTSIZE, "Num Tags: %u", unsigned(tags.size()));
         if (tags.size() > 0)
         {
            snprintf(lastTagStr, HUDCONTROLMAXTEXTSIZE, "  (Last: None)");
            for (unsigned int i = 0; i < tags.size(); i ++)
            {
               const dtGame::LogTag tag = tags[i];
               //double tagTime = tags[i].GetSimTimeStamp();
               //double simTime = mClientGM->GetSimulationTime();

               if (tags[i].GetSimTimeStamp() <= GetGameManager()->GetSimulationTime())
               {
                  std::string temp = (tags[i]).GetName();
                  snprintf(lastTagStr, HUDCONTROLMAXTEXTSIZE, " (%s)", temp.c_str());//(tags[tags.size()-1]).GetName());
               }
            }
         }
         else
         {
            snprintf(lastTagStr, HUDCONTROLMAXTEXTSIZE, " (----)");
         }

         // FRAMES - num frames and last frame
         const std::vector<dtGame::LogKeyframe> frames = mLogController->GetLastKnownKeyframeList();
         snprintf(numFramesStr, HUDCONTROLMAXTEXTSIZE, "Num Frames: %u", unsigned(frames.size()));
         if (frames.size() > 0)
         {
            snprintf(lastFrameStr, HUDCONTROLMAXTEXTSIZE, "  (Last: None)");
            for (unsigned int i = 0; i < frames.size(); i ++)
            {
               if (frames[i].GetSimTimeStamp() <= GetGameManager()->GetSimulationTime())
               {
                  std::string temp = (frames[i]).GetName();
                  snprintf(lastFrameStr, HUDCONTROLMAXTEXTSIZE, " (%s)", temp.c_str());
               }
            }
         }
         else
         {
            snprintf(lastFrameStr, HUDCONTROLMAXTEXTSIZE, " (----)");
         }
      }

      // Num Messages
      snprintf(clin, HUDCONTROLMAXTEXTSIZE, "Num Msgs: %lu", mLogController->GetLastKnownStatus().GetNumMessages());
      curYPos += (mTextHeight + 2) * 2;
      UpdateStaticText(mNumMessagesText, clin, -1.0f, -1.0f, -1.0f, baseWidth, curYPos);

      // Record Duration
      snprintf(clin, HUDCONTROLMAXTEXTSIZE, "Duration: %.2f", mLogController->GetLastKnownStatus().GetCurrentRecordDuration());
      curYPos += mTextHeight + 2;
      UpdateStaticText(mRecordDurationText, clin, -1.0f, -1.0f, -1.0f, baseWidth, curYPos);

      // Number of Tags
      curYPos += mTextHeight + 2;
      UpdateStaticText(mNumTagsText, numTagsStr, -1.0f, -1.0f, -1.0f, baseWidth, curYPos);

      // Last Tag
      curYPos += mTextHeight + 2;
      UpdateStaticText(mLastTagText, lastTagStr, -1.0f, -1.0f, -1.0f, baseWidth, curYPos);

      // Num Frames
      curYPos += mTextHeight + 2;
      UpdateStaticText(mNumFramesText, numFramesStr, -1.0f, -1.0f, -1.0f, baseWidth, curYPos);

      // Num Frames
      curYPos += mTextHeight + 2;
      UpdateStaticText(mLastFrameText, lastFrameStr, -1.0f, -1.0f, -1.0f, baseWidth, curYPos);

      // Current Log
      snprintf(clin, HUDCONTROLMAXTEXTSIZE, "LogFile: %s", mLogController->GetLastKnownStatus().GetLogFile().c_str());
      curYPos += mTextHeight + 2;
      UpdateStaticText(mCurLogText, clin, -1.0f, -1.0f, -1.0f, baseWidth, curYPos);

      // Current Map
      snprintf(clin, HUDCONTROLMAXTEXTSIZE, "CurMap: %s", mLogController->GetLastKnownStatus().GetActiveMaps()[0].c_str());
      curYPos += mTextHeight + 2;
      UpdateStaticText(mCurMapText, clin, -1.0f, -1.0f, -1.0f, baseWidth, curYPos);
   }
}