Пример #1
0
        private void DrawClientSection()
        {
            DrawClientSettingsList(_settings.clients);

            SimpleGUI.SectionSpacing();

            if (SimpleGUI.ErrorBox(_settings.WorldId == null, "Can't start clients, missing WorldID"))
            {
                return;
            }

            if (SimpleGUI.ErrorBox(_settings.userId == null, "Can't find user id, please log in SDK."))
            {
                return;
            }

            if (SimpleGUI.ErrorBox(!_settings.IsGamePathValid(), "Can't find game executable"))
            {
                return;
            }

            if (!_localTesting)
            {
                _keepInstance = EditorGUILayout.Toggle("Keep current instance ID", _keepInstance);
            }

            _localTesting = EditorGUILayout.Toggle("Use local testing", _localTesting);
            _clientsManager.InstanceId = EditorGUILayout.TextField(_clientsManager.InstanceId);

            GUILayout.BeginHorizontal();
            string startButtonText = _localTesting ? "Start last version (no build)" : "Start";

            SimpleGUI.ActionButton(startButtonText,
                                   () => _clientsManager.StartClients(false, _keepInstance, _localTesting, _keepInstanceForce));
            if (ClientProcessesManager.IsAnyRunning())
            {
                SimpleGUI.ActionButton("Restart",
                                       () => _clientsManager.StartClients(true, _keepInstance, _localTesting, _keepInstanceForce));
            }
            GUILayout.EndHorizontal();

            if (!Application.isPlaying)
            {
                if (_localTesting)
                {
                    SimpleGUI.ActionButton("Build & Start", BuildAndTest);
                }
                else
                {
                    if (SimpleGUI.ErrorBox(APIUser.CurrentUser == null || !VRC_SdkBuilder.VerifyCredentials(), "Can't find user for auto publish, please log in SDK."))
                    {
                        return;
                    }

                    SimpleGUI.ActionButton("Build & Auto Publish & Start", PublishAndTest);
                }
            }
        }
Пример #2
0
        private bool DrawClientSettings(ClientSettings settings, string buttonAction)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Name", GUILayout.Width(35));
            settings.name = EditorGUILayout.TextField(settings.name, GUILayout.Width(100), GUILayout.ExpandWidth(true));
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Profile", GUILayout.Width(45));
            settings.profile = EditorGUILayout.IntField(settings.profile, GUILayout.Width(20));
            if (_localTesting)
            {
                GUILayout.Label("Num of", GUILayout.Width(45));
                settings.instances = EditorGUILayout.IntField(settings.instances, GUILayout.Width(20));
            }

            GUILayout.Label("Enabled", GUILayout.Width(55));
            settings.enabled = EditorGUILayout.Toggle(settings.enabled, GUILayout.Width(15));
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
            GUILayout.Label("VR", GUILayout.Width(20));
            settings.vr = EditorGUILayout.Toggle(settings.vr, GUILayout.Width(15));

            bool isRunning = ClientProcessesManager.IsAnyRunning(settings.profile);

            if (isRunning)
            {
                SimpleGUI.ActionButton("Stop All", () => ClientProcessesManager.KillProfile(settings.profile), GUILayout.Width(65));
                SimpleGUI.ActionButton("Restart All",
                                       () =>
                {
                    ClientProcessesManager.KillProfile(settings.profile);
                    _clientsManager.StartClients(_keepInstance, _keepInstanceForce, _localTesting, settings);
                },
                                       GUILayout.Width(90));
            }

            if (_localTesting || !isRunning)
            {
                SimpleGUI.ActionButton("Start One",
                                       () => _clientsManager.StartClients(_keepInstance, _keepInstanceForce, _localTesting, settings.WithInstances(1)),
                                       GUILayout.Width(80));
            }

            bool actionButton = GUILayout.Button(buttonAction, GUILayout.Width(70));

            EditorGUILayout.EndHorizontal();

            return(actionButton);
        }