private EOPaperdollDialog(PacketAPI api, OldCharacter character, PaperdollDisplayData data) : base(api) { if (Instance != null) { throw new InvalidOperationException("Paperdoll is already open!"); } Instance = this; CharRef = character; Texture2D bgSprites = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 49); _setSize(bgSprites.Width, bgSprites.Height / 2); Color[] dat = new Color[DrawArea.Width * DrawArea.Height]; bgTexture = new Texture2D(Game.GraphicsDevice, DrawArea.Width, DrawArea.Height); bgSprites.GetData(0, DrawArea.WithPosition(new Vector2(0, CharRef.RenderData.gender * DrawArea.Height)), dat, 0, dat.Length); bgTexture.SetData(dat); //not using caption/message since we have other shit to take care of //ok button XNAButton ok = new XNAButton(smallButtonSheet, new Vector2(276, 253), _getSmallButtonOut(SmallButton.Ok), _getSmallButtonOver(SmallButton.Ok)) { Visible = true }; ok.OnClick += (s, e) => Close(ok, XNADialogResult.OK); ok.SetParent(this); dlgButtons.Add(ok); //items for (int i = (int)EquipLocation.Boots; i < (int)EquipLocation.PAPERDOLL_MAX; ++i) { var info = OldWorld.Instance.EIF[CharRef.PaperDoll[i]]; Rectangle itemArea = _getEquipLocRectangle((EquipLocation)i); //create item using itemArea if (CharRef.PaperDoll[i] > 0) { // ReSharper disable once UnusedVariable PaperdollDialogItem nextItem = new PaperdollDialogItem(m_api, itemArea, this, info, (EquipLocation)i); //auto-added as child of this dialog } else { // ReSharper disable once UnusedVariable PaperdollDialogItem nextItem = new PaperdollDialogItem(m_api, itemArea, this, null, (EquipLocation)i); } } //labels next XNALabel[] labels = { new XNALabel(new Rectangle(228, 22, 1, 1), Constants.FontSize08pt5) { Text = CharRef.Name.Length > 0 ? char.ToUpper(CharRef.Name[0]) + CharRef.Name.Substring(1) : "" }, //name new XNALabel(new Rectangle(228, 52, 1, 1), Constants.FontSize08pt5) { Text = data.Home.Length > 0 ? char.ToUpper(data.Home[0]) + data.Home.Substring(1) : "" }, //home new XNALabel(new Rectangle(228, 82, 1, 1), Constants.FontSize08pt5) { Text = (OldWorld.Instance.ECF[CharRef.Class] ?? new ECFRecord()).Name ?? "" }, //class new XNALabel(new Rectangle(228, 112, 1, 1), Constants.FontSize08pt5) { Text = data.Partner.Length > 0 ? char.ToUpper(data.Partner[0]) + data.Partner.Substring(1) : "" }, //partner new XNALabel(new Rectangle(228, 142, 1, 1), Constants.FontSize08pt5) { Text = CharRef.Title.Length > 0 ? char.ToUpper(CharRef.Title[0]) + CharRef.Title.Substring(1) : "" }, //title new XNALabel(new Rectangle(228, 202, 1, 1), Constants.FontSize08pt5) { Text = data.Guild.Length > 0 ? char.ToUpper(data.Guild[0]) + data.Guild.Substring(1) : "" }, //guild new XNALabel(new Rectangle(228, 232, 1, 1), Constants.FontSize08pt5) { Text = data.Rank.Length > 0 ? char.ToUpper(data.Rank[0]) + data.Rank.Substring(1) : "" } //rank }; labels.ToList().ForEach(_l => { _l.ForeColor = ColorConstants.LightGrayText; _l.SetParent(this); }); ChatIcon icon = OldChatRenderer.GetChatTypeFromPaperdollIcon(data.Icon); m_characterIcon = OldChatTab.GetChatIcon(icon); //should not be centered vertically: only display in game window //first center in the game display window, then move it 15px from top, THEN call end constructor logic //if not done in this order some items DrawAreaWithOffset field does not get updated properly when setting DrawLocation Center(Game.GraphicsDevice); DrawLocation = new Vector2(DrawLocation.X, 15); endConstructor(false); }
public HUD(Game g, PacketAPI api) : base(g) { if (!api.Initialized) { throw new ArgumentException("Need to initialize connection before the in-game stuff will work"); } m_packetAPI = api; DrawOrder = 100; chatRenderer = new OldChatRenderer(); CreateChatTextbox(); //m_whoIsOnline = new OldEOOnlineList(pnlOnline); //m_party = new OldEOPartyPanel(pnlParty); m_friendList = new XNAButton(((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 27, false, true), new Vector2(592, 312), new Rectangle(0, 260, 17, 15), new Rectangle(0, 276, 17, 15)) { Visible = true, Enabled = true, DrawOrder = HUD_CONTROL_DRAW_ORDER }; m_friendList.OnClick += (o, e) => FriendIgnoreListDialog.Show(isIgnoreList: false, apiHandle: m_packetAPI); m_friendList.OnMouseOver += (o, e) => SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_BUTTON, EOResourceID.STATUS_LABEL_FRIEND_LIST); m_ignoreList = new XNAButton(((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 27, false, true), new Vector2(609, 312), new Rectangle(17, 260, 17, 15), new Rectangle(17, 276, 17, 15)) { Visible = true, Enabled = true, DrawOrder = HUD_CONTROL_DRAW_ORDER }; m_ignoreList.OnClick += (o, e) => FriendIgnoreListDialog.Show(isIgnoreList: true, apiHandle: m_packetAPI); m_ignoreList.OnMouseOver += (o, e) => SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_BUTTON, EOResourceID.STATUS_LABEL_IGNORE_LIST); m_expInfo = new XNAButton(((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 58), new Vector2(55, 0), new Rectangle(331, 30, 22, 14), new Rectangle(331, 30, 22, 14)) { DrawOrder = HUD_CONTROL_DRAW_ORDER }; m_expInfo.OnClick += (o, e) => SessionExpDialog.Show(); m_questInfo = new XNAButton(((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 58), new Vector2(77, 0), new Rectangle(353, 30, 22, 14), new Rectangle(353, 30, 22, 14)) { DrawOrder = HUD_CONTROL_DRAW_ORDER }; m_questInfo.OnClick += (o, e) => QuestProgressDialog.Show(m_packetAPI); //no need to make this a member variable //it does not have any resources to dispose and it is automatically disposed by the framework // ReSharper disable once UnusedVariable //OldEOSettingsPanel settings = new OldEOSettingsPanel(pnlSettings); }