// ============================================================================================================ // Character list // ============================================================================================================ public void ShowCharacterList() { CurrentGump.Dispose(); CurrentGump = m_UserInterface.AddControl(new CharacterListGump( OnBackToSelectServer, OnLoginWithCharacter, OnDeleteCharacter, OnNewCharacter), 0, 0) as Gump; if (Settings.Login.AutoSelectLastCharacter && !string.IsNullOrWhiteSpace(Settings.Login.LastCharacterName)) { for (int i = 0; i < Characters.List.Length; i++) { if (Characters.List[i].Name == Settings.Login.LastCharacterName) { OnLoginWithCharacter(i); } } } }
public override void Intitialize() { base.Intitialize(); m_Gump = (Gump)m_UserInterface.AddControl(new Gump(0, 0), 0, 0); m_Gump.Size = new Point(800, 600); m_Gump.AddControl(new ResizePic(m_Gump, 5, 5, 3000, 790, 590)); int rowwidth = 60; // caption string m_Label = (TextLabel)m_Gump.AddControl(new TextLabel(m_Gump, 50, 8, 0, null)); // object that is hued based on the current overhue. m_HueDisplay = (HuedControl)m_Gump.AddControl(new HuedControl(m_Gump, 8305)); m_Gump.LastControl.Position = new Point(745, 15); ((HuedControl)m_Gump.LastControl).Hue = 0; // unhued object m_Gump.AddControl(new HuedControl(m_Gump)); m_Gump.LastControl.Position = new Point(-5, 10); ((HuedControl)m_Gump.LastControl).Hue = 0; // hue index 1 (uo hue -1), aka one of the "True Black" hues m_Gump.AddControl(new HuedControl(m_Gump)); m_Gump.LastControl.Position = new Point(3, 10); ((HuedControl)m_Gump.LastControl).Hue = 1; for (int i = 0; i < 3000; i++) { m_Gump.AddControl(new HuedControl(m_Gump)); m_Gump.LastControl.Position = new Point((i % rowwidth) * 11 - 5, (i / rowwidth) * 10 + 28); ((HuedControl)m_Gump.LastControl).Hue = i + 2; } using (FileStream file = new FileStream("hues0.png", FileMode.Create)) { HueData.HueTexture0.SaveAsPng(file, HueData.HueTexture0.Width, HueData.HueTexture0.Height); } using (FileStream file = new FileStream("hues1.png", FileMode.Create)) { HueData.HueTexture1.SaveAsPng(file, HueData.HueTexture1.Width, HueData.HueTexture1.Height); } }
public static void BuildGump(Gump gump, string[] gumpPieces, string[] gumpLines) { int currentGUMPPage = 0; int currentRadioGroup = 0; // get the resource provider IResourceProvider provider = ServiceRegistry.GetService<IResourceProvider>(); for (int i = 0; i < gumpPieces.Length; i++) { string[] gumpParams = gumpPieces[i].Split(' '); switch (gumpParams[0]) { case "button": // Button [x] [y] [released-id] [pressed-id] [quit] [page-id] [return-value] // [released-id] and [pressed-id] specify the buttongraphic. // If pressed check for [return-value]. // Use [page-id] to switch between pages and [quit]=1/0 to close the gump. gump.AddControl(new Button(gump, gumpParams), currentGUMPPage); break; case "buttontileart": // ButtonTileArt [x] [y] [released-id] [pressed-id] [quit] [page-id] [return-value] [tilepic-id] [hue] [tile-x] [tile-y] // Adds a button to the gump with the specified coordinates and tilepic as graphic. // [tile-x] and [tile-y] define the coordinates of the tile graphic and are relative to [x] and [y]. gump.AddControl(new Button(gump, int.Parse(gumpParams[1]), int.Parse(gumpParams[2]), int.Parse(gumpParams[3]), int.Parse(gumpParams[4]), (ButtonTypes)int.Parse(gumpParams[5]), int.Parse(gumpParams[6]), int.Parse(gumpParams[7])), currentGUMPPage); gump.AddControl(new StaticPic(gump, int.Parse(gumpParams[1]) + int.Parse(gumpParams[10]), int.Parse(gumpParams[2]) + int.Parse(gumpParams[11]), int.Parse(gumpParams[8]), int.Parse(gumpParams[9])), currentGUMPPage); break; case "checkertrans": // CheckerTrans [x] [y] [width] [height] // Creates a transparent rectangle on position [x,y] using [width] and [height]. gump.AddControl(new CheckerTrans(gump, gumpParams), currentGUMPPage); break; case "croppedtext": // CroppedText [x] [y] [width] [height] [color] [text-id] // Adds a text field to the gump. gump is similar to the text command, but the text is cropped to the defined area. gump.AddControl(new CroppedText(gump, gumpParams, gumpLines), currentGUMPPage); (gump.LastControl as CroppedText).Hue = 1; break; case "gumppic": // GumpPic [x] [y] [id] hue=[color] // Adds a graphic to the gump, where [id] ist the graphic id of an item. For example use InsideUO to get them. Optionaly there is a color parameter. gump.AddControl(new GumpPic(gump, gumpParams), currentGUMPPage); break; case "gumppictiled": // GumpPicTiled [x] [y] [width] [height] [id] // Similar to GumpPic, but the gumppic is tiled to the given [height] and [width]. gump.AddControl(new GumpPicTiled(gump, gumpParams), currentGUMPPage); break; case "htmlgump": // HtmlGump [x] [y] [width] [height] [text-id] [background] [scrollbar] // Defines a text-area where Html-commands are allowed. // [background] and [scrollbar] can be 0 or 1 and define whether the background is transparent and a scrollbar is displayed. gump.AddControl(new HtmlGumpling(gump, gumpParams, gumpLines), currentGUMPPage); break; case "page": // Page [Number] // Specifies which page to define. Page 0 is the background thus always visible. currentGUMPPage = Int32.Parse(gumpParams[1]); break; case "resizepic": // ResizePic [x] [y] [gump-id] [width] [height] // Similar to GumpPic but the pic is automatically resized to the given [width] and [height]. gump.AddControl(new ResizePic(gump, gumpParams), currentGUMPPage); break; case "text": // Text [x] [y] [color] [text-id] // Defines the position and color of a text (data) entry. gump.AddControl(new TextLabel(gump, gumpParams, gumpLines), currentGUMPPage); break; case "textentry": // TextEntry [x] [y] [width] [height] [color] [return-value] [default-text-id] // Defines an area where the [default-text-id] is displayed. // The player can modify gump data. To get gump data check the [return-value]. gump.AddControl(new TextEntry(gump, gumpParams, gumpLines), currentGUMPPage); break; case "textentrylimited": // TextEntryLimited [x] [y] [width] [height] [color] [return-value] [default-text-id] [textlen] // Similar to TextEntry but you can specify via [textlen] the maximum of characters the player can type in. gump.AddControl(new TextEntry(gump, gumpParams, gumpLines), currentGUMPPage); break; case "tilepic": // TilePic [x] [y] [id] // Adds a Tilepicture to the gump. [id] defines the tile graphic-id. For example use InsideUO to get them. gump.AddControl(new StaticPic(gump, gumpParams), currentGUMPPage); break; case "tilepichue": // TilePicHue [x] [y] [id] [hue] // Similar to the tilepic command, but with an additional hue parameter. gump.AddControl(new StaticPic(gump, gumpParams), currentGUMPPage); break; case "noclose": // NoClose // Prevents that the gump can be closed by right clicking. gump.IsUncloseableWithRMB = true; break; case "nodispose": // NoDispose //Prevents that the gump can be closed by hitting Esc. gump.IsUncloseableWithEsc = true; break; case "nomove": // NoMove // Locks the gump in his position. gump.BlockMovement = true; break; case "group": // Group [Number] // Links radio buttons to a group. Add gump before radiobuttons to do so. See also endgroup. currentRadioGroup++; break; case "endgroup": // EndGroup // Links radio buttons to a group. Add gump after radiobuttons to do so. See also group. currentRadioGroup++; break; case "radio": // Radio [x] [y] [released-id] [pressed-id] [status] [return-value] // Same as Checkbox, but only one Radiobutton can be pressed at the same time, and they are linked via the 'Group' command. gump.AddControl(new RadioButton(gump, currentRadioGroup, gumpParams, gumpLines), currentGUMPPage); break; case "checkbox": // CheckBox [x] [y] [released-id] [pressed-id] [status] [return-value] // Adds a CheckBox to the gump. Multiple CheckBoxes can be pressed at the same time. // Check the [return-value] if you want to know which CheckBoxes were selected. gump.AddControl(new CheckBox(gump, gumpParams, gumpLines), currentGUMPPage); break; case "xmfhtmlgump": // XmfHtmlGump [x] [y] [width] [height] [cliloc-nr] [background] [scrollbar] // Similar to the htmlgump command, but in place of the [text-id] a CliLoc entry is used. gump.AddControl(new HtmlGumpling(gump, int.Parse(gumpParams[1]), int.Parse(gumpParams[2]), int.Parse(gumpParams[3]), int.Parse(gumpParams[4]), int.Parse(gumpParams[6]), int.Parse(gumpParams[7]), "<span color=#000>" + provider.GetString(int.Parse(gumpParams[5]))), currentGUMPPage); break; case "xmfhtmlgumpcolor": // XmfHtmlGumpColor [x] [y] [width] [height] [cliloc-nr] [background] [scrollbar] [color] // Similar to the xmfhtmlgump command, but additionally a [color] can be specified. gump.AddControl(new HtmlGumpling(gump, int.Parse(gumpParams[1]), int.Parse(gumpParams[2]), int.Parse(gumpParams[3]), int.Parse(gumpParams[4]), int.Parse(gumpParams[6]), int.Parse(gumpParams[7]), string.Format("<span color=#{0}>{1}", Utility.GetColorFromInt(int.Parse(gumpParams[8])), provider.GetString(int.Parse(gumpParams[5])))), currentGUMPPage); (gump.LastControl as HtmlGumpling).Hue = 0; break; case "xmfhtmltok": // XmfHtmlTok [x] [y] [width] [height] [background] [scrollbar] [color] [cliloc-nr] @[arguments]@ // Similar to xmfhtmlgumpcolor command, but the parameter order is different and an additionally // [argument] entry enclosed with @'s can be used. With gump you can specify texts that will be // added to the CliLoc entry. string messageWithArgs = provider.GetString(1070788); int argReplaceBegin = messageWithArgs.IndexOf("~1"); if (argReplaceBegin != -1) { int argReplaceEnd = messageWithArgs.IndexOf("~", argReplaceBegin + 2); if (argReplaceEnd != -1) { if (gumpParams.Length == 10 && gumpParams[9].Length >= 2) { messageWithArgs = string.Format("{0}{1}{2}", messageWithArgs.Substring(0, argReplaceBegin), gumpParams[9].Substring(1, gumpParams[9].Length - 2), (argReplaceEnd > messageWithArgs.Length - 1) ? messageWithArgs.Substring(argReplaceEnd) : string.Empty); } } } gump.AddControl(new HtmlGumpling(gump, int.Parse(gumpParams[1]), int.Parse(gumpParams[2]), int.Parse(gumpParams[3]), int.Parse(gumpParams[4]), int.Parse(gumpParams[5]), int.Parse(gumpParams[6]), string.Format("<font color=#{0}>{1}", Utility.GetColorFromUshort(ushort.Parse(gumpParams[7])), messageWithArgs)), currentGUMPPage); (gump.LastControl as HtmlGumpling).Hue = 0; Tracer.Warn(string.Format("GUMP: Unhandled {0}.", gumpParams[0])); break; case "tooltip": // Tooltip [cliloc-number] // Adds to the previous layoutarray entry a Tooltip with the in [cliloc-number] defined CliLoc entry. string cliloc = provider.GetString(int.Parse(gumpPieces[1])); if (gump.LastControl != null) gump.LastControl.SetTooltip(cliloc); else Tracer.Warn(string.Format("GUMP: No control for gump tooltip: {0}.", gumpParams[1])); break; case "noresize": break; default: Tracer.Critical("GUMP: Unknown piece '" + gumpParams[0] + "'."); break; } } }
public static void BuildGump(Gump gump, string[] gumpPieces, string[] gumpLines) { int currentGUMPPage = 0; int currentRadioGroup = 0; // get the resource provider IResourceProvider provider = Service.Get <IResourceProvider>(); for (int i = 0; i < gumpPieces.Length; i++) { string[] gumpParams = Regex.Split(gumpPieces[i], @"\s+"); switch (gumpParams[0].ToLower()) { case "button": // Button [x] [y] [released-id] [pressed-id] [quit] [page-id] [return-value] // [released-id] and [pressed-id] specify the buttongraphic. // If pressed check for [return-value]. // Use [page-id] to switch between pages and [quit]=1/0 to close the gump. gump.AddControl(new Button(gump, gumpParams), currentGUMPPage); break; case "buttontileart": // ButtonTileArt [x] [y] [released-id] [pressed-id] [quit] [page-id] [return-value] [tilepic-id] [hue] [tile-x] [tile-y] // Adds a button to the gump with the specified coordinates and tilepic as graphic. // [tile-x] and [tile-y] define the coordinates of the tile graphic and are relative to [x] and [y]. gump.AddControl(new Button(gump, int.Parse(gumpParams[1]), int.Parse(gumpParams[2]), int.Parse(gumpParams[3]), int.Parse(gumpParams[4]), (ButtonTypes)int.Parse(gumpParams[5]), int.Parse(gumpParams[6]), int.Parse(gumpParams[7])), currentGUMPPage); gump.AddControl(new StaticPic(gump, int.Parse(gumpParams[1]) + int.Parse(gumpParams[10]), int.Parse(gumpParams[2]) + int.Parse(gumpParams[11]), int.Parse(gumpParams[8]), int.Parse(gumpParams[9])), currentGUMPPage); break; case "checkertrans": // CheckerTrans [x] [y] [width] [height] // Creates a transparent rectangle on position [x,y] using [width] and [height]. gump.AddControl(new CheckerTrans(gump, gumpParams), currentGUMPPage); break; case "croppedtext": // CroppedText [x] [y] [width] [height] [color] [text-id] // Adds a text field to the gump. gump is similar to the text command, but the text is cropped to the defined area. gump.AddControl(new CroppedText(gump, gumpParams, gumpLines), currentGUMPPage); (gump.LastControl as CroppedText).Hue = 1; break; case "gumppic": // GumpPic [x] [y] [id] hue=[color] // Adds a graphic to the gump, where [id] ist the graphic id of an item. For example use InsideUO to get them. Optionaly there is a color parameter. gump.AddControl(new GumpPic(gump, gumpParams), currentGUMPPage); break; case "gumppictiled": // GumpPicTiled [x] [y] [width] [height] [id] // Similar to GumpPic, but the gumppic is tiled to the given [height] and [width]. gump.AddControl(new GumpPicTiled(gump, gumpParams), currentGUMPPage); break; case "htmlgump": // HtmlGump [x] [y] [width] [height] [text-id] [background] [scrollbar] // Defines a text-area where Html-commands are allowed. // [background] and [scrollbar] can be 0 or 1 and define whether the background is transparent and a scrollbar is displayed. gump.AddControl(new HtmlGumpling(gump, gumpParams, gumpLines), currentGUMPPage); break; case "page": // Page [Number] // Specifies which page to define. Page 0 is the background thus always visible. currentGUMPPage = Int32.Parse(gumpParams[1]); break; case "resizepic": // ResizePic [x] [y] [gump-id] [width] [height] // Similar to GumpPic but the pic is automatically resized to the given [width] and [height]. gump.AddControl(new ResizePic(gump, gumpParams), currentGUMPPage); break; case "text": // Text [x] [y] [color] [text-id] // Defines the position and color of a text (data) entry. gump.AddControl(new TextLabel(gump, gumpParams, gumpLines), currentGUMPPage); break; case "textentry": // TextEntry [x] [y] [width] [height] [color] [return-value] [default-text-id] // Defines an area where the [default-text-id] is displayed. // The player can modify gump data. To get gump data check the [return-value]. gump.AddControl(new TextEntry(gump, gumpParams, gumpLines), currentGUMPPage); break; case "textentrylimited": // TextEntryLimited [x] [y] [width] [height] [color] [return-value] [default-text-id] [textlen] // Similar to TextEntry but you can specify via [textlen] the maximum of characters the player can type in. gump.AddControl(new TextEntry(gump, gumpParams, gumpLines), currentGUMPPage); break; case "tilepic": // TilePic [x] [y] [id] // Adds a Tilepicture to the gump. [id] defines the tile graphic-id. For example use InsideUO to get them. gump.AddControl(new StaticPic(gump, gumpParams), currentGUMPPage); break; case "tilepichue": // TilePicHue [x] [y] [id] [hue] // Similar to the tilepic command, but with an additional hue parameter. gump.AddControl(new StaticPic(gump, gumpParams), currentGUMPPage); break; case "noclose": // NoClose // Prevents that the gump can be closed by right clicking. gump.IsUncloseableWithRMB = true; break; case "nodispose": // NoDispose //Prevents that the gump can be closed by hitting Esc. gump.IsUncloseableWithEsc = true; break; case "nomove": // NoMove // Locks the gump in his position. gump.BlockMovement = true; break; case "group": // Group [Number] // Links radio buttons to a group. Add gump before radiobuttons to do so. See also endgroup. currentRadioGroup++; break; case "endgroup": // EndGroup // Links radio buttons to a group. Add gump after radiobuttons to do so. See also group. currentRadioGroup++; break; case "radio": // Radio [x] [y] [released-id] [pressed-id] [status] [return-value] // Same as Checkbox, but only one Radiobutton can be pressed at the same time, and they are linked via the 'Group' command. gump.AddControl(new RadioButton(gump, currentRadioGroup, gumpParams, gumpLines), currentGUMPPage); break; case "checkbox": // CheckBox [x] [y] [released-id] [pressed-id] [status] [return-value] // Adds a CheckBox to the gump. Multiple CheckBoxes can be pressed at the same time. // Check the [return-value] if you want to know which CheckBoxes were selected. gump.AddControl(new CheckBox(gump, gumpParams, gumpLines), currentGUMPPage); break; case "xmfhtmlgump": // XmfHtmlGump [x] [y] [width] [height] [cliloc-nr] [background] [scrollbar] // Similar to the htmlgump command, but in place of the [text-id] a CliLoc entry is used. gump.AddControl(new HtmlGumpling(gump, int.Parse(gumpParams[1]), int.Parse(gumpParams[2]), int.Parse(gumpParams[3]), int.Parse(gumpParams[4]), int.Parse(gumpParams[6]), int.Parse(gumpParams[7]), "<span color=#000>" + provider.GetString(int.Parse(gumpParams[5]))), currentGUMPPage); break; case "xmfhtmlgumpcolor": // XmfHtmlGumpColor [x] [y] [width] [height] [cliloc-nr] [background] [scrollbar] [color] // Similar to the xmfhtmlgump command, but additionally a [color] can be specified. gump.AddControl(new HtmlGumpling(gump, int.Parse(gumpParams[1]), int.Parse(gumpParams[2]), int.Parse(gumpParams[3]), int.Parse(gumpParams[4]), int.Parse(gumpParams[6]), int.Parse(gumpParams[7]), string.Format("<span color=#{0}>{1}", Utility.GetColorFromInt(int.Parse(gumpParams[8])), provider.GetString(int.Parse(gumpParams[5])))), currentGUMPPage); (gump.LastControl as HtmlGumpling).Hue = 0; break; case "xmfhtmltok": // XmfHtmlTok [x] [y] [width] [height] [background] [scrollbar] [color] [cliloc-nr] @[arguments]@ // Similar to xmfhtmlgumpcolor command, but the parameter order is different and an additionally // [argument] entry enclosed with @'s can be used. With gump you can specify texts that will be // added to the CliLoc entry. string messageWithArgs = provider.GetString(1070788); int argReplaceBegin = messageWithArgs.IndexOf("~1"); if (argReplaceBegin != -1) { int argReplaceEnd = messageWithArgs.IndexOf("~", argReplaceBegin + 2); if (argReplaceEnd != -1) { if (gumpParams.Length == 10 && gumpParams[9].Length >= 2) { messageWithArgs = string.Format("{0}{1}{2}", messageWithArgs.Substring(0, argReplaceBegin), gumpParams[9].Substring(1, gumpParams[9].Length - 2), (argReplaceEnd > messageWithArgs.Length - 1) ? messageWithArgs.Substring(argReplaceEnd) : string.Empty); } } } gump.AddControl(new HtmlGumpling(gump, int.Parse(gumpParams[1]), int.Parse(gumpParams[2]), int.Parse(gumpParams[3]), int.Parse(gumpParams[4]), int.Parse(gumpParams[5]), int.Parse(gumpParams[6]), string.Format("<font color=#{0}>{1}", Utility.GetColorFromUshort(ushort.Parse(gumpParams[7])), messageWithArgs)), currentGUMPPage); (gump.LastControl as HtmlGumpling).Hue = 0; Tracer.Warn(string.Format("GUMP: Unhandled {0}.", gumpParams[0])); break; case "tooltip": // Tooltip [cliloc-number] // Adds to the previous layoutarray entry a Tooltip with the in [cliloc-number] defined CliLoc entry. if (PlayerState.ClientFeatures.TooltipsEnabled) { string cliloc = provider.GetString(int.Parse(gumpPieces[1])); if (gump.LastControl != null) { gump.LastControl.SetTooltip(cliloc); } else { Tracer.Warn(string.Format("GUMP: No control for gump tooltip: {0}.", gumpParams[1])); } } break; case "noresize": break; default: Tracer.Critical("GUMP: Unknown piece '" + gumpParams[0] + "'."); break; } } }
void ResetToLogin() { Client.Disconnect(); m_UserInterface.Reset(); CurrentGump = m_UserInterface.AddControl(new LoginGump(OnLogin), 0, 0) as Gump; }
void openSkillsGump() { CurrentGump.Dispose(); CurrentGump = m_UserInterface.AddControl(new CreateCharSkillsGump(OnForwardSkills, OnBackwardSkills), 0, 0) as Gump; if (m_Data.HasSkillData) (CurrentGump as CreateCharSkillsGump).RestoreData(m_Data); }
void openAppearanceGump() { CurrentGump.Dispose(); CurrentGump = m_UserInterface.AddControl(new CreateCharAppearanceGump(OnForwardAppearance, OnBackwardAppearance), 0, 0) as Gump; if (m_Data.HasAppearanceData) (CurrentGump as CreateCharAppearanceGump).RestoreData(m_Data); }
void OnLogin(string server, int port, string account, SecureString password) { CurrentGump.Dispose(); CurrentGump = m_UserInterface.AddControl(new LoginStatusGump(OnCancelLogin), 0, 0) as Gump; if (Client.Connect(Settings.Login.ServerAddress, Settings.Login.ServerPort, account, password)) (CurrentGump as LoginStatusGump).Page = LoginStatusGump.PageCouldntConnect; else (CurrentGump as LoginStatusGump).Page = LoginStatusGump.PageVerifyingAccount; }
// ============================================================================================================ // Server list // ============================================================================================================ public void ShowServerList(ServerListEntry[] servers) { m_Servers = servers; CurrentGump.Dispose(); CurrentGump = m_UserInterface.AddControl(new SelectServerGump(servers, OnBackToLoginScreen, OnSelectLastServer, OnSelectServer), 0, 0) as Gump; // Auto select first server if only one exists. if (m_Servers.Length == 1) OnSelectServer(m_Servers[0].Index); }