Inheritance: IDisposable
Ejemplo n.º 1
0
        public void CleanupUntouchedEditors()
        {
            List <UnityEngine.Object> list = new List <UnityEngine.Object>();

            foreach (UnityEngine.Object obj2 in this.m_EditorCache.Keys)
            {
                if (!this.m_UsedEditors.ContainsKey(obj2))
                {
                    list.Add(obj2);
                }
            }
            if (this.m_EditorCache != null)
            {
                foreach (UnityEngine.Object obj3 in list)
                {
                    EditorWrapper wrapper = this.m_EditorCache[obj3];
                    this.m_EditorCache.Remove(obj3);
                    if (wrapper != null)
                    {
                        wrapper.Dispose();
                    }
                }
            }
            this.m_UsedEditors.Clear();
        }
Ejemplo n.º 2
0
        private void WidePreview(float actualSize, string s, UnityEngine.Object o, EditorWrapper p)
        {
            float num       = 5f;
            Rect  position  = new Rect(num, this.m_TopSize + num, actualSize - num * 2f, actualSize - num * 2f);
            Rect  position2 = new Rect(this.m_PreviewSize + 3f, this.m_TopSize + (this.m_PreviewSize - 75f) * 0.5f, this.m_Parent.window.position.width - this.m_PreviewSize - 3f - num, 75f);

            if (p != null && p.HasPreviewGUI())
            {
                p.OnPreviewGUI(position, this.m_Styles.previewTextureBackground);
            }
            else
            {
                if (o != null)
                {
                    this.DrawObjectIcon(position, this.m_ListArea.m_SelectedObjectIcon);
                }
            }
            if (EditorGUIUtility.isProSkin)
            {
                EditorGUI.DropShadowLabel(position2, s, this.m_Styles.smallStatus);
            }
            else
            {
                GUI.Label(position2, s, this.m_Styles.smallStatus);
            }
        }
Ejemplo n.º 3
0
        public void CleanupUntouchedEditors()
        {
            List <UnityEngine.Object> list = new List <UnityEngine.Object>();

            foreach (UnityEngine.Object current in m_EditorCache.Keys)
            {
                if (!m_UsedEditors.ContainsKey(current))
                {
                    list.Add(current);
                }
            }
            if (m_EditorCache != null)
            {
                foreach (UnityEngine.Object current2 in list)
                {
                    EditorWrapper editorWrapper = m_EditorCache[current2];
                    m_EditorCache.Remove(current2);
                    if (editorWrapper != null)
                    {
                        editorWrapper.Dispose();
                    }
                }
            }
            m_UsedEditors.Clear();
        }
Ejemplo n.º 4
0
        public void CleanupUntouchedEditors()
        {
            if (m_EditorCache != null)
            {
                List <Object> toDelete = new List <Object>();
                foreach (Object key in m_EditorCache.Keys)
                {
                    if (!m_UsedEditors.ContainsKey(key))
                    {
                        toDelete.Add(key);
                    }
                }

                foreach (Object key in toDelete)
                {
                    EditorWrapper ew = m_EditorCache[key];
                    m_EditorCache.Remove(key);

                    if (ew == null)
                    {
                        continue;
                    }
                    ew.Dispose();
                }
            }

            m_UsedEditors.Clear();
        }
Ejemplo n.º 5
0
        void WidePreview(float actualSize, string s, UnityObject o, EditorWrapper p)
        {
            float margin      = kPreviewMargin;
            Rect  previewRect = new Rect(margin, m_TopSize + margin, actualSize - margin * 2, actualSize - margin * 2);

            Rect labelRect = new Rect(m_PreviewSize + 3, m_TopSize + (m_PreviewSize - kPreviewExpandedAreaHeight) * 0.5f, m_Parent.window.position.width - m_PreviewSize - 3 - margin, kPreviewExpandedAreaHeight);

            if (p != null && p.HasPreviewGUI())
            {
                p.OnPreviewGUI(previewRect, Styles.previewTextureBackground);
            }
            else if (o != null)
            {
                DrawObjectIcon(previewRect, m_ListArea.m_SelectedObjectIcon);
            }

            if (EditorGUIUtility.isProSkin)
            {
                EditorGUI.DropShadowLabel(labelRect, s, Styles.smallStatus);
            }
            else
            {
                GUI.Label(labelRect, s, Styles.smallStatus);
            }
        }
