This commit is contained in:
Beppe
2019-07-14 13:18:06 +02:00
parent d883bce694
commit 89dc4d2047
9 changed files with 95 additions and 28 deletions

View File

@@ -1,10 +1,23 @@
using System;
using Globals.Interfaces;
using Newtonsoft.Json;
using static Globals.main;
namespace Globals.classes
{
public class Bet : IBet
{
[JsonConstructor]
public Bet(int Id, Game g, Person p, double cash, state ploeg, bool finished)
{
this.Id = Id;
this.game = g;
this.person = p;
this.cash = cash;
this.ploeg = ploeg;
this.finished = finished;
}
public Bet(Game game, Person person, double cash, main.state ploeg)
{
this.game = game;
@@ -17,12 +30,25 @@ namespace Globals.classes
public Game game { get; set; }
public Person person { get; set; }
public double cash { get; set; }
public bool succes { get { return (ploeg == game.getWinner());}}
public main.state ploeg { get; set; }
public bool finished { get; set; }
public bool succes()
{
return (ploeg == game.getWinner());
}
public override bool Equals(object obj)
{
try
{
Bet be = (Bet)obj;
} catch (Exception e)
{
return false;
}
Bet b = (Bet)obj;
return this.Id == b.Id;
}
@@ -37,7 +63,7 @@ namespace Globals.classes
double tmp = 0;
if (finished)
{
if (succes)
if (succes())
{
tmp += cash * 2;
}