Esempio n. 1
0
        public override void Initialize()
        {
            BruhUi();

            Chat = new Label("inget mottaget").SetFontScale(3);

            Table.Add(Chat);

            Table.Row().SetPadTop(20);

            textFields = TextFieldStyle.Create(Color.White, Color.White, Color.Black, Color.DarkGray);

            textField = new TextField("", textFields);

            Table.Add(textField);

            Table.Row().SetPadTop(20);

            KörPå            = Table.Add(new TextButton("skicka", Skin.CreateDefaultSkin())).SetFillX().SetMinHeight(30).GetElement <TextButton>();
            KörPå.OnClicked += SickaMeddelade;

            Table.Row().SetPadRight(50);

            /*TextButton Kör = Table.Add(new TextButton("byebye borski" , Skin.CreateDefaultSkin())).SetFillX().SetMinHeight(30).GetElement<TextButton>();
             * Kör.OnClicked += Koppplafrån;*/
            Skin     skin     = Skin.CreateDefaultSkin();
            CheckBox checkbox = Table.Add(new CheckBox("Ready", skin)).GetElement <CheckBox>();

            checkbox.IsChecked  = false;
            checkbox.OnChanged += isChecked => { ReadyStart = isChecked; };
        }
Esempio n. 2
0
        public void ApplyTextFieldStyle(TextFieldStyle style)
        {
            ApplyWidgetStyle(style);

            TextColor         = style.TextColor;
            DisabledTextColor = style.DisabledTextColor;
            FocusedTextColor  = style.FocusedTextColor;

            Cursor    = style.Cursor;
            Selection = style.Selection;

            Font = style.Font;
        }
Esempio n. 3
0
        public TextField(TextFieldStyle style)
        {
            HorizontalAlignment = HorizontalAlignment.Stretch;
            VerticalAlignment   = VerticalAlignment.Top;

            CanFocus = true;
            _formattedText.IsColored = false;

            if (style != null)
            {
                ApplyTextFieldStyle(style);
            }

            BlinkIntervalInMs = 450;
        }
Esempio n. 4
0
        public TextField(TextFieldStyle style)
        {
            HorizontalAlignment = HorizontalAlignment.Stretch;
            VerticalAlignment   = VerticalAlignment.Top;

            AcceptsKeyboardFocus = true;
            ClipToBounds         = true;

            if (style != null)
            {
                ApplyTextFieldStyle(style);
            }

            BlinkIntervalInMs = 450;
        }
Esempio n. 5
0
        public TextField(TextFieldStyle style)
        {
            _textEdit = new TextEdit(this);
            _textEdit.CursorIndexChanged += _textEdit_CursorIndexChanged;

            HorizontalAlignment = HorizontalAlignment.Stretch;
            VerticalAlignment   = VerticalAlignment.Top;

            CanFocus     = true;
            ClipToBounds = true;

            if (style != null)
            {
                ApplyTextFieldStyle(style);
            }

            BlinkIntervalInMs = 450;
        }
Esempio n. 6
0
        public override void Initialize()
        {
            BruhUi();
            KlientHanterare = new KlientHanterare();
            Core.RegisterGlobalManager(KlientHanterare);
            Table.Add(new Label("ip pls").SetFontScale(5));

            Table.Row().SetPadTop(20);

            TextFieldStyle textFields = TextFieldStyle.Create(Color.White, Color.White, Color.Black, Color.DarkGray);

            textField = new TextField("", textFields);

            Table.Add(textField);

            Table.Row().SetPadTop(20);

            TextButton KörPå = Table.Add(new TextButton("Klicka", Skin.CreateDefaultSkin())).SetFillX().SetMinHeight(30).GetElement <TextButton>();


            KörPå.OnClicked += TextFält;
        }
Esempio n. 7
0
 public SpinButtonStyle(SpinButtonStyle style) : base(style)
 {
     UpButtonStyle   = style.UpButtonStyle != null ? new ImageButtonStyle(style.UpButtonStyle) : null;
     DownButtonStyle = style.DownButtonStyle != null ? new ImageButtonStyle(style.DownButtonStyle) : null;
     TextFieldStyle  = style.TextFieldStyle != null ? new TextFieldStyle(style.TextFieldStyle) : null;
 }
Esempio n. 8
0
 public SpinButtonStyle(SpinButtonStyle style) : base(style)
 {
     UpButtonStyle   = new ImageButtonStyle(style.UpButtonStyle);
     DownButtonStyle = new ImageButtonStyle(style.DownButtonStyle);
     TextFieldStyle  = new TextFieldStyle(style.TextFieldStyle);
 }
