当前位置: 首页>>代码示例>>C++>>正文


C++ BroadcastEvent函数代码示例

本文整理汇总了C++中BroadcastEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ BroadcastEvent函数的具体用法?C++ BroadcastEvent怎么用?C++ BroadcastEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了BroadcastEvent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ObjectGuid

void Guild::DelMember(ObjectGuid guid, bool isDisbanding)
{
    uint32 lowguid = guid.GetCounter();

    // guild master can be deleted when loading guild and guid doesn't exist in characters table
    // or when he is removed from guild by gm command
    if (m_LeaderGuid == guid && !isDisbanding)
    {
        MemberSlot* oldLeader = NULL;
        MemberSlot* best = NULL;
        ObjectGuid newLeaderGUID;
        for (Guild::MemberList::iterator i = members.begin(); i != members.end(); ++i)
        {
            if (i->first == lowguid)
            {
                oldLeader = &(i->second);
                continue;
            }

            if (!best || best->RankId > i->second.RankId)
            {
                best = &(i->second);
                newLeaderGUID = ObjectGuid(HIGHGUID_PLAYER, i->first);
            }
        }
        if (!best)
        {
            Disband();
            return;
        }

        SetLeader(newLeaderGUID);

        // If player not online data in data field will be loaded from guild tabs no need to update it !!
        if (Player *newLeader = sObjectMgr.GetPlayer(newLeaderGUID))
            newLeader->SetRank(GR_GUILDMASTER);

        // when leader non-exist (at guild load with deleted leader only) not send broadcasts
        if (oldLeader)
        {
            BroadcastEvent(GE_LEADER_CHANGED, oldLeader->Name.c_str(), best->Name.c_str());
            BroadcastEvent(GE_LEFT, guid, oldLeader->Name.c_str());
        }
    }

    members.erase(lowguid);

    Player *player = sObjectMgr.GetPlayer(guid);
    // If player not online data in data field will be loaded from guild tabs no need to update it !!
    if (player)
    {
        player->SetInGuild(0);
        player->SetRank(0);
    }

    CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guid = '%u'", lowguid);

    if (!isDisbanding)
        UpdateAccountsNumber();
}
开发者ID:FoOtY,项目名称:ClassyWoW,代码行数:60,代码来源:Guild.cpp

示例2: BroadcastEvent

//----------------------------------------------------------------------------------------------
void CActor::SuperDeserializer(tinyxml2::XMLElement *xml_current_tree)
{
	Super::SuperDeserializer(xml_current_tree);

    BroadcastEvent(Event_PostLoad);
    BroadcastEvent(Event_Updated);
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:8,代码来源:Actor.cpp

示例3: stEventInfo

void AKUIInterface::SetFocus( UKUIInterfaceContainer* ctNewFocus )
{
	if ( ctFocused.Get() == ctNewFocus )
		return;

	UKUIInterfaceContainer* const ctOldFocus = ctFocused.Get();

	if ( ctOldFocus != NULL )
	{
		FKUIInterfaceEvent stEventInfo( EKUIInterfaceContainerEventList::E_Blur );
		ctOldFocus->SendEvent( stEventInfo );
	}

	this->ctFocused = ctNewFocus;

	if ( ctNewFocus != NULL )
	{
		FKUIInterfaceEvent stEventInfo( EKUIInterfaceContainerEventList::E_Focus );
		ctNewFocus->SendEvent( stEventInfo );
	}

	FKUIInterfaceContainerElementEvent stEventInfo( EKUIInterfaceContainerEventList::E_FocusChange, ctNewFocus );
	BroadcastEvent( stEventInfo );

	if ( !IsTemplate() )
		OnFocusChangeBP( ctOldFocus, ctNewFocus );
}
开发者ID:mrG7,项目名称:KeshUI,代码行数:27,代码来源:KUIInterface.cpp

示例4: while

void ArenaTeam::Disband(WorldSession* session)
{
    // Remove all members from arena team
    while (!Members.empty())
        DelMember(Members.front().Guid, false);

    // Broadcast update
    if (session)
    {
        BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), "");

        if (Player* player = session->GetPlayer())
            sLog->outArena("Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
    }

    // Update database
    SQLTransaction trans = CharacterDatabase.BeginTransaction();

    PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHARACTER_DELETE_ARENA_TEAM);
    stmt->setUInt32(0, TeamId);
    trans->Append(stmt);

    stmt = CharacterDatabase.GetPreparedStatement(CHARACTER_DELETE_ARENA_TEAM_MEMBERS);
    stmt->setUInt32(0, TeamId);
    trans->Append(stmt);

    CharacterDatabase.CommitTransaction(trans);

    // Remove arena team from ObjectMgr
    sArenaTeamMgr->RemoveArenaTeam(TeamId);
}
开发者ID:Crash911,项目名称:RaptoredSkyFire,代码行数:31,代码来源:ArenaTeam.cpp

示例5: while

