//Init
        public CreateCharacterWindow(
            Canvas parent,
            MainMenu mainMenu,
            ImagePanel parentPanel,
            SelectCharacterWindow selectCharacterWindow
            )
        {
            //Assign References
            mMainMenu = mainMenu;
            mSelectCharacterWindow = selectCharacterWindow;

            //Main Menu Window
            mCharCreationPanel          = new ImagePanel(parent, "CharacterCreationWindow");
            mCharCreationPanel.IsHidden = true;

            //Menu Header
            mCharCreationHeader = new Label(mCharCreationPanel, "CharacterCreationHeader");
            mCharCreationHeader.SetText(Strings.CharacterCreation.title);

            //Character Name Background
            mCharacterNameBackground = new ImagePanel(mCharCreationPanel, "CharacterNamePanel");

            //Character name Label
            mCharnameLabel = new Label(mCharacterNameBackground, "CharacterNameLabel");
            mCharnameLabel.SetText(Strings.CharacterCreation.name);

            //Character name Textbox
            mCharnameTextbox = new TextBox(mCharacterNameBackground, "CharacterNameField");
            mCharnameTextbox.SubmitPressed += CharnameTextbox_SubmitPressed;

            //Class Background
            mClassBackground = new ImagePanel(mCharCreationPanel, "ClassPanel");

            //Class Label
            mClassLabel = new Label(mClassBackground, "ClassLabel");
            mClassLabel.SetText(Strings.CharacterCreation.Class);

            //Class Combobox
            mClassCombobox = new ComboBox(mClassBackground, "ClassCombobox");
            mClassCombobox.ItemSelected += classCombobox_ItemSelected;

            //Hint Label
            mHintLabel = new Label(mCharCreationPanel, "HintLabel");
            mHintLabel.SetText(Strings.CharacterCreation.hint);
            mHintLabel.IsHidden = true;

            //Hint2 Label
            mHint2Label = new Label(mCharCreationPanel, "Hint2Label");
            mHint2Label.SetText(Strings.CharacterCreation.hint2);
            mHint2Label.IsHidden = true;

            //Character Container
            mCharacterContainer = new ImagePanel(mCharCreationPanel, "CharacterContainer");

            //Character sprite
            mCharacterPortrait = new ImagePanel(mCharacterContainer, "CharacterPortait");
            mCharacterPortrait.SetSize(48, 48);

            //Next Sprite Button
            mNextSpriteButton          = new Button(mCharacterContainer, "NextSpriteButton");
            mNextSpriteButton.Clicked += _nextSpriteButton_Clicked;

            //Prev Sprite Button
            mPrevSpriteButton          = new Button(mCharacterContainer, "PreviousSpriteButton");
            mPrevSpriteButton.Clicked += _prevSpriteButton_Clicked;

            //Class Background
            mGenderBackground = new ImagePanel(mCharCreationPanel, "GenderPanel");

            //Gender Label
            mGenderLabel = new Label(mGenderBackground, "GenderLabel");
            mGenderLabel.SetText(Strings.CharacterCreation.gender);

            //Male Checkbox
            mMaleChk = new LabeledCheckBox(mGenderBackground, "MaleCheckbox")
            {
                Text = Strings.CharacterCreation.male
            };

            mMaleChk.IsChecked  = true;
            mMaleChk.Checked   += maleChk_Checked;
            mMaleChk.UnChecked += femaleChk_Checked; // If you notice this, feel free to hate us ;)

            //Female Checkbox
            mFemaleChk = new LabeledCheckBox(mGenderBackground, "FemaleCheckbox")
            {
                Text = Strings.CharacterCreation.female
            };

            mFemaleChk.Checked   += femaleChk_Checked;
            mFemaleChk.UnChecked += maleChk_Checked;

            //Register - Send Registration Button
            mCreateButton = new Button(mCharCreationPanel, "CreateButton");
            mCreateButton.SetText(Strings.CharacterCreation.create);
            mCreateButton.Clicked += CreateButton_Clicked;

            mBackButton          = new Button(mCharCreationPanel, "BackButton");
            mBackButton.IsHidden = true;
            mBackButton.SetText(Strings.CharacterCreation.back);
            mBackButton.Clicked += BackButton_Clicked;

            mCharCreationPanel.LoadJsonUi(GameContentManager.UI.Menu, Graphics.Renderer.GetResolutionString());
        }
