本文整理汇总了C++中NF_SHARE_PTR::GetConfigNameList方法的典型用法代码示例。如果您正苦于以下问题:C++ NF_SHARE_PTR::GetConfigNameList方法的具体用法?C++ NF_SHARE_PTR::GetConfigNameList怎么用?C++ NF_SHARE_PTR::GetConfigNameList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NF_SHARE_PTR
的用法示例。
在下文中一共展示了NF_SHARE_PTR::GetConfigNameList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UnRegister
void NFCGameServerToWorldModule::UnRegister()
{
NF_SHARE_PTR<NFILogicClass> xLogicClass = m_pLogicClassModule->GetElement("GameServer");
if (xLogicClass.get())
{
NFList<std::string>& xNameList = xLogicClass->GetConfigNameList();
std::string strConfigName;
if (xNameList.Get(0, strConfigName))
{
const int nServerID = m_pElementInfoModule->GetPropertyInt(strConfigName, "ServerID");
const int nPort = m_pElementInfoModule->GetPropertyInt(strConfigName, "Port");
const int nMaxConnect = m_pElementInfoModule->GetPropertyInt(strConfigName, "MaxOnline");
const int nCpus = m_pElementInfoModule->GetPropertyInt(strConfigName, "CpuCount");
const std::string& strName = m_pElementInfoModule->GetPropertyString(strConfigName, "Name");
const std::string& strIP = m_pElementInfoModule->GetPropertyString(strConfigName, "IP");
NFMsg::ServerInfoReportList xMsg;
NFMsg::ServerInfoReport* pData = xMsg.add_server_list();
pData->set_server_id(nServerID);
pData->set_server_name(strName);
pData->set_server_cur_count(0);
pData->set_server_ip(strIP);
pData->set_server_port(nPort);
pData->set_server_max_online(nMaxConnect);
pData->set_server_state(NFMsg::EST_MAINTEN);
SendMsgPB(NFMsg::EGameMsgID::EGMI_GTW_GAME_UNREGISTERED, xMsg, GetNet()->FD());
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFIDENTID(0, pData->server_id()), pData->server_name(), "UnRegister");
}
}
}
示例2: AfterInit
bool NFCGameServerToWorldModule::AfterInit()
{
m_pEventProcessModule = dynamic_cast<NFIEventProcessModule*>(pPluginManager->FindModule("NFCEventProcessModule"));
m_pKernelModule = dynamic_cast<NFIKernelModule*>(pPluginManager->FindModule("NFCKernelModule"));
m_pLogicClassModule = dynamic_cast<NFILogicClassModule*>(pPluginManager->FindModule("NFCLogicClassModule"));
m_pElementInfoModule = dynamic_cast<NFIElementInfoModule*>(pPluginManager->FindModule("NFCElementInfoModule"));
m_pLogModule = dynamic_cast<NFILogModule*>(pPluginManager->FindModule("NFCLogModule"));
m_pGameServerNet_ServerModule = dynamic_cast<NFIGameServerNet_ServerModule*>(pPluginManager->FindModule("NFCGameServerNet_ServerModule"));
assert(NULL != m_pEventProcessModule);
assert(NULL != m_pKernelModule);
assert(NULL != m_pLogicClassModule);
assert(NULL != m_pElementInfoModule);
assert(NULL != m_pLogModule);
assert(NULL != m_pGameServerNet_ServerModule);
m_pKernelModule->ResgisterCommonClassEvent(this, &NFCGameServerToWorldModule::OnClassCommonEvent);
NFIClusterClientModule::Bind(this, &NFCGameServerToWorldModule::OnReciveWSPack, &NFCGameServerToWorldModule::OnSocketWSEvent);
m_pEventProcessModule->AddClassCallBack("Player", this, &NFCGameServerToWorldModule::OnObjectClassEvent);
// 连接world server
NF_SHARE_PTR<NFILogicClass> xLogicClass = m_pLogicClassModule->GetElement("Server");
if (xLogicClass.get())
{
NFList<std::string>& xNameList = xLogicClass->GetConfigNameList();
std::string strConfigName;
for (bool bRet = xNameList.First(strConfigName); bRet; bRet = xNameList.Next(strConfigName))
{
const int nServerType = m_pElementInfoModule->GetPropertyInt(strConfigName, "Type");
const int nServerID = m_pElementInfoModule->GetPropertyInt(strConfigName, "ServerID");
if (nServerType == NF_SERVER_TYPES::NF_ST_WORLD)
{
const int nPort = m_pElementInfoModule->GetPropertyInt(strConfigName, "Port");
const int nMaxConnect = m_pElementInfoModule->GetPropertyInt(strConfigName, "MaxOnline");
const int nCpus = m_pElementInfoModule->GetPropertyInt(strConfigName, "CpuCount");
const std::string& strName = m_pElementInfoModule->GetPropertyString(strConfigName, "Name");
const std::string& strIP = m_pElementInfoModule->GetPropertyString(strConfigName, "IP");
ServerData xServerData;
xServerData.nGameID = nServerID;
xServerData.eServerType = (NF_SERVER_TYPE)nServerType;
xServerData.strIP = strIP;
xServerData.nPort = nPort;
xServerData.strName = strName;
xServerData.eState = NFMsg::EServerState::EST_NARMAL;
NFIClusterClientModule::AddServer(xServerData);
}
}
}
m_pKernelModule->CreateContainer(-2, "");
return true;
}
示例3: AfterInit
bool NFCProxyServerNet_ServerModule::AfterInit()
{
m_pKernelModule = pPluginManager->FindModule<NFIKernelModule>();
m_pLogicClassModule = pPluginManager->FindModule<NFILogicClassModule>();
m_pProxyToWorldModule = pPluginManager->FindModule<NFIProxyServerToWorldModule>();
m_pLogModule = pPluginManager->FindModule<NFILogModule>();
m_pElementModule = pPluginManager->FindModule<NFIElementModule>();
m_pUUIDModule = pPluginManager->FindModule<NFIUUIDModule>();
m_pProxyServerToGameModule = pPluginManager->FindModule<NFIProxyServerToGameModule>();
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_CONNECT_KEY, this, &NFCProxyServerNet_ServerModule::OnConnectKeyProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_WORLD_LIST, this, &NFCProxyServerNet_ServerModule::OnReqServerListProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_SELECT_SERVER, this, &NFCProxyServerNet_ServerModule::OnSelectServerProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_ROLE_LIST, this, &NFCProxyServerNet_ServerModule::OnReqRoleListProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_CREATE_ROLE, this, &NFCProxyServerNet_ServerModule::OnReqCreateRoleProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_DELETE_ROLE, this, &NFCProxyServerNet_ServerModule::OnReqDelRoleProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_ENTER_GAME, this, &NFCProxyServerNet_ServerModule::OnReqEnterGameServer);
m_pNetModule->AddReceiveCallBack(this, &NFCProxyServerNet_ServerModule::OnOtherMessage);
m_pNetModule->AddEventCallBack(this, &NFCProxyServerNet_ServerModule::OnSocketClientEvent);
NF_SHARE_PTR<NFILogicClass> xLogicClass = m_pLogicClassModule->GetElement("Server");
if (xLogicClass.get())
{
NFList<std::string>& xNameList = xLogicClass->GetConfigNameList();
std::string strConfigName;
for (bool bRet = xNameList.First(strConfigName); bRet; bRet = xNameList.Next(strConfigName))
{
const int nServerType = m_pElementModule->GetPropertyInt(strConfigName, "Type");
const int nServerID = m_pElementModule->GetPropertyInt(strConfigName, "ServerID");
if (nServerType == NF_SERVER_TYPES::NF_ST_PROXY && pPluginManager->AppID() == nServerID)
{
const int nPort = m_pElementModule->GetPropertyInt(strConfigName, "Port");
const int nMaxConnect = m_pElementModule->GetPropertyInt(strConfigName, "MaxOnline");
const int nCpus = m_pElementModule->GetPropertyInt(strConfigName, "CpuCount");
const std::string& strName = m_pElementModule->GetPropertyString(strConfigName, "Name");
const std::string& strIP = m_pElementModule->GetPropertyString(strConfigName, "IP");
m_pUUIDModule->SetIdentID(nServerID);
int nRet = m_pNetModule->Initialization(nMaxConnect, nPort, nCpus);
if (nRet < 0)
{
std::ostringstream strLog;
strLog << "Cannot init server net, Port = " << nPort;
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, NULL_OBJECT, strLog, __FUNCTION__, __LINE__);
NFASSERT(nRet, "Cannot init server net", __FILE__, __FUNCTION__);
exit(0);
}
}
}
}
return true;
}
示例4: AfterInit
bool NFCProxyServerToWorldModule::AfterInit()
{
m_pEventProcessModule = pPluginManager->FindModule<NFIEventProcessModule>("NFCEventProcessModule");
m_pProxyLogicModule = dynamic_cast<NFIProxyLogicModule*>(pPluginManager->FindModule("NFCProxyLogicModule"));
m_pKernelModule = pPluginManager->FindModule<NFIKernelModule>("NFCKernelModule");
m_pProxyServerNet_ServerModule = dynamic_cast<NFIProxyServerNet_ServerModule*>(pPluginManager->FindModule("NFCProxyServerNet_ServerModule"));
m_pElementInfoModule = pPluginManager->FindModule<NFIElementInfoModule>("NFCElementInfoModule");
m_pLogModule = pPluginManager->FindModule<NFILogModule>("NFCLogModule");
m_pLogicClassModule = pPluginManager->FindModule<NFILogicClassModule>("NFCLogicClassModule");
m_pToGameServerClusterClient = dynamic_cast<NFIClusterClientModule*>(pPluginManager->FindModule("NFCProxyServerToGameModule"));
assert(NULL != m_pEventProcessModule);
assert(NULL != m_pProxyLogicModule);
assert(NULL != m_pKernelModule);
assert(NULL != m_pProxyServerNet_ServerModule);
assert(NULL != m_pElementInfoModule);
assert(NULL != m_pLogModule);
assert(NULL != m_pLogicClassModule);
assert(NULL != m_pToGameServerClusterClient);
NFIClusterClientModule::Bind(this, &NFCProxyServerToWorldModule::OnReciveWSPack, &NFCProxyServerToWorldModule::OnSocketWSEvent);
NF_SHARE_PTR<NFILogicClass> xLogicClass = m_pLogicClassModule->GetElement("Server");
if (xLogicClass.get())
{
NFList<std::string>& xNameList = xLogicClass->GetConfigNameList();
std::string strConfigName;
for (bool bRet = xNameList.First(strConfigName); bRet; bRet = xNameList.Next(strConfigName))
{
const int nServerType = m_pElementInfoModule->GetPropertyInt(strConfigName, "Type");
const int nServerID = m_pElementInfoModule->GetPropertyInt(strConfigName, "ServerID");
if (nServerType == NF_SERVER_TYPES::NF_ST_WORLD)
{
const int nPort = m_pElementInfoModule->GetPropertyInt(strConfigName, "Port");
const int nMaxConnect = m_pElementInfoModule->GetPropertyInt(strConfigName, "MaxOnline");
const int nCpus = m_pElementInfoModule->GetPropertyInt(strConfigName, "CpuCount");
const std::string& strName = m_pElementInfoModule->GetPropertyString(strConfigName, "Name");
const std::string& strIP = m_pElementInfoModule->GetPropertyString(strConfigName, "IP");
ConnectData xServerData;
xServerData.nGameID = nServerID;
xServerData.eServerType = (NF_SERVER_TYPE)nServerType;
xServerData.strIP = strIP;
xServerData.nPort = nPort;
xServerData.strName = strName;
NFIClusterClientModule::AddServer(xServerData);
}
}
}
return true;
}
示例5: AfterInit
bool NFCLoginNet_ServerModule::AfterInit()
{
m_pKernelModule = pPluginManager->FindModule<NFIKernelModule>();
m_pLoginLogicModule = pPluginManager->FindModule<NFILoginLogicModule>();
m_pLogModule = pPluginManager->FindModule<NFILogModule>();
m_pLogicClassModule = pPluginManager->FindModule<NFILogicClassModule>();
m_pElementModule = pPluginManager->FindModule<NFIElementModule>();
m_pLoginToMasterModule = pPluginManager->FindModule<NFILoginToMasterModule>();
m_pUUIDModule = pPluginManager->FindModule<NFIUUIDModule>();
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_STS_HEART_BEAT, this, &NFCLoginNet_ServerModule::OnHeartBeat);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_LOGIN, this, &NFCLoginNet_ServerModule::OnLoginProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_LOGOUT, this, &NFCLoginNet_ServerModule::OnLogOut);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_CONNECT_WORLD, this, &NFCLoginNet_ServerModule::OnSelectWorldProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_WORLD_LIST, this, &NFCLoginNet_ServerModule::OnViewWorldProcess);
m_pNetModule->AddReceiveCallBack(this, &NFCLoginNet_ServerModule::InvalidMessage);
m_pNetModule->AddEventCallBack(this, &NFCLoginNet_ServerModule::OnSocketClientEvent);
NF_SHARE_PTR<NFILogicClass> xLogicClass = m_pLogicClassModule->GetElement("Server");
if (xLogicClass.get())
{
NFList<std::string>& xNameList = xLogicClass->GetConfigNameList();
std::string strConfigName;
for (bool bRet = xNameList.First(strConfigName); bRet; bRet = xNameList.Next(strConfigName))
{
const int nServerType = m_pElementModule->GetPropertyInt(strConfigName, "Type");
const int nServerID = m_pElementModule->GetPropertyInt(strConfigName, "ServerID");
if (nServerType == NF_SERVER_TYPES::NF_ST_LOGIN && pPluginManager->AppID() == nServerID)
{
const int nPort = m_pElementModule->GetPropertyInt(strConfigName, "Port");
const int nMaxConnect = m_pElementModule->GetPropertyInt(strConfigName, "MaxOnline");
const int nCpus = m_pElementModule->GetPropertyInt(strConfigName, "CpuCount");
m_pUUIDModule->SetIdentID(nServerID);
int nRet = m_pNetModule->Initialization(nMaxConnect, nPort, nCpus);
if (nRet < 0)
{
std::ostringstream strLog;
strLog << "Cannot init server net, Port = " << nPort;
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, NULL_OBJECT, strLog, __FUNCTION__, __LINE__);
NFASSERT(nRet, "Cannot init server net", __FILE__, __FUNCTION__);
exit(0);
}
}
}
}
return true;
}
示例6: AfterInit
bool NFCMasterNet_ServerModule::AfterInit()
{
m_pKernelModule = pPluginManager->FindModule<NFIKernelModule>();
m_pLogModule = pPluginManager->FindModule<NFILogModule>();
m_pClassModule = pPluginManager->FindModule<NFIClassModule>();
m_pElementModule = pPluginManager->FindModule<NFIElementModule>();
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_STS_HEART_BEAT, this, &NFCMasterNet_ServerModule::OnHeartBeat);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_MTL_WORLD_REGISTERED, this, &NFCMasterNet_ServerModule::OnWorldRegisteredProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_MTL_WORLD_UNREGISTERED, this, &NFCMasterNet_ServerModule::OnWorldUnRegisteredProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_MTL_WORLD_REFRESH, this, &NFCMasterNet_ServerModule::OnRefreshWorldInfoProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_LTM_LOGIN_REGISTERED, this, &NFCMasterNet_ServerModule::OnLoginRegisteredProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_LTM_LOGIN_UNREGISTERED, this, &NFCMasterNet_ServerModule::OnLoginUnRegisteredProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_LTM_LOGIN_REFRESH, this, &NFCMasterNet_ServerModule::OnRefreshLoginInfoProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_CONNECT_WORLD, this, &NFCMasterNet_ServerModule::OnSelectWorldProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_ACK_CONNECT_WORLD, this, &NFCMasterNet_ServerModule::OnSelectServerResultProcess);
m_pNetModule->AddReceiveCallBack(this, &NFCMasterNet_ServerModule::InvalidMessage);
m_pNetModule->AddEventCallBack(this, &NFCMasterNet_ServerModule::OnSocketEvent);
NF_SHARE_PTR<NFIClass> xLogicClass = m_pClassModule->GetElement("Server");
if (xLogicClass.get())
{
NFList<std::string>& xNameList = xLogicClass->GetConfigNameList();
std::string strConfigName;
for (bool bRet = xNameList.First(strConfigName); bRet; bRet = xNameList.Next(strConfigName))
{
const int nServerType = m_pElementModule->GetPropertyInt(strConfigName, "Type");
const int nServerID = m_pElementModule->GetPropertyInt(strConfigName, "ServerID");
if (nServerType == NF_SERVER_TYPES::NF_ST_MASTER && pPluginManager->AppID() == nServerID)
{
const int nPort = m_pElementModule->GetPropertyInt(strConfigName, "Port");
const int nMaxConnect = m_pElementModule->GetPropertyInt(strConfigName, "MaxOnline");
const int nCpus = m_pElementModule->GetPropertyInt(strConfigName, "CpuCount");
const std::string& strName = m_pElementModule->GetPropertyString(strConfigName, "Name");
const std::string& strIP = m_pElementModule->GetPropertyString(strConfigName, "IP");
int nRet = m_pNetModule->Initialization(nMaxConnect, nPort, nCpus);
if (nRet < 0)
{
std::ostringstream strLog;
strLog << "Cannot init server net, Port = " << nPort;
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, NULL_OBJECT, strLog, __FUNCTION__, __LINE__);
NFASSERT(nRet, "Cannot init server net", __FILE__, __FUNCTION__);
exit(0);
}
}
}
}
return true;
}
示例7: AfterInit
bool NFCWorldToMasterModule::AfterInit()
{
m_pEventProcessModule = dynamic_cast<NFIEventProcessModule*>(pPluginManager->FindModule("NFCEventProcessModule"));
m_pWorldLogicModule = dynamic_cast<NFIWorldLogicModule*>(pPluginManager->FindModule("NFCWorldLogicModule"));
m_pLogicClassModule = dynamic_cast<NFILogicClassModule*>(pPluginManager->FindModule("NFCLogicClassModule"));
m_pElementInfoModule = dynamic_cast<NFIElementInfoModule*>(pPluginManager->FindModule("NFCElementInfoModule"));
m_pLogModule = dynamic_cast<NFILogModule*>(pPluginManager->FindModule("NFCLogModule"));
assert(NULL != m_pEventProcessModule);
assert(NULL != m_pWorldLogicModule);
assert(NULL != m_pLogicClassModule);
assert(NULL != m_pElementInfoModule);
assert(NULL != m_pLogModule);
m_pEventProcessModule->AddEventCallBack(NFIDENTID(), NFED_ON_CLIENT_SELECT_SERVER_RESULTS, this, &NFCWorldToMasterModule::OnSelectServerResultsEvent);
NFIClusterClientModule::Bind(this, &NFCWorldToMasterModule::OnReciveMSPack, &NFCWorldToMasterModule::OnSocketMSEvent);
NF_SHARE_PTR<NFILogicClass> xLogicClass = m_pLogicClassModule->GetElement("Server");
if (xLogicClass.get())
{
NFList<std::string>& xNameList = xLogicClass->GetConfigNameList();
std::string strConfigName;
for (bool bRet = xNameList.First(strConfigName); bRet; bRet = xNameList.Next(strConfigName))
{
const int nServerType = m_pElementInfoModule->GetPropertyInt(strConfigName, "Type");
const int nServerID = m_pElementInfoModule->GetPropertyInt(strConfigName, "ServerID");
if (nServerType == NF_SERVER_TYPES::NF_ST_MASTER)
{
const int nPort = m_pElementInfoModule->GetPropertyInt(strConfigName, "Port");
const int nMaxConnect = m_pElementInfoModule->GetPropertyInt(strConfigName, "MaxOnline");
const int nCpus = m_pElementInfoModule->GetPropertyInt(strConfigName, "CpuCount");
const std::string& strName = m_pElementInfoModule->GetPropertyString(strConfigName, "Name");
const std::string& strIP = m_pElementInfoModule->GetPropertyString(strConfigName, "IP");
ServerData xServerData;
xServerData.nGameID = nServerID;
xServerData.eServerType = (NF_SERVER_TYPE)nServerType;
xServerData.strIP = strIP;
xServerData.nPort = nPort;
xServerData.strName = strName;
xServerData.eState = NFMsg::EServerState::EST_NARMAL;
NFIClusterClientModule::AddServer(xServerData);
}
}
}
return true;
}
示例8: AfterInit
bool NFCLoginNet_ServerModule::AfterInit()
{
m_pEventProcessModule = dynamic_cast<NFIEventProcessModule*>(pPluginManager->FindModule("NFCEventProcessModule"));
m_pKernelModule = dynamic_cast<NFIKernelModule*>(pPluginManager->FindModule("NFCKernelModule"));
m_pLoginLogicModule = dynamic_cast<NFILoginLogicModule*>(pPluginManager->FindModule("NFCLoginLogicModule"));
m_pLogModule = dynamic_cast<NFILogModule*>(pPluginManager->FindModule("NFCLogModule"));
m_pLogicClassModule = dynamic_cast<NFILogicClassModule*>(pPluginManager->FindModule("NFCLogicClassModule"));
m_pElementInfoModule = dynamic_cast<NFIElementInfoModule*>(pPluginManager->FindModule("NFCElementInfoModule"));
m_pLoginToMasterModule = dynamic_cast<NFILoginToMasterModule*>(pPluginManager->FindModule("NFCLoginToMasterModule"));
m_pUUIDModule = dynamic_cast<NFIUUIDModule*>(pPluginManager->FindModule("NFCUUIDModule"));
assert(NULL != m_pEventProcessModule);
assert(NULL != m_pKernelModule);
assert(NULL != m_pLoginLogicModule);
assert(NULL != m_pLogModule);
assert(NULL != m_pLogicClassModule);
assert(NULL != m_pElementInfoModule);
assert(NULL != m_pLoginToMasterModule);
assert(NULL != m_pUUIDModule);
m_pEventProcessModule->AddEventCallBack(NFIDENTID(), NFED_ON_CLIENT_LOGIN_RESULTS, this, &NFCLoginNet_ServerModule::OnLoginResultsEvent);
m_pEventProcessModule->AddEventCallBack(NFIDENTID(), NFED_ON_CLIENT_SELECT_SERVER_RESULTS, this, &NFCLoginNet_ServerModule::OnSelectWorldResultsEvent);
NF_SHARE_PTR<NFILogicClass> xLogicClass = m_pLogicClassModule->GetElement("Server");
if (xLogicClass.get())
{
NFList<std::string>& xNameList = xLogicClass->GetConfigNameList();
std::string strConfigName;
for (bool bRet = xNameList.First(strConfigName); bRet; bRet = xNameList.Next(strConfigName))
{
const int nServerType = m_pElementInfoModule->GetPropertyInt(strConfigName, "Type");
const int nServerID = m_pElementInfoModule->GetPropertyInt(strConfigName, "ServerID");
if (nServerType == NF_SERVER_TYPES::NF_ST_LOGIN && pPluginManager->AppID() == nServerID)
{
const int nPort = m_pElementInfoModule->GetPropertyInt(strConfigName, "Port");
const int nMaxConnect = m_pElementInfoModule->GetPropertyInt(strConfigName, "MaxOnline");
const int nCpus = m_pElementInfoModule->GetPropertyInt(strConfigName, "CpuCount");
m_pUUIDModule->SetIdentID(nServerID);
Initialization(NFIMsgHead::NF_Head::NF_HEAD_LENGTH, this, &NFCLoginNet_ServerModule::OnReciveClientPack, &NFCLoginNet_ServerModule::OnSocketClientEvent, nMaxConnect, nPort, nCpus);
}
}
}
return true;
}
示例9: AfterInit
bool NFCSceneProcessModule::AfterInit()
{
//初始化场景容器
#ifdef NF_USE_ACTOR
int nSelfActorID = pPluginManager->GetActorID();
#endif
NF_SHARE_PTR<NFILogicClass> pLogicClass = m_pLogicClassModule->GetElement("Scene");
if (pLogicClass.get())
{
NFList<std::string>& list = pLogicClass->GetConfigNameList();
std::string strData;
bool bRet = list.First(strData);
while (bRet)
{
int nSceneID = boost::lexical_cast<int>(strData);
const std::string& strFilePath = m_pElementInfoModule->GetPropertyString( strData, "FilePath" );
const int nActorID = m_pElementInfoModule->GetPropertyInt( strData, "ActorID" );
#ifdef NF_USE_ACTOR
if ( nActorID == nSelfActorID && nSceneID > 0 )
#else
if ( nSceneID > 0 )
#endif
{
LoadInitFileResource( nSceneID );
m_pKernelModule->CreateContainer( nSceneID, strData );
if ( E_SCENE_TYPE::SCENE_TYPE_NORMAL == GetCloneSceneType(nSceneID) )
{
for (int i = 1; i <= mnContainerLine; ++i)
{
const int nTargetGroupID = m_pKernelModule->RequestGroupScene( nSceneID);
const int nCreateGroupID = CreateCloneScene( nSceneID, nTargetGroupID, "File.xml", NFCDataList() );
if ( nCreateGroupID == nTargetGroupID)
{
CreateContinerObjectByFile( nSceneID, nTargetGroupID, "File.xml" );
}
}
}
}
bRet = list.Next(strData);
}
}
return true;
}
示例10: AfterInit
bool NFCSceneProcessModule::AfterInit()
{
m_pKernelModule = pPluginManager->FindModule<NFIKernelModule>( "NFCKernelModule" );
m_pElementInfoModule = pPluginManager->FindModule<NFIElementInfoModule>( "NFCElementInfoModule" );
m_pLogicClassModule = pPluginManager->FindModule<NFILogicClassModule>( "NFCLogicClassModule" );
m_pLogModule = pPluginManager->FindModule<NFILogModule>("NFCLogModule");
m_pGameServerNet_ServerModule = pPluginManager->FindModule<NFIGameServerNet_ServerModule>("NFCGameServerNet_ServerModule");
assert(NULL != m_pKernelModule);
assert(NULL != m_pElementInfoModule);
assert(NULL != m_pLogicClassModule);
assert(NULL != m_pLogModule);
assert(NULL != m_pGameServerNet_ServerModule);
m_pKernelModule->AddClassCallBack( NFrame::Player::ThisName(), this, &NFCSceneProcessModule::OnObjectClassEvent );
//////////////////////////////////////////////////////////////////////////
//初始化场景容器
// #ifdef NF_USE_ACTOR
// int nSelfActorID = pPluginManager->GetActorID();
// #endif
NF_SHARE_PTR<NFILogicClass> pLogicClass = m_pLogicClassModule->GetElement("Scene");
if (pLogicClass.get())
{
NFList<std::string>& list = pLogicClass->GetConfigNameList();
std::string strData;
bool bRet = list.First(strData);
while (bRet)
{
int nSceneID = lexical_cast<int>(strData);
LoadSceneResource( nSceneID );
m_pKernelModule->CreateScene( nSceneID );
bRet = list.Next(strData);
}
}
//////////////////////////////////////////////////////////////////////////
// add msg handler
if (!m_pGameServerNet_ServerModule->AddReciveCallBack(NFMsg::EGMI_REQ_SWAP_SCENE, this, &NFCSceneProcessModule::OnClienSwapSceneProcess)){ return false; }
return true;
}
示例11: AfterInit
bool NFCGameServerToWorldModule::AfterInit()
{
m_pKernelModule = pPluginManager->FindModule<NFIKernelModule>();
m_pLogicClassModule = pPluginManager->FindModule<NFILogicClassModule>();
m_pElementModule = pPluginManager->FindModule<NFIElementModule>();
m_pLogModule = pPluginManager->FindModule<NFILogModule>();
m_pGameServerNet_ServerModule = pPluginManager->FindModule<NFIGameServerNet_ServerModule>();
m_pNetClientModule->AddReceiveCallBack(this, &NFCGameServerToWorldModule::TransPBToProxy);
m_pNetClientModule->AddEventCallBack(this, &NFCGameServerToWorldModule::OnSocketWSEvent);
m_pKernelModule->AddClassCallBack(NFrame::Player::ThisName(), this, &NFCGameServerToWorldModule::OnObjectClassEvent);
// 连接world server
NF_SHARE_PTR<NFILogicClass> xLogicClass = m_pLogicClassModule->GetElement("Server");
if (xLogicClass.get())
{
NFList<std::string>& xNameList = xLogicClass->GetConfigNameList();
std::string strConfigName;
for (bool bRet = xNameList.First(strConfigName); bRet; bRet = xNameList.Next(strConfigName))
{
const int nServerType = m_pElementModule->GetPropertyInt(strConfigName, "Type");
const int nServerID = m_pElementModule->GetPropertyInt(strConfigName, "ServerID");
if (nServerType == NF_SERVER_TYPES::NF_ST_WORLD)
{
const int nPort = m_pElementModule->GetPropertyInt(strConfigName, "Port");
const int nMaxConnect = m_pElementModule->GetPropertyInt(strConfigName, "MaxOnline");
const int nCpus = m_pElementModule->GetPropertyInt(strConfigName, "CpuCount");
const std::string& strName = m_pElementModule->GetPropertyString(strConfigName, "Name");
const std::string& strIP = m_pElementModule->GetPropertyString(strConfigName, "IP");
ConnectData xServerData;
xServerData.nGameID = nServerID;
xServerData.eServerType = (NF_SERVER_TYPES)nServerType;
xServerData.strIP = strIP;
xServerData.nPort = nPort;
xServerData.strName = strName;
m_pNetClientModule->AddServer(xServerData);
}
}
}
return true;
}
示例12: Register
void NFCGameServerToWorldModule::Register(NFINet* pNet)
{
//成功就注册
NF_SHARE_PTR<NFILogicClass> xLogicClass = m_pLogicClassModule->GetElement("Server");
if (xLogicClass.get())
{
NFList<std::string>& xNameList = xLogicClass->GetConfigNameList();
std::string strConfigName;
for (bool bRet = xNameList.First(strConfigName); bRet; bRet = xNameList.Next(strConfigName))
{
const int nServerType = m_pElementInfoModule->GetPropertyInt(strConfigName, "Type");
const int nServerID = m_pElementInfoModule->GetPropertyInt(strConfigName, "ServerID");
if (nServerType == NF_SERVER_TYPES::NF_ST_GAME && pPluginManager->AppID() == nServerID)
{
const int nPort = m_pElementInfoModule->GetPropertyInt(strConfigName, "Port");
const int nMaxConnect = m_pElementInfoModule->GetPropertyInt(strConfigName, "MaxOnline");
const int nCpus = m_pElementInfoModule->GetPropertyInt(strConfigName, "CpuCount");
const std::string& strName = m_pElementInfoModule->GetPropertyString(strConfigName, "Name");
const std::string& strIP = m_pElementInfoModule->GetPropertyString(strConfigName, "IP");
NFMsg::ServerInfoReportList xMsg;
NFMsg::ServerInfoReport* pData = xMsg.add_server_list();
pData->set_server_id(nServerID);
pData->set_server_name(strName);
pData->set_server_cur_count(0);
pData->set_server_ip(strIP);
pData->set_server_port(nPort);
pData->set_server_max_online(nMaxConnect);
pData->set_server_state(NFMsg::EST_NARMAL);
pData->set_server_type(nServerType);
NF_SHARE_PTR<ServerData> pServerData = GetServerNetInfo(pNet);
if (pServerData)
{
int nTargetID = pServerData->nGameID;
SendToServerByPB(nTargetID, NFMsg::EGameMsgID::EGMI_GTW_GAME_REGISTERED, xMsg);
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFIDENTID(0, pData->server_id()), pData->server_name(), "Register");
}
}
}
}
}
示例13: AfterInit
bool NFCMasterNet_ServerModule::AfterInit()
{
m_pKernelModule = pPluginManager->FindModule<NFIKernelModule>("NFCKernelModule");
m_pLogModule = pPluginManager->FindModule<NFILogModule>("NFCLogModule");
m_pLogicClassModule = pPluginManager->FindModule<NFILogicClassModule>("NFCLogicClassModule");
m_pElementInfoModule = pPluginManager->FindModule<NFIElementInfoModule>("NFCElementInfoModule");
assert(NULL != m_pKernelModule);
assert(NULL != m_pLogModule);
assert(NULL != m_pLogicClassModule);
assert(NULL != m_pElementInfoModule);
NF_SHARE_PTR<NFILogicClass> xLogicClass = m_pLogicClassModule->GetElement("Server");
if (xLogicClass.get())
{
NFList<std::string>& xNameList = xLogicClass->GetConfigNameList();
std::string strConfigName;
for (bool bRet = xNameList.First(strConfigName); bRet; bRet = xNameList.Next(strConfigName))
{
const int nServerType = m_pElementInfoModule->GetPropertyInt(strConfigName, "Type");
const int nServerID = m_pElementInfoModule->GetPropertyInt(strConfigName, "ServerID");
if (nServerType == NF_SERVER_TYPES::NF_ST_MASTER && pPluginManager->AppID() == nServerID)
{
const int nPort = m_pElementInfoModule->GetPropertyInt(strConfigName, "Port");
const int nMaxConnect = m_pElementInfoModule->GetPropertyInt(strConfigName, "MaxOnline");
const int nCpus = m_pElementInfoModule->GetPropertyInt(strConfigName, "CpuCount");
const std::string& strName = m_pElementInfoModule->GetPropertyString(strConfigName, "Name");
const std::string& strIP = m_pElementInfoModule->GetPropertyString(strConfigName, "IP");
int nRet = Initialization(this, &NFCMasterNet_ServerModule::OnRecivePack, &NFCMasterNet_ServerModule::OnSocketEvent, nMaxConnect, nPort, nCpus);
if (nRet < 0)
{
std::ostringstream strLog;
strLog << "Cannot init server net, Port = " << nPort;
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, NULL_OBJECT, strLog, __FUNCTION__, __LINE__);
NFASSERT(nRet, "Cannot init server net", __FILE__, __FUNCTION__);
exit(0);
}
}
}
}
return true;
}
示例14: AfterInit
bool NFCGameServerToWorldModule::AfterInit()
{
m_pEventProcessModule = dynamic_cast<NFIEventProcessModule*>(pPluginManager->FindModule("NFCEventProcessModule"));
m_pKernelModule = dynamic_cast<NFIKernelModule*>(pPluginManager->FindModule("NFCKernelModule"));
m_pLogicClassModule = dynamic_cast<NFILogicClassModule*>(pPluginManager->FindModule("NFCLogicClassModule"));
m_pElementInfoModule = dynamic_cast<NFIElementInfoModule*>(pPluginManager->FindModule("NFCElementInfoModule"));
m_pLogModule = dynamic_cast<NFILogModule*>(pPluginManager->FindModule("NFCLogModule"));
assert(NULL != m_pEventProcessModule);
assert(NULL != m_pKernelModule);
assert(NULL != m_pLogicClassModule);
assert(NULL != m_pElementInfoModule);
assert(NULL != m_pLogModule);
//m_pEventProcessModule->AddEventCallBack(0, NFED_ON_DATABASE_SERVER_LOADROE_BEGIN, this, &NFCGameServerNet_ClientModule::OnDataLoadBeginEvent);
//m_pEventProcessModule->AddEventCallBack(0, NFED_ON_CLIENT_WANTO_SWAP_GS, this, &NFCGameServerNet_ClientModule::OnSwapGSEvent);
m_pKernelModule->ResgisterCommonClassEvent(this, &NFCGameServerToWorldModule::OnClassCommonEvent);
// 连接world server
NF_SHARE_PTR<NFILogicClass> xLogicClass = m_pLogicClassModule->GetElement("WorldServer");
if (xLogicClass.get())
{
NFList<std::string>& xNameList = xLogicClass->GetConfigNameList();
std::string strConfigName;
if (xNameList.Get(0, strConfigName))
{
const int nServerID = m_pElementInfoModule->GetPropertyInt(strConfigName, "ServerID");
const int nPort = m_pElementInfoModule->GetPropertyInt(strConfigName, "Port");
const int nMaxConnect = m_pElementInfoModule->GetPropertyInt(strConfigName, "MaxOnline");
const int nCpus = m_pElementInfoModule->GetPropertyInt(strConfigName, "CpuCount");
const std::string& strName = m_pElementInfoModule->GetPropertyString(strConfigName, "Name");
const std::string& strIP = m_pElementInfoModule->GetPropertyString(strConfigName, "IP");
Initialization(NFIMsgHead::NF_Head::NF_HEAD_LENGTH, this, &NFCGameServerToWorldModule::OnRecivePack, &NFCGameServerToWorldModule::OnSocketEvent, strIP.c_str(), nPort);
}
}
m_pKernelModule->CreateContainer(-2, "");
return true;
}
示例15: OnObjectClassEvent
int NFCEctypeModule::OnObjectClassEvent(const NFIDENTID& self, const std::string& strClassName, const CLASS_OBJECT_EVENT eClassEvent, const NFIDataList& var)
{
if (strClassName == "Player")
{
if (COE_CREATE_BEFORE_EFFECT == eClassEvent)
{
int nOnlineCount = m_pKernelModule->GetPropertyInt(self, "OnlineCount");
if (nOnlineCount <= 0)
{
NF_SHARE_PTR<NFILogicClass> pLogicCLass = m_pLogicClassModule->GetElement("Scene");
if (!pLogicCLass.get())
{
return 0;
}
NFList<std::string>& configList = pLogicCLass->GetConfigNameList();
std::string strSceneConfigID;
for (bool bRet = configList.First(strSceneConfigID); bRet; bRet = configList.Next(strSceneConfigID))
{
int nFirstScene = m_pElementInfoModule->GetPropertyInt(strSceneConfigID, "IsFirstCloneScene");
//第一关,并且是普通模式才可以,其他模式要求普通模式开启才行
if (nFirstScene > 0)
{
int nSceneId = 0;
if(NF_StrTo(strSceneConfigID, nSceneId))
{//免激活的地图直接可以进,这里手动激活一下,否则EctypeList里没有数据
AddEctypeActiveState(self, nSceneId);
}
}
}
}
}
else if (COE_CREATE_FINISH == eClassEvent)
{
m_pKernelModule->AddPropertyCallBack(self, "GroupID", this, &NFCEctypeModule::OnObjectGroupIDEvent);
//m_pEventProcessModule->AddEventCallBack(self, NFED_ON_OBJECT_ENTER_SCENE_RESULT, this, &NFCEctypeModule::OnEntrySceneEvent);
}
}
return 0;
}