예제 #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
    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
    }