Header() private static méthode

private static Header ( Rect rect, float maxLightmaps ) : void
rect UnityEngine.Rect
maxLightmaps float
Résultat void
        public void LightmapPreview(Rect r)
        {
            if (LightingWindowLightmapPreviewTab.s_Styles == null)
            {
                LightingWindowLightmapPreviewTab.s_Styles = new LightingWindowLightmapPreviewTab.Styles();
            }
            bool flag = true;

            GUI.Box(r, string.Empty, "PreBackground");
            this.m_ScrollPositionLightmaps = EditorGUILayout.BeginScrollView(this.m_ScrollPositionLightmaps, new GUILayoutOption[]
            {
                GUILayout.Height(r.height)
            });
            int   num  = 0;
            float num2 = 2f;

            LightmapData[] lightmaps = LightmapSettings.lightmaps;
            for (int i = 0; i < lightmaps.Length; i++)
            {
                LightmapData lightmapData = lightmaps[i];
                if (lightmapData.lightmapFar == null && lightmapData.lightmapNear == null)
                {
                    num++;
                }
                else
                {
                    int               num3      = (!lightmapData.lightmapFar) ? -1 : Math.Max(lightmapData.lightmapFar.width, lightmapData.lightmapFar.height);
                    int               num4      = (!lightmapData.lightmapNear) ? -1 : Math.Max(lightmapData.lightmapNear.width, lightmapData.lightmapNear.height);
                    Texture2D         texture2D = (num3 <= num4) ? lightmapData.lightmapNear : lightmapData.lightmapFar;
                    GUILayoutOption[] options   = new GUILayoutOption[]
                    {
                        GUILayout.MaxWidth((float)texture2D.width * num2),
                        GUILayout.MaxHeight((float)texture2D.height)
                    };
                    Rect aspectRect = GUILayoutUtility.GetAspectRect((float)texture2D.width * num2 / (float)texture2D.height, options);
                    if (flag)
                    {
                        LightingWindowLightmapPreviewTab.Header(ref aspectRect, 20f, 6f, num2);
                        flag = false;
                    }
                    aspectRect.width /= num2;
                    EditorGUI.DrawPreviewTexture(aspectRect, lightmapData.lightmapFar);
                    this.MenuSelectLightmapUsers(aspectRect, num);
                    if (lightmapData.lightmapNear)
                    {
                        aspectRect.x += aspectRect.width;
                        EditorGUI.DrawPreviewTexture(aspectRect, lightmapData.lightmapNear);
                        this.MenuSelectLightmapUsers(aspectRect, num);
                    }
                    num++;
                }
            }
            EditorGUILayout.EndScrollView();
        }
