示例#1
0
        public void SetItem(EquipLocation loc, EIFRecord info)
        {
            PaperdollDialogItem itemToUpdate = (PaperdollDialogItem)children.Find(_ctrl =>
            {
                PaperdollDialogItem item = _ctrl as PaperdollDialogItem;
                if (item == null)
                {
                    return(false);
                }
                return(item.EquipLoc == loc);
            });

            if (itemToUpdate != null)
            {
                itemToUpdate.SetInfo(_getEquipLocRectangle(loc), info);
            }
        }
示例#2
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);
        }
		private EOPaperdollDialog(PacketAPI api, Character 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)
			{
				ItemRecord info = World.Instance.EIF.GetItemRecordByID(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 = ((ClassRecord)(World.Instance.ECF.Data.Find(_dat => ((ClassRecord)_dat).ID == CharRef.Class) ?? new ClassRecord(0))).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 = Constants.LightGrayText; _l.SetParent(this); });

			ChatType iconType = EOChatRenderer.GetChatTypeFromPaperdollIcon(data.Icon);
			m_characterIcon = ChatTab.GetChatIcon(iconType);

			//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);
		}