Exemplo n.º 1
0
    IEnumerator ClearPrefs()
    {
        yield return(new WaitForEndOfFrame()); // We want to delay this so the TutorialButton listeners happen first

        PlayerSession.Reset();
    }
Exemplo n.º 2
0
        private object IOnUserApprove(PlayerSession session)
        {
            session.Identity.Name = session.Identity.Name ?? "Unnamed";
            string id = session.SteamId.ToString();
            string ip = session.Player.ipAddress;

            Covalence.PlayerManager.PlayerJoin(session);

            object loginSpecific  = Interface.CallHook("CanClientLogin", session);
            object loginCovalence = Interface.CallHook("CanUserLogin", session.Identity.Name, id, ip);
            object canLogin       = loginSpecific ?? loginCovalence;

            if (canLogin is string || canLogin is bool && !(bool)canLogin)
            {
                GameManager.Instance.StartCoroutine(GameManager.Instance.DisconnectPlayerSync(session.Player, canLogin is string?canLogin.ToString() : "Connection was rejected"));   // TODO: Localization
                if (session.IsActiveSlot)
                {
                    session.IsActiveSlot = false;
                    GameManager.Instance._activePlayerCount--;
                }
                if (GameManager.Instance._steamIdSession.ContainsKey(session.SteamId))
                {
                    GameManager.Instance._steamIdSession.Remove(session.SteamId);
                }
                if (GameManager.Instance._playerQueue.Contains(session))
                {
                    GameManager.Instance._playerQueue.Remove(session);
                }
                if (GameManager.Instance._steamIdSession.ContainsKey(session.SteamId))
                {
                    GameManager.Instance._steamIdSession.Remove(session.SteamId);
                }
                int authTicketHash = session.AuthTicketBuffer.ComputeHash();
                if (GameManager.Instance._userTokenMap.ContainsKey(authTicketHash))
                {
                    GameManager.Instance._userTokenMap.Remove(authTicketHash);
                }
                if (GameManager.Instance._playerSessions.ContainsKey(session.Player))
                {
                    GameManager.Instance._playerSessions.Remove(session.Player);
                }
                if (session.Identity.ConnectedSession != session)
                {
                    HNetworkManager.Instance.FinalDestroyPlayerObjects(session.Player);
                    session.Reset();
                    ClassInstancePool.Instance.ReleaseInstanceExplicit(session);
                }
                else
                {
                    session.Identity.WriteFromEntity(false);
                    GameManager.Instance.StartCoroutine(GameManager.Instance.RemovePlayerWorldEntity(session));
                }
                return(true);
            }

            GameManager.Instance._playerSessions[session.Player] = session;

            object approvedSpecific  = Interface.CallHook("OnUserApprove", session);
            object approvedCovalence = Interface.CallHook("OnUserApproved", session.Identity.Name, id, ip);

            return(approvedSpecific ?? approvedCovalence);
        }