EpochTime() public static method

public static EpochTime ( ) : double
return double
Ejemplo n.º 1
0
        private void ShowConfig()
        {
            prop             = so.FindProperty("gmcsPath");
            prop.stringValue = EditorApplication.applicationContentsPath + "/Mono/bin/gmcs.bat";

            EditorGUILayout.Separator();
            EditorGUILayout.LabelField("Game Machine", EditorStyles.boldLabel);
            EditorGUILayout.Separator();

            string gmStartBash = serverConfig.serverPath + "/bin/game_machine.sh";

            if (!File.Exists(gmStartBash))
            {
                EditorGUILayout.HelpBox(
                    @"Path to the game machine server.  This will end in 'server'",
                    MessageType.Info);
                SetServerPath("Set Game Machine server folder");
                return;
            }
            else
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Game Machine folder is set correctly");
                SetServerPath("Reset");
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Separator();
            }

            prop             = so.FindProperty("configName");
            prop.stringValue = EditorGUILayout.TextField("Config name", prop.stringValue);

            EditorGUILayout.Separator();

            if (string.IsNullOrEmpty(serverConfig.gmcsPath))
            {
                EditorGUILayout.HelpBox("Unity installation path not set", MessageType.Error);
                return;
            }

            if (string.IsNullOrEmpty(serverConfig.serverPath))
            {
                EditorGUILayout.HelpBox("Game Machine server path not set", MessageType.Error);
                return;
            }

            if (ProcessTracker.HasProcess(gameMachineProcess))
            {
                //if (GUILayout.Button("Stop Server", GUILayout.Width(300))) {
                //    ProcessTracker.Stop(gameMachineProcess);
                //}
                EditorGUILayout.LabelField("Game Machine is running");
            }
            else
            {
                if (GUILayout.Button("Start Game Machine", GUILayout.ExpandWidth(true)))
                {
                    RunGameMachine("server", serverConfig.configName);
                }
                EditorGUILayout.Separator();
                if (GUILayout.Button("Build Game Machine (full)", GUILayout.ExpandWidth(true)))
                {
                    RunGameMachine("build clean", serverConfig.configName);
                }
                EditorGUILayout.Separator();
                if (GUILayout.Button("Build Game Machine (compile only)", GUILayout.ExpandWidth(true)))
                {
                    RunGameMachine("build compile", serverConfig.configName);
                }
                EditorGUILayout.Separator();
                if (GUILayout.Button("Build protocol buffers", GUILayout.ExpandWidth(true)))
                {
                    BuildProtobuf();
                }
            }



            EditorGUILayout.Separator();

            EditorGUILayout.Separator();
            EditorGUILayout.LabelField("Unity server", EditorStyles.boldLabel);
            prop = so.FindProperty("buildScenes");
            EditorGUILayout.PropertyField(prop, true);
            EditorGUILayout.Separator();

            prop           = so.FindProperty("runHeadless");
            prop.boolValue = EditorGUILayout.Toggle("Run headless", prop.boolValue);
            EditorGUILayout.Separator();



            buildTarget = (BuildTarget)EditorGUILayout.EnumPopup("Target", buildTarget);
            EditorGUILayout.BeginVertical(GUILayout.Height(20));
            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            if (TimeUtil.EpochTime() - lastUpdate > 3)
            {
                lastUpdate = TimeUtil.EpochTime();
                ProcessTracker.UpdateProcesses();
            }


            if (ProcessTracker.HasProcess(unityProcess))
            {
                if (GUILayout.Button("Stop Unity", GUILayout.Width(300)))
                {
                    ProcessTracker.Stop(unityProcess);
                }
            }
            else
            {
                if (buildTarget == BuildTarget.StandaloneWindows ||
                    buildTarget == BuildTarget.StandaloneWindows64 ||
                    buildTarget == BuildTarget.StandaloneLinux ||
                    buildTarget == BuildTarget.StandaloneLinux64 ||
                    buildTarget == BuildTarget.StandaloneOSXIntel ||
                    buildTarget == BuildTarget.StandaloneOSXIntel64 ||
                    buildTarget == BuildTarget.StandaloneOSXUniversal)
                {
                    if (GUILayout.Button("Build", GUILayout.Width(300)))
                    {
                        if (Directory.Exists(PublishPath()))
                        {
                            Directory.Delete(PublishPath(), true);
                        }
                        Build();
                    }
                }

                if (File.Exists(ExePath()))
                {
                    if (GUILayout.Button("Start single instance", GUILayout.Width(300)))
                    {
                        StartUnity(so.FindProperty("runHeadless").boolValue);
                    }
                }
            }

            if (File.Exists(Logfile()))
            {
                if (GUILayout.Button("View log", GUILayout.Width(300)))
                {
                    System.Diagnostics.Process.Start("notepad.exe", Logfile());
                }
            }

            EditorGUILayout.BeginVertical(GUILayout.Height(20));
            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            EditorGUILayout.LabelField("Unity process manager", EditorStyles.boldLabel);
            EditorGUILayout.Separator();

            prop          = so.FindProperty("deployCount");
            prop.intValue = EditorGUILayout.IntField("Deploy instance count", prop.intValue);
            EditorGUILayout.Separator();


            if (File.Exists(ExePath()))
            {
                if (GUILayout.Button("Deploy " + serverConfig.deployCount + " instances to process manager", GUILayout.Width(300)))
                {
                    Deploy();
                }
            }
        }
Ejemplo n.º 2
0
 void OnEnable()
 {
     so         = new SerializedObject(target);
     lastUpdate = TimeUtil.EpochTime();
 }