コード例 #1
0
        private static void BuildClientForWindows()
        {
            string buildFolder = Path.Combine("Builds", "BasicSpawner", "Client");

            BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions
            {
                scenes = new[] {
                    "Assets/MasterServerToolkit/Demos/BasicSpawner/Scenes/Client/Client.unity",
                    "Assets/MasterServerToolkit/Demos/BasicSpawner/Scenes/Room/Room.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");
            }
        }
コード例 #2
0
ファイル: RoomAlertMessage.cs プロジェクト: xyberviri/MST
        public override string ToString()
        {
            var options = new MstProperties();

            options.Add("Code", Code.ToString());
            options.Add("Message", Message);

            return(options.ToReadableString());
        }
コード例 #3
0
ファイル: MirrorRoomPlayer.cs プロジェクト: xyberviri/MST
        public override string ToString()
        {
            MstProperties options = new MstProperties();

            options.Add("Username", Username);
            options.Add("MirrorPeerId", MirrorPeer.connectionId);
            options.Add("MsfPeerId", MasterPeerId);
            options.Append(Profile.ToStringsDictionary());
            options.Append(CustomOptions);

            return(options.ToReadableString());
        }
コード例 #4
0
        private static void BuildSpawnerForWindows()
        {
            string buildFolder = Path.Combine("Builds", "BasicSpawner", "Room");
            string roomExePath = Path.Combine(Directory.GetCurrentDirectory(), "Builds", "BasicSpawner", "Room", "Room.exe");

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

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

            if (summary.result == BuildResult.Succeeded)
            {
                MstProperties properties = new MstProperties();
                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("Spawner build succeeded: " + (summary.totalSize / 1024) + " kb");
            }

            if (summary.result == BuildResult.Failed)
            {
                Debug.Log("Spawner build failed");
            }
        }