public void Start() { float viewWidth = CHARACTER_PANEL_X + characterPanelStyle.BackgroundWidth; float viewHeight = Math.Max(SCROLL_LIST_Y + scrollListStyle.Width, CHARACTER_PANEL_Y + characterPanelStyle.BackgroundHeight); // Create the root widget group m_rootWidgetGroup = new WidgetGroup(null, viewWidth, viewHeight, 0.0f, 0.0f); m_rootWidgetGroup.SetWidgetEventListener(this); // Game list m_characterScrollList = new ScrollListWidget( m_rootWidgetGroup, (ScrollListWidget parentGroup, object parameters) => { return(new CharacterThumbnailWidget( parentGroup, characterThumbnailStyle, parameters as CharacterData)); }, scrollListStyle, SCROLL_LIST_X, SCROLL_LIST_Y); // Character panel m_characterPanel = new CharacterPanelWidget(m_rootWidgetGroup, characterPanelStyle, CHARACTER_PANEL_X, CHARACTER_PANEL_Y); float panelWidth = m_characterPanel.Width - 2.0f * BORDER_WIDTH; // Create game button m_characterCreateButton = new ButtonWidget(m_characterPanel, buttonStyle, 0, 0, "Create"); m_characterCreateButton.SetLocalPosition( BORDER_WIDTH + panelWidth / 3 - m_characterCreateButton.Width, m_characterPanel.Height - m_characterCreateButton.Height - 5); // Select game button m_characterSelectButton = new ButtonWidget(m_characterPanel, buttonStyle, 0, 0, "Select"); m_characterSelectButton.SetLocalPosition( BORDER_WIDTH + (2 * panelWidth) / 3 - m_characterSelectButton.Width, m_characterPanel.Height - m_characterSelectButton.Height - 5); m_characterSelectButton.Visible = false; // Delete game button m_characterDeleteButton = new ButtonWidget(m_characterPanel, buttonStyle, 0, 0, "Delete"); m_characterDeleteButton.SetLocalPosition( BORDER_WIDTH + (3 * panelWidth) / 3 - m_characterDeleteButton.Width, m_characterPanel.Height - m_characterDeleteButton.Height - 5); m_characterDeleteButton.Visible = false; // Initially hide all game data m_characterPanel.HideCharacterData(); }
public void Start() { float viewWidth = CHARACTER_PANEL_X + characterPanelStyle.BackgroundWidth; float viewHeight = Math.Max(SCROLL_LIST_Y + scrollListStyle.Width, CHARACTER_PANEL_Y + characterPanelStyle.BackgroundHeight); // Create the root widget group m_rootWidgetGroup = new WidgetGroup(null, viewWidth, viewHeight, 0.0f, 0.0f); m_rootWidgetGroup.SetWidgetEventListener(this); // Game list m_characterScrollList = new ScrollListWidget( m_rootWidgetGroup, (ScrollListWidget parentGroup, object parameters) => { return new CharacterThumbnailWidget( parentGroup, characterThumbnailStyle, parameters as CharacterData); }, scrollListStyle, SCROLL_LIST_X, SCROLL_LIST_Y); // Character panel m_characterPanel = new CharacterPanelWidget(m_rootWidgetGroup, characterPanelStyle, CHARACTER_PANEL_X, CHARACTER_PANEL_Y); float panelWidth = m_characterPanel.Width - 2.0f * BORDER_WIDTH; // Create game button m_characterCreateButton = new ButtonWidget(m_characterPanel, buttonStyle, 0, 0, "Create"); m_characterCreateButton.SetLocalPosition( BORDER_WIDTH + panelWidth / 3 - m_characterCreateButton.Width, m_characterPanel.Height - m_characterCreateButton.Height - 5); // Select game button m_characterSelectButton = new ButtonWidget(m_characterPanel, buttonStyle, 0, 0, "Select"); m_characterSelectButton.SetLocalPosition( BORDER_WIDTH + (2 * panelWidth) / 3 - m_characterSelectButton.Width, m_characterPanel.Height - m_characterSelectButton.Height - 5); m_characterSelectButton.Visible = false; // Delete game button m_characterDeleteButton = new ButtonWidget(m_characterPanel, buttonStyle, 0, 0, "Delete"); m_characterDeleteButton.SetLocalPosition( BORDER_WIDTH + (3 * panelWidth) / 3 - m_characterDeleteButton.Width, m_characterPanel.Height - m_characterDeleteButton.Height - 5); m_characterDeleteButton.Visible = false; // Initially hide all game data m_characterPanel.HideCharacterData(); }