public void Start() { float viewWidth = GAME_PANEL_X + gamePanelStyle.Width; float viewHeight = Math.Max(SCROLL_LIST_Y + scrollListStyle.Width, GAME_PANEL_Y + gamePanelStyle.Height); // Create the root widget group m_rootWidgetGroup = new WidgetGroup(null, viewWidth, viewHeight, 0.0f, 0.0f); m_rootWidgetGroup.SetWidgetEventListener(this); // Game list m_gameScrollList = new ScrollListWidget( m_rootWidgetGroup, (ScrollListWidget parentGroup, object parameters) => { return(new GameThumbnailWidget( parentGroup, gameThumbnailStyle, parameters as GameResponseEntry, 0.0f, 0.0f)); }, scrollListStyle, SCROLL_LIST_X, SCROLL_LIST_Y); // Game panel m_gamePanel = new GamePanelWidget(m_rootWidgetGroup, gamePanelStyle, GAME_PANEL_X, GAME_PANEL_Y); float panelWidth = m_gamePanel.Width - 2.0f * BORDER_WIDTH; // Create game button m_gameCreateButton = new ButtonWidget(m_gamePanel, buttonStyle, 0, 0, "Create"); m_gameCreateButton.SetLocalPosition( BORDER_WIDTH + panelWidth / 3 - m_gameCreateButton.Width, m_gamePanel.Height - m_gameCreateButton.Height - 5); // Select game button m_gameSelectButton = new ButtonWidget(m_gamePanel, buttonStyle, 0, 0, "Select"); m_gameSelectButton.SetLocalPosition( BORDER_WIDTH + (2 * panelWidth) / 3 - m_gameSelectButton.Width, m_gamePanel.Height - m_gameSelectButton.Height - 5); m_gameSelectButton.Visible = false; // Delete game button m_gameDeleteButton = new ButtonWidget(m_gamePanel, buttonStyle, 0, 0, "Delete"); m_gameDeleteButton.SetLocalPosition( BORDER_WIDTH + (3 * panelWidth) / 3 - m_gameDeleteButton.Width, m_gamePanel.Height - m_gameSelectButton.Height - 5); m_gameDeleteButton.Visible = false; // Initially hide all game data m_gamePanel.HideGameData(); }
public void Start() { float viewWidth = GAME_PANEL_X + gamePanelStyle.Width; float viewHeight = Math.Max(SCROLL_LIST_Y + scrollListStyle.Width, GAME_PANEL_Y + gamePanelStyle.Height); // Create the root widget group m_rootWidgetGroup = new WidgetGroup(null, viewWidth, viewHeight, 0.0f, 0.0f); m_rootWidgetGroup.SetWidgetEventListener(this); // Game list m_gameScrollList = new ScrollListWidget( m_rootWidgetGroup, (ScrollListWidget parentGroup, object parameters) => { return new GameThumbnailWidget( parentGroup, gameThumbnailStyle, parameters as GameResponseEntry, 0.0f, 0.0f); }, scrollListStyle, SCROLL_LIST_X, SCROLL_LIST_Y); // Game panel m_gamePanel = new GamePanelWidget(m_rootWidgetGroup, gamePanelStyle, GAME_PANEL_X, GAME_PANEL_Y); float panelWidth= m_gamePanel.Width - 2.0f * BORDER_WIDTH; // Create game button m_gameCreateButton = new ButtonWidget(m_gamePanel, buttonStyle, 0, 0, "Create"); m_gameCreateButton.SetLocalPosition( BORDER_WIDTH + panelWidth/3 - m_gameCreateButton.Width, m_gamePanel.Height - m_gameCreateButton.Height - 5); // Select game button m_gameSelectButton = new ButtonWidget(m_gamePanel, buttonStyle, 0, 0, "Select"); m_gameSelectButton.SetLocalPosition( BORDER_WIDTH + (2*panelWidth)/3 - m_gameSelectButton.Width, m_gamePanel.Height - m_gameSelectButton.Height - 5); m_gameSelectButton.Visible = false; // Delete game button m_gameDeleteButton = new ButtonWidget(m_gamePanel, buttonStyle, 0, 0, "Delete"); m_gameDeleteButton.SetLocalPosition( BORDER_WIDTH + (3*panelWidth)/3 - m_gameDeleteButton.Width, m_gamePanel.Height - m_gameSelectButton.Height - 5); m_gameDeleteButton.Visible = false; // Initially hide all game data m_gamePanel.HideGameData(); }