Ejemplo n.º 1
0
 private void GameClient_DataRecieved(GClient sender, Packet packet, int channel)
 {
     CSteamID steamIDSender = sender.ConnectedTo;
     if (packet.PacketID == 0x001122)
     {
         int randomNumber = packet.ReadInteger();
         Debug.LogFormat("Random Number from Server: {0}", randomNumber);
     }
     Debug.LogFormat("Got message type 0x{0}.", packet.PacketID.ToString("X4"));
 }
Ejemplo n.º 2
0
        public GClient()
        {
            m_CallbackP2PSessionRequest = Callback<P2PSessionRequest_t>.Create(OnP2PSessionRequest);

            matchmakingPingResponse = new ISteamMatchmakingPingResponse(MatchmakingPing_ServerResponded, MatchmakingPing_ServerFailedToRespond);

            m_CallbackP2PSessionConnectFail = Callback<P2PSessionConnectFail_t>.Create(OnP2PSessionFailed);

            if (_Instance != null)
                throw new System.InvalidOperationException("Instance was already set.");

            _Instance = this;
        }
Ejemplo n.º 3
0
        internal Packet(GClient client, bool iswriteable = true, long packetID = 0x000000)
        {
            PacketID = packetID;
            _Client = client;
            _IsWriteable = iswriteable;

            _Stream = new MemoryStream();
            _Writer = new BinaryWriter(_Stream);
            _Reader = new BinaryReader(_Stream);

            if (_IsWriteable)
            {
                Write(packetID);
            }
        }
Ejemplo n.º 4
0
 private void GameClient_ConnectionStatusChanged(GClient sender, CSteamID server, EConnectionStatus status)
 {
     Debug.LogFormat("Server: {0} Connection Status: {1}", server.m_SteamID, status);
 }
Ejemplo n.º 5
0
 private void GameClient_ConnectingToServer(GClient sender, CSteamID server)
 {
     Debug.LogFormat("We are ready for liftoff! Connecting to: {0}", server);
 }
Ejemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        DontDestroyOnLoad(gameObject);

        if (CommandLineManager.IsServer)
        {
            gameServer = gameObject.AddComponent<ServerImplmentation>();
            cmdLineManager = gameObject.AddComponent<ConsoleManager>();
        }
        else
        {
            manager = gameObject.AddComponent<SteamManager>();
            gameClient = new GClient();
            gameClient.DataRecieved += GameClient_DataRecieved;
            gameClient.ConnectionStatusChanged += GameClient_ConnectionStatusChanged;
            gameClient.ConnectingToServer += GameClient_ConnectingToServer;

            gameClient.MatchmakingListFoundServer += GameClient_MatchmakingListFoundServer;

            //request = gameClient.RefreshList(EServerList.LAN);
        }
    }