private void Init(DeviceInfo deviceInfo, ScreenSimulation screenSimulation, SimulationPlayerSettings playerSettings) { m_ScreenWidthField = m_RootElement.Q <IntegerField>("screen-width"); m_ScreenHeightField = m_RootElement.Q <IntegerField>("screen-height"); m_ScreenSetResolution = m_RootElement.Q <Button>("screen-set-resolution-button"); m_ScreenSetResolution.clickable = new Clickable(SetResolution); m_FullScreenToggle = m_RootElement.Q <Toggle>("full-screen"); m_FullScreenToggle.RegisterValueChangedCallback(SetFullScreen); m_AutoRotationToggle = m_RootElement.Q <Toggle>("auto-rotation"); m_AutoRotationToggle.RegisterValueChangedCallback(SetAutoRotation); m_ScreenOrientationEnumField = m_RootElement.Q <EnumField>("screen-orientations"); m_ScreenOrientationEnumField.Init(RenderedScreenOrientation.Portrait); m_ScreenOrientationEnumField.RegisterValueChangedCallback(SetScreenOrientation); m_RenderedOrientationContainer = m_RootElement.Q <VisualElement>("rendered-orientation-container"); m_RendererOrientation = m_RootElement.Q <Label>("rendered-orientation"); m_AllowedOrientationsSection = m_RootElement.Q <VisualElement>("allowed-orientations"); m_AllowedPortrait = m_RootElement.Q <Toggle>("orientation-allow-portrait"); m_AllowedPortrait.RegisterValueChangedCallback((evt) => { Screen.autorotateToPortrait = evt.newValue; }); m_AllowedPortraitUpsideDown = m_RootElement.Q <Toggle>("orientation-allow-portrait-upside-down"); m_AllowedPortraitUpsideDown.RegisterValueChangedCallback((evt) => { Screen.autorotateToPortraitUpsideDown = evt.newValue; }); m_AllowedLandscapeLeft = m_RootElement.Q <Toggle>("orientation-allow-landscape-left"); m_AllowedLandscapeLeft.RegisterValueChangedCallback((evt) => { Screen.autorotateToLandscapeLeft = evt.newValue; }); m_AllowedLandscapeRight = m_RootElement.Q <Toggle>("orientation-allow-landscape-right"); m_AllowedLandscapeRight.RegisterValueChangedCallback((evt) => { Screen.autorotateToLandscapeRight = evt.newValue; }); // Initialized the control states. UpdateOrientationVisualElements(screenSimulation.AutoRotation); UpdateAllowedOrientationVisualElements(); Update(deviceInfo, screenSimulation, playerSettings); }
// Only gets called during initialization and switching device. public void Update(DeviceInfo deviceInfo, SystemInfoSimulation systemInfoSimulation, ScreenSimulation screenSimulation, SimulationPlayerSettings playerSettings) { if (deviceInfo == null) { return; } UpdateDeviceSpecifications(deviceInfo, systemInfoSimulation); m_SimulatorScreenSettings.Update(deviceInfo, screenSimulation, playerSettings); }
public SimulatorControlPanel(VisualElement rootElement, DeviceInfo deviceInfo, SystemInfoSimulation systemInfoSimulation, ScreenSimulation screenSimulation, SimulationPlayerSettings playerSettings) { m_RootElement = rootElement; InitDeviceSpecifications(); UpdateDeviceSpecifications(deviceInfo, systemInfoSimulation); m_SimulatorScreenSettings = new SimulatorScreenSettingsUI(m_RootElement.Q <VisualElement>("screen-settings"), deviceInfo, screenSimulation, playerSettings); InitDeviceSimulatorExtensions(); }
public SimulatorControlPanel(VisualElement rootElement, DeviceInfo deviceInfo, SystemInfoSimulation systemInfoSimulation, ScreenSimulation screenSimulation, ApplicationSimulation applicationSimulation, SimulationPlayerSettings playerSettings, SimulatorSerializationStates states) { m_RootElement = rootElement; m_DeviceSpecifications = new SimulatorDeviceSpecificationsUI(m_RootElement.Q <Foldout>("device-specifications"), deviceInfo, systemInfoSimulation); m_SimulatorScreenSettings = new SimulatorScreenSettingsUI(m_RootElement.Q <Foldout>("screen-settings"), deviceInfo, screenSimulation, playerSettings); m_SimulatorApplicationSettings = new SimulatorApplicationSettingsUI(m_RootElement.Q <Foldout>("application-settings"), applicationSimulation, states); m_SimulatorExtensions = new SimulatorExtensions(); foreach (var extension in m_SimulatorExtensions.Extensions) { var foldout = new Foldout() { text = extension.extensionTitle, value = false }; foldout.AddToClassList("unity-device-simulator__control-panel_foldout"); m_RootElement.Add(foldout); m_ExtensionFoldouts.Add(extension.GetType().ToString(), foldout); if (states != null && states.extensions.TryGetValue(extension.GetType().ToString(), out var serializedExtension)) { JsonUtility.FromJsonOverwrite(serializedExtension, extension); } extension.OnExtendDeviceSimulator(foldout); } }
public SimulatorScreenSettingsUI(VisualElement rootElement, DeviceInfo deviceInfo, ScreenSimulation screenSimulation, SimulationPlayerSettings playerSettings) { m_RootElement = rootElement; Init(deviceInfo, screenSimulation, playerSettings); }