예제 #1
0
파일: Room.cs 프로젝트: vaaan/EnjoyDotNet
 public void AddPoker(Poker poker)
 {
     if (poker == null || String.IsNullOrWhiteSpace(poker.NickName)) return;
     lock (pokerNameDic)
     {
         if (pokerNameDic.ContainsKey(poker.NickName)) pokerNameDic[poker.NickName] = poker;
         else pokerNameDic.Add(poker.NickName, poker);
     }
 }
예제 #2
0
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     var room = Lobby.Instance.GetRoom(tbRoomName.Text);
     var poker = room.GetPoker(tbNickName.Text);
     if (poker == null) poker = new Poker { NickName = tbNickName.Text };
     if (!String.IsNullOrEmpty(tbRoomPwd.Text))
     {
         if (!String.IsNullOrEmpty(room.Password) && room.Password != tbRoomPwd.Text)
         {
             ScriptManager.RegisterStartupScript(this, typeof(Login), "", "alert('房间密码不正确\\n无法作为管理员登录')", true);
             return;
         }
         room.Password = tbRoomPwd.Text;
         poker.IsRoomAdmin = true;
     }
     room.AddPoker(poker);
     SessionController.SetRoomName(this, room.Name);
     SessionController.SetPokerName(this, poker.NickName);
     SessionController.SetToken(this, "");
     if (poker.IsRoomAdmin) Response.Redirect("AdminPokerPlay.aspx");
     else Response.Redirect("PokerPlay.aspx");
 }