Ejemplo n.º 1
0
        protected override void LoadContent()
        {
            ClientDataRegistry.Settings = ClientSettings.GetSettings();

            //Parses content data from file named "content.json"
            _contentManager.ParseContent(ClientDataRegistry.Settings.DevelopmentMode);

            //Global texture load
            Texture2D defaultTexture = new Texture2D(_graphicsDeviceManager.GraphicsDevice, 1, 1);

            defaultTexture.SetData(new[] { Color.White });
            _contentManager.AddTexture("default", defaultTexture);

            AtlasTexture defaultAtlas = new AtlasTexture
            {
                Height     = 1,
                Width      = 1,
                Scale      = 1,
                Texture    = defaultTexture,
                TextureKey = "default",
                X          = 0,
                Y          = 0
            };

            _contentManager.AddAtlasTexture("default", defaultAtlas);

            //start first scene
            _sceneManager.StartScene(nameof(MainMenuScene));
        }
Ejemplo n.º 2
0
        public override void Body()
        {
            RootUI.Vstack(v1 =>
            {
                v1.Text("Control Settings")
                .FontSize(1.5f)
                .Color(Color.White)
                .Grow(2);


                v1.Vstack(v2 =>
                {
                    v2.Text("Vertical Scroll Sensitivity:")
                    .Color(Color.White)
                    .JustifyText(JustifyText.Start);

                    v2.SliderFor(Model, x => x.VerticalScrollSensitivity, 0, 100);
                }).Grow(3);

                v1.Spacer();

                v1.Vstack(v2 =>
                {
                    v2.Text("Horizontal Scroll Sensitivity:")
                    .Color(Color.White)
                    .JustifyText(JustifyText.Start);

                    v2.SliderFor(Model, x => x.HorizontalScrollSensitivity, 0, 100);
                }).Grow(3);

                v1.Spacer();
                v1.Text("Keyboard Controls:").JustifyText(JustifyText.Start).Color(Color.White);

                v1.ScrollableContainer(s2 =>
                {
                    s2.ListFor(Model, x => x.KeyboardControls.ToList(), (stack, item) =>
                    {
                        stack.Hstack(h3 =>
                        {
                            h3.Text(item.Key);
                            h3.ControlFor(item, x => x.Value, (e, s) =>
                            {
                            });
                        }).Height(0.3f);
                    });
                })
                .Background(Color.Silver)
                .Border(3, new Color(211, 212, 210))
                .Grow(6);

                v1.Spacer();

                v1.Hstack(h2 =>
                {
                    h2.Button("Back to Settings",
                              clickAction: (e, a) => { UIManager.StartLayer(nameof(SettingsMenuUI), ParentScene); })
                    .Height(0.9f);

                    h2.Button("Save Settings",
                              clickAction: (e, a) =>
                    {
                        //Save sound settings
                        ClientSettings settings  = ClientSettings.GetSettings();
                        settings.ControlSettings = Model;
                        ClientSettings.SaveSettings(settings);
                    })
                    .Height(0.9f);
                }).Grow(2);
            })
            .Width(0.7f)
            .Height(0.9f)
            .Center();
        }
Ejemplo n.º 3
0
 protected override void Init()
 {
     Model = ClientSettings.GetSettings().ControlSettings;
 }
Ejemplo n.º 4
0
 protected override void Init()
 {
     Ip = ClientSettings.GetSettings().ServerSettings.DirectConnect;
 }
Ejemplo n.º 5
0
        public override void Body()
        {
            RootUI.Vstack(v1 =>
            {
                v1.Text("Add Server").FontSize(1.6f).Color(Color.White);

                v1.Spacer(2);

                v1.Vstack(v2 =>
                {
                    v2.Text("Server name:").JustifyText(JustifyText.Start).Color(Color.White);
                    v2.TextBoxFor(NewServer, x => x.Name)
                    .Background(Color.White)
                    .Color(Color.Black);

                    v2.Text("IP Address:").JustifyText(JustifyText.Start).Color(Color.White);
                    v2.TextBoxFor(NewServer, x => x.Ip)
                    .Background(Color.White)
                    .Color(Color.Black);
                }).Grow(13);

                v1.Spacer(6);

                //Buttons
                v1.Hstack(h2 =>
                {
                    //Save Server
                    h2.Vstack(v3 =>
                    {
                        v3.Button("Save Server",
                                  clickAction: (e, a) =>
                        {
                            if (string.IsNullOrEmpty(NewServer.Name) || string.IsNullOrEmpty(NewServer.Ip))
                            {
                                return;
                            }

                            ClientSettings existingServers = ClientSettings.GetSettings();
                            existingServers.ServerSettings.Servers.Add(NewServer);
                            ClientSettings.SaveSettings(existingServers);
                            UIManager.StartLayer(nameof(ServerMenuUI), ParentScene);
                        })
                        .Height(0.8f)
                        .Center();
                    }).Grow(8);

                    h2.Spacer();

                    //Cancel
                    h2.Vstack(v3 =>
                    {
                        v3.Button("Cancel",
                                  clickAction: (e, a) =>
                        {
                            UIManager.StartLayer(nameof(ServerMenuUI), ParentScene);
                        })
                        .Height(0.8f)
                        .Center();
                    }).Grow(8);
                }).Grow(3);
            })
            .Width(0.8f)
            .Height(0.8f)
            .Grow(2)
            .Center();
        }
        public override void Body()
        {
            RootUI.Vstack(v1 =>
            {
                v1.Text("Sound Settings")
                .FontSize(1.5f)
                .Color(Color.White)
                .Grow(2);

                v1.Vstack(v2 =>
                {
                    v2.Text("Master Volume:")
                    .Color(Color.White)
                    .JustifyText(JustifyText.Start);

                    v2.Hstack(h3 =>
                    {
                        h3.SliderFor(Model, x => x.MasterVolume, 0, 100).Grow(10);
                        h3.Hstack(h4 =>
                        {
                            h4.CheckBoxFor(Model, x => x.MasterMute)
                            .Center();
                        });
                    });
                }).Grow(3);

                v1.Spacer();

                v1.Vstack(v2 =>
                {
                    v2.Text("Music Volume:")
                    .Color(Color.White)
                    .JustifyText(JustifyText.Start);

                    v2.Hstack(h3 =>
                    {
                        h3.SliderFor(Model, x => x.MusicVolume, 0, 100).Grow(10);
                        h3.Hstack(h4 =>
                        {
                            h4.CheckBoxFor(Model, x => x.MusicMute)
                            .Center();
                        });
                    });
                }).Grow(3);

                v1.Spacer();

                v1.Vstack(v2 =>
                {
                    v2.Text("Sound Effects Volume:")
                    .Color(Color.White)
                    .JustifyText(JustifyText.Start);

                    v2.Hstack(h3 =>
                    {
                        h3.SliderFor(Model, x => x.SoundEffectVolume, 0, 100).Grow(10);
                        h3.Hstack(h4 =>
                        {
                            h4.CheckBoxFor(Model, x => x.SoundEffectMute)
                            .Center();
                        });
                    });
                }).Grow(3);

                v1.Spacer();

                v1.Hstack(h2 =>
                {
                    h2.Button("Back to Settings",
                              clickAction: (e, a) => { UIManager.StartLayer(nameof(SettingsMenuUI), ParentScene); })
                    .Height(0.9f);

                    h2.Button("Save Settings",
                              clickAction: (e, a) =>
                    {
                        //Save sound settings
                        ClientSettings settings = ClientSettings.GetSettings();
                        settings.SoundSettings  = Model;
                        ClientSettings.SaveSettings(settings);
                    })
                    .Height(0.9f);
                }).Grow(2);
            })
            .Width(0.7f)
            .Height(0.8f)
            .Center();
        }
 protected override void Init()
 {
     Model = ClientSettings.GetSettings().SoundSettings;
 }
