示例#1
0
	void AccountsManager::RemoveAccount (const QModelIndex& index)
	{
		if (!index.isValid ())
			return;

		QObject *accObj = index.sibling (index.row (), 0)
				.data (Roles::AccountObj).value<QObject*> ();
		auto acc = qobject_cast<IStorageAccount*> (accObj);

		auto plugin = qobject_cast<IStoragePlugin*> (acc->GetParentPlugin ());
		plugin->RemoveAccount (accObj);
	}
示例#2
0
void GateAccountManager::Tick(int32 nFrameTime)
{
	std::vector<int32> vDestroy;

	Time tCurr = Time::CurrentTime();

	for (auto itr = m_mapSocketID2Account.begin(); itr != m_mapSocketID2Account.end(); ++itr)
	{
		GateAccount* pAccount = itr->second;
		assert(pAccount);

		GateAccountStateBase* pState = pAccount->GetState();
		assert(pState);

		pState->Tick( *pAccount, nFrameTime, tCurr);
		if(pAccount->IsDestroy())
			vDestroy.push_back(itr->first);
	}

	for (auto itr = vDestroy.begin(); itr != vDestroy.end(); ++itr)
	{
		RemoveAccount(*itr);
	}
}