Exemple #2
0
        public void LightmapPreview(Rect r)
        {
            if (LightingWindowLightmapPreviewTab.s_Styles == null)
            {
                LightingWindowLightmapPreviewTab.s_Styles = new LightingWindowLightmapPreviewTab.Styles();
            }
            GUI.Box(r, "", "PreBackground");
            this.m_ScrollPositionLightmaps = EditorGUILayout.BeginScrollView(this.m_ScrollPositionLightmaps, new GUILayoutOption[]
            {
                GUILayout.Height(r.height)
            });
            int   num  = 0;
            float num2 = 2f;
            Rect  rect = GUILayoutUtility.GetRect(r.width, r.width, 20f, 20f);

            LightingWindowLightmapPreviewTab.Header(rect, num2);
            LightmapData[] lightmaps = LightmapSettings.lightmaps;
            for (int i = 0; i < lightmaps.Length; i++)
            {
                LightmapData lightmapData = lightmaps[i];
                if (lightmapData.lightmapLight == null && lightmapData.lightmapDir == null)
                {
                    num++;
                }
                else
                {
                    int               num3      = (!lightmapData.lightmapLight) ? -1 : Math.Max(lightmapData.lightmapLight.width, lightmapData.lightmapLight.height);
                    int               num4      = (!lightmapData.lightmapDir) ? -1 : Math.Max(lightmapData.lightmapDir.width, lightmapData.lightmapDir.height);
                    Texture2D         texture2D = (num3 <= num4) ? lightmapData.lightmapDir : lightmapData.lightmapLight;
                    GUILayoutOption[] options   = new GUILayoutOption[]
                    {
                        GUILayout.MaxWidth(r.width),
                        GUILayout.MaxHeight((float)Mathf.Min(new int[]
                        {
                            texture2D.height
                        }))
                    };
                    Rect aspectRect = GUILayoutUtility.GetAspectRect(num2, options);
                    aspectRect.width -= 5f;
                    aspectRect.width /= num2;
                    EditorGUI.DrawPreviewTexture(aspectRect, lightmapData.lightmapLight);
                    this.MenuSelectLightmapUsers(aspectRect, num);
                    if (lightmapData.lightmapDir)
                    {
                        aspectRect.x += aspectRect.width + 5f;
                        EditorGUI.DrawPreviewTexture(aspectRect, lightmapData.lightmapDir);
                        this.MenuSelectLightmapUsers(aspectRect, num);
                    }
                    GUILayout.Space(10f);
                    num++;
                }
            }
            EditorGUILayout.EndScrollView();
        }
        public void LightmapPreview(Rect r)
        {
            if (LightingWindowLightmapPreviewTab.s_Styles == null)
            {
                LightingWindowLightmapPreviewTab.s_Styles = new LightingWindowLightmapPreviewTab.Styles();
            }
            bool flag = true;

            GUI.Box(r, string.Empty, (GUIStyle)"PreBackground");
            this.m_ScrollPositionLightmaps = EditorGUILayout.BeginScrollView(this.m_ScrollPositionLightmaps, GUILayout.Height(r.height));
            int   lightmapIndex = 0;
            float maxLightmaps  = 2f;

            foreach (LightmapData lightmap in LightmapSettings.lightmaps)
            {
                if ((UnityEngine.Object)lightmap.lightmapFar == (UnityEngine.Object)null && (UnityEngine.Object)lightmap.lightmapNear == (UnityEngine.Object)null)
                {
                    ++lightmapIndex;
                }
                else
                {
                    Texture2D         texture2D            = (!(bool)((UnityEngine.Object)lightmap.lightmapFar) ? -1 : Math.Max(lightmap.lightmapFar.width, lightmap.lightmapFar.height)) <= (!(bool)((UnityEngine.Object)lightmap.lightmapNear) ? -1 : Math.Max(lightmap.lightmapNear.width, lightmap.lightmapNear.height)) ? lightmap.lightmapNear : lightmap.lightmapFar;
                    GUILayoutOption[] guiLayoutOptionArray = new GUILayoutOption[2] {
                        GUILayout.MaxWidth((float)texture2D.width * maxLightmaps), GUILayout.MaxHeight((float)texture2D.height)
                    };
                    Rect aspectRect = GUILayoutUtility.GetAspectRect((float)texture2D.width * maxLightmaps / (float)texture2D.height, guiLayoutOptionArray);
                    if (flag)
                    {
                        LightingWindowLightmapPreviewTab.Header(ref aspectRect, 20f, 6f, maxLightmaps);
                        flag = false;
                    }
                    aspectRect.width /= maxLightmaps;
                    EditorGUI.DrawPreviewTexture(aspectRect, (Texture)lightmap.lightmapFar);
                    this.MenuSelectLightmapUsers(aspectRect, lightmapIndex);
                    if ((bool)((UnityEngine.Object)lightmap.lightmapNear))
                    {
                        aspectRect.x += aspectRect.width;
                        EditorGUI.DrawPreviewTexture(aspectRect, (Texture)lightmap.lightmapNear);
                        this.MenuSelectLightmapUsers(aspectRect, lightmapIndex);
                    }
                    ++lightmapIndex;
                }
            }
            EditorGUILayout.EndScrollView();
        }