示例#1
0
    private void DrawPlayersEditor()
    {
        GotoUdonSettings settings = _controller.Settings;

        if (SimpleGUI.WarningBox(!settings.enableSimulation, "Simulation is disabled"))
        {
            return;
        }

        VRCEmulator emulator = _controller.Emulator;

        if (SimpleGUI.InfoBox(!VRCEmulator.IsReady, "Waiting for emulation to begin..."))
        {
            return;
        }
        SimpleGUI.ErrorBox(emulator.GetAmountOfPlayers() == 0,
                           "Emulator should not be started without at least one player!");

        SimpleGUI.OptionSpacing();
        GUILayout.Label("Global settings");
        emulator.IsNetworkSettled = GUILayout.Toggle(emulator.IsNetworkSettled, "Is network settled");

        GUILayout.Label("Spawned players: ");
        SimpleGUI.OptionSpacing();
        foreach (SimulatedVRCPlayer runtimePlayer in _controller.RuntimePlayers)
        {
            if (!runtimePlayer.gameObject.activeSelf)
            {
                continue;
            }
            SimulatedPlayerEditor.DrawActiveRuntimePlayer(emulator, runtimePlayer);
            SimpleGUI.OptionSpacing();
        }

        SimpleGUI.SectionSpacing();

        GUILayout.Label("Available players: ");
        SimpleGUI.OptionSpacing();
        foreach (SimulatedVRCPlayer runtimePlayer in _controller.RuntimePlayers)
        {
            if (runtimePlayer.gameObject.activeSelf)
            {
                continue;
            }
            SimulatedPlayerEditor.DrawAvailableRuntimePlayer(emulator, runtimePlayer);
            SimpleGUI.OptionSpacing();
        }

        DrawAddPlayerBox();
    }
示例#2
0
        internal void DrawVersionInformation()
        {
            DrawSdkUpdateComponent();
            string version               = GotoUdonEditor.VERSION;
            string sdkVersion            = GotoUdonEditor.CurrentSDKVersion;
            string recommendedSdkVersion = GotoUdonEditor.ImplementedSDKVersion;
            string versionString         = sdkVersion == recommendedSdkVersion
                ? $"GotoUdon {version} for SDK {recommendedSdkVersion}"
                : $"GotoUdon {version} for SDK {recommendedSdkVersion}, running on SDK {sdkVersion}";
            string githubUrl = "https://github.com/GotoFinal/GotoUdon/releases";

            if (_updateCheckerLibraryResponse != null)
            {
                if (SimpleGUI.WarningBox(_updateCheckerLibraryResponse.IsError, _updateCheckerLibraryResponse.Error))
                {
                    if (GUILayout.Button($"{versionString}. Click to check for new version at: {githubUrl}",
                                         EditorStyles.helpBox))
                    {
                        Application.OpenURL(githubUrl);
                    }

                    return;
                }

                ReleaseInfo releaseInfo = _updateCheckerLibraryResponse.ReleaseInfo;
                if (releaseInfo.UnityPackage != null && SimpleGUI.InfoBox(releaseInfo.IsNewerThan(version),
                                                                          $"There is new version available: {releaseInfo.Version}! Click to update!\n{releaseInfo.Name}\n{releaseInfo.Description}")
                    )
                {
                    GUILayout.BeginHorizontal();
                    if (!_downloadingUpdate)
                    {
                        SimpleGUI.ActionButton($"Update to {releaseInfo.Version}!", UpdateLibrary);
                    }
                    SimpleGUI.ActionButton("Download manually.", () => Application.OpenURL(releaseInfo.UnityPackage.DownloadUrl));
                    GUILayout.EndHorizontal();
                    return;
                }
            }

            if (GUILayout.Button($"{versionString}. Click to retry check for new version.", EditorStyles.helpBox))
            {
                ForceCheckForUpdate();
            }
        }
示例#3
0
        private void DrawSdkUpdateComponent()
        {
            if (_updateCheckerSdkResponse != null)
            {
                if (_updateCheckerSdkResponse.IsError)
                {
#if GOTOUDON_DEV
                    SimpleGUI.ErrorBox(_updateCheckerSdkResponse.IsError, "Failed to check for VRChat SDK update.");
#endif
                    return;
                }

                ReleaseInfo releaseInfo = _updateCheckerSdkResponse.ReleaseInfo;
                if (releaseInfo.Version == null)
                {
                    return;
                }
                string newestSdkVersion  = NormalizeVrChatSDKVersion(releaseInfo.Version);
                string currentSdkVersion = NormalizeVrChatSDKVersion(GotoUdonEditor.CurrentSDKVersion);

                // I give up, TODO: save version in own repository instead of using vrchat
                if (currentSdkVersion.EndsWith("05.06") && newestSdkVersion.EndsWith("05.12"))
                {
                    return;
                }
                if (releaseInfo.Version.StartsWith(GotoUdonEditor.ImplementedSDKVersion))
                {
                    return;
                }

                if (releaseInfo.UnityPackage != null &&
                    SimpleGUI.InfoBox(
                        VersionUtils.IsRightNewerThanLeft(currentSdkVersion, newestSdkVersion),
                        $"There is new VRChat UDON SDK version available: {releaseInfo.Version}!\n{releaseInfo.Name}\n{releaseInfo.Description}")
                    )
                {
                    GUILayout.BeginHorizontal();
                    // if (!_downloadingSdk)
                    //     SimpleGUI.ActionButton($"Update to {releaseInfo.Version}!", UpdateSdk);
                    SimpleGUI.ActionButton("Download manually.", () => Application.OpenURL(releaseInfo.UnityPackage.DownloadUrl));
                    GUILayout.EndHorizontal();
                }
            }
        }
