Server.Mobiles.ChangeHairHueGump.OnResponse C# (CSharp) Méthode

OnResponse() public méthode

public OnResponse ( Server.Network.NetState sender, RelayInfo info ) : void
sender Server.Network.NetState
info Server.Gumps.RelayInfo
Résultat void
        public override void OnResponse( NetState sender, RelayInfo info )
        {
            if ( info.ButtonID == 1 )
            {
                int[] switches = info.Switches;

                if ( switches.Length > 0 )
                {
                    int index = switches[0] % m_Entries.Length;
                    int offset = switches[0] / m_Entries.Length;

                    if ( index >= 0 && index < m_Entries.Length )
                    {
                        if ( offset >= 0 && offset < m_Entries[index].Hues.Length )
                        {
                            if ( m_Hair && m_From.HairItemID > 0 || m_FacialHair && m_From.FacialHairItemID > 0 )
                            {
                                if ( !Banker.Withdraw( m_From, m_Price ) )
                                {
                                    m_Vendor.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1042293, m_From.NetState ); // You cannot afford my services for that style.
                                    return;
                                }

                                int hue = m_Entries[index].Hues[offset];

                                if ( m_Hair )
                                    m_From.HairHue = hue;

                                if ( m_FacialHair )
                                    m_From.FacialHairHue = hue;
                            }
                            else
                                m_Vendor.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 502623, m_From.NetState ); // You have no hair to dye and you cannot use this.
                        }
                    }
                }
                else
                {
                    // You decide not to change your hairstyle.
                    m_Vendor.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1013009, m_From.NetState );
                }
            }
            else
            {
                // You decide not to change your hairstyle.
                m_Vendor.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1013009, m_From.NetState );
            }
        }