Exemple #1
0
        private void _playerViewPaperdoll(PaperdollDisplayData _data)
        {
            if (EOPaperdollDialog.Instance != null)
            {
                return;
            }

            Character c;

            if (World.Instance.MainPlayer.ActiveCharacter.ID == _data.PlayerID)
            {
                //paperdoll requested for main player, all info should be up to date
                c = World.Instance.MainPlayer.ActiveCharacter;
                Array.Copy(_data.Paperdoll.ToArray(), c.PaperDoll, (int)EquipLocation.PAPERDOLL_MAX);
            }
            else
            {
                if ((c = World.Instance.ActiveMapRenderer.GetOtherPlayerByID(_data.PlayerID)) != null)
                {
                    c.Class = _data.Class;
                    c.RenderData.SetGender(_data.Gender);
                    c.Title     = _data.Title;
                    c.GuildName = _data.Guild;
                    Array.Copy(_data.Paperdoll.ToArray(), c.PaperDoll, (int)EquipLocation.PAPERDOLL_MAX);
                }
            }

            if (c != null)
            {
                EOPaperdollDialog.Show(m_packetAPI, c, _data);
            }
        }
Exemple #2
0
 public static void Show(PacketAPI api, OldCharacter character, PaperdollDisplayData data)
 {
     if (Instance != null)
     {
         return;
     }
     Instance = new EOPaperdollDialog(api, character, data);
     Instance.DialogClosing += (o, e) => Instance = null;
 }
Exemple #3
0
        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);
        }