private void RefreshRects()
 {
     if (this.m_RectsCache)
     {
         this.m_RectsCache.ClearAll();
         Undo.ClearUndo(this.m_RectsCache);
         UnityEngine.Object.DestroyImmediate(this.m_RectsCache);
     }
     this.m_RectsCache = ScriptableObject.CreateInstance <SpriteRectCache>();
     if (this.m_TextureImporterSprites != null)
     {
         if (this.multipleSprites)
         {
             for (int i = 0; i < this.m_TextureImporterSprites.arraySize; i++)
             {
                 SpriteRect spriteRect = new SpriteRect();
                 spriteRect.LoadFromSerializedProperty(this.m_TextureImporterSprites.GetArrayElementAtIndex(i));
                 this.m_RectsCache.AddRect(spriteRect);
                 EditorUtility.DisplayProgressBar(SpriteEditorWindow.SpriteEditorWindowStyles.loadProgressTitle.text, string.Format(SpriteEditorWindow.SpriteEditorWindowStyles.loadContentText.text, i, this.m_TextureImporterSprites.arraySize), (float)i / (float)this.m_TextureImporterSprites.arraySize);
             }
         }
         else if (this.validSprite)
         {
             SpriteRect spriteRect2 = new SpriteRect();
             spriteRect2.rect               = new Rect(0f, 0f, (float)this.m_Texture.width, (float)this.m_Texture.height);
             spriteRect2.name               = this.m_OriginalTexture.name;
             spriteRect2.alignment          = (SpriteAlignment)this.m_TextureImporterSO.FindProperty("m_Alignment").intValue;
             spriteRect2.border             = this.m_TextureImporter.spriteBorder;
             spriteRect2.pivot              = SpriteEditorUtility.GetPivotValue(spriteRect2.alignment, this.m_TextureImporter.spritePivot);
             spriteRect2.tessellationDetail = this.m_TextureImporterSO.FindProperty("m_SpriteTessellationDetail").floatValue;
             SerializedProperty outlineSP = this.m_TextureImporterSO.FindProperty("m_SpriteSheet.m_Outline");
             spriteRect2.outline = SpriteRect.AcquireOutline(outlineSP);
             SerializedProperty outlineSP2 = this.m_TextureImporterSO.FindProperty("m_SpriteSheet.m_PhysicsShape");
             spriteRect2.physicsShape = SpriteRect.AcquireOutline(outlineSP2);
             this.m_RectsCache.AddRect(spriteRect2);
         }
         EditorUtility.ClearProgressBar();
         if (this.m_RectsCache.Count > 0)
         {
             this.selectedSpriteRect = this.m_RectsCache.RectAt(0);
         }
     }
 }
 private void RefreshRects()
 {
   if (this.m_TextureImporterSprites == null)
     return;
   if ((bool) ((UnityEngine.Object) this.m_RectsCache))
   {
     this.m_RectsCache.ClearAll();
     Undo.ClearUndo((UnityEngine.Object) this.m_RectsCache);
     UnityEngine.Object.DestroyImmediate((UnityEngine.Object) this.m_RectsCache);
   }
   this.m_RectsCache = ScriptableObject.CreateInstance<SpriteRectCache>();
   if (this.multipleSprites)
   {
     for (int index = 0; index < this.m_TextureImporterSprites.arraySize; ++index)
     {
       SpriteRect spriteRect = new SpriteRect();
       spriteRect.m_Rect = this.m_TextureImporterSprites.GetArrayElementAtIndex(index).FindPropertyRelative("m_Rect").rectValue;
       spriteRect.m_Name = this.m_TextureImporterSprites.GetArrayElementAtIndex(index).FindPropertyRelative("m_Name").stringValue;
       spriteRect.m_Alignment = (SpriteAlignment) this.m_TextureImporterSprites.GetArrayElementAtIndex(index).FindPropertyRelative("m_Alignment").intValue;
       spriteRect.m_Border = this.m_TextureImporterSprites.GetArrayElementAtIndex(index).FindPropertyRelative("m_Border").vector4Value;
       spriteRect.m_Pivot = SpriteEditorUtility.GetPivotValue(spriteRect.m_Alignment, this.m_TextureImporterSprites.GetArrayElementAtIndex(index).FindPropertyRelative("m_Pivot").vector2Value);
       SpriteEditorWindow.AcquireOutline(this.m_TextureImporterSprites.GetArrayElementAtIndex(index).FindPropertyRelative("m_Outline"), spriteRect);
       this.m_RectsCache.AddRect(spriteRect);
     }
   }
   else if (this.validSprite)
   {
     SpriteRect spriteRect = new SpriteRect();
     spriteRect.m_Rect = new Rect(0.0f, 0.0f, (float) this.m_Texture.width, (float) this.m_Texture.height);
     spriteRect.m_Name = this.m_OriginalTexture.name;
     spriteRect.m_Alignment = (SpriteAlignment) this.m_TextureImporterSO.FindProperty("m_Alignment").intValue;
     spriteRect.m_Border = this.m_TextureImporter.spriteBorder;
     spriteRect.m_Pivot = SpriteEditorUtility.GetPivotValue(spriteRect.m_Alignment, this.m_TextureImporter.spritePivot);
     SpriteEditorWindow.AcquireOutline(this.m_SpriteSheetOutline, spriteRect);
     this.m_RectsCache.AddRect(spriteRect);
   }
   if (this.m_RectsCache.Count <= 0)
     return;
   this.selected = this.m_RectsCache.RectAt(0);
 }
		private void RefreshRects()
		{
			if (this.m_TextureImporterSprites == null)
			{
				return;
			}
			if (this.m_RectsCache)
			{
				this.m_RectsCache.ClearAll();
				UnityEngine.Object.DestroyImmediate(this.m_RectsCache);
			}
			this.m_RectsCache = ScriptableObject.CreateInstance<SpriteRectCache>();
			if (this.multipleSprites)
			{
				for (int i = 0; i < this.m_TextureImporterSprites.arraySize; i++)
				{
					SpriteRect spriteRect = new SpriteRect();
					spriteRect.m_Rect = this.m_TextureImporterSprites.GetArrayElementAtIndex(i).FindPropertyRelative("m_Rect").rectValue;
					spriteRect.m_Name = this.m_TextureImporterSprites.GetArrayElementAtIndex(i).FindPropertyRelative("m_Name").stringValue;
					spriteRect.m_Alignment = (SpriteAlignment)this.m_TextureImporterSprites.GetArrayElementAtIndex(i).FindPropertyRelative("m_Alignment").intValue;
					spriteRect.m_Border = this.m_TextureImporterSprites.GetArrayElementAtIndex(i).FindPropertyRelative("m_Border").vector4Value;
					spriteRect.m_Pivot = SpriteEditorUtility.GetPivotValue(spriteRect.m_Alignment, this.m_TextureImporterSprites.GetArrayElementAtIndex(i).FindPropertyRelative("m_Pivot").vector2Value);
					this.m_RectsCache.AddRect(spriteRect);
				}
			}
			else
			{
				SpriteRect spriteRect2 = new SpriteRect();
				spriteRect2.m_Rect = new Rect(0f, 0f, (float)this.m_Texture.width, (float)this.m_Texture.height);
				spriteRect2.m_Name = this.m_OriginalTexture.name;
				spriteRect2.m_Alignment = (SpriteAlignment)this.m_TextureImporterSO.FindProperty("m_Alignment").intValue;
				spriteRect2.m_Border = this.m_TextureImporter.spriteBorder;
				spriteRect2.m_Pivot = SpriteEditorUtility.GetPivotValue(spriteRect2.m_Alignment, this.m_TextureImporter.spritePivot);
				this.m_RectsCache.AddRect(spriteRect2);
			}
			if (this.m_RectsCache.Count > 0)
			{
				this.selected = this.m_RectsCache.RectAt(0);
			}
		}