Пример #1
0
 /// <summary>
 /// Remove (Reset) all Seats from data representation
 /// </summary>
 public void removeAllSeats()
 {
     for (int i = 0; i < seatList.Count; i++)
     {
         string key = seatList.ElementAt(i).Key;
         seatList[key] = new SeatData();
     }
 }
Пример #2
0
 /// <summary>
 /// Remove specific seat from data representation
 /// (Doesn't really remove. Just resets to new/empty seatData instasnce)
 /// </summary>
 /// <param name="seatName"></param>
 public void removeSeat(string seatName)
 {
     for (int i = 0; i < seatList.Count; i++)
     {
         string key = seatList.ElementAt(i).Key;
         if (key.Equals(seatName))
         {
             seatList[seatName] = new SeatData();
             break;
         }
     }
 }
Пример #3
0
 /// <summary>
 /// Requests seatname from/by playername
 /// </summary>
 /// <param name="playername"></param>
 /// <returns>String - seatname</returns>
 public string getSeatname(string playername)
 {
     foreach (KeyValuePair <string, SeatData> kvp in seatList)
     {
         SeatData sd = kvp.Value;
         if (sd.nickname == null)
         {
             continue;
         }
         else if (kvp.Value.nickname.Equals(playername))
         {
             return(kvp.Key);
         }
     }
     throw new Exception("Player was not found in SeatList");
 }
        public TableDataDebugDisplay(TableData input)
        {
            Form debug = new Form {
                Size = new System.Drawing.Size(600, 800), Text = "Debug for: " + input.tablename
            };
            Dictionary <string, SeatData> seatList = input.getSeatList();

            Label nameLabel = new Label {
                Text = input.tablename, Width = 100, Height = 25, Left = 5, Top = 5
            };

            nameLabel.Show();

            Label numberOfSeatsLabel = new Label {
                Text = "Number of Seats: " + input.getTableSize().ToString(), Width = 100, Height = 30, Left = 5, Top = 35
            };

            numberOfSeatsLabel.Show();

            Label      seatLabel;
            Label      nickLabel;
            Label      lockedLabel;
            PictureBox avatarBox;

            for (int i = 0; i < seatList.Count; i++)
            {
                string   seatName = seatList.ElementAt(i).Key;
                SeatData seat     = seatList.ElementAt(i).Value;

                seatLabel = new Label {
                    Text = seatName, Width = 100, Height = 25, Left = 5, Top = i * 100 + 50
                };
                seatLabel.Show();

                nickLabel = new Label {
                    Text = seat.nickname, Width = 100, Height = 25, Left = 105, Top = i * 100 + 50
                };
                nickLabel.Show();

                string isLocked = "unlocked";
                if (seat.locked)
                {
                    isLocked = "locked";
                }

                lockedLabel = new Label {
                    Text = isLocked, Width = 100, Height = 25, Left = 210, Top = i * 100 + 50
                };
                lockedLabel.Show();

                avatarBox = new PictureBox {
                    Image = seat.avatar, Width = 62, Height = 62, Left = 315, Top = i * 100 + 50, BackColor = System.Drawing.Color.Black
                };
                avatarBox.Show();

                //seat.avatar.Save("c:\\DEBUG_avatar_" + seatName + ".png");

                debug.Controls.Add(seatLabel);
                debug.Controls.Add(nickLabel);
                debug.Controls.Add(lockedLabel);
                debug.Controls.Add(avatarBox);
            }

            debug.Controls.Add(nameLabel);
            debug.Controls.Add(numberOfSeatsLabel);
            debug.Show();
        }