Beispiel #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();
    }
Beispiel #2
0
        private void DrawClientSettingsList(List <ClientSettings> allClients)
        {
            ClientSettings removed    = null;
            int            maxProfile = 10;

            foreach (ClientSettings clientSettings in allClients)
            {
                if (clientSettings.profile > maxProfile)
                {
                    maxProfile = clientSettings.profile;
                }
                bool beforeVr = clientSettings.vr;
                if (DrawClientSettings(clientSettings, "Remove"))
                {
                    removed = clientSettings;
                }

                if (!beforeVr && clientSettings.vr)
                {
                    allClients.ForEach(client =>
                    {
                        if (client != clientSettings)
                        {
                            client.vr = false;
                        }
                    });
                }

                SimpleGUI.OptionSpacing();
            }

            if (removed != null)
            {
                allClients.Remove(removed);
            }

            SimpleGUI.ActionButton("Add client", () =>
            {
                allClients.Add(new ClientSettings()
                {
                    name      = "",
                    profile   = maxProfile + 1,
                    instances = 1,
                    enabled   = true
                });
            });
        }
Beispiel #3
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
    }