//HANLDERS void OnAuthenticationChanged(bool state) { if (state == true) { m_PrimaryKey = CloudUser.instance.primaryKey; LobbyClient.RegisterPlayerMessageObserver(OnStatusReceived, m_PrimaryKey, LobbyGangMessage.STATUS); LobbyClient.RegisterPlayerMessageObserver(OnIsReadyReceived, m_PrimaryKey, LobbyGangMessage.READY); } else { LobbyClient.UnregisterPlayerMessageObserver(OnStatusReceived, m_PrimaryKey, LobbyGangMessage.STATUS); LobbyClient.UnregisterPlayerMessageObserver(OnIsReadyReceived, m_PrimaryKey, LobbyGangMessage.READY); } }
// HANDLERS void OnAuthenticationChanged(bool state) { if (state == true) { m_PrimaryKey = CloudUser.instance.primaryKey; LobbyClient.RegisterPlayerMessageObserver(OnInviteReceived, m_PrimaryKey, LobbyGangMessage.INVITE); LobbyClient.RegisterPlayerMessageObserver(OnKickReceived, m_PrimaryKey, LobbyGangMessage.KICK); LobbyClient.RegisterPlayerMessageObserver(OnRefreshReceived, m_PrimaryKey, LobbyGangMessage.REFRESH); } else { LobbyClient.UnregisterPlayerMessageObserver(OnInviteReceived, m_PrimaryKey, LobbyGangMessage.INVITE); LobbyClient.UnregisterPlayerMessageObserver(OnKickReceived, m_PrimaryKey, LobbyGangMessage.KICK); LobbyClient.UnregisterPlayerMessageObserver(OnRefreshReceived, m_PrimaryKey, LobbyGangMessage.REFRESH); } }
void OnUserAuthenticationChanged(bool state) { if (state == true) { m_PrimaryKey = CloudUser.instance.primaryKey; LobbyClient.RegisterPlayerMessageObserver(OnFriendMessageReceived, REQUEST_ID); Load(); #if UNITY_EDITOR // debug code... if (m_Friends.Count == 0) { //Debug_GenerateRandomFriends(true ); //Save(); } if (m_PendingFriends.Count == 0) { //Debug_GenerateRandomFriends(false); //Save(); } #endif } else { LobbyClient.UnregisterPlayerMessageObserver(OnFriendMessageReceived, REQUEST_ID); m_Friends.Clear(); m_PendingFriends.Clear(); m_PrimaryKey = string.Empty; m_LastSyncTime = new System.DateTime(); CancelOnlineStatusRequest(); } }
// HANDLERS void OnAuthenticationChanged(bool state) { if (state == true) { m_PrimaryKey = CloudUser.instance.primaryKey; LobbyClient.RegisterPlayerMessageObserver(OnChatStart, m_PrimaryKey, CMD_START); LobbyClient.RegisterPlayerMessageObserver(OnChatJoined, m_PrimaryKey, CMD_JOINED); LobbyClient.RegisterPlayerMessageObserver(OnChatLeave, m_PrimaryKey, CMD_LEAVE); LobbyClient.RegisterPlayerMessageObserver(OnChatFailed, m_PrimaryKey, CMD_FAILED); } else { while (m_Friends.Count > 0) { LeaveChat(0, true); } LobbyClient.UnregisterPlayerMessageObserver(OnChatStart, m_PrimaryKey, CMD_START); LobbyClient.UnregisterPlayerMessageObserver(OnChatJoined, m_PrimaryKey, CMD_JOINED); LobbyClient.UnregisterPlayerMessageObserver(OnChatLeave, m_PrimaryKey, CMD_LEAVE); LobbyClient.UnregisterPlayerMessageObserver(OnChatFailed, m_PrimaryKey, CMD_FAILED); } }