예제 #1
0
void InitLogic::CheckVersionCompletion(AsyncOp *theOp)
{
	Container *aLobbyContainer = LobbyScreen::GetLobbyContainer();
	if(aLobbyContainer==NULL)
		return;

	CheckValidVersionOp *anOp = (CheckValidVersionOp*)theOp;
	WONStatus aStatus = anOp->GetStatus();
	LobbyMisc::SetVersionStatus(aStatus);

	if(aStatus!=WS_Success && aStatus!=WS_DBProxyServ_ValidNotLatest && aStatus!=WS_DBProxyServ_OutOfDate)
	{
		// any other error is considered a get version error
		if(aStatus==WS_DBProxyServ_OutOfDateNoUpdate || aStatus==WS_DBProxyServ_DBError) // try next server on retry
		{
			ServerContext *aPatchServers = LobbyMisc::GetPatchServers();
			if(aPatchServers!=NULL)
				aPatchServers->NotifyFailed(anOp->GetCurAddr()); 
		}

		GUIString aString = StringLocalize::GetStr(LobbyContainer_VersionCheckFailure_String,FriendlyWONStatusToString(aStatus));
		SetLastInitError(InitErrorFlag_VersionCheckFailure,aString);

		return;
	}

	ControlIdSet anEnable;
	anEnable.AddIds(ID_ShowCreateAccount,ID_ShowLostPassword,ID_ShowLostUserName);
	aLobbyContainer->EnableControls(anEnable,true);

	LobbyEvent::BroadcastEvent(new LoginInitStatusEvent(LobbyContainer_InitComplete_String,LoginInitStatus_InitSuccess));
}
예제 #2
0
void InitLogic::DoInit()
{
	mIgnoreInitErrorFlags = 0;

	// Load the lobby's persistent data 
	LobbyPersistentData::ReadGlobal();

	// Set the preferred network adapter
	IPAddr::SetLocalHost(LobbyPersistentData::GetNetworkAdapter(),true);

	// Find the current modified times of the TOU
	SetTOUTimes();

	// Init UDP Manager
	// fixme, choose network adapter first
	LobbyMisc::RestartUDPManager();

	// Fill in the login names in the LoginCtrl
	LobbyEvent::BroadcastEvent(LobbyEvent_SetLoginNames);

	// Disable controls that enable you to talk to TitanServers.
	// The login button starts out disabled and enables itself when initialization 
	// finished successfully.
	Container *aLobby = LobbyScreen::GetLobbyContainer();
	if(aLobby==NULL)
		return;
	
	ControlIdSet aDisable;
	aDisable.AddIds(ID_ShowCreateAccount,ID_ShowLostPassword,ID_ShowLostUserName);
	aLobby->EnableControls(aDisable,false);

	LobbyGlobal_LobbyMusic_Sound->SetLooping(true);
	if(LobbyPersistentData::GetLobbyMusic())
		LobbyGlobal_LobbyMusic_Sound->Play();
	else
		LobbyGlobal_LobbyMusic_Sound->Stop(); // in case music is already playing from the game

	StartNetInit(false);
}