Ejemplo n.º 6
0
        public void CleanupUntouchedEditors()
        {
            List <UnityEngine.Object> objectList = new List <UnityEngine.Object>();

            using (Dictionary <UnityEngine.Object, EditorWrapper> .KeyCollection.Enumerator enumerator = this.m_EditorCache.Keys.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    UnityEngine.Object current = enumerator.Current;
                    if (!this.m_UsedEditors.ContainsKey(current))
                    {
                        objectList.Add(current);
                    }
                }
            }
            if (this.m_EditorCache != null)
            {
                using (List <UnityEngine.Object> .Enumerator enumerator = objectList.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        UnityEngine.Object current       = enumerator.Current;
                        EditorWrapper      editorWrapper = this.m_EditorCache[current];
                        this.m_EditorCache.Remove(current);
                        if (editorWrapper != null)
                        {
                            editorWrapper.Dispose();
                        }
                    }
                }
            }
            this.m_UsedEditors.Clear();
        }
Ejemplo n.º 7
0
 public static EditorWrapper Make(UnityEngine.Object obj, EditorFeatures requirements)
 {
   EditorWrapper editorWrapper = new EditorWrapper();
   if (editorWrapper.Init(obj, requirements))
     return editorWrapper;
   editorWrapper.Dispose();
   return (EditorWrapper) null;
 }
Ejemplo n.º 8
0
 public static EditorWrapper Make(UnityEngine.Object obj, EditorFeatures requirements)
 {
     EditorWrapper wrapper = new EditorWrapper();
     if (wrapper.Init(obj, requirements))
     {
         return wrapper;
     }
     wrapper.Dispose();
     return null;
 }
Ejemplo n.º 9
0
        public static EditorWrapper Make(UnityEngine.Object obj, EditorFeatures requirements)
        {
            EditorWrapper wrapper = new EditorWrapper();

            if (wrapper.Init(obj, requirements))
            {
                return(wrapper);
            }
            wrapper.Dispose();
            return(null);
        }
Ejemplo n.º 10
0
        public override void OnPreviewSettings()
        {
            AssetStoreAsset firstAsset = AssetStoreAssetSelection.GetFirstAsset();

            if (firstAsset != null)
            {
                EditorWrapper previewEditor = this.previewEditor;
                if (previewEditor != null && firstAsset.HasLivePreview)
                {
                    previewEditor.OnPreviewSettings();
                }
            }
        }
Ejemplo n.º 11
0
 public EditorWrapper this[UnityEngine.Object o]
 {
     get
     {
         this.m_UsedEditors[o] = true;
         if (this.m_EditorCache.ContainsKey(o))
         {
             return(this.m_EditorCache[o]);
         }
         EditorWrapper wrapper3 = EditorWrapper.Make(o, this.m_Requirements);
         this.m_EditorCache[o] = wrapper3;
         return(wrapper3);
     }
 }
Ejemplo n.º 12
0
 public void OnDisable()
 {
     EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, new EditorApplication.CallbackFunction(this.Update));
     if (this.m_PreviewEditor != null)
     {
         this.m_PreviewEditor.Dispose();
         this.m_PreviewEditor = null;
     }
     if (this.m_PreviewObject != null)
     {
         this.m_PreviewObject = null;
     }
     AssetStoreUtils.UnRegisterDownloadDelegate(this);
 }
Ejemplo n.º 13
0
 public void OnDisable()
 {
     EditorApplication.update -= Update;
     if (m_PreviewEditor != null)
     {
         m_PreviewEditor.Dispose();
         m_PreviewEditor = null;
     }
     if (m_PreviewObject != null)
     {
         m_PreviewObject = null;
     }
     AssetStoreUtils.UnRegisterDownloadDelegate(this);
 }
Ejemplo n.º 14
0
        static public EditorWrapper Make(Object obj, EditorFeatures requirements)
        {
            EditorWrapper cp = new EditorWrapper();

            if (cp.Init(obj, requirements))
            {
                return(cp);
            }
            else
            {
                cp.Dispose();
                return(null);
            }
        }
