Ejemplo n.º 1
0
    public ScrollListWidget(
        WidgetGroup parentGroup, 
        WidgetFactory widgetFactory,
        ScrollListStyle style,
        float x, 
        float y)
        : base(parentGroup, style.Width, style.Height, x, y)
    {
        m_widgetFactory = widgetFactory;
        m_widgetList = new List<IWidget>();
        m_scrollIndex = 0;

        m_scrollFrame = new ImageWidget(this, style.Width, style.Height, style.Background, 0.0f, 0.0f);

        m_scrollUpButton =
            new ButtonWidget(this, style.ButtonStyle, 0, 0, "Previous");
        m_scrollUpButton.SetLocalPosition(
            m_scrollFrame.Width / 2 - m_scrollUpButton.Width / 2,
            BORDER_WIDTH);
        m_scrollUpButton.Visible = false;

        m_scrollDownButton =
            new ButtonWidget(this, style.ButtonStyle, 0, 0, "Next");
        m_scrollDownButton.SetLocalPosition(
            m_scrollUpButton.LocalX,
            m_scrollFrame.Height - m_scrollDownButton.Height - BORDER_WIDTH);
        m_scrollDownButton.Visible = false;
    }
Ejemplo n.º 2
0
    public ScrollListWidget(
        WidgetGroup parentGroup,
        WidgetFactory widgetFactory,
        ScrollListStyle style,
        float x,
        float y)
        : base(parentGroup, style.Width, style.Height, x, y)
    {
        m_widgetFactory = widgetFactory;
        m_widgetList    = new List <IWidget>();
        m_scrollIndex   = 0;

        m_scrollFrame = new ImageWidget(this, style.Width, style.Height, style.Background, 0.0f, 0.0f);

        m_scrollUpButton =
            new ButtonWidget(this, style.ButtonStyle, 0, 0, "Previous");
        m_scrollUpButton.SetLocalPosition(
            m_scrollFrame.Width / 2 - m_scrollUpButton.Width / 2,
            BORDER_WIDTH);
        m_scrollUpButton.Visible = false;

        m_scrollDownButton =
            new ButtonWidget(this, style.ButtonStyle, 0, 0, "Next");
        m_scrollDownButton.SetLocalPosition(
            m_scrollUpButton.LocalX,
            m_scrollFrame.Height - m_scrollDownButton.Height - BORDER_WIDTH);
        m_scrollDownButton.Visible = false;
    }
Ejemplo n.º 3
0
    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  = 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();
    }
Ejemplo n.º 5
0
    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();
    }
