Beispiel #1
0
    // Quand un joueur se connecte, cette fonction est déclenchée sur le host
    public override void OnServerConnect(NetworkConnection conn)
    {
        Debug.Log("Un client s'est connecté !" + conn.connectionId);
        Debug.Log("Envoi de la seed ! " + this.seed);
        SeedMessage msg = new SeedMessage();

        msg.seed     = this.seed;
        msg.clientId = NetworkServer.connections.Count;
        NetworkServer.SendToClient(conn.connectionId, MyMsgType.Seed, msg);
    }
Beispiel #2
0
    // Quand le joueur reçoit un seed du host
    public void OnSeed(NetworkMessage netMsg)
    {
        SeedMessage msg = netMsg.ReadMessage <SeedMessage>();

        Debug.Log("Réception de la seed: " + msg.seed);
        Debug.Log("clientId assigné: " + msg.clientId);
        this.seed     = msg.seed;
        this.clientId = msg.clientId;

        GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>().genererTerrain(seed);
    }
        public IActionResult SendNewSMS([FromBody] SeedMessage data)
        {
            _logger.LogInformation("Starting message send");
            // In a production environment this input needs to be sanatised, but I am not going to do it for this exercise

            IWorker worker = new ClickatellWrapperClient("ahtBtY72SJOsbrTZJu-SOg==");

            if (!worker.IsInitialized)
            {
                worker.Init();
            }

            SendMessageToAPI(worker, "27813457008", data.msg);

            using (var connection = new MySqlConnection(conString))
            {
                connection.Open();
                MySqlCommand command = new MySqlCommand("Insert into smsLOG (sms_date, sms_msg, sms_number) values ('" + new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds() + "','" + data.msg + "','27813457008')", connection);
                command.ExecuteReader();
            }

            return(Content("Your message was added to the send queue."));
        }