Example #1
0
		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;

			mainFrame = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 1, true);
			topLeft = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 21, true);
			sidebar = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 22, true);
			topBar = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 23, true);
			filler = new Texture2D(g.GraphicsDevice, 1, 1);
			filler.SetData(new[] {Color.FromNonPremultiplied(8, 8, 8, 255)});

			Texture2D mainButtonTexture = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 25);
			mainBtn = new XNAButton[NUM_BTN];

			CreatePanels();
			CreateMainButtons(g, mainButtonTexture);

			SpriteBatch = new SpriteBatch(g.GraphicsDevice);

			state = InGameStates.News;

			chatRenderer = new EOChatRenderer();
			chatRenderer.SetParent(pnlChat);
			chatRenderer.AddTextToTab(ChatTabs.Global, World.GetString(DATCONST2.STRING_SERVER),
				World.GetString(DATCONST2.GLOBAL_CHAT_SERVER_MESSAGE_1),
				ChatType.Note, ChatColor.Server);
			chatRenderer.AddTextToTab(ChatTabs.Global, World.GetString(DATCONST2.STRING_SERVER),
				World.GetString(DATCONST2.GLOBAL_CHAT_SERVER_MESSAGE_2),
				ChatType.Note, ChatColor.Server);

			newsTab = new ChatTab(pnlNews);

			CreateChatTextbox();

			m_muteTimer = new Timer(s =>
			{
				chatTextBox.ToggleTextInputIgnore();
				currentChatMode = ChatMode.NoText;
				m_muteTimer.Change(Timeout.Infinite, Timeout.Infinite);
			}, null, Timeout.Infinite, Timeout.Infinite);

			statusLabel = new XNALabel(new Rectangle(97, 455, 1, 1), Constants.FontSize07) { DrawOrder = HUD_CONTROL_DRAW_ORDER };
			clockLabel = new XNALabel(new Rectangle(558, 455, 1, 1), Constants.FontSize07) { DrawOrder = HUD_CONTROL_DRAW_ORDER };

			m_whoIsOnline = new EOOnlineList(pnlOnline);
			m_party = new EOPartyPanel(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(DATCONST2.STATUS_LABEL_TYPE_BUTTON, DATCONST2.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(DATCONST2.STATUS_LABEL_TYPE_BUTTON, DATCONST2.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
			EOSettingsPanel settings = new EOSettingsPanel(pnlSettings);
		}
Example #2
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);
		}