| 278 | } |
| 279 | |
| 280 | bool AFCGameNetModule::ProcessEnterGroup(const AFGUID& self, int nSceneID, int nNewGroupID) |
| 281 | { |
| 282 | // broadcast self enter to others |
| 283 | if (nNewGroupID <= 0) |
| 284 | { |
| 285 | return false; |
| 286 | } |
| 287 | |
| 288 | //exclude myself |
| 289 | ////////////////////////////////////////////////////////////////////////// |
| 290 | AFCDataList valueAllObjectList; |
| 291 | AFCDataList valueAllObjectListNoSelf; |
| 292 | AFCDataList valuePlayerList; |
| 293 | AFCDataList valuePlayerListNoSelf; |
| 294 | m_pMapModule->GetInstEntityList(nSceneID, nNewGroupID, valueAllObjectList); |
| 295 | |
| 296 | for (size_t i = 0; i < valueAllObjectList.GetCount(); i++) |
| 297 | { |
| 298 | AFGUID identBC = valueAllObjectList.Int64(i); |
| 299 | auto pEntity = m_pKernelModule->GetEntity(identBC); |
| 300 | if (pEntity == nullptr) |
| 301 | { |
| 302 | continue; |
| 303 | } |
| 304 | |
| 305 | const std::string& class_name = pEntity->GetClassName(); |
| 306 | if (AFEntityMetaPlayer::self_name() == class_name) |
| 307 | { |
| 308 | valuePlayerList << identBC; |
| 309 | |
| 310 | if (identBC != self) |
| 311 | { |
| 312 | valuePlayerListNoSelf << identBC; |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | if (identBC != self) |
| 317 | { |
| 318 | valueAllObjectListNoSelf << identBC; |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | // broadcast others that I'm here(need exclude self) |
| 323 | if (valuePlayerListNoSelf.GetCount() > 0) |
| 324 | { |
| 325 | auto pEntity = m_pKernelModule->GetEntity(self); |
| 326 | if (pEntity == nullptr) |
| 327 | { |
| 328 | return false; |
| 329 | } |
| 330 | |
| 331 | OnEntityListEnter(valuePlayerListNoSelf, AFCDataList() << self); |
| 332 | OnViewDataNodeEnter(valuePlayerListNoSelf, self); |
| 333 | OnViewDataTableEnter(valuePlayerListNoSelf, self); |
| 334 | |
| 335 | const std::string class_name = pEntity->GetClassName(); |
| 336 | if (class_name == AFEntityMetaPlayer::self_name()) |
| 337 | { |
nothing calls this directly
no test coverage detected