Ejemplo n.º 1
0
        /// <summary>
        /// Creates a <see cref="CheckBox"/> for a <see cref="Level"/>.
        /// </summary>
        /// <param name="level">The level.</param>
        /// <param name="index">The display index.</param>
        /// <returns>The created <see cref="CheckBox"/>.</returns>
        CheckBox CreateLogLevelCheckBox(Level level, int index)
        {
            var ret = new CheckBox(_cSettingsPanel, new Vector2(_cSettingsPanel.Size.X - 100, 5))
            { Font = _consoleFont, Text = level.Name, Tag = level, ForeColor = level.GetColor(), Value = true };

            ret.Position += new Vector2(0, ret.Size.Y * index);
            ret.ValueChanged += LevelCheckBox_ValueChanged;

            return ret;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles initialization of the GameScreen. This will be invoked after the GameScreen has been
        /// completely and successfully added to the ScreenManager. It is highly recommended that you
        /// use this instead of the constructor. This is invoked only once.
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            var decodedPass = MachineCrypto.ValidatedDecode(ClientSettings.Default.UI_EnteredPassword) ?? string.Empty;

            var cScreen = new Panel(GUIManager, Vector2.Zero, ScreenManager.ScreenSize);

            // Create the login fields
            GameScreenHelper.CreateMenuLabel(cScreen, new Vector2(60, 260), "Name:");
            _cNameText = new TextBox(cScreen, new Vector2(220, 260), new Vector2(200, 40)) { IsMultiLine = false, Text = ClientSettings.Default.UI_EnteredUserName };
            _cNameText.KeyPressed += cNameText_KeyPressed;
            _cNameText.TextChanged += cNameText_TextChanged;

            GameScreenHelper.CreateMenuLabel(cScreen, new Vector2(60, 320), "Password:"******"Remember Password",
                Value = ClientSettings.Default.UI_RememberPassword,
                ForeColor = Color.White,
                Font = GameScreenHelper.DefaultChatFont
            };
            _cRememberPassword.ValueChanged += _cRememberPassword_ValueChanged;

            // Display the admin account info
            const string adminAccountInfo = "Use the following account for the default admin account:" + "\n    Username: Spodi" + "\n    Password: qwerty123";
            new Label(cScreen, _cRememberPassword.Position + new Vector2(-32, _cRememberPassword.Size.Y + 32)) 
            { 
                Text = adminAccountInfo, 
                ForeColor = Color.Green, 
                Font = GameScreenHelper.DefaultChatFont 
            };

            // Create the menu buttons
            var menuButtons = GameScreenHelper.CreateMenuButtons(ScreenManager, cScreen, "Login", "Back");
            _btnLogin = menuButtons["Login"];
            _btnLogin.Clicked += _btnLogin_Clicked;
            menuButtons["Back"].Clicked += LoginScreen_Clicked;

            cScreen.SetFocus();

            // Set up the networking stuff for this screen
            _sockets = ClientSockets.Instance;

            _sockets.StatusChanged -= _sockets_StatusChanged;
            _sockets.StatusChanged += _sockets_StatusChanged;

            _sockets.PacketHandler.ReceivedLoginSuccessful -= PacketHandler_ReceivedLoginSuccessful;
            _sockets.PacketHandler.ReceivedLoginSuccessful += PacketHandler_ReceivedLoginSuccessful;

            _sockets.PacketHandler.ReceivedLoginUnsuccessful -= PacketHandler_ReceivedLoginUnsuccessful;
            _sockets.PacketHandler.ReceivedLoginUnsuccessful += PacketHandler_ReceivedLoginUnsuccessful;


        }