Esempio n. 9
0
 public SpinButtonStyle()
 {
     UpButtonStyle   = new ImageButtonStyle();
     DownButtonStyle = new ImageButtonStyle();
     TextFieldStyle  = new TextFieldStyle();
 }
Esempio n. 10
0
        public override void initialize()
        {
            this.myService = (CommunicationManager)Nez.Core.services.GetService(typeof(CommunicationManager));
            // default to 1280x720 with no SceneResolutionPolicy
            setDesignResolution(1280, 720, Scene.SceneResolutionPolicy.ExactFit);
            Screen.setSize(1280, 720);
            var myRenderer = new ScreenSpaceRenderer(100, SCREEN_SPACE_RENDER_LAYER);

            myRenderer.wantsToRenderAfterPostProcessors = false;
            addRenderer(myRenderer);
            var myGUIRenderer = new RenderLayerExcludeRenderer(0, SCREEN_SPACE_RENDER_LAYER);

            addRenderer(myGUIRenderer);
            canvas = createEntity("GUI").addComponent(new UICanvas());
            canvas.isFullScreen = true;           // this.myCommunicationsManager = myCommunicationsManager;
            SpriteFont myFont            = content.Load <SpriteFont>("Arial");
            Texture2D  TextboxBackground = content.Load <Texture2D>("GUI/Login Elements/TextField");
            Texture2D  PasswordHeader    = content.Load <Texture2D>("GUI/Login Elements/PasswordButtonHeader");
            Texture2D  LoginHeader       = content.Load <Texture2D>("GUI/Login Elements/LoginButtonHeader");
            Texture2D  LoginBackground   = content.Load <Texture2D>("GUI/Login Elements/LoginBackground");

            canvas.renderLayer = SCREEN_SPACE_RENDER_LAYER;


            TextFieldStyle myStyle         = TextFieldStyle.create(Color.White, Color.White, Color.Blue, Color.Black);
            VerticalGroup  myVerticalGroup = new VerticalGroup();
            Image          myLabel1        = new Image(LoginHeader);

            myVerticalGroup.addElement(myLabel1);
            myStyle.background = new SubtextureDrawable(TextboxBackground);

            myUsername = new TextField("", myStyle);
            myUsername.setHeight(TextboxBackground.Height);
            myUsername.setBounds(0, 0, TextboxBackground.Width, TextboxBackground.Height);
            myUsername.setPreferredWidth(TextboxBackground.Width);
            myUsername.setAlignment(Align.center);
            myUsername.setMaxLength(10);

            myVerticalGroup.addElement(myUsername);
            Image myLabel2 = new Image(PasswordHeader);

            myVerticalGroup.addElement(myLabel2);
            myPassword = new TextField("", myStyle);
            myPassword.setPasswordMode(true);
            myPassword.setPreferredWidth(TextboxBackground.Width);
            myPassword.setAlignment(Align.center);
            myPassword.setMaxLength(10);
            myVerticalGroup.addElement(myPassword);
            myLoginFailure = new Label("Invalid Login!");
            myVerticalGroup.addElement(myLoginFailure);
            canvas.stage.addElement(new Image(LoginBackground, Scaling.Fit, 0));
            canvas.stage.addElement(myVerticalGroup);
            myVerticalGroup.setPosition(Screen.width / 2, Screen.height / 2);
            var moonTex      = content.Load <Texture2D>("GUI/Mouse/Green");
            var playerEntity = createEntity("player", new Vector2(200, 200));

            playerEntity.addComponent(new Sprite(moonTex));
            myBUtton = new VirtualButton();
            var versionLabel = new Label(InternalSettings.Version);

            versionLabel.setPosition(0, Screen.height - versionLabel.preferredHeight);
            canvas.stage.addElement(versionLabel);
            myLoginFailure.setIsVisible(false);
            myBUtton.nodes.Add(new Nez.VirtualButton.KeyboardKey(Microsoft.Xna.Framework.Input.Keys.Enter));
            myService.AssignProcessor(delegate(Packet P)
            {
                myLoginFailure.setIsVisible(true);
            }, typeof(LoginFailedPacket));


            myService.AssignProcessor(delegate(Packet P)
            {
                if (((PlayerInfoPacket)P).NewChar)
                {
                    CharacterCreation myScene = SceneManager.GetScene <CharacterCreation>("CharacterCreator");
                    myScene.SetPlayerData(((PlayerInfoPacket)P).GetPlayerData());
                    MainWorldViewScene myWorldScene = SceneManager.GetScene <MainWorldViewScene>("MainWorldViewScene");
                    myWorldScene.SetPlayerData(((PlayerInfoPacket)P).GetPlayerData());
                    SceneManager.ChangeScenes("CharacterCreator");
                    myWorldScene.SetMapData(((PlayerInfoPacket)P).myMap);
                    myService.AssignProcessor(null, typeof(PlayerInfoPacket));
                    myService.AssignProcessor(null, typeof(LoginFailedPacket));
                }
                else
                {
                    MainWorldViewScene myScene = SceneManager.GetScene <MainWorldViewScene>("MainWorldViewScene");
                    myScene.SetPlayerData(((PlayerInfoPacket)P).GetPlayerData());
                    myScene.LoadInPlayer();
                    myScene.SetMapData(((PlayerInfoPacket)P).myMap);
                    SceneManager.ChangeScenes("MainWorldViewScene");
                    myService.AssignProcessor(null, typeof(PlayerInfoPacket));
                    myService.AssignProcessor(null, typeof(LoginFailedPacket));
                }
            }, typeof(PlayerInfoPacket));
            base.initialize();
        }