Ejemplo n.º 6
0
    public void Start()
    {
        SessionData sessionData = SessionData.GetInstance();

        // Create the root widget group
        m_rootWidgetGroup = new WidgetGroup(null, gamePanelStyle.Width, gamePanelStyle.Height, 0.0f, 0.0f);
        m_rootWidgetGroup.SetWidgetEventListener(this);

        // Background for the game info
        ImageWidget gamePanel =
            new ImageWidget(
                m_rootWidgetGroup,
                gamePanelStyle.Width,
                gamePanelStyle.Height,
                gamePanelStyle.Background,
                0.0f, 0.0f);

        float statsLabelWidth = (gamePanel.Width - 2 * BORDER_WIDTH) / 2 - 3;
        float statsX          = 10;
        float statsY          = 10;

        // Owner Name
        LabelWidget ownerNameLabel =
            new LabelWidget(m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT, statsX, statsY, "Owner Name:");

        ownerNameLabel.Alignment = TextAnchor.UpperRight;
        m_ownerNameLabel         =
            new LabelWidget(
                m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT,
                statsX + statsLabelWidth, statsY, sessionData.UserName);
        m_ownerNameLabel.Text = "";

        // Game name
        statsY += STATS_LABEL_HEIGHT;
        LabelWidget gameNameLabel =
            new LabelWidget(m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT, statsX, statsY, "Game Name:");

        gameNameLabel.Alignment = TextAnchor.UpperRight;
        m_gameNameTextField     = new TextEntryWidget(m_rootWidgetGroup,
                                                      statsLabelWidth, STATS_LABEL_HEIGHT, statsX + statsLabelWidth, statsY, "");

        // IRC Server
        statsY += STATS_LABEL_HEIGHT;
        LabelWidget IRCServerLabel =
            new LabelWidget(m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT, statsX, statsY, "IRC Server:");

        IRCServerLabel.Alignment = TextAnchor.UpperRight;
        m_IRCServerTextField     = new TextEntryWidget(m_rootWidgetGroup,
                                                       statsLabelWidth, STATS_LABEL_HEIGHT, statsX + statsLabelWidth, statsY, "");
        m_IRCServerTextField.Text = ServerConstants.DEFAULT_IRC_SERVER;

        // IRC Port
        statsY += STATS_LABEL_HEIGHT;
        LabelWidget IRCPortLabel =
            new LabelWidget(m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT, statsX, statsY, "IRC Port:");

        IRCPortLabel.Alignment = TextAnchor.UpperRight;
        m_IRCPortTextField     = new TextEntryWidget(m_rootWidgetGroup,
                                                     statsLabelWidth, STATS_LABEL_HEIGHT, statsX + statsLabelWidth, statsY, "");
        m_IRCPortTextField.Restrict  = @"[^0-9]";
        m_IRCPortTextField.MaxLength = 6;
        m_IRCPortTextField.Text      = ServerConstants.DEFAULT_IRC_PORT.ToString();

        // IRC Enabled
        statsY += STATS_LABEL_HEIGHT;
        LabelWidget IRCEnabledLabel =
            new LabelWidget(m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT, statsX, statsY, "IRC Enabled:");

        IRCEnabledLabel.Alignment  = TextAnchor.UpperRight;
        m_IRCEnabledToggle         = new CheckBoxWidget(m_rootWidgetGroup, chekBoxStyle, statsX + statsLabelWidth, statsY);
        m_IRCEnabledToggle.Enabled = true;

        // IRC Encryption Enabled
        statsY += STATS_LABEL_HEIGHT;
        LabelWidget IRCEncryptionEnabledLabel =
            new LabelWidget(m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT, statsX, statsY, "IRC Encryption Enabled:");

        IRCEncryptionEnabledLabel.Alignment  = TextAnchor.UpperRight;
        m_IRCEncryptionEnabledToggle         = new CheckBoxWidget(m_rootWidgetGroup, chekBoxStyle, statsX + statsLabelWidth, statsY);
        m_IRCEncryptionEnabledToggle.Enabled = true;

        // Creation status
        m_statusLabel = new LabelWidget(m_rootWidgetGroup, gamePanel.Width, STATS_LABEL_HEIGHT, 0.0f, 0.0f, "");
        m_statusLabel.SetLocalPosition(0, gamePanel.Height - m_statusLabel.Height - BORDER_WIDTH);
        m_statusLabel.Alignment = TextAnchor.UpperCenter;

        // Create button
        m_createButton = new ButtonWidget(m_rootWidgetGroup, buttonStyle, 0, 0, "Create");
        m_createButton.SetLocalPosition(gamePanel.Width / 3 - m_createButton.Width / 2, m_statusLabel.LocalY - m_createButton.Height - 5);

        // Cancel button
        m_cancelButton = new ButtonWidget(m_rootWidgetGroup, buttonStyle, 0, 0, "Cancel");
        m_cancelButton.SetLocalPosition((2 * gamePanel.Width) / 3 - m_cancelButton.Width / 2, m_statusLabel.LocalY - m_cancelButton.Height - 5);

        // Center the group info widgets
        m_rootWidgetGroup.SetLocalPosition(Screen.width / 2 - gamePanel.Width / 2, Screen.height / 2 - gamePanel.Height / 2);
    }