void ArenaTeam::Disband(WorldSession* session)
{
    // Remove all members from arena team
    while (!Members.empty())
        DelMember(Members.front().Guid, false);

    // Broadcast update
    if (session)
    {
        BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), "");
    }

    // Update database
    SQLTransaction trans = CharacterDatabase.BeginTransaction();

    PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM);
    stmt->setUInt32(0, TeamId);
    trans->Append(stmt);

    stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM_MEMBERS);
    stmt->setUInt32(0, TeamId);
    trans->Append(stmt);

    CharacterDatabase.CommitTransaction(trans);

    // Remove arena team from ObjectMgr
    sArenaTeamMgr->RemoveArenaTeam(TeamId);
}
开发者ID:AzerothShard-Dev,项目名称:azerothcore,代码行数:28,代码来源:ArenaTeam.cpp

示例6: assert

//----------------------------------------------------------------------------------------------
void CActor::Initialize()
{
	assert(!IsInitialized());

	std::for_each(m_ChildNodes.begin(), m_ChildNodes.end(), std::mem_fun(&CActor::Initialize));
	
	Super::Initialize();

    BroadcastEvent(Event_PostInitialize);
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:11,代码来源:Actor.cpp

示例7: while

/** Warning: this function releases all depend childs & free self memory */
bool CActor::ProcessRelease(bool ForceOperation /*= false*/)
{	
	bool bReleaseObject = false;
	
	if (ForceOperation || IsPendingToDelete()) // need to be deleted
	{
		TVecActorChildIterator IterActor = m_ChildNodes.begin();
		while (IterActor != m_ChildNodes.end())
		{
			(*IterActor)->ProcessRelease(true);   // force release childs
			(*IterActor) = nullptr;				  // zero pointer
			++IterActor;
		}

		m_ChildNodes.erase(std::remove(m_ChildNodes.begin(), m_ChildNodes.end(), static_cast<CActor*>(nullptr)), m_ChildNodes.end());

		return Super::ProcessRelease(ForceOperation); // free memory
	}
	else
	{
		TVecActorChildIterator IterActor = m_ChildNodes.begin();
		while (IterActor != m_ChildNodes.end())
		{
			if ((*IterActor)->ProcessRelease(ForceOperation)) // found pending to delete child object
			{
				(*IterActor) = nullptr;
				bReleaseObject = true;
			}
			++IterActor;
		}
		
		if (bReleaseObject == true)
		{
			m_ChildNodes.erase(std::remove(m_ChildNodes.begin(), m_ChildNodes.end(), static_cast<CActor*>(nullptr)), m_ChildNodes.end());

            BroadcastEvent(Event_PostRelease);
            BroadcastEvent(Event_Updated);
		}
	}

	return false;
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:43,代码来源:Actor.cpp

示例8: SetName

//----------------------------------------------------------------------------------------------
bool CActor::Rename(const char* name)
{
	bool bResult = false;
	if (strcmp(GetName(), name) != 0)
	{
		SetName(name);
        BroadcastEvent(Event_ObjectRename);
		bResult = true;
	}
	return bResult;
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:12,代码来源:Actor.cpp

示例9: BroadcastEvent

void Guild::Disband()
{
    BroadcastEvent(GE_DISBANDED);

    while (!members.empty())
    {
        MemberList::const_iterator itr = members.begin();
        DelMember(ObjectGuid(HIGHGUID_PLAYER, itr->first), true);
    }

    CharacterDatabase.BeginTransaction();
    CharacterDatabase.PExecute("DELETE FROM guild WHERE guildid = '%u'", m_Id);
    CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid = '%u'", m_Id);
    CharacterDatabase.PExecute("DELETE FROM guild_eventlog WHERE guildid = '%u'", m_Id);
    CharacterDatabase.CommitTransaction();
    sObjectMgr.RemoveGuild(m_Id);
}
开发者ID:FoOtY,项目名称:ClassyWoW,代码行数:17,代码来源:Guild.cpp

示例10: BroadcastEvent

void Guild::Disband()
{
    BroadcastEvent(GE_DISBANDED, 0, 0, "", "", "");

    while (!members.empty())
    {
        MemberList::const_iterator itr = members.begin();
        DelMember(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER), true);
    }

    CharacterDatabase.BeginTransaction();
    CharacterDatabase.PExecute("DELETE FROM guild WHERE guildid = '%u'", m_Id);
    CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid = '%u'", m_Id);
    // TODO item_instance should be deleted ?
    CharacterDatabase.PExecute("DELETE FROM guild_eventlog WHERE guildid = '%u'", m_Id);
    CharacterDatabase.CommitTransaction();
    sObjectMgr.RemoveGuild(m_Id);
}
开发者ID:dythzer,项目名称:mangoszero,代码行数:18,代码来源:Guild.cpp

示例11: FindTargetPath

//==============================
// VRMenuEventHandler::HandleEvents
void VRMenuEventHandler::HandleEvents( OvrGuiSys & guiSys, VrFrame const & vrFrame, 
		menuHandle_t const rootHandle, Array< VRMenuEvent > const & events ) const
{
	VRMenuObject * root = guiSys.GetVRMenuMgr().ToObject( rootHandle );
	if ( root == NULL )
	{
		return;
	}

	// find the list of all objects that are in the focused path
	Array< menuHandle_t > focusPath;
	FindTargetPath( guiSys, rootHandle, FocusedHandle, focusPath );
    
	Array< menuHandle_t > targetPath;

	for ( int i = 0; i < events.GetSizeI(); ++i )
	{
		VRMenuEvent const & event = events[i];
		switch ( event.DispatchType )
		{
			case EVENT_DISPATCH_BROADCAST:
			{
				// broadcast to everything
				BroadcastEvent( guiSys, vrFrame, event, root );
			}
			break;
			case EVENT_DISPATCH_FOCUS:
				// send to the focus path only -- this list should be parent -> child order
				DispatchToPath( guiSys, vrFrame, event, focusPath, false );
				break;
			case EVENT_DISPATCH_TARGET:
				if ( targetPath.GetSizeI() == 0 || event.TargetHandle != targetPath.Back() )
				{
					targetPath.Clear();
					FindTargetPath( guiSys, rootHandle, event.TargetHandle, targetPath );
				}
				DispatchToPath( guiSys, vrFrame, event, targetPath, false );
				break;
			default:
				OVR_ASSERT( !"unknown dispatch type" );
				break;
		}
	}
}
开发者ID:8BitRick,项目名称:GearVRNative,代码行数:46,代码来源:VRMenuEventHandler.cpp

示例12: GetParent

//----------------------------------------------------------------------------------------------
void CActor::FinishGeneration()
{
	Super::FinishGeneration();

	CActor *pAParent = GetParent();
	if (pAParent)
	{
		pAParent->BroadcastEvent(Event_ObjectGenerated, this);
	}

	TVecActorChildConstIterator Iterator = m_ChildNodes.begin();
	while (Iterator != m_ChildNodes.end())
	{
		if ((*Iterator)->IsTransient()){
			BroadcastEvent(Event_ObjectGenerated, (*Iterator));
		}
		++Iterator;
	}
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:20,代码来源:Actor.cpp

示例13: BroadcastEvent

void ArenaTeam::Disband(WorldSession *session)
{
    // event
    if (session)
        BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, session->GetPlayerName(), GetName().c_str());

    while (!m_members.empty())
        // Removing from members is done in DelMember.
        DelMember(m_members.front().guid);

    if (session)
        if (Player* player = session->GetPlayer())
            sLog->outArena("Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());

    CharacterDatabase.BeginTransaction();
    CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid = '%u'", m_TeamId);
    CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u'", m_TeamId); // this should be alredy done by calling DelMember(memberGuids[j]); for each member
    CharacterDatabase.PExecute("DELETE FROM arena_team_stats WHERE arenateamid = '%u'", m_TeamId);
    CharacterDatabase.CommitTransaction();
    sObjectMgr->RemoveArenaTeam(m_TeamId);
}
开发者ID:Blumfield,项目名称:TBCPvP,代码行数:21,代码来源:ArenaTeam.cpp

示例14: BroadcastEvent

void ArenaTeam::Disband(WorldSession *session)
{
    // event
    if (session)
    {
        // probably only 1 string required...
        BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, session->GetPlayerName(), GetName().c_str());
    }

    while (!m_members.empty())
    {
        // Removing from members is done in DelMember.
        DelMember(m_members.front().guid);
    }

    CharacterDatabase.BeginTransaction();
    CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid = '%u'", m_TeamId);
    CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u'", m_TeamId); //< this should be already done by calling DelMember(memberGuids[j]); for each member
    CharacterDatabase.PExecute("DELETE FROM arena_team_stats WHERE arenateamid = '%u'", m_TeamId);
    CharacterDatabase.CommitTransaction();
    sObjectMgr.RemoveArenaTeam(m_TeamId);
}
开发者ID:Archives,项目名称:easy-mangos,代码行数:22,代码来源:ArenaTeam.cpp

示例15: DROID_ASSERT

//==============================
// VRMenuEventHandler::BroadcastEvent
bool VRMenuEventHandler::BroadcastEvent( App * app, VrFrame const & vrFrame, OvrVRMenuMgr & menuMgr,
        VRMenuEvent const & event, VRMenuObject * receiver ) const
{
    DROID_ASSERT( receiver != NULL, "VrMenu" );

    // allow parent components to handle first
    if ( DispatchToComponents( app, vrFrame, menuMgr, event, receiver ) )
    {
        return true;
    }

    // if the parent did not consume, dispatch to children
    int numChildren = receiver->NumChildren();
    for ( int i = 0; i < numChildren; ++i )
    {
        menuHandle_t childHandle = receiver->GetChildHandleForIndex( i );
        VRMenuObject * child = menuMgr.ToObject( childHandle );
        if ( child != NULL && BroadcastEvent( app, vrFrame, menuMgr, event, child ) )
        {
            return true;    // consumed by child
        }
    }
    return false;
}
开发者ID:colwalder,项目名称:unrealengine,代码行数:26,代码来源:VRMenuEventHandler.cpp


注:本文中的BroadcastEvent函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。