Ejemplo n.º 15
0
        public EditorWrapper this[Object o]
        {
            get
            {
                m_UsedEditors[o] = true;
                if (m_EditorCache.ContainsKey(o))
                {
                    return(m_EditorCache[o]);
                }

                EditorWrapper w = EditorWrapper.Make(o, m_Requirements);
                return(m_EditorCache[o] = w);
            }
        }
 public void OnDisable()
 {
     EditorApplication.update -= new EditorApplication.CallbackFunction(this.Update);
     if (this.m_PreviewEditor != null)
     {
         this.m_PreviewEditor.Dispose();
         this.m_PreviewEditor = (EditorWrapper)null;
     }
     if (this.m_PreviewObject != (Object)null)
     {
         this.m_PreviewObject = (Object)null;
     }
     AssetStoreUtils.UnRegisterDownloadDelegate((ScriptableObject)this);
 }
Ejemplo n.º 17
0
        public override string GetInfoString()
        {
            EditorWrapper   previewEditor = this.previewEditor;
            AssetStoreAsset firstAsset    = AssetStoreAssetSelection.GetFirstAsset();

            if (firstAsset == null)
            {
                return("No item selected");
            }
            if ((previewEditor != null) && firstAsset.HasLivePreview)
            {
                return(previewEditor.GetInfoString());
            }
            return(string.Empty);
        }
Ejemplo n.º 18
0
 public EditorWrapper this[UnityEngine.Object o]
 {
     get
     {
         m_UsedEditors[o] = true;
         if (m_EditorCache.ContainsKey(o))
         {
             return(m_EditorCache[o]);
         }
         EditorWrapper editorWrapper  = EditorWrapper.Make(o, m_Requirements);
         EditorWrapper editorWrapper2 = editorWrapper;
         m_EditorCache[o] = editorWrapper2;
         return(editorWrapper2);
     }
 }
Ejemplo n.º 19
0
 public override void OnPreviewGUI(Rect r, GUIStyle background)
 {
     if (!(this.m_PreviewObject == null))
     {
         EditorWrapper previewEditor = this.previewEditor;
         if (previewEditor != null && this.m_PreviewObject is AnimationClip)
         {
             previewEditor.OnPreviewGUI(r, background);
         }
         else
         {
             this.OnInteractivePreviewGUI(r, background);
         }
     }
 }
Ejemplo n.º 20
0
        public static EditorWrapper Make(UnityEngine.Object obj, EditorFeatures requirements)
        {
            EditorWrapper editorWrapper = new EditorWrapper();
            EditorWrapper result;

            if (editorWrapper.Init(obj, requirements))
            {
                result = editorWrapper;
            }
            else
            {
                editorWrapper.Dispose();
                result = null;
            }
            return(result);
        }
Ejemplo n.º 21
0
        public override void OnPreviewSettings()
        {
            AssetStoreAsset asset = AssetStoreAssetSelection.GetFirstAsset();

            if (asset == null)
            {
                return;
            }

            EditorWrapper editor = previewEditor;

            if (editor != null && asset.HasLivePreview)
            {
                editor.OnPreviewSettings();
            }
        }
        public override void OnPreviewSettings()
        {
            AssetStoreAsset firstAsset = AssetStoreAssetSelection.GetFirstAsset();

            if (firstAsset == null)
            {
                return;
            }
            EditorWrapper previewEditor = this.previewEditor;

            if (previewEditor == null || !firstAsset.HasLivePreview)
            {
                return;
            }
            previewEditor.OnPreviewSettings();
        }
Ejemplo n.º 23
0
        private void LinePreview(string s, UnityEngine.Object o, EditorWrapper p)
        {
            if (this.m_ListArea.m_SelectedObjectIcon != null)
            {
                GUI.DrawTexture(new Rect(2f, (float)((int)(this.m_TopSize + 2f)), 16f, 16f), this.m_ListArea.m_SelectedObjectIcon, ScaleMode.StretchToFill);
            }
            Rect position = new Rect(20f, this.m_TopSize + 1f, base.position.width - 22f, 18f);

            if (EditorGUIUtility.isProSkin)
            {
                EditorGUI.DropShadowLabel(position, s, this.m_Styles.smallStatus);
            }
            else
            {
                GUI.Label(position, s, this.m_Styles.smallStatus);
            }
        }
