Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 2
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();
    }
Ejemplo n.º 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();
                }
            }
        }
Ejemplo n.º 4
0
    private void DrawGlobalOptions(GotoUdonSettings settings)
    {
        settings.Init();
        if (!settings.IsSimulatorInstalled)
        {
            SimpleGUI.ActionButton("Install legacy simulator (probably doesnt work)", () => settings.IsSimulatorInstalled = true);
        }
        else
        {
            SimpleGUI.ActionButton("Remove simulator", () => settings.IsSimulatorInstalled = false);
        }

#if GOTOUDON_SIMULATION_LEGACY
        SimpleGUI.ErrorBox(settings.avatarPrefab == null,
                           "You need to select some avatar prefab to use this resource. You can find ybot-mini in Assets folder with this resource.");
        SimpleGUI.ErrorBox(settings.spawnPoint == null,
                           "You need to select some spawn point to use this resource!");

        GUILayout.Label("Global settings");
        SimpleGUI.Indent(() =>
        {
            settings.enableSimulation = EditorGUILayout.Toggle("Enable simulation", settings.enableSimulation);
            settings.avatarPrefab     = SimpleGUI.ObjectField("Avatar prefab", settings.avatarPrefab, false);
            settings.spawnPoint       = SimpleGUI.ObjectField("Spawn point", settings.spawnPoint, true);
        });

        // nah, not really working
        // SimpleGUI.DrawFoldout(this, "Advanced settings", () =>
        // {
        //     SimpleGUI.WarningBox(true,
        //         "Enabling vrchat client mode might cause some issues, but also allow to test your scripts with secure heap enabled\n" +
        //         "This will add or remove VRC_CLIENT define for compiler, meaning that all internal sdk code will think its running on client and not in editor.\n" +
        //         "Use at own risk.");
        //     string VRC_CLIENT = "VRC_CLIENT";
        //     bool vrchatClientMode = UnityCompilerUtils.IsDefineEnabled(VRC_CLIENT);
        //     string buttonName = vrchatClientMode ? "Use vrchat editor mode" : "Use vrchat client mode";
        //     SimpleGUI.ActionButton(buttonName, () => UnityCompilerUtils.SetDefineEnabled(VRC_CLIENT, !vrchatClientMode));
        // });
#endif
    }
Ejemplo n.º 5
0
        public static void DrawValidationErrors(List <MissingImplementationData> missingImpls)
        {
            VRCVersionStatus versionStatus = IsVRChatSdkOutdated();

            if (missingImpls.Count == 0)
            {
                SimpleGUI.ErrorBox(versionStatus == VRCVersionStatus.Error,
                                   "SDK version check failed, please report this to author. You can try to keep using current version, but some features might not work correctly");
                SimpleGUI.ErrorBox(versionStatus == VRCVersionStatus.Outdated,
                                   $"Please update your VRChat SDK, this GotoUdon was made for: {GotoUdonEditor.ImplementedSDKVersion}");
                SimpleGUI.ErrorBox(versionStatus == VRCVersionStatus.TooNew,
                                   "Please update GotoUdon if new version is available, if not you can try to keep using current version, but some features might not work correctly.\n" +
                                   "You can also check our discord to see if we are already working on update.\n" + "For emulation please use CyanEmu instead: https://github.com/CyanLaser/CyanEmu");
                return;
            }

            StringBuilder errorStr =
                new StringBuilder(
                    $"GotoUdon {GotoUdonEditor.VERSION} is not compatible with VRChat sdk {GotoUdonEditor.CurrentSDKVersion}.\n");

            if (versionStatus == VRCVersionStatus.Same)
            {
                errorStr.AppendLine("This project is no longer maintained, Please use CyanEmu instead: https://github.com/CyanLaser/CyanEmu");
            }

            errorStr.AppendLine("Auto detected problematic methods: ");

            foreach (MissingImplementationData missingImpl in missingImpls)
            {
                errorStr.AppendLine($" - {missingImpl.FieldName}");
            }

            errorStr.AppendLine();
            errorStr.AppendLine("If your udon scripts don't use methods above they might work just fine in emulator.");
            SimpleGUI.ErrorBox(true, errorStr.ToString());
        }