コード例 #1
0
    public void AddMatchResultToLocal(Player winner, Player loser)
    {
        int id_w = (int)winner.CustomProperties["id"];
        int id_l = (int)loser.CustomProperties["id"];

        string username_w = (string)winner.CustomProperties["username"];
        string username_l = (string)loser.CustomProperties["username"];

        Jugador player_ganador = new Jugador()
        {
            id       = id_w,
            username = username_w
        };

        Jugador player_perdedor = new Jugador()
        {
            id       = id_l,
            username = username_l
        };

        int goles_w = (int)winner.CustomProperties["Goals"];
        int goles_l = (int)loser.CustomProperties["Goals"];

        DateTime localDate = DateTime.Now;
        var      fecha     = localDate.ToString("yyyy-MM-dd");

        Duelo tmpDuelo = new Duelo()
        {
            id             = 999,
            ganador        = player_ganador,
            perdedor       = player_perdedor,
            goles_ganador  = goles_w,
            goles_perdedor = goles_l,
            fecha          = fecha
        };

        userLogin.AddDuelo(tmpDuelo);
    }