Esempio n. 11
0
        public override void Initialize()
        {
            base.Initialize();

            //Load Assets, always load textures before generating items so they can match texture and ID
            TextureContainer.LoadTextures();
            AbilityContainerClient.LoadAbilities();
            KeyBindContainer.SetKeyBinds();

            Entity e = CreateEntity("Wallpaper");

            e.AddComponent(new SpriteRenderer(TextureContainer.LoginWallpaper)).SetOrigin(new Vector2(0, 0));
            float h = (float)Screen.Height / (float)TextureContainer.LoginWallpaper.Height;
            float w = (float)Screen.Width / (float)TextureContainer.LoginWallpaper.Width;

            e.SetScale(new Vector2(w, h));
            Sprite textfieldTexture = TextureContainer.GetSpriteAtlasByName("UI").GetSprite("Plank_03");

            TextFieldStyle    textFields = TextFieldStyle.Create(Color.White, Color.White, Color.Black, Color.DarkGray);
            NinePatchDrawable drawable   = new NinePatchDrawable(textfieldTexture, 0, 0, 0, 0)
            {
                MinHeight = 20, MinWidth = 50
            };
            NinePatchDrawable drawablebutton = new NinePatchDrawable(TextureContainer.GetSpriteAtlasByName("UI").GetSprite("plank_15"), 0, 0, 0, 0)
            {
                MinHeight = 20, MinWidth = 50
            };
            NinePatchDrawable drawablehover = new NinePatchDrawable(TextureContainer.GetSpriteAtlasByName("UI").GetSprite("plank_18"), 0, 0, 0, 0)
            {
                MinHeight = 20, MinWidth = 50
            };

            textFields.Background = drawable;

            Label label = new Label("Menu").SetFontScale(5).SetFontColor(Color.MediumVioletRed);

            Table.Add(label);

            Label user = new Label("Username").SetFontScale(2).SetFontColor(Color.MediumVioletRed);

            Table.Row().SetPadTop(10);
            Table.Add(user).Pad(20);
            textFieldu = new TextField("", textFields);

            Table.Row().SetPadTop(10);
            Table.Add(textFieldu);

            Label pass = new Label("Password").SetFontScale(2).SetFontColor(Color.MediumVioletRed);

            Table.Row().SetPadTop(10);
            Table.Add(pass);
            textFieldp = new TextField("", textFields);
            Table.Row().SetPadTop(10);
            textFieldp.SetPasswordMode(true);
            Table.Add(textFieldp);

            TextButtonStyle textButtonStyle = new TextButtonStyle(drawablebutton, drawablehover, drawablehover);

            TextButton button = new TextButton("Login", textButtonStyle);

            button.Pad(10);
            button.PadLeft(20);
            button.PadRight(20);
            button.OnClicked += SendLogin;
            Table.Row().SetPadTop(10);
            Table.Add(button);

            TextButton buttonr = new TextButton("Register", textButtonStyle);

            buttonr.Pad(10);
            buttonr.PadLeft(20);
            buttonr.PadRight(20);
            buttonr.OnClicked += Sendregister;
            Table.Row().SetPadTop(10);
            Table.Add(buttonr);

            //var imGuiManager = new ImGuiManager();
            //Core.RegisterGlobalManager(imGuiManager);
            //imGuiManager.SetEnabled(false);
            //imGuiManager.ShowDemoWindow = true;
        }