コード例 #1
0
ファイル: HUD.cs プロジェクト: weedindeed/EndlessClient
		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);
		}
コード例 #2
0
ファイル: ChatPanel.cs プロジェクト: weedindeed/EndlessClient
		public EOChatRenderer()
		{
			tabs = new ChatTab[Enum.GetNames(typeof(ChatTabs)).Length - 1]; // -1 skips the 'none' tab which is used for news
			for(int i = 0; i < tabs.Length; ++i)
			{
				tabs[i] = new ChatTab((ChatTabs)i, this, (ChatTabs)i == ChatTabs.Local)
				{
					DrawLocation = i > (int) ChatTabs.Private2 ? new Vector2(289 + 44*(i - 2), 102) : new Vector2((ChatTabs) i == ChatTabs.Private1 ? 23 : 156, 102)
				};
			}

			currentSelTab = (int)ChatTabs.Local;
			tabs[currentSelTab].Selected = true;
		}