Exemplo n.º 1
0
        public int CreateTable(int idPlayer, string name, string pass)
        {
            if (GetIdByName.ContainsKey(name))
            {
                return(-1);
            }
            if (!NickIsGood(name) || !PassIsGood(pass))
            {
                return(-1);
            }
            int id = Utily.GetTag();

            Tables.Add(id, new WebTable(idPlayer, pass, name));
            GetIdByName.Add(name, id);
            Accounts[idPlayer].JoinTable(id);
            return(id);
        }
Exemplo n.º 2
0
        public int LogIn(string nick, string pass)
        {
            if (GetIdByNick.ContainsKey(nick))
            {
                if (Accounts[GetIdByNick[nick]].Password == pass)
                {
                    return(GetIdByNick[nick]);
                }
                else
                {
                    return(-1);
                }
            }
            if (!NickIsGood(nick) || !PassIsGood(pass))
            {
                return(-1);
            }
            int id = Utily.GetTag();

            GetIdByNick.Add(nick, id);
            Accounts.Add(id, new WebPlayer(nick, pass, id));
            return(id);
        }
Exemplo n.º 3
0
 public void Next(int NumPlayer)
 {
     Players[NumPlayer].IsReady = true;
     if (Players[0].IsReady && Players[1].IsReady)
     {
         if (RoundEnden)
         {
             NewRound();
             return;
         }
         Players[0].IsReady = Players[1].IsReady = false;
         Tag = Utily.GetTag();
         if (HorizDirect == 1)
         {
             if (WasherY == 0)
             {
                 WasherY = 1;
             }
             else
             {
                 WasherY--;
             }
             if (WasherX == 0 && WasherY == 0)
             {
                 NowDirect = 0;
             }
             if (WasherX == 7 && WasherY == 0)
             {
                 NowDirect = 2;
             }
         }
         if (HorizDirect == 3)
         {
             if (WasherY == 2)
             {
                 WasherY = 1;
             }
             else
             {
                 WasherY++;
             }
             if (WasherX == 0 && WasherY == 2)
             {
                 NowDirect = 0;
             }
             if (WasherX == 7 && WasherY == 2)
             {
                 NowDirect = 2;
             }
         }
         HorizDirect = -1;
         while (WasherX >= 0 && WasherX < 8 && (Table[WasherY][WasherX] == null || Table[WasherY][WasherX].Direct == NowDirect))
         {
             if (WasherX == 0 && WasherY != 1 && NowDirect == 2)
             {
                 WasherY   = 1;
                 NowDirect = 0;
             }
             else if (WasherX == 7 && WasherY != 1 && NowDirect == 0)
             {
                 WasherY   = 1;
                 NowDirect = 2;
             }
             else if (NowDirect == 0)
             {
                 WasherX++;
             }
             else
             {
                 WasherX--;
             }
         }
         if (WasherX < 0)
         {
             Players[1].Gool();
             RoundEnden = true;
         }
         else if (WasherX > 7)
         {
             Players[0].Gool();
             RoundEnden = true;
         }
         else
         {
             var NewDir = Table[WasherY][WasherX].Direct;
             Table[WasherY][WasherX].Recive();
             if (Table[WasherY][WasherX].HP == 0)
             {
                 Table[WasherY][WasherX] = null;
             }
             if (NewDir == 1 || NewDir == 3)
             {
                 HorizDirect = NewDir;
             }
             else
             {
                 NowDirect = NewDir;
             }
         }
     }
 }