示例#4
0
    private void DrawTemplatesEditor()
    {
        EditorGUI.BeginChangeCheck();
        DrawGlobalOptions(GotoUdonSettings.Instance);
        SimpleGUI.SectionSpacing();

#if GOTOUDON_SIMULATION_LEGACY
        List <PlayerTemplate> templates = GotoUdonSettings.Instance.playerTemplates;
        if (templates.Count == 0)
        {
            templates.Add(PlayerTemplate.CreateNewPlayer(true));
        }

        GUILayout.Label("Players to create at startup:");
        PlayerTemplate toRemove = null;
        foreach (var template in templates)
        {
            if (PlayerTemplateEditor.DrawPlayerTemplateWithRemoveButton(template))
            {
                toRemove = template;
            }
            SimpleGUI.OptionSpacing();
        }

        templates.Remove(toRemove);
        if (templates.Count == 0)
        {
            templates.Add(PlayerTemplate.CreateNewPlayer(true));
        }

        SimpleGUI.ActionButton("Add another player",
                               () => templates.Add(PlayerTemplate.CreateNewPlayer(templates.Count == 0)));
        SimpleGUI.SectionSpacing();

        if (SimpleGUI.EndChangeCheck())
        {
            EditorUtility.SetDirty(GotoUdonSettings.Instance);
        }

        SimpleGUI.InfoBox(true, "In play mode you will be able to control all created players here, or add more");
#endif
    }
示例#5
0
        private void OnGUI()
        {
#if GOTOUDON_DEV
            DrawReleaseHelper();
#endif
            UpdaterEditor.Instance.DrawVersionInformation();

            _scroll = GUILayout.BeginScrollView(_scroll, GUIStyle.none);
            if (!Application.isPlaying)
            {
                VRCSdkControlPanel.InitAccount();
            }

            _settings.Init();
            SimpleGUI.DrawFoldout(this, "Help", () =>
            {
                SimpleGUI.InfoBox(true,
                                  "Here you can prepare profiles (vrchat --profile=x option) and launch them at once and connect to given world.\n" +
                                  "Each profile can be logged in to other vrchat account, allowing you for simple testing.\n" +
                                  "You can also disable some profiles, this will just simply ignore them when using button to start all clients.\n" +
                                  "Keeping instance might cause issues on restart with multiple clients, vrchat servers might still think you are trying to join twice.");
            });

            EditorGUI.BeginChangeCheck();

            SimpleGUI.DrawFoldout(this, "Advanced settings", () =>
            {
                SimpleGUI.WarningBox(string.IsNullOrWhiteSpace(_settings.WorldId),
                                     "Missing world. Make sure your world have a vrc world descriptor and you are logged in to SDK.");
                SimpleGUI.InfoBox(string.IsNullOrWhiteSpace(_settings.UserId), "Login to SDK and User ID field will fill up itself");
                _settings.userId = EditorGUILayout.TextField("User ID", _settings.userId);
                SimpleGUI.InfoBox(string.IsNullOrWhiteSpace(_settings.gamePath),
                                  "This should be automatically filled from sdk, but if its not, point it to your vrchat.exe");
                _settings.gamePath           = EditorGUILayout.TextField("Game path", _settings.gamePath);
                _settings.launchOptions      = EditorGUILayout.TextField("Launch options", _settings.launchOptions);
                _settings.localLaunchOptions = EditorGUILayout.TextField("Local launch options", _settings.localLaunchOptions);
                // _settings.sendInvitesOnUpdate = EditorGUILayout.Toggle("Send invites on world update", _settings.sendInvitesOnUpdate);
                _settings.accessType = (ApiWorldInstance.AccessType)EditorGUILayout.EnumPopup("Access Type", _settings.accessType);
                _keepInstanceForce   = EditorGUILayout.Toggle("Force keep instance ID", _keepInstanceForce);
                if (_keepInstanceForce)
                {
                    _keepInstance = true;
                }

                GUILayout.BeginHorizontal();
                GUILayout.Label("Same room restart wait time (s)", GUILayout.Width(200));
                _settings.sameInstanceRestartDelay = EditorGUILayout.IntField(_settings.sameInstanceRestartDelay, GUILayout.Width(30));
                GUILayout.EndHorizontal();
            });

            SimpleGUI.SectionSpacing();
            DrawClientSection();
            SimpleGUI.SectionSpacing();

            if (SimpleGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(_settings);
                EditorUtility.SetDirty(GotoUdonInternalState.Instance);
            }

            SimpleGUI.DrawFooterInformation();
            GUILayout.EndScrollView();
        }