public NewsPanel(INativeGraphicsManager nativeGraphicsManager, IChatRenderableGenerator chatRenderableGenerator, INewsProvider newsProvider, SpriteFont chatFont) { _nativeGraphicsManager = nativeGraphicsManager; _chatRenderableGenerator = chatRenderableGenerator; _newsProvider = newsProvider; //abs coordiantes: 568 331 _scrollBar = new ScrollBar(new Vector2(467, 20), new Vector2(16, 97), ScrollBarColors.LightOnMed, _nativeGraphicsManager) { LinesToRender = 7, Visible = true }; _scrollBar.SetParentControl(this); _chatRenderables = new List <IChatRenderable>(); _chatFont = chatFont; _cachedNewsStrings = new List <string>(); _cachedScrollOffset = -1; _cachedLinesToRender = -1; BackgroundImage = _nativeGraphicsManager.TextureFromResource(GFXTypes.PostLoginUI, 48); DrawArea = new Rectangle(102, 330, BackgroundImage.Width, BackgroundImage.Height); }
public ChatPanel(INativeGraphicsManager nativeGraphicsManager, IChatRenderableGenerator chatRenderableGenerator, IChatProvider chatProvider, IHudControlProvider hudControlProvider, SpriteFont chatFont) { _nativeGraphicsManager = nativeGraphicsManager; _chatRenderableGenerator = chatRenderableGenerator; _chatProvider = chatProvider; _hudControlProvider = hudControlProvider; _chatFont = chatFont; //abs coordiantes: 568 309 _scrollBar = new ScrollBar(new Vector2(467, 2), new Vector2(16, 97), ScrollBarColors.LightOnMed, _nativeGraphicsManager) { LinesToRender = 7, Visible = true }; _chatRenderables = new List <IChatRenderable>(); _state = new ChatPanelStateCache(); CurrentTab = ChatTab.Local; var tabTexture = _nativeGraphicsManager.TextureFromResource(GFXTypes.PostLoginUI, 35); _smallSelected = new SpriteSheet(tabTexture, new Rectangle(307, 16, 43, 16)); _smallUnselected = new SpriteSheet(tabTexture, new Rectangle(264, 16, 43, 16)); _largeSelected = new SpriteSheet(tabTexture, new Rectangle(132, 16, 132, 16)); _largeUnselected = new SpriteSheet(tabTexture, new Rectangle(0, 16, 132, 16)); BackgroundImage = _nativeGraphicsManager.TextureFromResource(GFXTypes.PostLoginUI, 28); DrawArea = new Rectangle(102, 330, BackgroundImage.Width, BackgroundImage.Height); _tabLabels = new Dictionary <ChatTab, IXNALabel> { { ChatTab.Local, new XNALabel(Constants.FontSize08) { Text = "scr", ForeColor = Color.White } }, { ChatTab.Global, new XNALabel(Constants.FontSize08) { Text = "glb" } }, { ChatTab.Group, new XNALabel(Constants.FontSize08) { Text = "grp" } }, { ChatTab.System, new XNALabel(Constants.FontSize08) { Text = "sys" } }, { ChatTab.Private1, new XNALabel(Constants.FontSize08) { Text = "[priv 1]", Visible = false } }, { ChatTab.Private2, new XNALabel(Constants.FontSize08) { Text = "[priv 2]", Visible = false } } }; _tabLabelClickableAreas = new Dictionary <ChatTab, Rectangle> { { ChatTab.Local, new Rectangle(0, 0, 43, 16).WithPosition(GetDestinationVectorForTab(ChatTab.Local)) }, { ChatTab.Global, new Rectangle(0, 0, 43, 16).WithPosition(GetDestinationVectorForTab(ChatTab.Global)) }, { ChatTab.Group, new Rectangle(0, 0, 43, 16).WithPosition(GetDestinationVectorForTab(ChatTab.Group)) }, { ChatTab.System, new Rectangle(0, 0, 43, 16).WithPosition(GetDestinationVectorForTab(ChatTab.System)) }, { ChatTab.Private1, new Rectangle(0, 0, 132, 16).WithPosition(GetDestinationVectorForTab(ChatTab.Private1)) }, { ChatTab.Private2, new Rectangle(0, 0, 132, 16).WithPosition(GetDestinationVectorForTab(ChatTab.Private2)) }, }; foreach (var kvp in _tabLabels) { var startPos = GetDestinationVectorForTab(kvp.Key); kvp.Value.DrawPosition = startPos + new Vector2(14, 2); //note: these must be manually drawn so they appear on top of the tab graphics if (Game.Components.Contains(kvp.Value)) { Game.Components.Remove(kvp.Value); } } _closeButtonAreaForTab1 = new Rectangle(3, 3, 11, 11).WithPosition(GetDestinationVectorForTab(ChatTab.Private1)); _closeButtonAreaForTab2 = new Rectangle(3, 3, 11, 11).WithPosition(GetDestinationVectorForTab(ChatTab.Private2)); }