private void Initialize() { BnetFriendMgr.Get().AddChangeListener(new BnetFriendMgr.ChangeCallback(this.OnFriendsChanged)); Network.Get().AddBnetErrorListener(BnetFeature.Friends, new Network.BnetErrorCallback(this.OnBnetError)); BnetPresenceMgr.Get().AddPlayersChangedListener(new BnetPresenceMgr.PlayersChangedCallback(this.OnPlayersChanged)); SceneMgr.Get().RegisterSceneLoadedEvent(new SceneMgr.SceneLoadedCallback(this.OnSceneLoaded)); }
private void UpdateDisplayInfo() { this.UpdateName(); this.UpdateRank(); if (this.IsBnetPlayer() && !this.IsLocalUser()) { BnetPlayer player = BnetPresenceMgr.Get().GetPlayer(this.m_gameAccountId); if (BnetFriendMgr.Get().IsFriend(player)) { ChatMgr.Get().AddRecentWhisperPlayerToBottom(player); } } }
private void CacheSpecialGameAccounts() { this.m_hsGameAccount = null; this.m_bestGameAccount = null; ulong lastOnlineMicrosec = 0L; foreach (BnetGameAccount account in this.m_gameAccounts.Values) { BnetProgramId programId = account.GetProgramId(); if (programId != null) { if (programId == BnetProgramId.HEARTHSTONE) { this.m_hsGameAccount = account; if (account.IsOnline() || !BnetFriendMgr.Get().IsFriend(account.GetId())) { this.m_bestGameAccount = account; } break; } if (this.m_bestGameAccount == null) { this.m_bestGameAccount = account; lastOnlineMicrosec = this.m_bestGameAccount.GetLastOnlineMicrosec(); } else { BnetProgramId id2 = this.m_bestGameAccount.GetProgramId(); if (programId.IsGame() && !id2.IsGame()) { this.m_bestGameAccount = account; lastOnlineMicrosec = this.m_bestGameAccount.GetLastOnlineMicrosec(); } else if ((account.IsOnline() && programId.IsGame()) && id2.IsGame()) { ulong num2 = account.GetLastOnlineMicrosec(); if (num2 > lastOnlineMicrosec) { this.m_bestGameAccount = account; lastOnlineMicrosec = num2; } } } } } }
private static bool GetUniqueName(BnetPlayer friend, out BnetBattleTag battleTag, out string name) { battleTag = friend.GetBattleTag(); name = friend.GetBestName(); if (battleTag != null) { if (BnetNearbyPlayerMgr.Get().IsNearbyStranger(friend)) { return(true); } foreach (BnetPlayer player in BnetFriendMgr.Get().GetFriends()) { if (player != friend) { string bestName = player.GetBestName(); if (string.Compare(name, bestName, true) == 0) { return(true); } } } } return(false); }
public virtual void UpdateNearbyPlayer() { if (base.gameObject.activeSelf) { if (this.m_player == null) { this.m_PlayerNameText.Text = string.Empty; } else { BnetPlayer friend = BnetFriendMgr.Get().FindFriend(this.m_player.GetAccountId()); if (friend != null) { this.m_PlayerNameText.Text = FriendUtils.GetFriendListName(friend, true); } else { this.m_PlayerNameText.Text = FriendUtils.GetFriendListName(this.m_player, true); } } this.m_ChallengeButton.UpdateButton(); this.UpdateLayout(); } }
private void OnDeclineButtonPressed(UIEvent e) { BnetFriendMgr.Get().DeclineInvite(this.m_invite.GetId()); }
private void OnAcceptButtonPressed(UIEvent e) { BnetFriendMgr.Get().AcceptInvite(this.m_invite.GetId()); }