Ejemplo n.º 24
0
        public override string GetInfoString()
        {
            EditorWrapper   editor = previewEditor;
            AssetStoreAsset a      = AssetStoreAssetSelection.GetFirstAsset();

            if (a == null)
            {
                return("No item selected");
            }

            if (editor != null && a.HasLivePreview)
            {
                return(editor.GetInfoString());
            }

            return("");
        }
Ejemplo n.º 25
0
        void LinePreview(string s, UnityObject o, EditorWrapper p)
        {
            if (m_ListArea.m_SelectedObjectIcon != null)
            {
                GUI.DrawTexture(new Rect(2, (int)(m_TopSize + 2), 16, 16), m_ListArea.m_SelectedObjectIcon, ScaleMode.StretchToFill);
            }
            Rect labelRect = new Rect(20, m_TopSize + 1, position.width - 22, 18);

            if (EditorGUIUtility.isProSkin)
            {
                EditorGUI.DropShadowLabel(labelRect, s, Styles.smallStatus);
            }
            else
            {
                GUI.Label(labelRect, s, Styles.smallStatus);
            }
        }
Ejemplo n.º 26
0
        public override void OnInteractivePreviewGUI(Rect r, GUIStyle background)
        {
            EditorWrapper previewEditor = this.previewEditor;

            if (previewEditor != null)
            {
                previewEditor.OnInteractivePreviewGUI(r, background);
            }
            AssetStoreAsset firstAsset = AssetStoreAssetSelection.GetFirstAsset();

            if (firstAsset != null && !firstAsset.HasLivePreview && !string.IsNullOrEmpty(firstAsset.dynamicPreviewURL))
            {
                GUIContent statusWheel = AssetStoreAssetInspector.StatusWheel;
                r.y += (r.height - (float)statusWheel.image.height) / 2f;
                r.x += (r.width - (float)statusWheel.image.width) / 2f;
                GUI.Label(r, AssetStoreAssetInspector.StatusWheel);
                base.Repaint();
            }
        }
Ejemplo n.º 27
0
 public EditorWrapper this[UnityEngine.Object o]
 {
     get
     {
         this.m_UsedEditors[o] = true;
         EditorWrapper result;
         if (this.m_EditorCache.ContainsKey(o))
         {
             result = this.m_EditorCache[o];
         }
         else
         {
             EditorWrapper editorWrapper  = EditorWrapper.Make(o, this.m_Requirements);
             EditorWrapper editorWrapper2 = editorWrapper;
             this.m_EditorCache[o] = editorWrapper2;
             result = editorWrapper2;
         }
         return(result);
     }
 }
Ejemplo n.º 28
0
        public override string GetInfoString()
        {
            EditorWrapper   previewEditor = this.previewEditor;
            AssetStoreAsset firstAsset    = AssetStoreAssetSelection.GetFirstAsset();
            string          result;

            if (firstAsset == null)
            {
                result = "No item selected";
            }
            else if (previewEditor != null && firstAsset.HasLivePreview)
            {
                result = previewEditor.GetInfoString();
            }
            else
            {
                result = "";
            }
            return(result);
        }
Ejemplo n.º 29
0
        public override void OnInteractivePreviewGUI(Rect r, GUIStyle background)
        {
            EditorWrapper editor = previewEditor;

            if (editor != null)
            {
                editor.OnInteractivePreviewGUI(r, background);
            }

            // If the live preview is not available yes the show a spinner
            AssetStoreAsset a = AssetStoreAssetSelection.GetFirstAsset();

            if (a != null && !a.HasLivePreview && !string.IsNullOrEmpty(a.dynamicPreviewURL))
            {
                GUIContent c = StatusWheel;
                r.y += (r.height - c.image.height) / 2f;
                r.x += (r.width - c.image.width) / 2f;
                GUI.Label(r, StatusWheel);
                Repaint();
            }
        }
