Exemplo n.º 1
0
        public static void SelectOnlinePlayer(Mobile callingPlayer, IPlayerSelect parentScript, string searchString)
        {
            //Build the list of online players
            ArrayList onlinePlayers = BuildOnlineList(callingPlayer, searchString);

            if (onlinePlayers.Count == 0)
            {
                callingPlayer.SendMessage("No player online matches your request");
                parentScript.OnPlayerSelectCanceled( );
                return;
            }
            else if (onlinePlayers.Count == 1)
            {
                parentScript.OnPlayerSelected((PlayerMobile)onlinePlayers[0]);
                return;
            }

            callingPlayer.SendGump(new PlayerSelectGump(callingPlayer, parentScript, onlinePlayers));
        }
Exemplo n.º 2
0
            //Handles button presses
            public override void OnResponse(NetState state, RelayInfo info)
            {
                Mobile player = state.Mobile;

                switch (info.ButtonID)
                {
                case 0:                         // Closed
                {
                    player.SendMessage("Finished");
                    return;
                }

                case GumpUtil.BUTTONID_NEXT_PAGE:                         // Next
                {
                    if ((currentPage + 1) * playersPerPage < m_OnlinePlayers.Count)
                    {
                        player.SendGump(new PlayerSelectGump(player, m_ParentScript, m_OnlinePlayers, currentPage + 1));
                    }
                    else
                    {
                        player.SendMessage("Error:  invalid gump return");
                    }

                    break;
                }

                case GumpUtil.BUTTONID_LAST_PAGE:                         // Previous
                {
                    if (currentPage > 0)
                    {
                        player.SendGump(new PlayerSelectGump(player, m_ParentScript, m_OnlinePlayers, currentPage - 1));
                    }
                    else
                    {
                        player.SendMessage("Error:  invalid gump return");
                    }

                    break;
                }

                default:
                {
                    int selectedInt = info.ButtonID - 100;
                    if (selectedInt >= 0 && selectedInt < m_OnlinePlayers.Count)
                    {
                        try
                        {
                            PlayerMobile selectedPlayer = (PlayerMobile)m_OnlinePlayers[selectedInt];
                            m_ParentScript.OnPlayerSelected(selectedPlayer);
                        }
                        catch
                        {
                            player.SendMessage("Error caught!");
                        }
                        return;
                    }
                    player.SendMessage("Error:  invalid gump return");
                    break;
                }
                }
            }