Ejemplo n.º 1
0
        void DrawElementCallback(Rect rect, int index, bool isActive, bool isFocused)
        {
            var li = m_LoaderMetadata[index];

            if (PackageNotificationUtils.registeredPackagesWithNotifications.TryGetValue(li.packageId, out var notificationInfo))
            {
                PackageNotificationUtils.DrawNotificationIconUI(notificationInfo, rect);
            }

            li.toggled = XRPackageMetadataStore.IsLoaderAssigned(li.loaderType, CurrentBuildTargetGroup);
            var preToggledState = li.toggled;

            EditorGUI.BeginDisabledGroup(li.disabled);

            if (li.customLoaderUI != null)
            {
                li.customLoaderUI.OnGUI(rect);
                li.toggled = li.customLoaderUI.IsLoaderEnabled;
            }
            else
            {
                li.toggled = EditorGUI.ToggleLeft(rect, li.loaderName, preToggledState);
            }

            li.stateChanged         = (li.toggled != preToggledState);
            m_LoaderMetadata[index] = li;
            EditorGUI.EndDisabledGroup();
        }
        void DrawElementCallback(Rect rect, int index, bool isActive, bool isFocused)
        {
            var li = m_LoaderMetadata[index];

            if (PackageNotificationUtils.registeredPackagesWithNotifications.TryGetValue(li.packageId, out var notificationInfo))
            {
                PackageNotificationUtils.DrawNotificationIconUI(notificationInfo, rect);
            }

            li.toggled = XRPackageMetadataStore.IsLoaderAssigned(li.loaderType, CurrentBuildTargetGroup);
            var preToggledState = li.toggled;

            EditorGUI.BeginDisabledGroup(li.disabled);

            if (li.customLoaderUI != null)
            {
                li.customLoaderUI.OnGUI(rect);
                li.toggled = li.customLoaderUI.IsLoaderEnabled;
            }
            else
            {
                string name = li.loaderName;
                if (s_DeprecationInfo.ContainsKey(name))
                {
                    var depInfo = s_DeprecationInfo[name];

                    var labelRect = rect;
                    var size      = EditorStyles.label.CalcSize(depInfo.icon);
                    labelRect.width -= size.y + 1;

                    var imageRect = new Rect(rect);
                    imageRect.xMin  = labelRect.xMax + 1;
                    imageRect.width = size.y;

                    li.toggled = EditorGUI.ToggleLeft(labelRect, li.loaderName, preToggledState);
                    EditorGUI.LabelField(imageRect, depInfo.renderContent);
                }
                else
                {
                    li.toggled = EditorGUI.ToggleLeft(rect, li.loaderName, preToggledState);
                }
            }

            li.stateChanged         = (li.toggled != preToggledState);
            m_LoaderMetadata[index] = li;
            EditorGUI.EndDisabledGroup();
        }