Beispiel #1
0
        public flight quickCloneForDraw()
        {
            flight ret = new flight();

            ret.matchType = matchType;
            ret.name      = name;
            foreach (team t in teams.Values)
            {
                ret.teams.Add(t.name, t.quickCloneForDraw());
            }
            return(ret);
        }
Beispiel #2
0
        public double getShPointsForMatch(String PlayerName, ConfigsForYear shPointsDef)
        {
            double ret = 0;
            flight ctF = getMyFlight(PlayerName);

            if (ctF != null)
            {
                double shForMatch = getShPointsForMatchType(ctF.matchType, shPointsDef);
                foreach (match m in ctF.matchs.Values)
                {
                    team myTeam = m.GetMyTeam(PlayerName);
                    if (myTeam == null)
                    {
                        continue; //suis pas dans le match
                    }
                    else
                    {
                        if (matchScores.matchResults.ContainsKey(m.name))
                        {
                            switch (matchScores.matchResults[m.name].WinnerteamName)
                            {
                            case 0:
                                ret += shForMatch / 2;     //half the points for a draw
                                break;

                            case 1:
                                if (m.Team1.name1based == myTeam.name1based)
                                {
                                    ret += shForMatch;
                                }
                                break;     //half the points for a draw

                            case 2:
                                if (m.Team2.name1based == myTeam.name1based)
                                {
                                    ret += shForMatch;
                                }
                                break;     //half the points for a draw
                            }
                        }
                    }
                }
            }
            return(ret);
        }