public SimulatorApplicationSettingsUI(Foldout rootElement, ApplicationSimulation applicationSimulation) { m_RootElement = rootElement; m_ApplicationSimulation = applicationSimulation; InitUI(); }
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 SimulatorApplicationSettingsUI(VisualElement rootElement, ApplicationSimulation applicationSimulation) { var visualTree = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>("packages/com.unity.device-simulator/Editor/uxmls/ui_application_settings.uxml"); visualTree.CloneTree(rootElement); m_RootElement = rootElement.Q <Foldout>("application-settings"); m_ApplicationSimulation = applicationSimulation; InitUI(); }
public SimulatorControlPanel(VisualElement rootElement, DeviceInfo deviceInfo, SystemInfoSimulation systemInfoSimulation, ScreenSimulation screenSimulation, ApplicationSimulation applicationSimulation, SimulationPlayerSettings playerSettings) { m_RootElement = rootElement; InitDeviceSpecifications(); UpdateDeviceSpecifications(deviceInfo, systemInfoSimulation); m_SimulatorScreenSettings = new SimulatorScreenSettingsUI(m_RootElement.Q <VisualElement>("screen-settings"), deviceInfo, screenSimulation, playerSettings); m_SimulatorApplicationSettings = new SimulatorApplicationSettingsUI(m_RootElement, applicationSimulation); InitDeviceSimulatorExtensions(); }
public SimulatorApplicationSettingsUI(Foldout rootElement, ApplicationSimulation applicationSimulation, SimulatorSerializationStates states) { m_RootElement = rootElement; m_ApplicationSimulation = applicationSimulation; m_SystemLanguageEnumField = m_RootElement.Q <EnumField>("application-system-language"); m_SystemLanguageEnumField.Init(states?.systemLanguage ?? SystemLanguage.English); m_ApplicationSimulation.ShimmedSystemLanguage = (SystemLanguage)m_SystemLanguageEnumField.value; m_SystemLanguageEnumField.RegisterValueChangedCallback((evt) => { m_ApplicationSimulation.ShimmedSystemLanguage = (SystemLanguage)evt.newValue; }); m_InternetReachabilityEnumField = m_RootElement.Q <EnumField>("application-internet-reachability"); m_InternetReachabilityEnumField.Init(states?.networkReachability ?? NetworkReachability.NotReachable); m_ApplicationSimulation.ShimmedInternetReachability = (NetworkReachability)m_InternetReachabilityEnumField.value; m_InternetReachabilityEnumField.RegisterValueChangedCallback((evt) => { m_ApplicationSimulation.ShimmedInternetReachability = (NetworkReachability)evt.newValue; }); var onLowMemoryButton = m_RootElement.Q <Button>("application-low-memory"); onLowMemoryButton.clickable = new Clickable(() => m_ApplicationSimulation.OnLowMemory()); }