Exemple #1
0
    protected void HandlePlayerConnect(RakNet.SystemAddress _cSystemAddress, RakNet.RakNetGUID _cGuid)
    {
        // Create network player instance for new player
        CNetworkPlayer cNetworkPlayer = gameObject.AddComponent <CNetworkPlayer>();

        // Check is host by matching address and connection guid
        bool bIsHost = _cGuid.g == CNetwork.Connection.RakPeer.GetMyGUID().g;

        // Initialise player instance
        cNetworkPlayer.Initialise(_cSystemAddress, _cGuid, bIsHost);

        // Store network player instance
        s_mNetworkPlayers.Add(cNetworkPlayer.Guid.g, cNetworkPlayer);

        // Join notice
        Logger.Write("A player has joined. Instance id ({0}) System address ({1}) Guid ({2})", cNetworkPlayer.PlayerId, _cSystemAddress, _cGuid);

        // Notify event observers
        if (EventPlayerConnect != null)
        {
            EventPlayerConnect(cNetworkPlayer);
        }

        // Update server info, player count
        UpdateServerInfo();

        // Tell player that he has been given the initial game state
        cNetworkPlayer.SetDownloadingInitialGameStateComplete();
    }
Exemple #2
0
    public void Initialise(RakNet.SystemAddress _cSystemAddress, RakNet.RakNetGUID _cGuid, bool _bHost)
    {
        ResetNetworkViewSteam();

        m_cSystemAddress = new RakNet.SystemAddress(_cSystemAddress.ToString(), _cSystemAddress.GetPort());
        m_cGuid          = new RakNet.RakNetGUID(_cGuid.g);
        m_bHost          = _bHost;
    }
Exemple #3
0
	public void Initialise(RakNet.SystemAddress _cSystemAddress, RakNet.RakNetGUID _cGuid, bool _bHost)
	{
		ResetNetworkViewSteam();

		m_cSystemAddress = new RakNet.SystemAddress(_cSystemAddress.ToString(), _cSystemAddress.GetPort());
		m_cGuid = new RakNet.RakNetGUID(_cGuid.g);
		m_bHost = _bHost;
	}
Exemple #4
0
    public void GetParticipantList(RakNetGUID[] participantList)
    {
			RakNetListRakNetGUID passListGUID = new RakNetListRakNetGUID();
			GetParticipantListHelper(passListGUID);
			for (int i = 0; i < participantList.Length && i < passListGUID.Size(); i++)
			{
			  participantList[i] = passListGUID[i];
			}
    }
Exemple #5
0
    protected void HandlePlayerMicrophoneAudio(RakNet.RakNetGUID _cPlayerGuid, byte[] _baData)
    {
        if (EventRecievedPlayerMicrophoneAudio != null)
        {
            CNetworkStream cAudioDataStream = new CNetworkStream(_baData);
            cAudioDataStream.IgnoreBytes(1);

            EventRecievedPlayerMicrophoneAudio(FindNetworkPlayer(_cPlayerGuid.g), cAudioDataStream);
        }
    }
Exemple #6
0
    public bool GetConnectionListForRemoteSystem(RakNetGUID remoteSystemGuid, SystemAddress[] saOut, RakNetGUID[] guidOut, ref uint inOutLength)
    {
        uint minLength = inOutLength;
        if (guidOut.Length < minLength)
        { minLength = (uint)guidOut.Length; }

        if (saOut.Length < minLength)
        { minLength = (uint)saOut.Length; }

        RakNetListRakNetGUID passListGUID = new RakNetListRakNetGUID();
        RakNetListSystemAddress passListSystemAddress = new RakNetListSystemAddress();

        bool returnVal = GetConnectionListForRemoteSystemHelper(remoteSystemGuid, passListSystemAddress, passListGUID, ref inOutLength);

        if (inOutLength< minLength)
        { minLength = (uint)inOutLength;}

        for (int i = 0; i < minLength; i++)
        {
            guidOut[i] = passListGUID[i];
            saOut[i] = passListSystemAddress[i];
        }
        return returnVal;
    }
