Example #1
0
		public EOPartyPanel(XNAPanel parent)
			: base(null, null, parent)
		{
			_setSize(parent.BackgroundImage.Width, parent.BackgroundImage.Height);

			m_removeTexture = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 43);
			m_buttons = new List<XNAButton>();
			
			//will tint this different colors for health bar and fill a rectangle
			m_healthBar = new Texture2D[4];
			m_healthBar[HP_OUTLINE] = Game.Content.Load<Texture2D>("Party\\hp-outline");
			m_healthBar[HP_RED] = Game.Content.Load<Texture2D>("Party\\hp-red");
			m_healthBar[HP_YELLOW] = Game.Content.Load<Texture2D>("Party\\hp-yellow");
			m_healthBar[HP_GREEN] = Game.Content.Load<Texture2D>("Party\\hp-green");

			m_numMembers = new XNALabel(new Rectangle(455, 2, 27, 14), Constants.FontSize08pt5)
			{
				AutoSize = false,
				ForeColor = Constants.LightGrayText,
				TextAlign = LabelAlignment.MiddleRight
			};
			m_numMembers.SetParent(this);

			m_scrollBar = new ScrollBar(this, new Vector2(467, 20), new Vector2(16, 97), ScrollBarColors.LightOnMed)
			{
				LinesToRender = 7,
				Visible = true
			};
			m_scrollBar.SetParent(this);
			World.IgnoreDialogs(m_scrollBar);
		}
