Example #1
0
        private static void BuildClientForWindows()
        {
            string buildFolder = Path.Combine("Builds", "BasicSpawnerMirror", "Client");

            BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions
            {
                scenes = new[] {
                    "Assets/MasterServerToolkit/Demos/BasicSpawnerMirror/Scenes/Client/Client.unity",
                    "Assets/MasterServerToolkit/Demos/BasicSpawnerMirror/Scenes/Room/RoomStart.unity",
                    "Assets/MasterServerToolkit/Demos/BasicSpawnerMirror/Scenes/Room/RoomOnline.unity"
                },
                locationPathName = Path.Combine(buildFolder, "Client.exe"),
                target           = BuildTarget.StandaloneWindows64,
                options          = BuildOptions.ShowBuiltPlayer | BuildOptions.Development
            };

            BuildReport  report  = BuildPipeline.BuildPlayer(buildPlayerOptions);
            BuildSummary summary = report.summary;

            if (summary.result == BuildResult.Succeeded)
            {
                MstProperties properties = new MstProperties();
                properties.Add(Mst.Args.Names.StartClientConnection, true);
                properties.Add(Mst.Args.Names.MasterIp, Mst.Args.MasterIp);
                properties.Add(Mst.Args.Names.MasterPort, Mst.Args.MasterPort);

                File.WriteAllText(Path.Combine(buildFolder, "application.cfg"), properties.ToReadableString("\n", "="));

                Debug.Log("Client build succeeded: " + (summary.totalSize / 1024) + " kb");
            }

            if (summary.result == BuildResult.Failed)
            {
                Debug.Log("Client build failed");
            }
        }
Example #2
0
        private static void BuildMasterAndSpawnerForWindows()
        {
            string buildFolder = Path.Combine("Builds", "BasicSpawnerMirror", "MasterAndSpawner");
            string roomExePath = Path.Combine(Directory.GetCurrentDirectory(), "Builds", "BasicSpawnerMirror", "Room", "Room.exe");

            BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions
            {
                scenes           = new[] { "Assets/MasterServerToolkit/Bridges/Mirror/BasicSpawnerMirror/Scenes/MasterAndSpawner/MasterAndSpawner.unity" },
                locationPathName = Path.Combine(buildFolder, "MasterAndSpawner.exe"),
                target           = BuildTarget.StandaloneWindows64,
                options          = BuildOptions.EnableHeadlessMode | BuildOptions.ShowBuiltPlayer | BuildOptions.Development
            };

            BuildReport  report  = BuildPipeline.BuildPlayer(buildPlayerOptions);
            BuildSummary summary = report.summary;

            if (summary.result == BuildResult.Succeeded)
            {
                MstProperties properties = new MstProperties();
                properties.Add(Mst.Args.Names.StartMaster, true);
                properties.Add(Mst.Args.Names.StartSpawner, true);
                properties.Add(Mst.Args.Names.StartClientConnection, true);
                properties.Add(Mst.Args.Names.MasterIp, Mst.Args.MasterIp);
                properties.Add(Mst.Args.Names.MasterPort, Mst.Args.MasterPort);
                properties.Add(Mst.Args.Names.RoomExecutablePath, roomExePath);

                File.WriteAllText(Path.Combine(buildFolder, "application.cfg"), properties.ToReadableString("\n", "="));

                Debug.Log("Master Server build succeeded: " + (summary.totalSize / 1024) + " kb");
            }

            if (summary.result == BuildResult.Failed)
            {
                Debug.Log("Master Server build failed");
            }
        }
Example #3
0
 /// <summary>
 /// Sends request to master server to start new room process
 /// </summary>
 /// <param name="spawnOptions"></param>
 public virtual void CreateNewRoom(MstProperties spawnOptions)
 {
     CreateNewRoom(string.Empty, spawnOptions);
 }
Example #4
0
 public MirrorRoomPlayer(int msfPeerId, NetworkConnection mirrorPeer, string username, MstProperties customOptions)
 {
     MasterPeerId  = msfPeerId;
     MirrorPeer    = mirrorPeer ?? throw new ArgumentNullException(nameof(mirrorPeer));
     Username      = username ?? throw new ArgumentNullException(nameof(username));
     CustomOptions = customOptions ?? throw new ArgumentNullException(nameof(customOptions));
     Profile       = new ObservableServerProfile(username);
 }