Example #1
0
File: Logger.cs Project: drudo1/mm
        internal static void LogVictory(int playerID)
        {
            RoomState state = RoomState.CurrentState;

            state.playerStats.LogVictory(playerID);
            GameStats.LogVictory(playerID);
        }
Example #2
0
        public void NewRoom(string name, string roomKey)
        {
            int       id = Rooms.Values.Cast <RoomState>().Max(mr => mr.RoomID) + 1;
            RoomState r  = new RoomState(id, name, roomKey);

            Rooms[id.ToString()] = r;
            HttpContext.Current.Session["RoomID"] = r.RoomID;
        }
Example #3
0
File: Logger.cs Project: drudo1/mm
        internal static void LogBattle(BattleResult br)
        {
            RoomState state = RoomState.CurrentState;

            GameStats.LogBattle(br);
            if (br.Victory)
            {
                state.playerStats.LogBattleVictory(br);
            }
        }
Example #4
0
 public string LinkScoreBoardToRoom(string boardName, string roomKey)
 {
     if (!Rooms.Values.Cast <RoomState>().ToList().Exists(r => r.RoomKey == roomKey))
     {
         return("Invalid Room Key.");
     }
     else
     {
         HttpContext.Current.Session["boardName"] = boardName.ToLower();
         RoomState room = Rooms.Values.Cast <RoomState>().Where(r => r.RoomKey == roomKey).FirstOrDefault();
         HttpContext.Current.Session["RoomID"] = room.RoomID;
         int gameID = -1;
         if (room.games.Values.Cast <Game>().ToList().Exists(g => g.ScoreBoardName.ToLower() == boardName.ToLower()))
         {
             gameID = room.games.Values.Cast <Game>().Where(g => g.ScoreBoardName.ToLower() == boardName.ToLower()).FirstOrDefault().GameID;
         }
         if (!ScoreBoardGamePairings.Keys.Contains(boardName.ToLower()))
         {
             ScoreBoardGamePairings.Add(boardName.ToLower(), gameID.ToString());
         }
         return("LoggedIn");
     }
 }