示例#1
0
 public void OnStartClient()
 {
     _fixedUpdater = new FixedUpdater((int)(NetworkTime.Milliseconds), timeStepMilliseconds, time =>
     {
         _inputMessage.Time = time;
         NetworkClient.Send(_inputMessage, 1);
         NetworkInput.AddKeyMap(_inputMessage.Keymap);
         _inputMessage.Keymap = 0u;
     });
 }
示例#2
0
        public void OnStartServer()
        {
            NetworkServer.NewConnectionEvent += NetworkInput.AddConnection;

            NetworkServer.ConnectionDisconnectEvent += NetworkInput.RemoveConnection;

            NetworkServer.RegisterHandler <InputMessage>(data =>
            {
//				Debug.Log($"Time: {data.Message.Time}, Keys: {data.Message.Keymap}");
                if (_lastInputTime < data.Message.Time)
                {
                    _lastInputTime = data.Message.Time;
                    NetworkInput.AddKeyMap(data.Connection, data.Message.Keymap);
                }
            });
        }