Example #2
0
		private QuestDialog(PacketAPI api)
			: base(api)
		{
			DialogClosing += (o, e) =>
			{
				if (e.Result == XNADialogResult.OK)
				{
					if (!m_api.RespondToQuestDialog(_stateInfo, DialogReply.Ok))
						((EOGame) Game).DoShowLostConnectionDialogAndReturnToMainMenu();
				}
				Instance = null;
			};

			_dialogNames = new Dictionary<short, string>();
			_links = new Dictionary<short, string>();
			_pages = new List<string>();

			_setBackgroundTexture(((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 67));

			caption = new XNALabel(new Rectangle(16, 16, 255, 18), Constants.FontSize08pt5)
			{
				AutoSize = false,
				TextAlign = LabelAlignment.MiddleLeft,
				ForeColor = Constants.LightGrayText
			};
			caption.SetParent(this);

			m_scrollBar.SetParent(null);
			m_scrollBar.Close();

			m_scrollBar = new ScrollBar(this, new Vector2(252, 44), new Vector2(16, 99), ScrollBarColors.LightOnMed);
			m_scrollBar.SetParent(this);
			SmallItemStyleMaxItemDisplay = 6;
		}
		public ScrollingMessageDialog(string msgText)
		{
			textSplitter = new TextSplitter("", EOGame.Instance.DBGFont) { LineLength = 275 };

			bgTexture = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PreLoginUI, 40);
			_setSize(bgTexture.Width, bgTexture.Height);

			XNAButton ok = new XNAButton(smallButtonSheet, new Vector2(138, 197), _getSmallButtonOut(SmallButton.Ok), _getSmallButtonOver(SmallButton.Ok));
			ok.OnClick += (sender, e) => Close(ok, XNADialogResult.OK);
			ok.SetParent(this);
			dlgButtons.Add(ok);

			scrollBar = new ScrollBar(this, new Vector2(320, 66), new Vector2(16, 119), ScrollBarColors.LightOnMed);
			MessageText = msgText;

			endConstructor();
		}
		public EOOnlineList(XNAPanel parent)
			: base(null, null, parent)
		{
			m_onlineList = new List<ClientOnlineEntry>();
			//this enables scrolling with mouse wheel and mouseover for parent
			_setSize(parent.BackgroundImage.Width, parent.BackgroundImage.Height);

			m_totalNumPlayers = new XNALabel(new Rectangle(455, 2, 27, 14), Constants.FontSize08pt5)
			{
				AutoSize = false,
				ForeColor = Constants.LightGrayText,
				TextAlign = LabelAlignment.MiddleRight
			};
			m_totalNumPlayers.SetParent(this);

			m_scrollBar = new ScrollBar(this, new Vector2(467, 20), new Vector2(16, 97), ScrollBarColors.LightOnMed)
			{
				LinesToRender = 7,
				Visible = true
			};
			m_scrollBar.SetParent(this);
			World.IgnoreDialogs(m_scrollBar);

			m_filterClick = new Rectangle(2 + DrawAreaWithOffset.X, 2 + DrawAreaWithOffset.Y, 14, 14);

			Texture2D weirdOffsets = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 27, true);
			for (int i = 0; i < m_filterTextures.Length; ++i)
			{
				Rectangle offsetsSource = new Rectangle(i % 2 == 0 ? 0 : 12, i >= 2 ? 246 : 233, 12, 13);

				m_filterTextures[i] = new Texture2D(EOGame.Instance.GraphicsDevice, 12, 13);
				Color[] dat = new Color[12*13];
				weirdOffsets.GetData(0, offsetsSource, dat, 0, dat.Length);
				m_filterTextures[i].SetData(dat);
			}
		}
		public ActiveSpells(XNAPanel parent, PacketAPI api)
			: base(null, null, parent)
		{
			_api = api;

			_childItems = new List<ISpellIcon>(SPELL_NUM_ROWS * SPELL_ROW_LENGTH);
			RemoveAllSpells();

			var localSpellSlotMap = new Dictionary<int, int>();
			_spellsKey = _tryGetCharacterRegKey();
			if (_spellsKey != null)
			{
				const string spellFmt = "item{0}";
				for (int i = 0; i < SPELL_ROW_LENGTH*4; ++i)
				{
					int id;
					try
					{
						id = Convert.ToInt32(_spellsKey.GetValue(String.Format(spellFmt, i)));
					}
					catch { continue; }
					localSpellSlotMap.Add(i, id);
				}
			}

			var localSpells = World.Instance.MainPlayer.ActiveCharacter.Spells;
			// ReSharper disable once LoopCanBeConvertedToQuery
			foreach (var spell in localSpells)
			{
				SpellRecord rec = World.Instance.ESF.GetSpellRecordByID(spell.id);
				int slot = localSpellSlotMap.ContainsValue(spell.id)
					? localSpellSlotMap.First(_pair => _pair.Value == spell.id).Key
					: _getNextOpenSlot();

				if (slot < 0 || !_addNewSpellToSlot(slot, rec, spell.level))
				{
					EOMessageBox.Show("You have too many spells! They don't all fit.", "Warning", XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
					break;
				}

				if (slot >= SPELL_ROW_LENGTH*(SPELL_NUM_ROWS/2))
					_childItems.Last().Visible = false;
			}

			_setSize(parent.DrawArea.Width, parent.DrawArea.Height);

			_functionKeyGraphics = ((EOGame) Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 58, true);
			_functionKeyRow1SourceRect = new Rectangle(148, 51, 18, 13);
			_functionKeyRow2SourceRect = new Rectangle(148 + 18*8, 51, 18, 13);

			_selectedSpellName = new XNALabel(new Rectangle(9, 50, 81, 13), Constants.FontSize08pt5)
			{
				Visible = false,
				Text = "",
				AutoSize = false,
				TextAlign = LabelAlignment.MiddleCenter,
				ForeColor = Constants.LightGrayText
			};
			_selectedSpellName.SetParent(this);

			_selectedSpellLevel = new XNALabel(new Rectangle(32, 78, 42, 15), Constants.FontSize08pt5)
			{
				Visible = true,
				Text = "0",
				AutoSize = false,
				TextAlign = LabelAlignment.MiddleLeft,
				ForeColor = Constants.LightGrayText
			};
			_selectedSpellLevel.SetParent(this);

			var skillPoints = World.Instance.MainPlayer.ActiveCharacter.Stats.SkillPoints;
			_totalSkillPoints = new XNALabel(new Rectangle(32, 96, 42, 15), Constants.FontSize08pt5)
			{
				Visible = true,
				Text = skillPoints.ToString(),
				AutoSize = false,
				TextAlign = LabelAlignment.MiddleLeft,
				ForeColor = Constants.LightGrayText
			};
			_totalSkillPoints.SetParent(this);

			var buttonSheet = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 27, true);

			_levelUpButton1 = new XNAButton(buttonSheet, new Vector2(71, 77), new Rectangle(215, 386, 19, 15), new Rectangle(234, 386, 19, 15))
			{
				FlashSpeed = 500,
				Visible = false
			};
			_levelUpButton1.OnClick += LevelUp_Click;
			_levelUpButton1.SetParent(this);
			_levelUpButton2 = new XNAButton(buttonSheet, new Vector2(71, 95), new Rectangle(215, 386, 19, 15), new Rectangle(234, 386, 19, 15))
			{
				FlashSpeed = 500,
				Visible = false
			};
			_levelUpButton2.OnClick += LevelUp_Click;
			_levelUpButton2.SetParent(this);

			_scroll = new ScrollBar(this, new Vector2(467, 2), new Vector2(16, 115), ScrollBarColors.LightOnMed) { LinesToRender = 2 };
			_scroll.UpdateDimensions(4);

			foreach (var child in children.Where(x => !(x is EmptySpellIcon)))
				World.IgnoreDialogs(child);
		}