Ejemplo n.º 8
0
        public override void Body()
        {
            Color bgColor = new Color(130, 131, 129);
            bool  bg      = false;

            RootUI.Vstack(v1 =>
            {
                v1.Text("Edit Servers").FontSize(1.6f).Color(Color.White);

                v1.Spacer();

                v1.Hstack(h2 =>
                {
                    h2.ScrollableContainer(s3 =>
                    {
                        int counter = 0;

                        s3.ListFor(Model, x => x.Servers, (stack4, item) =>
                        {
                            var counter3 = counter;
                            stack4.Hstack(h5 =>
                            {
                                h5.Spacer();

                                h5.Vstack(v6 =>
                                {
                                    v6.Text(item.Name).JustifyText(JustifyText.Start);
                                    v6.Text(item.Ip).JustifyText(JustifyText.Start).FontSize(0.75f);
                                })
                                .Grow(30);

                                var counter4 = counter3;
                                h5.Vstack(v6 =>
                                {
                                    v6.Spacer();

                                    var counter1 = counter4;
                                    v6.Button("Favorite",
                                              clickAction: (e, a) =>
                                    {
                                        int index           = counter1;
                                        var existingServers = ClientSettings.GetSettings();
                                        existingServers.ServerSettings.DirectConnect = existingServers.ServerSettings.Servers[index].Ip;
                                        ClientSettings.SaveSettings(existingServers);
                                    })
                                    .Center()
                                    .Grow(18);

                                    v6.Spacer();
                                })
                                .Grow(8);

                                h5.Spacer();

                                var counter2 = counter3;
                                h5.Vstack(v6 =>
                                {
                                    v6.Spacer();

                                    var counter1 = counter2;
                                    v6.Button("Delete",
                                              clickAction: (e, a) =>
                                    {
                                        int index           = counter1;
                                        var existingServers = ClientSettings.GetSettings();
                                        existingServers.ServerSettings.Servers.RemoveAt(index);
                                        ClientSettings.SaveSettings(existingServers);
                                        UIManager.StartLayer(nameof(EditServerListUI),
                                                             ParentScene);
                                    })
                                    .Center()
                                    .Grow(18);

                                    v6.Spacer();
                                })
                                .Grow(6);

                                h5.Spacer();
                            })
                            .Background(bgColor)
                            .Height(0.23f);

                            counter++;

                            if (bg)
                            {
                                bg      = false;
                                bgColor = new Color(130, 131, 129);
                            }
                            else
                            {
                                bg      = true;
                                bgColor = new Color(169, 170, 168);
                            }
                        });
                    });
                })
                .Grow(15);

                v1.Hstack(h2 =>
                {
                    //Add Server
                    h2.Vstack(v3 =>
                    {
                        v3.Button("Add Server",
                                  clickAction: (e, a) => { UIManager.StartLayer(nameof(AddServerUI), ParentScene); })
                        .Height(0.8f)
                        .Center();
                    }).Grow(8);

                    h2.Spacer();

                    //Cancel
                    h2.Vstack(v3 =>
                    {
                        v3.Button("Cancel",
                                  clickAction: (e, a) => { UIManager.StartLayer(nameof(ServerMenuUI), ParentScene); })
                        .Height(0.8f)
                        .Center();
                    }).Grow(8);
                }).Grow(3);

                //Back
                v1.Button("Back",
                          clickAction: (e, a) => { UIManager.StartLayer(nameof(MainMenuUI), ParentScene); }).Grow(2);
            })
            .Width(0.8f)
            .Height(0.8f)
            .Grow(2)
            .Center();
        }