示例#1
0
widgetChat::widgetChat(QWidget *parent,QList<QString> *listJoueur) :
    QWidget(parent),
    ui(new Ui::widgetChat)
{
    ui->setupUi(this);
    connect(ui->btQuitterChat,SIGNAL(clicked()),this,SLOT(close()));
    connect(ui->btSendMessages,SIGNAL(clicked()),this,SLOT(SendMessages()));

    //Parcourir la liste des joueur et remplir la liste view avec celle ci.
}
示例#2
0
int FeelerGui::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: PrintText((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 1: showBudies(); break;
        case 2: CloseTalk(); break;
        case 3: SendMessages(); break;
        case 4: SendNotify((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 5: Logout(); break;
        case 6: StartTalk((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break;
        case 7: SendMessages((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 8: RecvMessage((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        }
        _id -= 9;
    }
    return _id;
}
uint32 FTcpMessageTransportConnection::Run()
{
	while (bRun)
	{
		// Try sending and receiving messages and detect if they fail or if another connection error is reported.
		if ((!ReceiveMessages() || !SendMessages() || Socket->GetConnectionState() == SCS_ConnectionError) && bRun)
		{
			// Disconnected. Reconnect if requested.
			if (ConnectionRetryDelay > 0)
			{
				UE_LOG(LogTcpMessaging, Verbose, TEXT("Connection to '%s' failed, retrying..."), *RemoteEndpoint.ToString());
				FPlatformProcess::Sleep(ConnectionRetryDelay);

				ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->DestroySocket(Socket);
				Socket = FTcpSocketBuilder(TEXT("FTcpMessageTransport.RemoteConnection"));
				if (Socket && Socket->Connect(RemoteEndpoint.ToInternetAddr().Get()))
				{
					bSentHeader = false;
					bReceivedHeader = false;
					UpdateConnectionState(STATE_DisconnectReconnectPending);
					RemoteNodeId.Invalidate();
				}
				else
				{
					if (Socket)
					{
						ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->DestroySocket(Socket);
						Socket = nullptr;
					}
					bRun = false;
				}
			}
			else
			{
				bRun = false;
			}
		}

		FPlatformProcess::Sleep(0.0f);
	}

	UpdateConnectionState(STATE_Disconnected);
	RemoteNodeId.Invalidate();
	ClosedTime = FDateTime::UtcNow();

	// Clear the delegate to remove a reference to this connection
	ConnectionStateChangedDelegate.Unbind();
	return 0;
}
示例#4
0
void ClientSystem::UpdateThread()
{
    while (mRunning)
    {
        //PerfTimer.Log( "client thread update started" );
        if (!mProgramState.mClientConnected)
        {
            //PerfTimer.Log( "client not connected, client update ended" );
            std::this_thread::sleep_for( std::chrono::milliseconds( mWaitMillisecs ) );
            continue;
        }

        ReceiveMessages();

        SendMessages();

        //PerfTimer.Log( "client thread update ended" );
    }
}
示例#5
0
void Bombing::Resolve()
{
	// Are there any Fleets
	if( mSmartBombingFleets.size() == 0 && mNormalBombingFleets.size() == 0 && mTerraBombingFleets.size() == 0)
		return;
		
	// Calculate Total bombing  
	double normal_KillPercentage = 0.0;
	double smart_KillPercentage = 0.0;
	long normal_minimum = 0;
	long installation_loss = 0;
	
	// Calculate Normal bombing (Sum up bombing)
	for (deque<Fleet*>::iterator k = mNormalBombingFleets.begin(); k != mNormalBombingFleets.end(); ++k)
	{
		normal_KillPercentage += (*k)->GetNormalKillPercentage();
		normal_minimum += (*k)->GetKillMin();
		installation_loss += (*k)->GetKillInstallation();
	}
	
	smart_KillPercentage = GetSmartKillPercentage();
	
	// percentage stopped 
	mNormalPercentageStopped = mTargetPlanet->GetDefenseValue();
	mSmartPercentageStopped = mTargetPlanet->GetSmartDefenseValue();
	
	// Population Loss
	DoPopulationLosses(normal_KillPercentage,normal_minimum,smart_KillPercentage);
	
	// Installation Losses 
	DoInstallationLosses(installation_loss);
	
	// check if planet is now uninhabited later in turn processing, don't check now
	
	// Do Remote Terrraforming
	DoTerraTransforming();
			
	// Send Messages To Everyone
	SendMessages();
}
示例#6
0
void ClientSystem::Update( double DeltaTime )
{
    PerfTimer.Log( "client update started" );

    if ( !mProgramState.mClientConnected )
    {
        PerfTimer.Log( "client not connected, client update ended" );
        return;
    }

    if (mThreaded)
    {
        std::lock_guard<std::mutex> lck( mMessageHolder.GetOutgoingMessages().GetMutex() );
        mMessageHolder.GetOutgoingMessages().Publish();
        mMessageHolder.GetOutgoingMessages().GetCV().notify_all();
    }
    else
    {
        ReceiveMessages();
        mMessageHolder.GetOutgoingMessages().Publish();
        SendMessages();
    }
    PerfTimer.Log( "client update ended" );
}