private void DrawElement(Rect elementRect)
        {
            int num  = 86;
            int num2 = (int)((float)base.platformIcon.height / (float)base.platformIcon.height * (float)num);
            int num3 = Mathf.Min(num, base.platformIcon.width);
            int num4 = (int)((float)base.platformIcon.height * (float)num3 / (float)base.platformIcon.width);

            if (Event.current.type == EventType.Repaint)
            {
                this.s_Defaults.boxBackground.Draw(elementRect, false, false, false, false);
            }
            float     num5        = Mathf.Min(elementRect.width, EditorGUIUtility.labelWidth + 4f + 64f + 8f + 86f);
            Rect      contentRect = PlatformIconField.GetContentRect(elementRect, 6f, 12f);
            Rect      position    = new Rect(contentRect.x + contentRect.width - 86f - (float)num - 8f, contentRect.y, (float)num, (float)num2);
            Texture2D texture     = (Texture2D)EditorGUI.ObjectField(position, base.platformIcon.GetTexture(0), typeof(Texture2D), false);

            base.platformIcon.SetTexture(texture, 0);
            Rect rect = new Rect(contentRect.x + contentRect.width - 86f, contentRect.y, (float)num3, (float)num4);

            GUI.Box(rect, "");
            Texture2D platformIconAtSize = PlayerSettings.GetPlatformIconAtSize(this.m_PlatformName, base.platformIcon.width, base.platformIcon.height, base.platformIcon.kind.kind, base.platformIcon.iconSubKind, 0);

            if (platformIconAtSize != null)
            {
                GUI.DrawTexture(PlatformIconField.GetContentRect(rect, 1f, 1f), platformIconAtSize);
            }
            if (this.m_ShowSizeLabel)
            {
                GUI.Label(new Rect(contentRect.x, contentRect.y, num5 - 64f - 8f, 20f), this.m_SizeLabel);
            }
        }
        private void OnElementDraw(Rect rect, int index, bool isActive, bool isFocused)
        {
            string elementLabel = this.GetElementLabel(index);
            float  num          = Mathf.Min(rect.width, EditorGUIUtility.labelWidth + 4f + 86f + 6f);

            GUI.Label(new Rect(rect.x, rect.y, num - 86f - 6f, 20f), elementLabel);
            int  num2     = 86;
            int  num3     = (int)((float)this.m_ImageHeight / (float)this.m_ImageWidth * 86f);
            Rect position = new Rect(rect.x + rect.width - (float)num2 - (float)num2 - 6f, rect.y, (float)num2, (float)num3);

            EditorGUI.BeginChangeCheck();
            this.textures[index] = (Texture2D)EditorGUI.ObjectField(position, this.textures[index], typeof(Texture2D), false);
            if (EditorGUI.EndChangeCheck())
            {
                this.OnChange(this.m_List);
            }
            Rect rect2 = new Rect(rect.x + rect.width - (float)num2, rect.y, (float)num2, (float)num3);

            GUI.Box(rect2, "");
            Texture2D x = this.previewTextures[index];

            if (x != null)
            {
                GUI.DrawTexture(PlatformIconField.GetContentRect(rect2, 1f, 1f), this.previewTextures[index]);
            }
        }
Пример #3
0
        void OnElementDraw(Rect rect, int index, bool isActive, bool isFocused)
        {
            string label = GetElementLabel(index);

            float width = Mathf.Min(rect.width, EditorGUIUtility.labelWidth + 4 + kSlotSize + kIconSpacing);

            GUI.Label(new Rect(rect.x, rect.y, width - kSlotSize - kIconSpacing, 20), label);

            // Texture slot
            int slotWidth   = kSlotSize;
            int slotHeight  = (int)((float)m_ImageHeight / m_ImageWidth * kSlotSize); // take into account the aspect ratio
            var textureRect = new Rect(rect.x + rect.width - slotWidth - slotWidth - kIconSpacing, rect.y, slotWidth, slotHeight);

            EditorGUI.BeginChangeCheck();
            textures[index] = (Texture2D)EditorGUI.ObjectField(textureRect, textures[index], typeof(Texture2D), false);
            if (EditorGUI.EndChangeCheck())
            {
                OnChange(m_List);
            }

            // Preview
            Rect previewRect = new Rect(rect.x + rect.width - slotWidth, rect.y, slotWidth, slotHeight);

            GUI.Box(previewRect, "");

            Texture2D closestIcon = previewTextures[index];

            if (closestIcon != null)
            {
                GUI.DrawTexture(PlatformIconField.GetContentRect(previewRect, 1, 1), previewTextures[index]);
            }
        }