Example #6
0
		public TradeDialog(PacketAPI apiHandle)
			: base(apiHandle)
		{
			bgTexture = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 50);
			_setSize(bgTexture.Width, bgTexture.Height);

			Instance = this;
			DialogClosing += (sender, args) => Instance = null;
			m_main = World.Instance.MainPlayer.ActiveCharacter;

			m_leftItems = new List<ListDialogItem>();
			m_rightItems = new List<ListDialogItem>();

			m_leftPlayerID = 0;
			m_rightPlayerID = 0;

			m_leftPlayerName = new XNALabel(new Rectangle(20, 14, 166, 20), Constants.FontSize08pt5)
			{
				AutoSize = false,
				TextAlign = LabelAlignment.MiddleLeft,
				ForeColor = Constants.LightGrayText
			};
			m_leftPlayerName.SetParent(this);
			m_rightPlayerName = new XNALabel(new Rectangle(285, 14, 166, 20), Constants.FontSize08pt5)
			{
				AutoSize = false,
				TextAlign = LabelAlignment.MiddleLeft,
				ForeColor = Constants.LightGrayText
			};
			m_rightPlayerName.SetParent(this);
			m_leftPlayerStatus = new XNALabel(new Rectangle(195, 14, 79, 20), Constants.FontSize08pt5)
			{
				AutoSize = false,
				TextAlign = LabelAlignment.MiddleLeft,
				Text = World.GetString(DATCONST2.DIALOG_TRADE_WORD_TRADING),
				ForeColor = Constants.LightGrayText
			};
			m_leftPlayerStatus.SetParent(this);
			m_rightPlayerStatus = new XNALabel(new Rectangle(462, 14, 79, 20), Constants.FontSize08pt5)
			{
				AutoSize = false,
				TextAlign = LabelAlignment.MiddleLeft,
				Text = World.GetString(DATCONST2.DIALOG_TRADE_WORD_TRADING),
				ForeColor = Constants.LightGrayText
			};
			m_rightPlayerStatus.SetParent(this);

			m_leftScroll = new ScrollBar(this, new Vector2(252, 44), new Vector2(16, 199), ScrollBarColors.LightOnMed) { LinesToRender = 5 };
			m_rightScroll = new ScrollBar(this, new Vector2(518, 44), new Vector2(16, 199), ScrollBarColors.LightOnMed) { LinesToRender = 5 };

			//BUTTONSSSS
			XNAButton ok = new XNAButton(smallButtonSheet, new Vector2(356, 252), _getSmallButtonOut(SmallButton.Ok),
				_getSmallButtonOver(SmallButton.Ok));
			ok.OnClick += _buttonOkClicked;
			ok.SetParent(this);
			dlgButtons.Add(ok);
			XNAButton cancel = new XNAButton(smallButtonSheet, new Vector2(449, 252), _getSmallButtonOut(SmallButton.Cancel),
				_getSmallButtonOver(SmallButton.Cancel));
			cancel.OnClick += _buttonCancelClicked;
			cancel.SetParent(this);
			dlgButtons.Add(cancel);

			Timer localTimer = new Timer(state =>
			{
				if (m_recentPartnerRemoves > 0)
					m_recentPartnerRemoves--;
			}, null, 0, 5000);

			DialogClosing += (o, e) =>
			{
				if (e.Result == XNADialogResult.Cancel)
				{
					if (!m_api.TradeClose())
						((EOGame)Game).DoShowLostConnectionDialogAndReturnToMainMenu();
					((EOGame)Game).Hud.SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_ACTION, DATCONST2.STATUS_LABEL_TRADE_ABORTED);
				}

				localTimer.Dispose();
			};

			Center(Game.GraphicsDevice);
			DrawLocation = new Vector2(DrawLocation.X, 30);
			endConstructor(false);
		}
		public ScrollingListDialog(PacketAPI api = null)
			: base(api)
		{
			_setBackgroundTexture(((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 52));

			//defaults
			LargeItemStyleMaxItemDisplay = 5;
			SmallItemStyleMaxItemDisplay = 12;

			m_titleText = new XNALabel(new Rectangle(16, 13, 253, 19), Constants.FontSize08pt75)
			{
				AutoSize = false,
				TextAlign = LabelAlignment.MiddleLeft,
				ForeColor = Constants.LightGrayText
			};
			m_titleText.SetParent(this);

			m_scrollBar = new ScrollBar(this, new Vector2(252, 44), new Vector2(16, 199), ScrollBarColors.LightOnMed);

			Center(Game.GraphicsDevice);
			DrawLocation = new Vector2(DrawLocation.X, 15);
			endConstructor(false);
		}
Example #8
0
		/// <summary>
		/// This constructor should be used for the news rendering
		/// </summary>
		public ChatTab(XNAControl parentControl)
			: base(null, null, parentControl)
		{
			WhichTab = ChatTabs.None;
			_selected = true;
			tabLabel = null;

			relativeTextPos = new Vector2(20, 23);
			//568 331
			scrollBar = new ScrollBar(parent, new Vector2(467, 20), new Vector2(16, 97), ScrollBarColors.LightOnMed)
			{
				LinesToRender = 7,
				Visible = true
			};
			World.IgnoreDialogs(scrollBar);
		}
Example #9
0
		/// <summary>
		/// This Constructor should be used for all values in ChatTabs
		/// </summary>
		public ChatTab(ChatTabs tab, EOChatRenderer parentRenderer, bool selected = false)
			: base(null, null, parentRenderer)
		{
			WhichTab = tab;
			
			tabLabel = new XNALabel(new Rectangle(14, 2, 1, 1), Constants.FontSize08);
			tabLabel.SetParent(this);

			switch(WhichTab)
			{
				case ChatTabs.Local: tabLabel.Text = "scr";  break;
				case ChatTabs.Global: tabLabel.Text = "glb"; break;
				case ChatTabs.Group: tabLabel.Text = "grp"; break;
				case ChatTabs.System: tabLabel.Text = "sys"; break;
				case ChatTabs.Private1:
				case ChatTabs.Private2:
					tabLabel.Text = "[priv " + ((int)WhichTab + 1) + "]";
					break;
			}
			_selected = selected;

			relativeTextPos = new Vector2(20, 3);

			//enable close button based on which tab was specified
			switch(WhichTab)
			{
				case ChatTabs.Private1:
				case ChatTabs.Private2:
					{
						closeRect = new Rectangle(3, 3, 11, 11);
						drawArea = new Rectangle(drawArea.X, drawArea.Y, 132, 16);
						Visible = false;
					} break;
				default:
					{
						closeRect = null;
						drawArea = new Rectangle(drawArea.X, drawArea.Y, 43, 16);
						Visible = true;
					} break;
			}
			
			//568 331
			scrollBar = new ScrollBar(parent, new Vector2(467, 2), new Vector2(16, 97), ScrollBarColors.LightOnMed)
			{
				Visible = selected,
				LinesToRender = 7
			};
			World.IgnoreDialogs(scrollBar);
		}