void UGameplayTagReponseTable::TagResponseEvent(const FGameplayTag Tag, int32 NewCount, UAbilitySystemComponent* ASC, int32 idx)
{
	if (!ensure(Entries.IsValidIndex(idx)))
	{
		return;
	}

	const FGameplayTagResponseTableEntry& Entry = Entries[idx];
	int32 TotalCount = 0;

	{
		QUICK_SCOPE_CYCLE_COUNTER(ABILITY_TRT_CALC_COUNT);

		TotalCount += ASC->GetAggregatedStackCount(MakeQuery(Entry.Positive.Tag));
		TotalCount -= ASC->GetAggregatedStackCount(MakeQuery(Entry.Negative.Tag));
	}

	FGameplayTagResponseAppliedInfo& Info = RegisteredASCs.FindChecked(ASC);

	if (TotalCount < 0)
	{
		Remove(ASC, Info.PositiveHandle);
		AddOrUpdate(ASC, Entry.Negative.ResponseGameplayEffect, TotalCount, Info.NegativeHandle);
	}
	else if (TotalCount > 0)
	{
		Remove(ASC, Info.NegativeHandle);
		AddOrUpdate(ASC, Entry.Positive.ResponseGameplayEffect, TotalCount, Info.PositiveHandle);
	}
	else if (TotalCount == 0)
	{
		Remove(ASC, Info.PositiveHandle);
		Remove(ASC, Info.NegativeHandle);
	}
}
int32 UGameplayTagReponseTable::GetCount(const FGameplayTagReponsePair& Pair, UAbilitySystemComponent* ASC) const
{
	int32 Count=0;
	if (Pair.Tag.IsValid())
	{
		Count = ASC->GetAggregatedStackCount(MakeQuery(Pair.Tag));
		if (Pair.SoftCountCap > 0)
		{
			Count = FMath::Min<int32>(Pair.SoftCountCap, Count);
		}
	}

	return Count;
}
Beispiel #3
0
bool SQLBase::Select( string strTab, UI nReq, void* pData )
{
	//---------------------------------------------------------
	UI bCond = 0;
	strIns = "SELECT * FROM ";
	strIns.append( strTab );
	DataPack* pBuff = (DataPack*) pData;		//query
	//---------------------------------------------------------
	char* pPos = new char[5];		//positions of each element in query
	memset( pPos, 0, 5 );
	char** pQueries = new char*[5];//{ "nId=?", "nConv=?", "nDate=?", "nType=?", "nChange=?" };
	pQueries[0] = "nId=?";
	pQueries[1] = "nConv=?";
	pQueries[2] = "nDate=?";
	pQueries[3] = "nType=?";
	pQueries[4] = "nChange=?";
	//---------------------------------------------------------
	if( pBuff->isEmpty() )
	{
		cout << "HERE!" << endl;
		strIns.append( ";" );
	}
	else
	{
		strIns.append( " WHERE " );
		for( int i = 0; i < 5; i++ )
		{
			if( *( (int*)pBuff + i ) )
			{
				MakeQuery( pQueries[i], bCond );
				pPos[i] = bCond;
			}
		}
		cout << strIns << endl;
		strIns.append( ";" );
	}

	if( psql->sql_prepair_v2( strIns.c_str() , stmt ) != _sql_errors::SQL_OK )
	{
		psql->Release();
		return( 0 );
	}

	if( !pBuff->isEmpty() )
	{
		for( int i = 0; i < 5; i++ )
		{
			if( pPos[i] )
			{
				psql->sql_bind_int( stmt , pPos[i] , *( (int*)pBuff + i ) );
			}
		}
	}

	bool bFound = false;
	while( psql->sql_step( stmt , -1 ) ==_sql_errors::SQL_ROW )
	{
		bFound = true;
		DataPack* pSend = new DataPack;
		for( int i = 0 ; i < psql->sql_column_count( stmt ) ; i ++ )
		{
			*( (int*)pSend + i ) = psql->sql_column_int( stmt , i );
		}
		pSend->dPackage.cFlag = 0;
		vdpSendData.push_back( *pSend );
		delete pSend;
	}
	return bFound;
}
Beispiel #4
0
SimpleQueryWidget::SimpleQueryWidget(Database *db, QWidget *parent) : QWidget(parent)
{
    dao = new QueryDAO(db);
    generator = new QueryGenerator();
    getAllTables();
    for(auto i = 0; i < tablesList.size(); i++)
    {
        getAllColumns(tablesList[i]);
    }

    QStringList typesList;
    typesList.push_back("INSERT");
    typesList.push_back("SELECT");
    typesList.push_back("UPDATE");
    typesList.push_back("DELETE");

    ////


    /////

    widgetLayout = new QVBoxLayout;

    beginLabel  = new QLabel("Input data for your Query");
    resultLabel = new QLabel("Result of your Query");
    equalsLabel = new QLabel(" = ");

    tableBox   = new QComboBox();
    columnsBox = new QComboBox();



    chosenContent = new QLineEdit();
    location      = new QLineEdit();
    location->setText("FROM");
    whereEq1      = new QLineEdit();
    whereEq2      = new QLineEdit();


    buttonOK   = new QPushButton("Make");
    buttonExit = new QPushButton("Exit");

    queryTypesBox = new QComboBox;
    queryTypesBox->addItems(typesList);

    textBrowser = new QTextBrowser;

    InitTableBox();

    widgetLayout->addWidget(beginLabel);
    widgetLayout->addWidget(queryTypesBox);
    widgetLayout->addWidget(tableBox);
    widgetLayout->addWidget(columnsBox);
//    widgetLayout->addWidget(chosenContent);
//    widgetLayout->addWidget(location);
//    widgetLayout->addWidget(whereEq1);
//    widgetLayout->addWidget(equalsLabel);
    widgetLayout->addWidget(resultLabel);
    widgetLayout->addWidget(textBrowser);
    widgetLayout->addWidget(buttonOK);
    widgetLayout->addWidget(buttonExit);


    connect(tableBox, SIGNAL(currentIndexChanged(int)), this, SLOT(loadCB(int)));
    connect(buttonOK, SIGNAL(clicked()), this, SLOT (MakeQuery()));
    connect(buttonExit, SIGNAL(clicked()), this, SLOT(close()));

    setLayout(widgetLayout);

}