private void DrawFileButtons(SaveFile file, ref float width)
        {
            if (file.replay)
            {
                if (Widgets.ButtonText(new Rect(width, 0, 120, 40), "MpWatchReplay".Translate()))
                {
                    Close(false);
                    Replay.LoadReplay(file.file);
                }

                width += 120 + 10;
            }

            if (Widgets.ButtonText(new Rect(width, 0, 120, 40), "MpHostButton".Translate()))
            {
                Close(false);
                Find.WindowStack.Add(new HostWindow(file)
                {
                    returnToServerBrowser = true
                });
            }

            width += 120 + 10;

            if (Widgets.ButtonText(new Rect(width, 0, 120, 40), "Delete".Translate()))
            {
                Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmDelete".Translate(file.displayName), () =>
                {
                    file.file.Delete();
                    ReloadFiles();
                }, true));
            }

            width += 120;
        }
Exemplo n.º 2
0
        private void HostFromReplay(ServerSettings settings)
        {
            TickPatch.disableSkipCancel = true;

            Replay.LoadReplay(file.fileName, true, () =>
            {
                ClientUtil.HostServer(settings, true);
            });
        }
Exemplo n.º 3
0
        private static void HandleCommandLine()
        {
            if (GenCommandLine.TryGetCommandLineArg("connect", out string addressPort) && Multiplayer.restartConnect == null)
            {
                int port = MultiplayerServer.DefaultPort;

                var split = addressPort.Split(':');
                if (split.Length == 0)
                {
                    addressPort = "127.0.0.1";
                }
                else if (split.Length >= 1)
                {
                    addressPort = split[0];
                }

                if (split.Length == 2)
                {
                    int.TryParse(split[1], out port);
                }

                DoubleLongEvent(() => ClientUtil.TryConnectWithWindow(addressPort, port, false), "Connecting");
            }

            if (GenCommandLine.CommandLineArgPassed("arbiter"))
            {
                Multiplayer.username = "******";
                Prefs.VolumeGame     = 0;
            }

            if (GenCommandLine.TryGetCommandLineArg("replay", out string replay))
            {
                DoubleLongEvent(() =>
                {
                    Replay.LoadReplay(Replay.ReplayFile(replay), true, () =>
                    {
                        var rand = Find.Maps.Select(m => m.AsyncTime().randState).Select(s => $"{s} {(uint)s} {s >> 32}");

                        Log.Message($"timer {TickPatch.Timer}");
                        Log.Message($"world rand {Multiplayer.WorldComp.randState} {(uint)Multiplayer.WorldComp.randState} {Multiplayer.WorldComp.randState >> 32}");
                        Log.Message($"map rand {rand.ToStringSafeEnumerable()} | {Find.Maps.Select(m => m.AsyncTime().mapTicks).ToStringSafeEnumerable()}");

                        Application.Quit();
                    });
                }, "Replay");
            }

            if (GenCommandLine.CommandLineArgPassed("printsync"))
            {
                ExtendDirectXmlSaver.extend = true;
                DirectXmlSaver.SaveDataObject(new SyncContainer(), "SyncHandlers.xml");
                ExtendDirectXmlSaver.extend = false;
            }
        }
Exemplo n.º 4
0
        private void HostFromReplay(ServerSettings settings)
        {
            void ReplayLoaded() => ClientUtil.HostServer(settings, true, withSimulation, debugMode: debugMode);

            if (file != null)
            {
                Replay.LoadReplay(file.file, true, ReplayLoaded, cancel: GenScene.GoToMainMenu, simTextKey: "MpSimulatingServer");
            }
            else
            {
                ReplayLoaded();
            }
        }
Exemplo n.º 5
0
        private void DrawFileButtons(SaveFile file, ref float width)
        {
            if (file.HasRwVersion)
            {
                if (file.replay && Multiplayer.ShowDevInfo)
                {
                    if (Widgets.ButtonText(new Rect(width, 0, 120, 40), "MpWatchReplay".Translate()))
                    {
                        CheckGameVersionAndMods(
                            file,
                            () => { Close(false); Replay.LoadReplay(file.file); }
                            );
                    }

                    width += 120 + 10;
                }

                if (Widgets.ButtonText(new Rect(width, 0, 120, 40), "MpHostButton".Translate()))
                {
                    CheckGameVersionAndMods(
                        file,
                        () => { Close(false); Find.WindowStack.Add(new HostWindow(file)
                        {
                            returnToServerBrowser = true
                        }); }
                        );
                }

                width += 120 + 10;
            }

            if (Widgets.ButtonText(new Rect(width, 0, 120, 40), "Delete".Translate()))
            {
                Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmDelete".Translate(file.displayName), () =>
                {
                    file.file.Delete();
                    reader.RemoveFile(file.file);
                    selectedFile = null;
                }, true));
            }

            width += 120;
        }