Ejemplo n.º 30
0
        private void OverlapPreview(float actualSize, string s, Object o, EditorWrapper p)
        {
            float x        = 5f;
            Rect  position = new Rect(x, this.m_TopSize + x, base.position.width - (x * 2f), actualSize - (x * 2f));

            if ((p != null) && p.HasPreviewGUI())
            {
                p.OnPreviewGUI(position, this.m_Styles.previewTextureBackground);
            }
            else if (o != null)
            {
                this.DrawObjectIcon(position, this.m_ListArea.m_SelectedObjectIcon);
            }
            if (EditorGUIUtility.isProSkin)
            {
                EditorGUI.DropShadowLabel(position, s, this.m_Styles.largeStatus);
            }
            else
            {
                EditorGUI.DoDropShadowLabel(position, EditorGUIUtility.TempContent(s), this.m_Styles.largeStatus, 0.3f);
            }
        }
Ejemplo n.º 31
0
        public override void OnPreviewGUI(Rect r, GUIStyle background)
        {
            if (m_PreviewObject == null)
            {
                return;
            }
            EditorWrapper editor = previewEditor;

            // Special handling for animation clips because they only have
            // an interactive preview available which shows play button etc.
            // The OnPreviewGUI is also used for the small icons in the top
            // of the inspectors where buttons should not be rendered.

            if (editor != null && m_PreviewObject is AnimationClip)
            {
                editor.OnPreviewGUI(r, background); // currently renders nothing for animation clips
            }
            else
            {
                OnInteractivePreviewGUI(r, background);
            }
        }
Ejemplo n.º 32
0
        void OverlapPreview(float actualSize, string s, UnityObject o, EditorWrapper p)
        {
            float margin      = kPreviewMargin;
            Rect  previewRect = new Rect(margin, m_TopSize + margin, position.width - margin * 2, actualSize - margin * 2);

            if (p != null && p.HasPreviewGUI())
            {
                p.OnPreviewGUI(previewRect, Styles.previewTextureBackground);
            }
            else if (o != null)
            {
                DrawObjectIcon(previewRect, m_ListArea.m_SelectedObjectIcon);
            }

            if (EditorGUIUtility.isProSkin)
            {
                EditorGUI.DropShadowLabel(previewRect, s, Styles.largeStatus);
            }
            else
            {
                EditorGUI.DoDropShadowLabel(previewRect, EditorGUIUtility.TempContent(s), Styles.largeStatus, .3f);
            }
        }
Ejemplo n.º 33
0
		private void LinePreview(string s, UnityEngine.Object o, EditorWrapper p)
		{
			if (this.m_ListArea.m_SelectedObjectIcon != null)
			{
				GUI.DrawTexture(new Rect(2f, (float)((int)(this.m_TopSize + 2f)), 16f, 16f), this.m_ListArea.m_SelectedObjectIcon, ScaleMode.StretchToFill);
			}
			Rect position = new Rect(20f, this.m_TopSize + 1f, base.position.width - 22f, 18f);
			if (EditorGUIUtility.isProSkin)
			{
				EditorGUI.DropShadowLabel(position, s, this.m_Styles.smallStatus);
			}
			else
			{
				GUI.Label(position, s, this.m_Styles.smallStatus);
			}
		}
Ejemplo n.º 34
0
		private void OverlapPreview(float actualSize, string s, UnityEngine.Object o, EditorWrapper p)
		{
			float num = 5f;
			Rect position = new Rect(num, this.m_TopSize + num, base.position.width - num * 2f, actualSize - num * 2f);
			if (p != null && p.HasPreviewGUI())
			{
				p.OnPreviewGUI(position, this.m_Styles.previewTextureBackground);
			}
			else
			{
				if (o != null)
				{
					this.DrawObjectIcon(position, this.m_ListArea.m_SelectedObjectIcon);
				}
			}
			if (EditorGUIUtility.isProSkin)
			{
				EditorGUI.DropShadowLabel(position, s, this.m_Styles.largeStatus);
			}
			else
			{
				EditorGUI.DoDropShadowLabel(position, EditorGUIUtility.TempContent(s), this.m_Styles.largeStatus, 0.3f);
			}
		}
