protected override void DoPaintEvent(BaseScreen screen) { base.DoPaintEvent(screen); string s = BaseLocale.GetStr(RS.rs_AdventurerName); screen.SetTextColor(Colors.Gold, true); screen.DrawText((Width - CtlCommon.SmFont.GetTextWidth(s)) / 2, fEditBox.Top - CtlCommon.SmFont.Height, s, 0); s = BaseLocale.GetStr(RS.rs_Apprenticeship); screen.Font = CtlCommon.BgFont; screen.SetTextColor(Colors.Gold, true); screen.DrawText((Width - CtlCommon.BgFont.GetTextWidth(s)) / 2, 60, s, 0); screen.Font = CtlCommon.SmFont; for (var pa = SysCreature.sc_First; pa <= SysCreature.sc_Last; pa++) { SysCreatureRec sc = StaticData.dbSysCreatures[(int)pa]; s = BaseLocale.GetStr(sc.Name); ExtRect r = sc.ScrRect; BaseImage img = fImages[(int)pa]; screen.DrawImage(r.Left, r.Top, 0, 0, (int)img.Width, (int)img.Height, img, 255); screen.DrawText(r.Left + (r.Width - CtlCommon.SmFont.GetTextWidth(s)) / 2, r.Top - CtlCommon.SmFont.Height, s, 0); } }
protected override void DoMouseDownEvent(MouseEventArgs eventArgs) { base.DoMouseDownEvent(eventArgs); try { for (var pa = SysCreature.sc_First; pa <= SysCreature.sc_Last; pa++) { SysCreatureRec sc = StaticData.dbSysCreatures[(int)pa]; if (sc.ScrRect.Contains(eventArgs.X, eventArgs.Y)) { Hide(); GlobalVars.nwrGame.SelectHero(sc.Sign, fEditBox.Text); return; } } } catch (Exception ex) { Logger.Write("HeroWindow.DoMouseDown(): " + ex.Message); throw ex; } }
public HeroWindow(BaseControl owner) : base(owner) { Font = CtlCommon.SmFont; Width = 590; Height = 430; WindowStyle = new WindowStyles(WindowStyles.wsScreenCenter, WindowStyles.wsModal, WindowStyles.wsKeyPreview); fImages = new BaseImage[6]; for (int pa = (int)SysCreature.sc_First; pa <= (int)SysCreature.sc_Last; pa++) { SysCreatureRec sc = StaticData.dbSysCreatures[pa]; fImages[pa] = NWResourceManager.LoadImage(MainWindow.Screen, "itf/pa_" + sc.Sign + ".tga", Colors.None); } fEditBox = new EditBox(this); fEditBox.Left = (Width - 200) / 2; fEditBox.Top = 35; fEditBox.Width = 200; fEditBox.Visible = true; }