public override void OnResponse(NetState sender, RelayInfo info) { Mobile m = sender.Mobile; switch (info.ButtonID) { case 0: { m.CloseGump(typeof(CommandInfoGump)); break; } case 1: { if (m_Page > 0) { m.SendGump(new CommandListGump(m_Page - 1, m, m_List)); } break; } case 2: { if ((m_Page + 1) * EntriesPerPage < m_SortedHelpInfo.Count) { m.SendGump(new CommandListGump(m_Page + 1, m, m_List)); } break; } default: { int v = info.ButtonID - 3; if (v >= 0 && v < m_List.Count) { CommandInfo c = m_List[v]; if (m.AccessLevel >= c.AccessLevel) { m.SendGump(new CommandInfoGump(c)); m.SendGump(new CommandListGump(m_Page, m, m_List)); } else { m.SendMessage("You no longer have access to that command."); m.SendGump(new CommandListGump(m_Page, m, null)); } } break; } } }
public CommandInfoGump(CommandInfo info, int width, int height) : base(300, 50) { m_Info = info; this.AddPage(0); this.AddBackground(0, 0, width, height, 5054); this.AddHtml(10, 10, width - 20, 20, this.Color(this.Center(info.Name), 0xFF0000), false, false); this.AddHtml(10, height - 30, 50, 20, this.Color("Params:", 0x00FF00), false, false); this.AddAlphaRegion(65, height - 34, 170, 28); this.AddTextEntry(70, height - 30, 160, 20, 789, 0, ""); this.AddHtml(250, height - 30, 30, 20, this.Color("Go", 0x00FF00), false, false); this.AddButton(280, height - 30, 0xFA6, 0xFA7, 99, GumpButtonType.Reply, 0); StringBuilder sb = new StringBuilder(); sb.Append("Usage: "); sb.Append(info.Usage.Replace("<", "(").Replace(">", ")")); sb.Append("<BR>"); string[] aliases = info.Aliases; if (aliases != null && aliases.Length != 0) { sb.Append(String.Format("Alias{0}: ", aliases.Length == 1 ? "" : "es")); for (int i = 0; i < aliases.Length; ++i) { if (i != 0) { sb.Append(", "); } sb.Append(aliases[i]); } sb.Append("<BR>"); } sb.Append("AccessLevel: "); sb.Append(info.AccessLevel.ToString()); sb.Append("<BR>"); sb.Append("<BR>"); sb.Append(info.Description); this.AddHtml(10, 40, width - 20, height - 80, sb.ToString(), false, true); //AddImageTiled( 10, height - 30, width - 20, 20, 2624 ); //AddAlphaRegion( 10, height - 30, width - 20, 20 ); }
public CommandInfoGump(CommandInfo info, int width = 320, int height = 200) : base(300, 50) { AddPage(0); AddBackground(0, 0, width, height, 5054); //AddImageTiled( 10, 10, width - 20, 20, 2624 ); //AddAlphaRegion( 10, 10, width - 20, 20 ); //AddHtmlLocalized( 10, 10, width - 20, 20, header, headerColor, false, false ); AddHtml(10, 10, width - 20, 20, Color(Center(info.Name), 0xFF0000)); //AddImageTiled( 10, 40, width - 20, height - 80, 2624 ); //AddAlphaRegion( 10, 40, width - 20, height - 80 ); StringBuilder sb = new StringBuilder(); sb.Append("Usage: "); sb.Append(info.Usage.Replace("<", "(").Replace(">", ")")); sb.Append("<BR>"); string[] aliases = info.Aliases; if (aliases?.Length > 0) { sb.Append($"Alias{(aliases.Length == 1 ? "" : "es")}: "); for (int i = 0; i < aliases.Length; ++i) { if (i != 0) { sb.Append(", "); } sb.Append(aliases[i]); } sb.Append("<BR>"); } sb.Append("AccessLevel: "); sb.Append(info.AccessLevel.ToString()); sb.Append("<BR>"); sb.Append("<BR>"); sb.Append(info.Description); AddHtml(10, 40, width - 20, height - 80, sb.ToString(), false, true); //AddImageTiled( 10, height - 30, width - 20, 20, 2624 ); //AddAlphaRegion( 10, height - 30, width - 20, 20 ); }
public CommandInfoGump(CommandInfo info, int width, int height) : base(300, 50) { m_Info = info; AddPage(0); AddBackground(0, 0, width, height, 5054); AddHtml(10, 10, width - 20, 20, Color(Center(info.Name), 0xFF0000), false, false); AddHtml(10, height - 30, 50, 20, Color("Params:", 0x00FF00), false, false); AddAlphaRegion(65, height - 34, 170, 28); AddTextEntry(70, height - 30, 160, 20, 789, 0, ""); AddHtml(250, height - 30, 30, 20, Color("Go", 0x00FF00), false, false); AddButton(280, height - 30, 0xFA6, 0xFA7, 99, GumpButtonType.Reply, 0); StringBuilder sb = new StringBuilder(); sb.Append("Usage: "); sb.Append(info.Usage.Replace("<", "(").Replace(">", ")")); sb.Append("<BR>"); string[] aliases = info.Aliases; if (aliases != null && aliases.Length != 0) { sb.Append(String.Format("Alias{0}: ", aliases.Length == 1 ? "" : "es")); for (int i = 0; i < aliases.Length; ++i) { if (i != 0) sb.Append(", "); sb.Append(aliases[i]); } sb.Append("<BR>"); } sb.Append("AccessLevel: "); sb.Append(info.AccessLevel.ToString()); sb.Append("<BR>"); sb.Append("<BR>"); sb.Append(info.Description); AddHtml(10, 40, width - 20, height - 80, sb.ToString(), false, true); //AddImageTiled( 10, height - 30, width - 20, 20, 2624 ); //AddAlphaRegion( 10, height - 30, width - 20, 20 ); }
public CommandInfoGump(CommandInfo info) : this(info, 320, 210) { }
public CommandListGump(int page, Mobile from, List <CommandInfo> list) : base(30, 30) { this.m_Page = page; if (list == null) { this.m_List = new List <CommandInfo>(); foreach (CommandInfo c in m_SortedHelpInfo) { if (from.AccessLevel >= c.AccessLevel) { this.m_List.Add(c); } } } else { this.m_List = list; } this.AddNewPage(); if (this.m_Page > 0) { this.AddEntryButton(20, ArrowLeftID1, ArrowLeftID2, 1, ArrowLeftWidth, ArrowLeftHeight); } else { this.AddEntryHeader(20); } this.AddEntryHtml(160, this.Center(String.Format("Page {0} of {1}", this.m_Page + 1, (this.m_List.Count + EntriesPerPage - 1) / EntriesPerPage))); if ((this.m_Page + 1) * EntriesPerPage < this.m_List.Count) { this.AddEntryButton(20, ArrowRightID1, ArrowRightID2, 2, ArrowRightWidth, ArrowRightHeight); } else { this.AddEntryHeader(20); } int last = (int)AccessLevel.Player - 1; for (int i = this.m_Page * EntriesPerPage, line = 0; line < EntriesPerPage && i < this.m_List.Count; ++i, ++line) { CommandInfo c = this.m_List[i]; if (from.AccessLevel >= c.AccessLevel) { if ((int)c.AccessLevel != last) { this.AddNewLine(); this.AddEntryHtml(20 + this.OffsetSize + 160, this.Color(c.AccessLevel.ToString(), 0xFF0000)); this.AddEntryHeader(20); line++; } last = (int)c.AccessLevel; this.AddNewLine(); this.AddEntryHtml(20 + this.OffsetSize + 160, c.Name); this.AddEntryButton(20, ArrowRightID1, ArrowRightID2, 3 + i, ArrowRightWidth, ArrowRightHeight); } } this.FinishPage(); }
public CommandInfoGump( CommandInfo info, int width, int height ) : base( 300, 50 ) { AddPage( 0 ); AddBackground( 0, 0, width, height, 5054 ); //AddImageTiled( 10, 10, width - 20, 20, 2624 ); //AddAlphaRegion( 10, 10, width - 20, 20 ); //AddHtmlLocalized( 10, 10, width - 20, 20, header, headerColor, false, false ); AddHtml( 10, 10, width - 20, 20, Color( Center( info.Name ), 0xFF0000 ), false, false ); //AddImageTiled( 10, 40, width - 20, height - 80, 2624 ); //AddAlphaRegion( 10, 40, width - 20, height - 80 ); StringBuilder sb = new StringBuilder(); sb.Append( "Usage: " ); sb.Append( info.Usage.Replace( "<", "(" ).Replace( ">", ")" ) ); sb.Append( "<BR>" ); string[] aliases = info.Aliases; if( aliases != null && aliases.Length != 0 ) { sb.Append( String.Format( "Alias{0}: ", aliases.Length == 1 ? "" : "es" ) ); for( int i = 0; i < aliases.Length; ++i ) { if( i != 0 ) sb.Append( ", " ); sb.Append( aliases[i] ); } sb.Append( "<BR>" ); } sb.Append( "AccessLevel: " ); sb.Append( info.AccessLevel.ToString() ); sb.Append( "<BR>" ); sb.Append( "<BR>" ); sb.Append( info.Description ); AddHtml( 10, 40, width - 20, height - 80, sb.ToString(), false, true ); //AddImageTiled( 10, height - 30, width - 20, 20, 2624 ); //AddAlphaRegion( 10, height - 30, width - 20, 20 ); }