Ejemplo n.º 35
0
		private void WidePreview(float actualSize, string s, UnityEngine.Object o, EditorWrapper p)
		{
			float num = 5f;
			Rect position = new Rect(num, this.m_TopSize + num, actualSize - num * 2f, actualSize - num * 2f);
			Rect position2 = new Rect(this.m_PreviewSize + 3f, this.m_TopSize + (this.m_PreviewSize - 75f) * 0.5f, this.m_Parent.window.position.width - this.m_PreviewSize - 3f - num, 75f);
			if (p != null && p.HasPreviewGUI())
			{
				p.OnPreviewGUI(position, this.m_Styles.previewTextureBackground);
			}
			else
			{
				if (o != null)
				{
					this.DrawObjectIcon(position, this.m_ListArea.m_SelectedObjectIcon);
				}
			}
			if (EditorGUIUtility.isProSkin)
			{
				EditorGUI.DropShadowLabel(position2, s, this.m_Styles.smallStatus);
			}
			else
			{
				GUI.Label(position2, s, this.m_Styles.smallStatus);
			}
		}
 public void OnDisable()
 {
   EditorApplication.update -= new EditorApplication.CallbackFunction(this.Update);
   if (this.m_PreviewEditor != null)
   {
     this.m_PreviewEditor.Dispose();
     this.m_PreviewEditor = (EditorWrapper) null;
   }
   if (this.m_PreviewObject != (Object) null)
     this.m_PreviewObject = (Object) null;
   AssetStoreUtils.UnRegisterDownloadDelegate((ScriptableObject) this);
 }
		public void OnDisable()
		{
			EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, new EditorApplication.CallbackFunction(this.Update));
			if (this.m_PreviewEditor != null)
			{
				this.m_PreviewEditor.Dispose();
				this.m_PreviewEditor = null;
			}
			if (this.m_PreviewObject != null)
			{
				this.m_PreviewObject = null;
			}
			AssetStoreUtils.UnRegisterDownloadDelegate(this);
		}
Ejemplo n.º 38
0
 private void WidePreview(float actualSize, string s, Object o, EditorWrapper p)
 {
     float x = 5f;
     Rect position = new Rect(x, this.m_TopSize + x, actualSize - (x * 2f), actualSize - (x * 2f));
     Rect rect2 = new Rect(this.m_PreviewSize + 3f, this.m_TopSize + ((this.m_PreviewSize - 75f) * 0.5f), ((base.m_Parent.window.position.width - this.m_PreviewSize) - 3f) - x, 75f);
     if ((p != null) && p.HasPreviewGUI())
     {
         p.OnPreviewGUI(position, this.m_Styles.previewTextureBackground);
     }
     else if (o != null)
     {
         this.DrawObjectIcon(position, this.m_ListArea.m_SelectedObjectIcon);
     }
     if (EditorGUIUtility.isProSkin)
     {
         EditorGUI.DropShadowLabel(rect2, s, this.m_Styles.smallStatus);
     }
     else
     {
         GUI.Label(rect2, s, this.m_Styles.smallStatus);
     }
 }
Ejemplo n.º 39
0
 private void WidePreview(float actualSize, string s, UnityEngine.Object o, EditorWrapper p)
 {
   float x = 5f;
   Rect position1 = new Rect(x, this.m_TopSize + x, actualSize - x * 2f, actualSize - x * 2f);
   Rect position2 = new Rect(this.m_PreviewSize + 3f, this.m_TopSize + (float) (((double) this.m_PreviewSize - 75.0) * 0.5), (float) ((double) this.m_Parent.window.position.width - (double) this.m_PreviewSize - 3.0) - x, 75f);
   if (p != null && p.HasPreviewGUI())
     p.OnPreviewGUI(position1, this.m_Styles.previewTextureBackground);
   else if (o != (UnityEngine.Object) null)
     this.DrawObjectIcon(position1, this.m_ListArea.m_SelectedObjectIcon);
   if (EditorGUIUtility.isProSkin)
     EditorGUI.DropShadowLabel(position2, s, this.m_Styles.smallStatus);
   else
     GUI.Label(position2, s, this.m_Styles.smallStatus);
 }