Exemplo n.º 1
0
        //toStrings
        public string CandidatesToBtn()
        {
            if (IsSolved)
            {
                return(Solution + "");
            }
            else
            {
                string result = "";

                for (int i = 1; i <= 9; i++)
                {
                    result += Candidates.Contains(i) ? i + "" : " ";
                    result += i % 3 == 0 ? "\n" : " ";
                }

                return(result);
            }
        }
Exemplo n.º 2
0
        public void TryWithdraw(PlayerMobile pm)
        {
            BallotEntry entry = Candidates.FirstOrDefault(e => e.Player == pm);

            if (entry != null)
            {
                //Are you sure you wish to withdrawal?
                pm.SendGump(new ConfirmCallbackGump(pm, null, 1153918, entry, null, (m, o) =>
                {
                    BallotEntry e = (BallotEntry)o;

                    if (Candidates.Contains(e))
                    {
                        Candidates.Remove(e);
                        m.PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, 1153911, m.NetState); // *You smudge your name off the stone*
                    }
                }));
            }
            else
            {
                pm.SendLocalizedMessage(1153924); // You are not currently on any ballot to withdraw from.
            }
        }
Exemplo n.º 3
0
 public void AcceptCandidate(ServerPlayer player)
 {
     lock (this)
     {
         if (player.Union != null)
         {
             return;
         }
         if (!Candidates.Contains(player.Name))
         {
             return;
         }
         Candidates.Remove(player.Name);
         AddMember(player);
         string s = $"欢迎 {player.Name} 加入公会";
         foreach (var member in Members)
         {
             var splayer = ServerSideCharacter2.PlayerCollection.Get(member);
             splayer?.SendInfoMessage(s);
         }
         CommandBoardcast.ConsoleMessage($"玩家 {player.Name} 加入公会 {Name}");
     }
 }
Exemplo n.º 4
0
 public void AddCandidate(ServerPlayer player)
 {
     lock (this)
     {
         if (player.Union != null)
         {
             player.SendMessageBox("您已经有公会了", 180, Color.Yellow);
             return;
         }
         if (Candidates.Contains(player.Name))
         {
             player.SendMessageBox("您已经在公会的申请列表中,请耐心等待审核", 180, Color.Yellow);
             return;
         }
         if (Candidates.Count >= MAX_CANDIDATES)
         {
             player.SendMessageBox("公会申请人数已满,无法申请", 180, Color.OrangeRed);
             return;
         }
         Candidates.Add(player.Name);
         SyncToOwner();
         player.SendMessageBox("申请成功,请等待会长审核", 180, Color.LimeGreen);
     }
 }
Exemplo n.º 5
0
 public bool ContainCandidate(int number) => Candidates.Contains(number);
Exemplo n.º 6
0
 public static bool Is <T>(this T Obj, params T[] Candidates)
 {
     return(Candidates != null && Candidates.Contains(Obj));
 }