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() { // 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() { 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() { // 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() { 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(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); }