Exemple #7
0
 public void SetHostGuid(RakNetGUID _hostGuid)
 {
     RakNetPINVOKE.TeamBalancer_SetHostGuid(swigCPtr, RakNetGUID.getCPtr(_hostGuid));
     if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
 }
 public RakNetGUID GetHostSystem() {
   RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.FullyConnectedMesh2_GetHostSystem(swigCPtr), true);
   return ret;
 }
 public bool RequestForwarding(SystemAddress proxyCoordinator, SystemAddress sourceAddress, RakNetGUID targetGuid, uint timeoutOnNoDataMS) {
   bool ret = RakNetPINVOKE.UDPProxyClient_RequestForwarding__SWIG_3(swigCPtr, SystemAddress.getCPtr(proxyCoordinator), SystemAddress.getCPtr(sourceAddress), RakNetGUID.getCPtr(targetGuid), timeoutOnNoDataMS);
   if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public bool HasParticipant(RakNetGUID participantGuid)
 {
     bool ret = RakNetPINVOKE.FullyConnectedMesh2_HasParticipant(swigCPtr, RakNetGUID.getCPtr(participantGuid));
     if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Exemple #11
0
 public virtual RakNetGUID GetMyGUID() {
   RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.RakPeerInterface_GetMyGUID(swigCPtr), true);
   return ret;
 }
 private RakNetConnection RemoveConnection(RakNetGUID guid)
 {
     RakNetConnection connection;
     _connections.TryRemove(guid.g, out connection);
     return connection;
 }
Exemple #13
0
 private bool OpLess(RakNetGUID right) {
   bool ret = RakNetPINVOKE.RakNetGUID_OpLess(swigCPtr, RakNetGUID.getCPtr(right));
   if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Exemple #14
0
        public RakNetGUID GetMyGUIDUnified()
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.CSharp_PluginInterface2_GetMyGUIDUnified(swigCPtr), true);

            return(ret);
        }
 internal static HandleRef getCPtr(RakNetGUID obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
Exemple #16
0
 public void AddParticipant(SystemAddress systemAddress, RakNetGUID rakNetGUID)
 {
     RakNetPINVOKE.ConnectionGraph2_AddParticipant(swigCPtr, SystemAddress.getCPtr(systemAddress), RakNetGUID.getCPtr(rakNetGUID));
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemple #17
0
        private bool GetConnectionListForRemoteSystemHelper(RakNetGUID remoteSystemGuid, RakNetListSystemAddress saOut, RakNetListRakNetGUID guidOut, ref uint inOutLength)
        {
            bool ret = RakNetPINVOKE.ConnectionGraph2_GetConnectionListForRemoteSystemHelper(swigCPtr, RakNetGUID.getCPtr(remoteSystemGuid), RakNetListSystemAddress.getCPtr(saOut), RakNetListRakNetGUID.getCPtr(guidOut), ref inOutLength);

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemple #18
0
        public RakNetGUID GetLowestAveragePingSystem()
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.ConnectionGraph2_GetLowestAveragePingSystem(swigCPtr), true);

            return(ret);
        }
Exemple #19
0
        public ushort GetPingBetweenSystems(RakNetGUID g1, RakNetGUID g2)
        {
            ushort ret = RakNetPINVOKE.ConnectionGraph2_GetPingBetweenSystems(swigCPtr, RakNetGUID.getCPtr(g1), RakNetGUID.getCPtr(g2));

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemple #20
0
        public bool ConnectionExists(RakNetGUID g1, RakNetGUID g2)
        {
            bool ret = RakNetPINVOKE.ConnectionGraph2_ConnectionExists(swigCPtr, RakNetGUID.getCPtr(g1), RakNetGUID.getCPtr(g2));

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemple #21
0
 public void EstablishRouting(RakNetGUID endpointGuid)
 {
     RakNetPINVOKE.Router2_EstablishRouting(swigCPtr, RakNetGUID.getCPtr(endpointGuid));
     if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
 }
Exemple #22
0
 public AddressOrGUID(RakNetGUID input) : this(RakNetPINVOKE.new_AddressOrGUID__SWIG_3(RakNetGUID.getCPtr(input)), true)
 {
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 private RakNetConnection GetConnection(RakNetGUID guid)
 {
     return _connections[guid.g];
 }
Exemple #24
0
        public AddressOrGUID CopyData(RakNetGUID input)
        {
            AddressOrGUID ret = new AddressOrGUID(RakNetPINVOKE.AddressOrGUID_CopyData__SWIG_2(swigCPtr, RakNetGUID.getCPtr(input)), false);

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemple #25
0
 public RakNetGUID CopyData(RakNetGUID input) {
   RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.RakNetGUID_CopyData(swigCPtr, RakNetGUID.getCPtr(input)), false);
   if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public void Replace(RakNetGUID input, RakNetGUID filler, uint position, string file, uint line)
 {
     RakNetPINVOKE.RakNetListRakNetGUID_Replace__SWIG_0(swigCPtr, RakNetGUID.getCPtr(input), RakNetGUID.getCPtr(filler), position, file, line);
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public bool OpenNAT(RakNetGUID destination, SystemAddress facilitator) {
   bool ret = RakNetPINVOKE.NatPunchthroughClient_OpenNAT(swigCPtr, RakNetGUID.getCPtr(destination), SystemAddress.getCPtr(facilitator));
   if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
        public RakNetGUID Get(uint position)
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.RakNetListRakNetGUID_Get(swigCPtr, position), false);

            return(ret);
        }
Exemple #29
0
        public RakNetGUID GetHostSystem()
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.FullyConnectedMesh2_GetHostSystem(swigCPtr), true);

            return(ret);
        }
        public RakNetGUID Pop()
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.RakNetListRakNetGUID_Pop(swigCPtr), false);

            return(ret);
        }
Exemple #31
0
 public virtual SystemAddress GetSystemAddressFromGuid(RakNetGUID input) {
   SystemAddress ret = new SystemAddress(RakNetPINVOKE.RakPeerInterface_GetSystemAddressFromGuid(swigCPtr, RakNetGUID.getCPtr(input)), true);
   if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Exemple #32
0
        public virtual RakNetGUID GetGUIDFromIndex(uint index)
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.RakPeerInterface_GetGUIDFromIndex(swigCPtr, index), true);

            return(ret);
        }