Esempio n. 2
0
        //Init
        public MainMenu(Canvas menuCanvas)
        {
            mMenuCanvas = menuCanvas;

            var logo = new ImagePanel(menuCanvas, "Logo");

            logo.LoadJsonUi(GameContentManager.UI.Menu, Graphics.Renderer.GetResolutionString());

            //Main Menu Window
            mMenuWindow = new ImagePanel(menuCanvas, "MenuWindow");

            mServerStatusLabel = new Label(mMenuWindow, "ServerStatusLabel")
            {
                AutoSizeToContents   = true,
                ShouldDrawBackground = true,
                Text = Strings.Server.StatusLabel.ToString(ActiveNetworkStatus.ToLocalizedString()),
            };

            mServerStatusLabel.SetTextColor(Color.White, Label.ControlState.Normal);
            mServerStatusLabel.AddAlignment(Alignments.Bottom);
            mServerStatusLabel.AddAlignment(Alignments.Left);
            mServerStatusLabel.ProcessAlignments();

            NetworkStatusChanged += HandleNetworkStatusChanged;

            //Menu Header
            mMenuHeader = new Label(mMenuWindow, "Title");
            mMenuHeader.SetText(Strings.MainMenu.title);

            //Login Button
            mLoginButton = new Button(mMenuWindow, "LoginButton");
            mLoginButton.SetText(Strings.MainMenu.login);
            mLoginButton.Clicked += LoginButton_Clicked;

            //Register Button
            mRegisterButton = new Button(mMenuWindow, "RegisterButton");
            mRegisterButton.SetText(Strings.MainMenu.register);
            mRegisterButton.Clicked += RegisterButton_Clicked;

            //Credits Button
            mCreditsButton = new Button(mMenuWindow, "CreditsButton");
            mCreditsButton.SetText(Strings.MainMenu.credits);
            mCreditsButton.Clicked += CreditsButton_Clicked;

            //Exit Button
            mExitButton = new Button(mMenuWindow, "ExitButton");
            mExitButton.SetText(Strings.MainMenu.exit);
            mExitButton.Clicked += ExitButton_Clicked;

            //Options Button
            mOptionsButton          = new Button(mMenuWindow, "OptionsButton");
            mOptionsButton.Clicked += OptionsButton_Clicked;
            mOptionsButton.SetText(Strings.MainMenu.options);
            if (!string.IsNullOrEmpty(Strings.MainMenu.optionstooltip))
            {
                mOptionsButton.SetToolTipText(Strings.MainMenu.optionstooltip);
            }

            mMenuWindow.LoadJsonUi(GameContentManager.UI.Menu, Graphics.Renderer.GetResolutionString());

            //Options Controls
            mOptionsWindow = new OptionsWindow(menuCanvas, this, mMenuWindow);

            //Login Controls
            mLoginWindow = new LoginWindow(menuCanvas, this, mMenuWindow);

            //Register Controls
            mRegisterWindow = new RegisterWindow(menuCanvas, this, mMenuWindow);

            //Forgot Password Controls
            mForgotPasswordWindow = new ForgotPasswordWindow(menuCanvas, this, mMenuWindow);

            //Reset Password Controls
            mResetPasswordWindow = new ResetPasswordWindow(menuCanvas, this, mMenuWindow);

            //Character Selection Controls
            mSelectCharacterWindow = new SelectCharacterWindow(mMenuCanvas, this, mMenuWindow);

            //Character Creation Controls
            mCreateCharacterWindow = new CreateCharacterWindow(mMenuCanvas, this, mMenuWindow, mSelectCharacterWindow);

            //Credits Controls
            mCreditsWindow = new CreditsWindow(mMenuCanvas, this);

            UpdateDisabled();
        }