Exemplo n.º 1
0
        internal static void Show()
        {
            WizardWindow      wizard = EditorWindow.CreateInstance <WizardWindow>();
            List <WizardPage> pages  = new List <WizardPage>()
            {
                new WelcomePage(),
                new TrainingSceneSetupPage(),
                new AnalyticsPage(),
                new AllAboutPage()
            };

            int xrSetupIndex = 2;

#if CREATOR_PRO
            if (CreatorPro.Account.UserAccount.IsAllowedToUsePro() == false)
            {
                pages.Insert(1, new CreatorPro.Core.CreatorLoginPage());
                xrSetupIndex++;
            }
#endif
            bool isShowingXRSetupPage = EditorReflectionUtils.AssemblyExists(XRInnoactiveAssemblyName);
            isShowingXRSetupPage &= EditorReflectionUtils.AssemblyExists(XRAssemblyName) == false;
            isShowingXRSetupPage &= XRLoaderHelper.GetCurrentXRConfiguration()
                                    .Contains(XRLoaderHelper.XRConfiguration.XRLegacy) == false;

            if (isShowingXRSetupPage)
            {
                pages.Insert(xrSetupIndex, new XRSDKSetupPage());
            }

            wizard.WizardClosing += OnWizardClosing;

            wizard.Setup("Innoactive Creator - VR Training Setup Wizard", pages);
            wizard.ShowModalUtility();
        }
Exemplo n.º 2
0
        public override GUIContent GetLabel(object value, Type declaredType)
        {
            IData data = ((IDataOwner)value).Data;

            ITrainingDrawer dataDrawer = DrawerLocator.GetDrawerForMember(EditorReflectionUtils.GetFieldsAndPropertiesToDraw(value).First(member => member.Name == "Data"), value);

            return(dataDrawer.GetLabel(data, declaredType));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns a list with all XR SDKs enabled in this project.
        /// </summary>
        public static IEnumerable <XRConfiguration> GetCurrentXRConfiguration()
        {
            List <XRConfiguration> enabledSDKs = new List <XRConfiguration>();

            if (EditorReflectionUtils.AssemblyExists("Unity.XR.Management"))
            {
#if UNITY_XR_MANAGEMENT
                if (XRGeneralSettings.Instance != null)
                {
                    foreach (XRLoader loader in XRGeneralSettings.Instance.Manager.activeLoaders)
                    {
                        if (loader.name == "Oculus Loader")
                        {
                            enabledSDKs.Add(XRConfiguration.OculusXR);
                        }

                        if (loader.name == "Windows MR Loader")
                        {
                            enabledSDKs.Add(XRConfiguration.WindowsMR);
                        }
                    }

                    enabledSDKs.Add(XRConfiguration.XRManagement);
                }
#endif
            }
#if UNITY_2019_1_OR_NEWER && !UNITY_2020_1_OR_NEWER
#pragma warning disable CS0618
            else if (PlayerSettings.virtualRealitySupported)
            {
                foreach (string device in UnityEngine.XR.XRSettings.supportedDevices)
                {
                    if (device == "OpenVR")
                    {
                        enabledSDKs.Add(XRConfiguration.OpenVRLegacy);
                    }

                    if (device == "Oculus")
                    {
                        enabledSDKs.Add(XRConfiguration.OculusLegacy);
                    }
                }
                enabledSDKs.Add(XRConfiguration.XRLegacy);
            }
#pragma warning restore CS0618
#endif

            if (enabledSDKs.Any() == false)
            {
                enabledSDKs.Add(XRConfiguration.None);
            }



            return(enabledSDKs);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Tries to find the given assembly name, and add/removes the symbol according to the existence of it.
 /// </summary>
 /// <param name="assemblyName">The assembly name looked for, just the name, no full name.</param>
 /// <param name="className">The class name looked for.</param>
 /// <param name="symbol">The symbol added/removed.</param>
 public static void CheckForClass(string assemblyName, string className, string symbol)
 {
     if (EditorReflectionUtils.ClassExists(assemblyName, className))
     {
         AddSymbol(symbol);
     }
     else
     {
         RemoveSymbol(symbol);
     }
 }
Exemplo n.º 5
0
        public override Rect Draw(Rect rect, object currentValue, Action <object> changeValueCallback, GUIContent label)
        {
            if (currentValue == null)
            {
                throw new NullReferenceException("Attempting to draw null object.");
            }

            IData data = ((IDataOwner)currentValue).Data;

            ITrainingDrawer dataDrawer = DrawerLocator.GetDrawerForMember(EditorReflectionUtils.GetFieldsAndPropertiesToDraw(currentValue).First(member => member.Name == "Data"), currentValue);

            return(dataDrawer.Draw(rect, data, (value) => changeValueCallback(currentValue), label));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Retrieves and loads the OpenVR XR package.
        /// </summary>
        public static void LoadOpenVR()
        {
            if (GetCurrentXRConfiguration().Any(loader => loader == XRConfiguration.OpenVRXR || loader == XRConfiguration.OpenVRLegacy))
            {
                Debug.LogWarning("OpenVR is already loaded.");
                return;
            }

            EditorPrefs.DeleteKey(IsXRLoaderInitialized);

#if UNITY_2020_1_OR_NEWER
            // This will be integrated as soon as there is an OpenVR XR SDK compatible with the XR interaction framework.
#elif UNITY_2019_1_OR_NEWER
            if (EditorReflectionUtils.AssemblyExists("Unity.XR.Management") == false)
            {
                LoadOpenVRLegacy();
            }
            else
            {
                Debug.LogWarning("OpenVR could not be loaded. XR Plug-in Management must be disabled before start using OpenVR.");
            }
#endif
        }
Exemplo n.º 7
0
 protected virtual IEnumerable <MemberInfo> GetMembersToDraw(object value)
 {
     return(EditorReflectionUtils.GetFieldsAndPropertiesToDraw(value));
 }