Пример #1
0
 protected void OnNotifyChange(NeutronSyncBehaviour syncBehaviour, string propertiesName, Broadcast broadcast)
 {
     if (state != null)
     {
         NeutronServerFunctions.onChanged(Player, syncBehaviour, propertiesName, broadcast);
     }
 }
 private void OnEnable()
 {
     if (NeutronServerFunctions.IsHeadlessMode() || Application.isEditor)
     {
         _TCPSocket      = new TcpListener(_EndPoint);
         _UDPSocket      = new UdpClient(_EndPoint);
         _UDPVoiceSocket = new UdpClient(new IPEndPoint(IPAddress.Any, 5056));
         //====================================\\
         _TCPSocket.Start(LISTEN_MAX);
     }
 }
Пример #3
0
 void Start()
 {
     if (NeutronServerFunctions.IsHeadlessMode())
     {
         Logger("- Server Mode Enabled");
     }
     else
     {
         if (!Application.isEditor)
         {
             Destroy(gameObject);
         }
     }
     //==========================================================================
     serverChannels.Add(new Channel(0, "Canal 1", 100));
     serverChannels.Add(new Channel(1, "Canal 2", 100));
     serverChannels.Add(new Channel(2, "Canal 3", 100));
     //===============================================================
     serverChannels[0]._rooms.Add(new Room(1001, "Sala do servidor", 40, false, true, new byte[] { }));
     //===============================================================
     Initilize();
 }
    void OnCheat()
    {
        if (ServerCheatDetection.AntiTeleport(transform.position, lastPosition, NeutronServerConstants.TELEPORT_TOLERANCE))
        {
            NeutronServerFunctions.onCheatDetected(_Player, "Teleport");
        }
        else
        {
            transform.position = Vector3.Lerp(transform.position, lastPosition, 8f * Time.deltaTime);
            transform.rotation = Quaternion.Lerp(transform.rotation, lastRotation, 8f * Time.deltaTime);
        }

        frequencyTime += Time.deltaTime;
        if (frequencyTime >= 1f)
        {
            if (ServerCheatDetection.AntiSpeedHack(mFrequency, NeutronServerConstants.SPEEDHACK_TOLERANCE))
            {
                NeutronServerFunctions.onCheatDetected(_Player, "SpeedHack");
            }
            mFrequency    = 0;
            frequencyTime = 0;
        }
    }
Пример #5
0
    public void ExecuteValidation(ValidationPacket vType, NeutronReader paramsReader, Player mSocket)
    {
        using (paramsReader)
        {
            try
            {
                switch (vType)
                {
                case ValidationPacket.Movement:
                    CustomServerValidation.ServerMovementValidation(paramsReader, mSocket);     // Don't change that.
                    break;

                case ValidationPacket.None:
                    // Your custom validation script.
                    break;
                }
            }
            catch (Exception ex)
            {
                NeutronServerFunctions.SendDisconnect(mSocket, ex.Message);
                return; // Return to prevent sending to other players. do not use return within the queue (DO NOT WORK).
            }
        }
    }
 public static void Logger(object message)
 {
     NeutronServerFunctions.Logger(message);
 }
 //=============================================================================================================
 public void Awake()
 {
     _singleton = this;
     //===============================\\
     Application.targetFrameRate = 90;
 }