Beispiel #1
0
        public Server()
        {
            // Set up network items
            var listener = new EventBasedNetListener();

            _netServer = new LiteNetLib.NetManager(listener, "Cities: Skylines Multiplayer");

            // Listen to events
            listener.NetworkReceiveEvent       += ListenerOnNetworkReceiveEvent;
            listener.NetworkErrorEvent         += ListenerOnNetworkErrorEvent;
            listener.PeerDisconnectedEvent     += ListenerOnPeerDisconnectedEvent;
            listener.NetworkLatencyUpdateEvent += ListenerOnNetworkLatencyUpdateEvent;
        }
Beispiel #2
0
        public Client()
        {
            // Set up network items
            var listener = new EventBasedNetListener();

            _netClient = new LiteNetLib.NetManager(listener);

            // Listen to events
            listener.NetworkReceiveEvent   += ListenerOnNetworkReceiveEvent;
            listener.NetworkErrorEvent     += ListenerOnNetworkErrorEvent;
            listener.PeerConnectedEvent    += ListenerOnPeerConnectedEvent;
            listener.PeerDisconnectedEvent += ListenerOnPeerDisconnectedEvent;
        }
Beispiel #3
0
        public Server()
        {
            // Set up network items
            var listener = new EventBasedNetListener();

            _netServer = new LiteNetLib.NetManager(listener);

            // Listen to events
            listener.NetworkReceiveEvent       += ListenerOnNetworkReceiveEvent;
            listener.NetworkErrorEvent         += ListenerOnNetworkErrorEvent;
            listener.PeerDisconnectedEvent     += ListenerOnPeerDisconnectedEvent;
            listener.NetworkLatencyUpdateEvent += ListenerOnNetworkLatencyUpdateEvent;
            listener.ConnectionRequestEvent    += ListenerOnConnectionRequestEvent;
        }
Beispiel #4
0
    static int get_mClient(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FirClient.Manager.NetworkManager obj = (FirClient.Manager.NetworkManager)o;
            LiteNetLib.NetManager            ret = obj.mClient;
            ToLua.PushSealed(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index mClient on a nil value"));
        }
    }
Beispiel #5
0
        public Server()
        {
            // Set up network items
            var listener = new EventBasedNetListener();

            NetServer = new LiteNetLib.NetManager(listener, "Tango");

            // Listen to events
            listener.NetworkReceiveEvent += ListenerOnNetworkReceiveEvent;
            listener.NetworkErrorEvent   += ListenerOnNetworkErrorEvent;

            // Setup timer
            _pingTimer          = new System.Timers.Timer();
            _pingTimer.Elapsed += OnPing;
            _pingTimer.Interval = 100;
            _pingTimer.Start();
        }
Beispiel #6
0
 internal NatPunchModule(NetManager netBase)
 {
     _netBase       = netBase;
     _requestEvents = new Queue <RequestEventData>();
     _successEvents = new Queue <SuccessEventData>();
 }
Beispiel #7
0
 public NetSocket(NetManager listener)
 {
     _listener = listener;
 }