Beispiel #1
0
        public override void Init()
        {
            base.Init();
            INetworkProcessor network = game.Network;

            widgets = new Widget[] {
                // Column 1
                MakeBool(-1, -150, "Music", OptionsKey.UseMusic,
                         OnWidgetClick, g => g.UseMusic,
                         (g, v) => { g.UseMusic = v; g.AudioPlayer.SetMusic(g.UseMusic); }),

                MakeBool(-1, -100, "Invert mouse", OptionsKey.InvertMouse,
                         OnWidgetClick, g => g.InvertMouse, (g, v) => g.InvertMouse = v),

                MakeOpt(-1, -50, "View distance", OnWidgetClick,
                        g => g.ViewDistance.ToString(),
                        (g, v) => g.SetViewDistance(Int32.Parse(v), true)),

                !network.IsSinglePlayer ? null :
                MakeBool(-1, 0, "Block physics", OptionsKey.SingleplayerPhysics, OnWidgetClick,
                         g => ((SinglePlayerServer)network).physics.Enabled,
                         (g, v) => ((SinglePlayerServer)network).physics.Enabled = v),

                // Column 2
                MakeBool(1, -150, "Sound", OptionsKey.UseSound,
                         OnWidgetClick, g => g.UseSound,
                         (g, v) => { g.UseSound = v; g.AudioPlayer.SetSound(g.UseSound); }),

                MakeBool(1, -100, "Show FPS", OptionsKey.ShowFPS,
                         OnWidgetClick, g => g.ShowFPS, (g, v) => g.ShowFPS = v),

                MakeBool(1, -50, "View bobbing", OptionsKey.ViewBobbing,
                         OnWidgetClick, g => g.ViewBobbing, (g, v) => g.ViewBobbing = v),

                MakeOpt(1, 0, "FPS mode", OnWidgetClick,
                        g => g.FpsLimit.ToString(),
                        (g, v) => { object raw = Enum.Parse(typeof(FpsLimitMethod), v);
                                    g.SetFpsLimitMethod((FpsLimitMethod)raw);
                                    Options.Set(OptionsKey.FpsLimit, v); }),

                !game.ClassicHacks ? null :
                MakeBool(0, 60, "Hacks enabled", OptionsKey.HacksEnabled,
                         OnWidgetClick, g => g.LocalPlayer.Hacks.Enabled,
                         (g, v) => { g.LocalPlayer.Hacks.Enabled = v;
                                     g.LocalPlayer.CheckHacksConsistency(); }),

                MakeTitle(0, 110, "Controls", LeftOnly(
                              (g, w) => g.SetNewScreen(new ClassicKeyBindingsScreen(g)))),

                MakeBack("Done", 25, titleFont, (g, w) => g.SetNewScreen(new PauseScreen(g))),
                null, null,
            };
            MakeValidators();
        }
        public override void Init()
        {
            base.Init();
            INetworkProcessor network = game.Network;

            widgets = new Widget[] {
                // Column 1
                !network.IsSinglePlayer ? null :
                MakeOpt(-1, -100, "Click distance", OnWidgetClick,
                        g => g.LocalPlayer.ReachDistance.ToString(),
                        (g, v) => g.LocalPlayer.ReachDistance = Single.Parse(v)),

                MakeBool(-1, -50, "Music", OptionsKey.UseMusic,
                         OnWidgetClick, g => g.UseMusic,
                         (g, v) => { g.UseMusic = v; g.AudioPlayer.SetMusic(g.UseMusic); }),

                MakeBool(-1, 0, "Sound", OptionsKey.UseSound,
                         OnWidgetClick, g => g.UseSound,
                         (g, v) => { g.UseSound = v; g.AudioPlayer.SetSound(g.UseSound); }),

                MakeBool(-1, 50, "View bobbing", OptionsKey.ViewBobbing,
                         OnWidgetClick, g => g.ViewBobbing, (g, v) => g.ViewBobbing = v),

                // Column 2
                !network.IsSinglePlayer ? null :
                MakeBool(1, -100, "Block physics", OptionsKey.SingleplayerPhysics, OnWidgetClick,
                         g => ((SinglePlayerServer)network).physics.Enabled,
                         (g, v) => ((SinglePlayerServer)network).physics.Enabled = v),

                MakeBool(1, -50, "Auto close launcher", OptionsKey.AutoCloseLauncher, OnWidgetClick,
                         g => Options.GetBool(OptionsKey.AutoCloseLauncher, false),
                         (g, v) => Options.Set(OptionsKey.AutoCloseLauncher, v)),

                MakeBool(1, 0, "Invert mouse", OptionsKey.InvertMouse,
                         OnWidgetClick, g => g.InvertMouse, (g, v) => g.InvertMouse = v),

                MakeOpt(1, 50, "Mouse sensitivity", OnWidgetClick,
                        g => g.MouseSensitivity.ToString(),
                        (g, v) => { g.MouseSensitivity = Int32.Parse(v);
                                    Options.Set(OptionsKey.Sensitivity, v); }),

                MakeBack(false, titleFont,
                         (g, w) => g.SetNewScreen(new OptionsGroupScreen(g))),
                null, null,
            };
            MakeValidators();
            MakeDescriptions();
        }
        void MakeValidators()
        {
            INetworkProcessor network = game.Network;

            validators = new MenuInputValidator[] {
                network.IsSinglePlayer ? new RealValidator(1, 1024) : null,
                new BooleanValidator(),
                new BooleanValidator(),
                new BooleanValidator(),

                network.IsSinglePlayer ? new BooleanValidator() : null,
                new BooleanValidator(),
                new BooleanValidator(),
                new IntegerValidator(1, 200),
            };
        }
        public override void ReceiveData(ConoConnect connect, byte[] data, int dataLen)
        {
            Packet packet = ClientFrontPacket.Deserialize(data, dataLen);

            int cmd = packet.cmd;

            INetworkProcessor networkProcessor = null;

            if (npDict.TryGetValue(cmd, out networkProcessor) == false)
            {
                Console.WriteLine("ReceiveData - cmd : " + cmd);

                return;
            }

            networkProcessor.Process(connect, packet);
        }
Beispiel #5
0
        void MakeValidators()
        {
            INetworkProcessor network = game.Network;

            validators = new MenuInputValidator[] {
                new BooleanValidator(),
                new BooleanValidator(),
                new IntegerValidator(16, 4096),
                network.IsSinglePlayer ? new BooleanValidator() : null,

                new BooleanValidator(),
                new BooleanValidator(),
                new BooleanValidator(),
                new EnumValidator(typeof(FpsLimitMethod)),
                game.ClassicHacks ? new BooleanValidator() : null,
            };
        }
Beispiel #6
0
 public void setNetworkProcessor(int cmd, INetworkProcessor networkProcessor)
 {
     npDict.Add(cmd, networkProcessor);
 }
Beispiel #7
0
 public NetController(INetworkProcessor networkProcessor, INodeProcessor nodeProcessor, IConnectionProcessor connectionProcessor, IMutationController mutationController) =>
 (_networkProcessor, _nodeProcessor, _connectionProcessor, _mutationController) = (networkProcessor, nodeProcessor, connectionProcessor, mutationController);