Exemple #33
0
        public bool GetConnectionListForRemoteSystem(RakNetGUID remoteSystemGuid, SystemAddress saOut, RakNetGUID guidOut, out uint outLength)
        {
            bool ret = RakNetPINVOKE.ConnectionGraph2_GetConnectionListForRemoteSystem(swigCPtr, RakNetGUID.getCPtr(remoteSystemGuid), SystemAddress.getCPtr(saOut), RakNetGUID.getCPtr(guidOut), out outLength);

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemple #34
0
        public virtual RakNetGUID GetMyGUID()
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.RakPeerInterface_GetMyGUID(swigCPtr), true);

            return(ret);
        }
 public RakNetGUID GetMyGUIDUnified() {
   RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.PluginInterface2_GetMyGUIDUnified(swigCPtr), true);
   return ret;
 }
Exemple #36
0
        public virtual SystemAddress GetSystemAddressFromGuid(RakNetGUID input)
        {
            SystemAddress ret = new SystemAddress(RakNetPINVOKE.RakPeerInterface_GetSystemAddressFromGuid(swigCPtr, RakNetGUID.getCPtr(input)), true);

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemple #37
0
 public AddressOrGUID(RakNetGUID input) : this(RakNetPINVOKE.new_AddressOrGUID__SWIG_4(RakNetGUID.getCPtr(input)), true) {
   if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
 }
Exemple #38
0
 public virtual void OnForwardingInProgress(string proxyIPAddress, ushort proxyPort, SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, UDPProxyClient proxyClientPlugin)
 {
     RakNetPINVOKE.CSharp_UDPProxyClientResultHandler_OnForwardingInProgress(swigCPtr, proxyIPAddress, proxyPort, SystemAddress.getCPtr(proxyCoordinator), SystemAddress.getCPtr(sourceAddress), SystemAddress.getCPtr(targetAddress), RakNetGUID.getCPtr(targetGuid), UDPProxyClient.getCPtr(proxyClientPlugin));
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemple #39
0
 public uint GetConnectionRequestIndex(RakNetGUID endpointGuid)
 {
     uint ret = RakNetPINVOKE.Router2_GetConnectionRequestIndex(swigCPtr, RakNetGUID.getCPtr(endpointGuid));
     if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
 public virtual void OnRecipientNotConnected(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, UDPProxyClient proxyClientPlugin)
 {
     RakNetPINVOKE.UDPProxyClientResultHandler_OnRecipientNotConnected(swigCPtr, SystemAddress.getCPtr(proxyCoordinator), SystemAddress.getCPtr(sourceAddress), SystemAddress.getCPtr(targetAddress), RakNetGUID.getCPtr(targetGuid), UDPProxyClient.getCPtr(proxyClientPlugin));
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
 }
        private RakNetConnection CreateNewConnection(RakNetGUID raknetGuid, RakPeerInterface peer)
        {
            var cid = _handler.GenerateNewConnectionId();
            var c = new RakNetConnection(raknetGuid, cid, peer, OnRequestClose);
            _connections.TryAdd(raknetGuid.g, c);
            return c;

        }
Exemple #42
0
        public RakNetGUID GetHost()
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.TM_World_GetHost(swigCPtr), true);

            return(ret);
        }
Exemple #43
0
 public static uint ToUint32(RakNetGUID g) {
   uint ret = RakNetPINVOKE.RakNetGUID_ToUint32(RakNetGUID.getCPtr(g));
   if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Exemple #44
0
        public bool RemoveFromWaitList(int eventId, RakNetGUID guid)
        {
            bool ret = RakNetPINVOKE.ReadyEvent_RemoveFromWaitList(swigCPtr, eventId, RakNetGUID.getCPtr(guid));

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemple #45
0
 public bool Equals(RakNetGUID right) {
   bool ret = RakNetPINVOKE.RakNetGUID_Equals(swigCPtr, RakNetGUID.getCPtr(right));
   if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Exemple #46
0
        public RakNetGUID GetFromWaitListAtIndex(int eventId, uint index)
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.ReadyEvent_GetFromWaitListAtIndex(swigCPtr, eventId, index), true);

            return(ret);
        }
Exemple #47
0
 internal static HandleRef getCPtr(RakNetGUID obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Exemple #48
0
        public ReadyEventSystemStatus GetReadyStatus(int eventId, RakNetGUID guid)
        {
            ReadyEventSystemStatus ret = (ReadyEventSystemStatus)RakNetPINVOKE.ReadyEvent_GetReadyStatus(swigCPtr, eventId, RakNetGUID.getCPtr(guid));

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
 public virtual void GetVerifiedJoinRequiredProcessingList(RakNetGUID host, RakNetListSystemAddress addresses, RakNetListRakNetGUID guids)
 {
     RakNetPINVOKE.FullyConnectedMesh2_GetVerifiedJoinRequiredProcessingList(swigCPtr, RakNetGUID.getCPtr(host), RakNetListSystemAddress.getCPtr(addresses), RakNetListRakNetGUID.getCPtr(guids));
     if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
 }
Exemple #50
0
        public override RakNetGUID GetGUIDFromIndex(int index)
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.RakPeer_GetGUIDFromIndex(swigCPtr, index), true);

            return(ret);
        }
 public virtual void StartVerifiedJoin(RakNetGUID client)
 {
     RakNetPINVOKE.FullyConnectedMesh2_StartVerifiedJoin(swigCPtr, RakNetGUID.getCPtr(client));
     if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
 }
Exemple #52
0
        public uint GetConnectionRequestIndex(RakNetGUID endpointGuid)
        {
            uint ret = RakNetPINVOKE.CSharp_Router2_GetConnectionRequestIndex(swigCPtr, RakNetGUID.getCPtr(endpointGuid));

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemple #53
0
 public virtual RakNetGUID GetGUIDFromIndex(uint index) {
   RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.RakPeerInterface_GetGUIDFromIndex(swigCPtr, index), true);
   return ret;
 }
Exemple #54
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RakNetGUID obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Exemple #55
0
 public virtual RakNetGUID GetGuidFromSystemAddress(SystemAddress input) {
   RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.RakPeerInterface_GetGuidFromSystemAddress(swigCPtr, SystemAddress.getCPtr(input)), false);
   if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public RakNetGUID Get(uint position)
 {
     RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.RakNetListRakNetGUID_Get(swigCPtr, position), false);
     return ret;
 }
Exemple #57
0
 public virtual void ChangeSystemAddress(RakNetGUID guid, SystemAddress systemAddress) {
   RakNetPINVOKE.RakPeerInterface_ChangeSystemAddress(swigCPtr, RakNetGUID.getCPtr(guid), SystemAddress.getCPtr(systemAddress));
   if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
 }
 public virtual void OnForwardingInProgress(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, UDPProxyClient proxyClientPlugin)
 {
     RakNetPINVOKE.UDPProxyClientResultHandler_OnForwardingInProgress(swigCPtr, SystemAddress.getCPtr(proxyCoordinator), SystemAddress.getCPtr(sourceAddress), SystemAddress.getCPtr(targetAddress), RakNetGUID.getCPtr(targetGuid), UDPProxyClient.getCPtr(proxyClientPlugin));
     if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
 }
Exemple #59
0
 public void AddParticipant(RakNetGUID rakNetGuid) {
   RakNetPINVOKE.FullyConnectedMesh2_AddParticipant(swigCPtr, RakNetGUID.getCPtr(rakNetGuid));
   if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
 }
Exemple #60
0
        public override RakNetGUID GetMyGUID()
        {
            RakNetGUID ret = new RakNetGUID(RakNetPINVOKE.RakPeer_GetMyGUID(swigCPtr), true);

            return(ret);
        }