public void Start(WidgetGroup parentGroup) { m_rootWidgetGroup = new WidgetGroup(parentGroup, Screen.width, Screen.height, 0.0f, 0.0f); m_rootWidgetGroup.SetWidgetEventListener(this); m_mouseCursorState = eMouseCursorState.defaultCursor; }
public void Start(WidgetGroup parentGroup) { _rootWidgetGroup = new WidgetGroup(parentGroup, 0, 0, 0.0f, 0.0f); _rootWidgetGroup.SetWidgetEventListener(this); _window = new WindowWidget( _rootWidgetGroup, "Chat", m_chatWindowStyle.windowStyle, Screen.width - m_chatWindowStyle.windowStyle.WindowWidth - 3, 0); _chatText = new ScrollTextWidget( _window, m_chatWindowStyle.windowStyle.WindowWidth, m_chatWindowStyle.windowStyle.WindowHeight - m_chatWindowStyle.chatInputHeight - m_chatWindowStyle.windowStyle.TitleBarHeight, 0.0f, 0.0f, ""); _chatText.FontSize = 12; _chatInput = new TextEntryWidget( _window, m_chatWindowStyle.windowStyle.WindowWidth, m_chatWindowStyle.chatInputHeight, 0, m_chatWindowStyle.windowStyle.WindowHeight - m_chatWindowStyle.chatInputHeight, ""); _chatText.FontSize = 12; _chatInput.MaxLength = (int)IRCSession.MAX_CHAT_STRING_LENGTH; SetChatInputVisible(true); }
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(); }
public void Start() { // Create the root widget group m_rootWidgetGroup = new WidgetGroup(null, Screen.width, Screen.height, 0.0f, 0.0f); m_rootWidgetGroup.SetWidgetEventListener(this); m_widgetEventDispatcher = new WidgetEventDispatcher(); m_widgetEventDispatcher.Start(m_rootWidgetGroup); // Create the background m_backgroundGroup = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f); m_backgroundTiles = null; m_wallTiles = null; m_backgroundObjectTiles = null; // Create the foreground object group m_entityGroup = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f); // Create the foreground tile group m_foregroundGroup = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f); m_foregroundObjectTiles = null; // Create the foreground UI m_foregroundUIGroup = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f); // Create game button m_logoutButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, 0, 0, "Logout"); // Create the event navigation buttons { float layoutX = 0; float layoutY = Screen.height - buttonStyle.Height; m_firstEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, "<<"); layoutX += m_firstEventButton.Width; m_previousEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, "<"); layoutX += m_previousEventButton.Width; m_playPauseEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, "||"); layoutX += m_playPauseEventButton.Width; m_nextEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, ">"); layoutX += m_nextEventButton.Width; m_lastEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, ">>"); } }
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 OnDestroy() { m_widgetEventDispatcher.OnDestroy(); m_rootWidgetGroup.SetWidgetEventListener(null); m_rootWidgetGroup.OnDestroy(); }
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); }
public void Start() { bool isLocalServerRunning= AsyncRPGServer.GetInstance().IsServerActive(); Screen.showCursor = true; // Create the root widget group m_rootWidgetGroup = new WidgetGroup(null, Screen.width, Screen.height, 0.0f, 0.0f); m_rootWidgetGroup.SetWidgetEventListener(this); m_widgetEventDispatcher = new WidgetEventDispatcher(); m_widgetEventDispatcher.Start(m_rootWidgetGroup); // Create the widget group to hold the login panel m_loginPanelWidgetGroup = new WidgetGroup( m_rootWidgetGroup, loginPanelStyle.gamePanelStyle.Width, loginPanelStyle.gamePanelStyle.Height, Screen.width / 2 - loginPanelStyle.gamePanelStyle.Width / 2, Screen.height / 2 - loginPanelStyle.gamePanelStyle.Height / 2); // Background for the game info new ImageWidget( m_loginPanelWidgetGroup, loginPanelStyle.gamePanelStyle.Width, loginPanelStyle.gamePanelStyle.Height, loginPanelStyle.gamePanelStyle.Background, 0.0f, 0.0f); // Username and Password - Left Aligned { WidgetLayoutCursor cursor = new WidgetLayoutCursor( loginPanelStyle.gamePanelStyle.BorderWidth + loginPanelStyle.gamePanelStyle.WidgetSpacing, loginPanelStyle.gamePanelStyle.BorderWidth + loginPanelStyle.gamePanelStyle.WidgetSpacing); cursor.Kerning= loginPanelStyle.gamePanelStyle.WidgetSpacing; cursor.Leading= loginPanelStyle.gamePanelStyle.WidgetSpacing; // Server cursor.Advance( new LabelWidget( m_loginPanelWidgetGroup, loginPanelStyle.labelStyle, cursor.X, cursor.Y, "Server:")); m_serverText = cursor.Advance( new TextEntryWidget( m_loginPanelWidgetGroup, loginPanelStyle.textEntryStyle, cursor.X, cursor.Y, "localhost")); m_serverText.Visible= !isLocalServerRunning; m_localHostLabel= new LabelWidget( m_loginPanelWidgetGroup, m_serverText.Width, m_serverText.Height, m_serverText.LocalX, m_serverText.LocalY, "localhost"); m_localHostLabel.Visible= isLocalServerRunning; cursor.NewLine(); // Local hosted check box cursor.Advance( new LabelWidget( m_loginPanelWidgetGroup, loginPanelStyle.labelStyle, cursor.X, cursor.Y, "Host Server:")); m_localHostCheckBox= cursor.Advance( new CheckBoxWidget( m_loginPanelWidgetGroup, loginPanelStyle.checkBoxStyle, cursor.X, cursor.Y)); m_localHostCheckBox.Enabled = isLocalServerRunning; cursor.NewLine(); // Username cursor.Advance( new LabelWidget( m_loginPanelWidgetGroup, loginPanelStyle.labelStyle, cursor.X, cursor.Y, "Username:"******"test" : "")); cursor.NewLine(); // Password cursor.Advance( new LabelWidget( m_loginPanelWidgetGroup, loginPanelStyle.labelStyle, cursor.X, cursor.Y, "Password:"******"password" : "")); m_passwordText.IsPassword= true; cursor.NewLine(); } // Buttons - Centered along the bottom { WidgetLayoutCursor cursor = new WidgetLayoutCursor( loginPanelStyle.gamePanelStyle.Width/2 - loginPanelStyle.gamePanelStyle.WidgetSpacing/2 - loginPanelStyle.buttonStyle.Width, loginPanelStyle.gamePanelStyle.Height - loginPanelStyle.buttonStyle.Height - loginPanelStyle.labelStyle.Height - loginPanelStyle.gamePanelStyle.BorderWidth - loginPanelStyle.gamePanelStyle.WidgetSpacing); m_createAccountButton = cursor.Advance( new ButtonWidget( m_loginPanelWidgetGroup, loginPanelStyle.buttonStyle, cursor.X, cursor.Y, "New Account")); m_createAccountButton.Visible= false; m_loginButton = cursor.Advance( new ButtonWidget( m_loginPanelWidgetGroup, loginPanelStyle.buttonStyle, cursor.X, cursor.Y, "Login")); m_loginButton.Visible= true; cursor.NewLine(); m_loginStatusLabel= cursor.Advance( new LabelWidget( m_loginPanelWidgetGroup, loginPanelStyle.gamePanelStyle.Width - 2.0f*loginPanelStyle.gamePanelStyle.BorderWidth, loginPanelStyle.labelStyle.Height, cursor.X, cursor.Y, "")); } // Server Status Panel m_serverPanelWidgetGroup = new WidgetGroup( m_rootWidgetGroup, loginPanelStyle.gamePanelStyle.Width, loginPanelStyle.gamePanelStyle.Height, Screen.width / 2 - loginPanelStyle.gamePanelStyle.Width / 2, Screen.height / 2 - loginPanelStyle.gamePanelStyle.Height / 2); m_serverPanelWidgetGroup.Visible= false; // Background for the game info new ImageWidget( m_serverPanelWidgetGroup, loginPanelStyle.gamePanelStyle.Width, loginPanelStyle.gamePanelStyle.Height, loginPanelStyle.gamePanelStyle.Background, 0.0f, 0.0f); { float contentCenter= loginPanelStyle.gamePanelStyle.Width / 2.0f; WidgetLayoutCursor cursor = new WidgetLayoutCursor( 0.0f, loginPanelStyle.gamePanelStyle.BorderWidth + loginPanelStyle.gamePanelStyle.WidgetSpacing); cursor.Kerning= loginPanelStyle.gamePanelStyle.WidgetSpacing; cursor.Leading= loginPanelStyle.gamePanelStyle.WidgetSpacing; LabelWidget topLabel= cursor.Advance( new LabelWidget( m_serverPanelWidgetGroup, loginPanelStyle.labelStyle, contentCenter - loginPanelStyle.labelStyle.Width / 2.0f, cursor.Y, "[Server]")); topLabel.Alignment= TextAnchor.UpperCenter; cursor.NewLine(); m_serverStatusText= cursor.Advance( new ScrollTextWidget( m_serverPanelWidgetGroup, loginPanelStyle.scrollTextStyle, contentCenter - loginPanelStyle.scrollTextStyle.Width / 2.0f, cursor.Y, "")); cursor.NewLine(); m_serverOkButton= cursor.Advance( new ButtonWidget( m_serverPanelWidgetGroup, loginPanelStyle.buttonStyle, contentCenter - loginPanelStyle.buttonStyle.Width / 2.0f, cursor.Y, "Ok")); m_serverOkButton.Visible= false; } }
public void Start() { // Create the root widget group m_rootWidgetGroup = new WidgetGroup( null, panelWidth, panelHeight, Screen.width/2 - panelWidth/2, Screen.height/2 - panelHeight/2); m_rootWidgetGroup.SetWidgetEventListener(this); // Background for the game info new ImageWidget(m_rootWidgetGroup, panelWidth, panelHeight, panelTexture, 0.0f, 0.0f); // Character portraits m_portraits = new List<ImageWidget>(); for (int portraitIndex = 0; portraitIndex < ClientGameConstants.GetPortraitCount(); portraitIndex++ ) { ImageWidget portrait = new ImageWidget( m_rootWidgetGroup, portraitWidth, portraitHeight, Resources.Load<Texture>(ClientGameConstants.GetResourceNameForPicture((uint)portraitIndex)), PORTRAIT_X, PORTRAIT_Y); portrait.Visible = false; m_portraits.Add(portrait); } float statsX = PORTRAIT_X + portraitWidth + BORDER_WIDTH; float statsY = PORTRAIT_Y; // Character Name new LabelWidget(m_rootWidgetGroup, labelWidth, labelHeight, statsX, statsY, "Name:"); m_nameTextField = new TextEntryWidget(m_rootWidgetGroup, labelWidth, labelHeight, statsX + labelWidth, statsY, ""); m_nameTextField.Restrict = @"[^0-9A-Za-z]"; m_nameTextField.MaxLength = 12; // Character Gender statsY += labelHeight; new LabelWidget(m_rootWidgetGroup, labelWidth, labelHeight, statsX, statsY, "Gender:"); m_genderLabel = new LabelWidget(m_rootWidgetGroup, labelWidth, labelHeight, statsX+labelWidth, statsY, ""); // Character Archetype statsY += labelHeight; new LabelWidget(m_rootWidgetGroup, labelWidth, labelHeight, statsX, statsY, "Archetype:"); m_archetypeLabel = new LabelWidget(m_rootWidgetGroup, labelWidth, labelHeight, statsX + labelWidth, statsY, ""); // Creation Status Label m_statusLabel = new LabelWidget(m_rootWidgetGroup, panelWidth, panelHeight, 0, panelHeight - labelHeight, ""); m_statusLabel.Alignment = TextAnchor.UpperCenter; // Create Button m_createButton = new ButtonWidget( m_rootWidgetGroup, buttonStyle, panelWidth / 3 - buttonStyle.Width / 2, m_statusLabel.LocalY - buttonStyle.Height - 5, "Create"); // Cancel Button m_cancelButton = new ButtonWidget( m_rootWidgetGroup, buttonStyle, (2*panelWidth) / 3 - buttonStyle.Width / 2, m_statusLabel.LocalY - buttonStyle.Height - 5, "Cancel"); // Previous Portrait Button m_previousPortraitButton= new ButtonWidget( m_rootWidgetGroup, buttonStyle, m_createButton.LocalX, m_createButton.LocalY - buttonStyle.Height - 5, "<"); // Next Portrait Button m_nextPortraitButton = new ButtonWidget( m_rootWidgetGroup, buttonStyle, m_cancelButton.LocalX, m_cancelButton.LocalY - buttonStyle.Height - 5, ">"); }
public void Start() { bool isLocalServerRunning = AsyncRPGServer.GetInstance().IsServerActive(); Screen.showCursor = true; // Create the root widget group m_rootWidgetGroup = new WidgetGroup(null, Screen.width, Screen.height, 0.0f, 0.0f); m_rootWidgetGroup.SetWidgetEventListener(this); m_widgetEventDispatcher = new WidgetEventDispatcher(); m_widgetEventDispatcher.Start(m_rootWidgetGroup); // Create the widget group to hold the login panel m_loginPanelWidgetGroup = new WidgetGroup( m_rootWidgetGroup, loginPanelStyle.gamePanelStyle.Width, loginPanelStyle.gamePanelStyle.Height, Screen.width / 2 - loginPanelStyle.gamePanelStyle.Width / 2, Screen.height / 2 - loginPanelStyle.gamePanelStyle.Height / 2); // Background for the game info new ImageWidget( m_loginPanelWidgetGroup, loginPanelStyle.gamePanelStyle.Width, loginPanelStyle.gamePanelStyle.Height, loginPanelStyle.gamePanelStyle.Background, 0.0f, 0.0f); // Username and Password - Left Aligned { WidgetLayoutCursor cursor = new WidgetLayoutCursor( loginPanelStyle.gamePanelStyle.BorderWidth + loginPanelStyle.gamePanelStyle.WidgetSpacing, loginPanelStyle.gamePanelStyle.BorderWidth + loginPanelStyle.gamePanelStyle.WidgetSpacing); cursor.Kerning = loginPanelStyle.gamePanelStyle.WidgetSpacing; cursor.Leading = loginPanelStyle.gamePanelStyle.WidgetSpacing; // Server cursor.Advance( new LabelWidget( m_loginPanelWidgetGroup, loginPanelStyle.labelStyle, cursor.X, cursor.Y, "Server:")); m_serverText = cursor.Advance( new TextEntryWidget( m_loginPanelWidgetGroup, loginPanelStyle.textEntryStyle, cursor.X, cursor.Y, "localhost")); m_serverText.Visible = !isLocalServerRunning; m_localHostLabel = new LabelWidget( m_loginPanelWidgetGroup, m_serverText.Width, m_serverText.Height, m_serverText.LocalX, m_serverText.LocalY, "localhost"); m_localHostLabel.Visible = isLocalServerRunning; cursor.NewLine(); // Local hosted check box cursor.Advance( new LabelWidget( m_loginPanelWidgetGroup, loginPanelStyle.labelStyle, cursor.X, cursor.Y, "Host Server:")); m_localHostCheckBox = cursor.Advance( new CheckBoxWidget( m_loginPanelWidgetGroup, loginPanelStyle.checkBoxStyle, cursor.X, cursor.Y)); m_localHostCheckBox.Enabled = isLocalServerRunning; cursor.NewLine(); // Username cursor.Advance( new LabelWidget( m_loginPanelWidgetGroup, loginPanelStyle.labelStyle, cursor.X, cursor.Y, "Username:"******"test" : "")); cursor.NewLine(); // Password cursor.Advance( new LabelWidget( m_loginPanelWidgetGroup, loginPanelStyle.labelStyle, cursor.X, cursor.Y, "Password:"******"password" : "")); m_passwordText.IsPassword = true; cursor.NewLine(); } // Buttons - Centered along the bottom { WidgetLayoutCursor cursor = new WidgetLayoutCursor( loginPanelStyle.gamePanelStyle.Width / 2 - loginPanelStyle.gamePanelStyle.WidgetSpacing / 2 - loginPanelStyle.buttonStyle.Width, loginPanelStyle.gamePanelStyle.Height - loginPanelStyle.buttonStyle.Height - loginPanelStyle.labelStyle.Height - loginPanelStyle.gamePanelStyle.BorderWidth - loginPanelStyle.gamePanelStyle.WidgetSpacing); m_createAccountButton = cursor.Advance( new ButtonWidget( m_loginPanelWidgetGroup, loginPanelStyle.buttonStyle, cursor.X, cursor.Y, "New Account")); m_createAccountButton.Visible = false; m_loginButton = cursor.Advance( new ButtonWidget( m_loginPanelWidgetGroup, loginPanelStyle.buttonStyle, cursor.X, cursor.Y, "Login")); m_loginButton.Visible = true; cursor.NewLine(); m_loginStatusLabel = cursor.Advance( new LabelWidget( m_loginPanelWidgetGroup, loginPanelStyle.gamePanelStyle.Width - 2.0f * loginPanelStyle.gamePanelStyle.BorderWidth, loginPanelStyle.labelStyle.Height, cursor.X, cursor.Y, "")); } // Server Status Panel m_serverPanelWidgetGroup = new WidgetGroup( m_rootWidgetGroup, loginPanelStyle.gamePanelStyle.Width, loginPanelStyle.gamePanelStyle.Height, Screen.width / 2 - loginPanelStyle.gamePanelStyle.Width / 2, Screen.height / 2 - loginPanelStyle.gamePanelStyle.Height / 2); m_serverPanelWidgetGroup.Visible = false; // Background for the game info new ImageWidget( m_serverPanelWidgetGroup, loginPanelStyle.gamePanelStyle.Width, loginPanelStyle.gamePanelStyle.Height, loginPanelStyle.gamePanelStyle.Background, 0.0f, 0.0f); { float contentCenter = loginPanelStyle.gamePanelStyle.Width / 2.0f; WidgetLayoutCursor cursor = new WidgetLayoutCursor( 0.0f, loginPanelStyle.gamePanelStyle.BorderWidth + loginPanelStyle.gamePanelStyle.WidgetSpacing); cursor.Kerning = loginPanelStyle.gamePanelStyle.WidgetSpacing; cursor.Leading = loginPanelStyle.gamePanelStyle.WidgetSpacing; LabelWidget topLabel = cursor.Advance( new LabelWidget( m_serverPanelWidgetGroup, loginPanelStyle.labelStyle, contentCenter - loginPanelStyle.labelStyle.Width / 2.0f, cursor.Y, "[Server]")); topLabel.Alignment = TextAnchor.UpperCenter; cursor.NewLine(); m_serverStatusText = cursor.Advance( new ScrollTextWidget( m_serverPanelWidgetGroup, loginPanelStyle.scrollTextStyle, contentCenter - loginPanelStyle.scrollTextStyle.Width / 2.0f, cursor.Y, "")); cursor.NewLine(); m_serverOkButton = cursor.Advance( new ButtonWidget( m_serverPanelWidgetGroup, loginPanelStyle.buttonStyle, contentCenter - loginPanelStyle.buttonStyle.Width / 2.0f, cursor.Y, "Ok")); m_serverOkButton.Visible = false; } }
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); }
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() { // Create the root widget group m_rootWidgetGroup = new WidgetGroup(null, Screen.width, Screen.height, 0.0f, 0.0f); m_rootWidgetGroup.SetWidgetEventListener(this); m_widgetEventDispatcher = new WidgetEventDispatcher(); m_widgetEventDispatcher.Start(m_rootWidgetGroup); // Create the background m_backgroundGroup = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f); m_backgroundTiles = null; m_wallTiles = null; m_backgroundObjectTiles = null; // Create the foreground object group m_entityGroup = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f); // Create the foreground tile group m_foregroundGroup = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f); m_foregroundObjectTiles = null; // Create the foreground UI m_foregroundUIGroup = new WidgetGroup(m_rootWidgetGroup, Screen.width, Screen.height, 0.0f, 0.0f); // Create game button m_logoutButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, 0, 0, "Logout"); // Create the event navigation buttons { float layoutX = 0; float layoutY = Screen.height - buttonStyle.Height; m_firstEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, "<<"); layoutX += m_firstEventButton.Width; m_previousEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, "<"); layoutX += m_previousEventButton.Width; m_playPauseEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, "||"); layoutX += m_playPauseEventButton.Width; m_nextEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, ">"); layoutX += m_nextEventButton.Width; m_lastEventButton = new ButtonWidget(m_foregroundUIGroup, buttonStyle, layoutX, layoutY, ">>"); } }
public void Start(WidgetGroup parentGroup) { m_rootWidgetGroup = new WidgetGroup(parentGroup, Screen.width, Screen.height, 0.0f, 0.0f); m_rootWidgetGroup.SetWidgetEventListener(this); m_mouseCursorState = eMouseCursorState.defaultCursor; }
public void Start() { // Create the root widget group m_rootWidgetGroup = new WidgetGroup( null, panelWidth, panelHeight, Screen.width / 2 - panelWidth / 2, Screen.height / 2 - panelHeight / 2); m_rootWidgetGroup.SetWidgetEventListener(this); // Background for the game info new ImageWidget(m_rootWidgetGroup, panelWidth, panelHeight, panelTexture, 0.0f, 0.0f); // Character portraits m_portraits = new List <ImageWidget>(); for (int portraitIndex = 0; portraitIndex < ClientGameConstants.GetPortraitCount(); portraitIndex++) { ImageWidget portrait = new ImageWidget( m_rootWidgetGroup, portraitWidth, portraitHeight, Resources.Load <Texture>(ClientGameConstants.GetResourceNameForPicture((uint)portraitIndex)), PORTRAIT_X, PORTRAIT_Y); portrait.Visible = false; m_portraits.Add(portrait); } float statsX = PORTRAIT_X + portraitWidth + BORDER_WIDTH; float statsY = PORTRAIT_Y; // Character Name new LabelWidget(m_rootWidgetGroup, labelWidth, labelHeight, statsX, statsY, "Name:"); m_nameTextField = new TextEntryWidget(m_rootWidgetGroup, labelWidth, labelHeight, statsX + labelWidth, statsY, ""); m_nameTextField.Restrict = @"[^0-9A-Za-z]"; m_nameTextField.MaxLength = 12; // Character Gender statsY += labelHeight; new LabelWidget(m_rootWidgetGroup, labelWidth, labelHeight, statsX, statsY, "Gender:"); m_genderLabel = new LabelWidget(m_rootWidgetGroup, labelWidth, labelHeight, statsX + labelWidth, statsY, ""); // Character Archetype statsY += labelHeight; new LabelWidget(m_rootWidgetGroup, labelWidth, labelHeight, statsX, statsY, "Archetype:"); m_archetypeLabel = new LabelWidget(m_rootWidgetGroup, labelWidth, labelHeight, statsX + labelWidth, statsY, ""); // Creation Status Label m_statusLabel = new LabelWidget(m_rootWidgetGroup, panelWidth, panelHeight, 0, panelHeight - labelHeight, ""); m_statusLabel.Alignment = TextAnchor.UpperCenter; // Create Button m_createButton = new ButtonWidget( m_rootWidgetGroup, buttonStyle, panelWidth / 3 - buttonStyle.Width / 2, m_statusLabel.LocalY - buttonStyle.Height - 5, "Create"); // Cancel Button m_cancelButton = new ButtonWidget( m_rootWidgetGroup, buttonStyle, (2 * panelWidth) / 3 - buttonStyle.Width / 2, m_statusLabel.LocalY - buttonStyle.Height - 5, "Cancel"); // Previous Portrait Button m_previousPortraitButton = new ButtonWidget( m_rootWidgetGroup, buttonStyle, m_createButton.LocalX, m_createButton.LocalY - buttonStyle.Height - 5, "<"); // Next Portrait Button m_nextPortraitButton = new ButtonWidget( m_rootWidgetGroup, buttonStyle, m_cancelButton.LocalX, m_cancelButton.LocalY - buttonStyle.Height - 5, ">"); }
public void Start(WidgetGroup parentGroup) { _rootWidgetGroup = new WidgetGroup(parentGroup, 0, 0, 0.0f, 0.0f); _rootWidgetGroup.SetWidgetEventListener(this); _window = new WindowWidget( _rootWidgetGroup, "Chat", m_chatWindowStyle.windowStyle, Screen.width - m_chatWindowStyle.windowStyle.WindowWidth - 3, 0); _chatText = new ScrollTextWidget( _window, m_chatWindowStyle.windowStyle.WindowWidth, m_chatWindowStyle.windowStyle.WindowHeight - m_chatWindowStyle.chatInputHeight - m_chatWindowStyle.windowStyle.TitleBarHeight, 0.0f, 0.0f, ""); _chatText.FontSize= 12; _chatInput = new TextEntryWidget( _window, m_chatWindowStyle.windowStyle.WindowWidth, m_chatWindowStyle.chatInputHeight, 0, m_chatWindowStyle.windowStyle.WindowHeight - m_chatWindowStyle.chatInputHeight, ""); _chatText.FontSize= 12; _chatInput.MaxLength = (int)IRCSession.MAX_CHAT_STRING_LENGTH; SetChatInputVisible(true); }