| 80 | } |
| 81 | |
| 82 | void TwoPlayerModule::onUserlistSetup(CCNode* container, int accountId, bool myself, UserListPopup* popup) { |
| 83 | if (myself) return; |
| 84 | |
| 85 | // if we are already linked, show only an unlink button on the linked player |
| 86 | if (m_linkedPlayer) { |
| 87 | if (accountId != *m_linkedPlayer) { |
| 88 | return; |
| 89 | } |
| 90 | |
| 91 | Build<CCSprite>::createSpriteName("gj_linkBtnOff_001.png") |
| 92 | .scale(0.8f) |
| 93 | .intoMenuItem([this, popup] { |
| 94 | this->unlink(); |
| 95 | popup->hardRefresh(); |
| 96 | }) |
| 97 | .id("2p-unlink") |
| 98 | .parent(container); |
| 99 | |
| 100 | return; |
| 101 | } |
| 102 | |
| 103 | // otherwise, show a link button on all players |
| 104 | |
| 105 | Build<CCSprite>::createSpriteName("gj_linkBtn_001.png") |
| 106 | .scale(0.8f) |
| 107 | .intoMenuItem([accountId, popup] { |
| 108 | LinkRequestPopup::create(accountId, popup)->show(); |
| 109 | }) |
| 110 | .id("2p-unlink") |
| 111 | .parent(container); |
| 112 | } |
| 113 | |
| 114 | void TwoPlayerModule::onPlayerLeave(GlobedGJBGL* gjbgl, int accountId) { |
| 115 | if (accountId == m_linkedPlayer) { |
no test coverage detected