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)); }
public static bool CanReceiveWhisperFrom(BnetGameAccountId id) { if (BnetPresenceMgr.Get().GetMyPlayer().IsBusy()) { return(false); } return(BnetFriendMgr.Get().IsFriend(id)); }
protected override void Awake() { s_instance = this; base.Awake(); this.UpdateOnlineCount(); BnetFriendMgr.Get().AddChangeListener(new BnetFriendMgr.ChangeCallback(this.OnFriendsChanged)); BnetPresenceMgr.Get().AddPlayersChangedListener(new BnetPresenceMgr.PlayersChangedCallback(this.OnPlayersChanged)); this.ShowPendingInvitesIcon(false); }
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 UpdateOnlineCount() { int activeOnlineFriendCount = BnetFriendMgr.Get().GetActiveOnlineFriendCount(); if (activeOnlineFriendCount == 0) { this.m_OnlineCountText.TextColor = this.m_AllOfflineColor; } else { this.m_OnlineCountText.TextColor = this.m_AnyOnlineColor; } this.m_OnlineCountText.Text = activeOnlineFriendCount.ToString(); }
private void Awake() { s_instance = this; this.m_toast = UnityEngine.Object.Instantiate <SocialToast>(this.m_socialToastPrefab); RenderUtils.SetAlpha(this.m_toast.gameObject, 0f); this.m_toast.gameObject.SetActive(false); this.m_toast.transform.parent = BnetBar.Get().m_socialToastBone.transform; this.m_toast.transform.localRotation = Quaternion.Euler(new Vector3(90f, 180f, 0f)); this.m_toast.transform.localScale = (Vector3)this.TOAST_SCALE; this.m_toast.transform.position = BnetBar.Get().m_socialToastBone.transform.position; BnetPresenceMgr.Get().AddPlayersChangedListener(new BnetPresenceMgr.PlayersChangedCallback(this.OnPlayersChanged)); BnetPresenceMgr.Get().OnGameAccountPresenceChange += new Action <BattleNet.PresenceUpdate[]>(this.OnPresenceChanged); BnetFriendMgr.Get().AddChangeListener(new BnetFriendMgr.ChangeCallback(this.OnFriendsChanged)); Network.Get().SetShutdownHandler(new Network.ShutdownHandler(this.ShutdownHandler)); SoundManager.Get().Load("UI_BnetToast"); }
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; } } } } } }
public void OnLoggedIn() { Network.Get().SetPartyHandler(new Network.PartyHandler(this.OnPartyUpdate)); NetCache.Get().RegisterFriendChallenge(new NetCache.NetCacheCallback(this.OnNetCacheReady)); SceneMgr.Get().RegisterSceneUnloadedEvent(new SceneMgr.SceneUnloadedCallback(this.OnSceneUnloaded)); SceneMgr.Get().RegisterSceneLoadedEvent(new SceneMgr.SceneLoadedCallback(this.OnSceneLoaded)); BnetPresenceMgr.Get().AddPlayersChangedListener(new BnetPresenceMgr.PlayersChangedCallback(this.OnPlayersChanged)); BnetFriendMgr.Get().AddChangeListener(new BnetFriendMgr.ChangeCallback(this.OnFriendsChanged)); BnetNearbyPlayerMgr.Get().AddChangeListener(new BnetNearbyPlayerMgr.ChangeCallback(this.OnNearbyPlayersChanged)); BnetEventMgr.Get().AddChangeListener(new BnetEventMgr.ChangeCallback(this.OnBnetEventOccurred)); GameMgr.Get().RegisterFindGameEvent(new GameMgr.FindGameCallback(this.OnFindGameEvent)); BnetParty.OnJoined += new BnetParty.JoinedHandler(this.BnetParty_OnJoined); BnetParty.RegisterAttributeChangedHandler("WTCG.Friendly.DeclineReason", new BnetParty.PartyAttributeChangedHandler(this.BnetParty_OnPartyAttributeChanged_DeclineReason)); BnetParty.RegisterAttributeChangedHandler("error", new BnetParty.PartyAttributeChangedHandler(this.BnetParty_OnPartyAttributeChanged_Error)); this.AddChangedListener(new ChangedCallback(this.OnChallengeChanged)); BnetPresenceMgr.Get().SetGameField(0x13, BattleNet.GetVersion()); BnetPresenceMgr.Get().SetGameField(20, BattleNet.GetEnvironment()); }
public void SetGameAccountId(BnetGameAccountId id) { this.m_gameAccountId = id; this.UpdateLocal(); this.UpdateSide(); if (this.IsDisplayable()) { this.UpdateDisplayInfo(); } else if (this.IsBnetPlayer()) { BnetPresenceMgr.Get().AddPlayersChangedListener(new BnetPresenceMgr.PlayersChangedCallback(this.OnBnetPlayersChanged)); if (!BnetFriendMgr.Get().IsFriend(this.m_gameAccountId) && (GameMgr.Get().IsSpectator() || (GameMgr.Get().GetReconnectType() == ReconnectType.LOGIN))) { this.RequestPlayerPresence(); } } }
private void OnInputSubmitted(string input) { string email = !this.m_usePlayer ? input.Trim() : this.m_player.GetBattleTag().ToString(); if (email.Contains("@")) { BnetFriendMgr.Get().SendInviteByEmail(email); } else if (email.Contains("#")) { BnetFriendMgr.Get().SendInviteByBattleTag(email); } else { string message = GameStrings.Get("GLOBAL_ADDFRIEND_ERROR_MALFORMED"); UIStatus.Get().AddError(message); } this.OnClosed(); }
private bool InitReceiver() { this.m_receiver = null; if (this.m_recentPlayers.Count == 0) { string str; if (BnetFriendMgr.Get().GetOnlineFriendCount() == 0) { str = GameStrings.Get("GLOBAL_CHAT_NO_FRIENDS_ONLINE"); } else { str = GameStrings.Get("GLOBAL_CHAT_NO_RECENT_CONVERSATIONS"); } UIStatus.Get().AddError(str); return(false); } this.m_receiver = this.m_recentPlayers[0]; return(true); }
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(); } }
public static bool CanReceiveChallengeFrom(BnetGameAccountId id) { return(BnetFriendMgr.Get().IsFriend(id) || BnetNearbyPlayerMgr.Get().IsNearbyStranger(id)); }
private void OnAcceptButtonPressed(UIEvent e) { BnetFriendMgr.Get().AcceptInvite(this.m_invite.GetId()); }
private void OnDestroy() { BnetFriendMgr.Get().RemoveChangeListener(new BnetFriendMgr.ChangeCallback(this.OnFriendsChanged)); BnetPresenceMgr.Get().RemovePlayersChangedListener(new BnetPresenceMgr.PlayersChangedCallback(this.OnPlayersChanged)); s_instance = null; }
private void OnDeclineButtonPressed(UIEvent e) { BnetFriendMgr.Get().DeclineInvite(this.m_invite.GetId()); }
public bool IsFriend() { BnetAccountId accountId = this.GetAccountId(); return(BnetFriendMgr.Get().IsFriend(accountId)); }
private void AssetsVersionCheckCompleted() { if (!string.IsNullOrEmpty(UpdateManager.Get().GetError()) && UpdateManager.Get().UpdateIsRequired()) { Error.AddFatalLoc("GLUE_PATCHING_ERROR", new object[0]); } else { if (Network.ShouldBeConnectedToAurora()) { BnetPresenceMgr.Get().Initialize(); BnetFriendMgr.Get().Initialize(); BnetChallengeMgr.Get().Initialize(); BnetWhisperMgr.Get().Initialize(); BnetNearbyPlayerMgr.Get().Initialize(); FriendChallengeMgr.Get().OnLoggedIn(); SpectatorManager.Get().Initialize(); if (!Options.Get().GetBool(Option.CONNECT_TO_AURORA)) { Options.Get().SetBool(Option.CONNECT_TO_AURORA, true); } TutorialProgress progress = Options.Get().GetEnum <TutorialProgress>(Option.LOCAL_TUTORIAL_PROGRESS); if (progress > TutorialProgress.NOTHING_COMPLETE) { this.m_waitingForSetProgress = true; ConnectAPI.SetProgress((long)progress); } if (WebAuth.GetIsNewCreatedAccount()) { AdTrackingManager.Get().TrackAccountCreated(); WebAuth.SetIsNewCreatedAccount(false); } } ConnectAPI.RequestAccountLicenses(); ConnectAPI.RequestGameLicenses(); Box.Get().OnLoggedIn(); BaseUI.Get().OnLoggedIn(); InactivePlayerKicker.Get().OnLoggedIn(); HealthyGamingMgr.Get().OnLoggedIn(); DefLoader.Get().Initialize(); CollectionManager.Init(); AdventureProgressMgr.Init(); Tournament.Init(); GameMgr.Get().OnLoggedIn(); if (Network.ShouldBeConnectedToAurora()) { StoreManager.Get().Init(); } Network.TrackClient(Network.TrackLevel.LEVEL_INFO, Network.TrackWhat.TRACK_LOGIN_FINISHED); Network.ResetConnectionFailureCount(); if (Network.ShouldBeConnectedToAurora()) { ConnectAPI.DoLoginUpdate(); } else { this.m_waitingForUpdateLoginComplete = false; } Enum[] args = new Enum[] { PresenceStatus.LOGIN }; PresenceMgr.Get().SetStatus(args); if (SplashScreen.Get() != null) { SplashScreen.Get().StopPatching(); SplashScreen.Get().ShowRatings(); } this.PreloadActors(); if (!Network.ShouldBeConnectedToAurora()) { base.StartCoroutine(this.RegisterScreenWhenReady()); } SceneMgr.Get().LoadShaderPreCompiler(); } }