Ejemplo n.º 7
0
    public void Start()
    {
        SessionData sessionData = SessionData.GetInstance();

        // Create the root widget group
        m_rootWidgetGroup = new WidgetGroup(null, gamePanelStyle.Width, gamePanelStyle.Height, 0.0f, 0.0f);
        m_rootWidgetGroup.SetWidgetEventListener(this);

        // Background for the game info
        ImageWidget gamePanel =
            new ImageWidget(
                m_rootWidgetGroup,
                gamePanelStyle.Width,
                gamePanelStyle.Height,
                gamePanelStyle.Background,
                0.0f, 0.0f);

        float statsLabelWidth = (gamePanel.Width - 2 * BORDER_WIDTH) / 2 - 3;
        float statsX = 10;
        float statsY = 10;

        // Owner Name
        LabelWidget ownerNameLabel =
            new LabelWidget(m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT, statsX, statsY, "Owner Name:");
        ownerNameLabel.Alignment = TextAnchor.UpperRight;
        m_ownerNameLabel =
            new LabelWidget(
                m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT,
                statsX + statsLabelWidth, statsY, sessionData.UserName);
        m_ownerNameLabel.Text = "";

        // Game name
        statsY += STATS_LABEL_HEIGHT;
        LabelWidget gameNameLabel =
            new LabelWidget(m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT, statsX, statsY, "Game Name:");
        gameNameLabel.Alignment = TextAnchor.UpperRight;
        m_gameNameTextField = new TextEntryWidget(m_rootWidgetGroup,
            statsLabelWidth, STATS_LABEL_HEIGHT, statsX+statsLabelWidth, statsY, "");

        // IRC Server
        statsY += STATS_LABEL_HEIGHT;
        LabelWidget IRCServerLabel =
            new LabelWidget(m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT, statsX, statsY, "IRC Server:");
        IRCServerLabel.Alignment = TextAnchor.UpperRight;
        m_IRCServerTextField = new TextEntryWidget(m_rootWidgetGroup,
            statsLabelWidth, STATS_LABEL_HEIGHT, statsX+statsLabelWidth, statsY, "");
        m_IRCServerTextField.Text = ServerConstants.DEFAULT_IRC_SERVER;

        // IRC Port
        statsY += STATS_LABEL_HEIGHT;
        LabelWidget IRCPortLabel =
            new LabelWidget(m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT, statsX, statsY, "IRC Port:");
        IRCPortLabel.Alignment = TextAnchor.UpperRight;
        m_IRCPortTextField = new TextEntryWidget(m_rootWidgetGroup,
            statsLabelWidth, STATS_LABEL_HEIGHT, statsX + statsLabelWidth, statsY, "");
        m_IRCPortTextField.Restrict = @"[^0-9]";
        m_IRCPortTextField.MaxLength = 6;
        m_IRCPortTextField.Text = ServerConstants.DEFAULT_IRC_PORT.ToString();

        // IRC Enabled
        statsY += STATS_LABEL_HEIGHT;
        LabelWidget IRCEnabledLabel =
            new LabelWidget(m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT, statsX, statsY, "IRC Enabled:");
        IRCEnabledLabel.Alignment = TextAnchor.UpperRight;
        m_IRCEnabledToggle = new CheckBoxWidget(m_rootWidgetGroup, chekBoxStyle, statsX + statsLabelWidth, statsY);
        m_IRCEnabledToggle.Enabled = true;

        // IRC Encryption Enabled
        statsY += STATS_LABEL_HEIGHT;
        LabelWidget IRCEncryptionEnabledLabel =
            new LabelWidget(m_rootWidgetGroup, statsLabelWidth, STATS_LABEL_HEIGHT, statsX, statsY, "IRC Encryption Enabled:");
        IRCEncryptionEnabledLabel.Alignment = TextAnchor.UpperRight;
        m_IRCEncryptionEnabledToggle = new CheckBoxWidget(m_rootWidgetGroup, chekBoxStyle, statsX + statsLabelWidth, statsY);
        m_IRCEncryptionEnabledToggle.Enabled = true;

        // Creation status
        m_statusLabel = new LabelWidget(m_rootWidgetGroup, gamePanel.Width, STATS_LABEL_HEIGHT, 0.0f, 0.0f, "");
        m_statusLabel.SetLocalPosition(0, gamePanel.Height - m_statusLabel.Height - BORDER_WIDTH);
        m_statusLabel.Alignment = TextAnchor.UpperCenter;

        // Create button
        m_createButton = new ButtonWidget(m_rootWidgetGroup, buttonStyle, 0, 0, "Create");
        m_createButton.SetLocalPosition(gamePanel.Width/3 - m_createButton.Width/2, m_statusLabel.LocalY - m_createButton.Height - 5);

        // Cancel button
        m_cancelButton = new ButtonWidget(m_rootWidgetGroup, buttonStyle, 0, 0, "Cancel");
        m_cancelButton.SetLocalPosition((2*gamePanel.Width)/3 - m_cancelButton.Width/2, m_statusLabel.LocalY - m_cancelButton.Height - 5);

        // Center the group info widgets
        m_rootWidgetGroup.SetLocalPosition(Screen.width / 2 - gamePanel.Width / 2, Screen.height / 2 - gamePanel.Height / 2);
    }
Ejemplo n.º 8
0
    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();
    }