Exemplo n.º 1
0
 public override void OnStartLocalPlayer()
 {
     base.OnStartLocalPlayer();
     PlayerManager.SetViewerForControl(this);
     UIManager.ResetAllUI();
     UIManager.Display.DetermineGameMode();
     UIManager.SetDeathVisibility(true);
     if (BuildPreferences.isSteamServer)
     {
         // Send request to be authenticated by the server
         if (Client.Instance != null)
         {
             Logger.Log("Client Requesting Auth", Category.Steam);
             // Generate authentication Ticket
             var ticket       = Client.Instance.Auth.GetAuthSessionTicket();
             var ticketBinary = ticket.Data;
             // Send Clientmessage to authenticate
             RequestAuthMessage.Send(Client.Instance.SteamId, ticketBinary);
         }
         else
         {
             Logger.Log("Client NOT requesting auth", Category.Steam);
         }
     }
 }
Exemplo n.º 2
0
        private void Init()
        {
            if (isLocalPlayer)
            {
                UIManager.ResetAllUI();
                UIManager.DisplayManager.SetCameraFollowPos();
                int rA = Random.Range(0, 3);
                SoundManager.PlayVarAmbient(rA);
                playerMove    = GetComponent <PlayerMove>();
                playerSprites = GetComponent <PlayerSprites>();
                GetComponent <InputController>().enabled = true;

                if (!UIManager.Instance.playerListUIControl.window.activeInHierarchy)
                {
                    UIManager.Instance.playerListUIControl.window.SetActive(true);
                }

                CmdTrySetInitialName(PlayerManager.PlayerNameCache);

                PlayerManager.SetPlayerForControl(gameObject);

                if (PlayerManager.LocalPlayerScript.JobType == JobType.NULL)
                {
                    // I (client) have connected to the server, ask what my job preference is
                    UIManager.Instance.GetComponent <ControlDisplays>().jobSelectWindow.SetActive(true);
                }
                UIManager.SetDeathVisibility(true);
                // Send request to be authenticated by the server
                if (Client.Instance != null)
                {
                    Debug.Log("Client Requesting Auth");
                    // Generate authentication Ticket
                    var ticket       = Client.Instance.Auth.GetAuthSessionTicket();
                    var ticketBinary = ticket.Data;
                    // Send Clientmessage to authenticate
                    RequestAuthMessage.Send(Client.Instance.SteamId, ticketBinary);
                }
                else
                {
                    Debug.Log("Client NOT requesting auth");
                }
//				Request sync to get all the latest transform data
//				new RequestSyncMessage().Send();
                SelectedChannels = ChatChannel.Local;
            }
            else if (isServer)
            {
                playerMove = GetComponent <PlayerMove>();

                //Add player to player list
                PlayerList.Instance.Add(new ConnectedPlayer
                {
                    Connection = connectionToClient,
                    GameObject = gameObject,
                    Job        = JobType
                });
            }
        }
Exemplo n.º 3
0
    public static RequestAuthMessage Send(ulong steamid, byte[] ticketBinary)
    {
        RequestAuthMessage msg = new RequestAuthMessage
        {
            SteamID      = steamid,
            TicketBinary = ticketBinary
        };

        msg.Send();
        return(msg);
    }
Exemplo n.º 4
0
    //Just ensures connected player record is set on the server first before Auth req is sent
    IEnumerator WaitUntilServerInit()
    {
        yield return(WaitFor.EndOfFrame);

        if (Client.Instance != null)
        {
            Logger.Log("Client Requesting Auth", Category.Steam);
            // Generate authentication Ticket
            var ticket       = Client.Instance.Auth.GetAuthSessionTicket();
            var ticketBinary = ticket.Data;
            // Send Clientmessage to authenticate
            RequestAuthMessage.Send(Client.Instance.SteamId, ticketBinary);
        }
        else
        {
            Logger.Log("Client NOT requesting auth", Category.Steam);
        }
    }