Exemplo n.º 1
0
            // draw the default footer
            public void DrawFooter(Rect rect, ReorderableList list)
            {
                float rightEdge = rect.xMax - 10f;
                float leftEdge  = rightEdge - 8f;

                if (list.displayAdd)
                {
                    leftEdge -= 25;
                }
                if (list.displayRemove)
                {
                    leftEdge -= 25;
                }
                rect = new Rect(leftEdge, rect.y, rightEdge - leftEdge, rect.height);
                Rect addRect    = new Rect(leftEdge + 4, rect.y, 25, 16);
                Rect removeRect = new Rect(rightEdge - 29, rect.y, 25, 16);

                if (Event.current.type == EventType.Repaint)
                {
                    footerBackground.Draw(rect, false, false, false, false);
                }
                if (list.displayAdd)
                {
                    using (new EditorGUI.DisabledScope(
                               list.onCanAddCallback != null && !list.onCanAddCallback(list)))
                    {
                        if (GUI.Button(addRect, list.onAddDropdownCallback != null ? iconToolbarPlusMore : iconToolbarPlus, preButton))
                        {
                            if (list.onAddDropdownCallback != null)
                            {
                                list.onAddDropdownCallback(addRect, list);
                            }
                            else if (list.onAddCallback != null)
                            {
                                list.onAddCallback(list);
                            }
                            else
                            {
                                DoAddButton(list);
                            }

                            if (list.onChangedCallback != null)
                            {
                                list.onChangedCallback(list);
                            }
                        }
                    }
                }
                if (list.displayRemove)
                {
                    using (new EditorGUI.DisabledScope(
                               list.index < 0 || list.index >= list.count ||
                               (list.onCanRemoveCallback != null && !list.onCanRemoveCallback(list))))
                    {
                        if (GUI.Button(removeRect, iconToolbarMinus, preButton))
                        {
                            if (list.onRemoveCallback == null)
                            {
                                DoRemoveButton(list);
                            }
                            else
                            {
                                list.onRemoveCallback(list);
                            }

                            if (list.onChangedCallback != null)
                            {
                                list.onChangedCallback(list);
                            }
                        }
                    }
                }
            }
Exemplo n.º 2
0
            public void DrawFooter(Rect rect, ReorderableList list)
            {
                float xMax = rect.xMax;
                float x    = xMax - 8f;

                if (list.displayAdd)
                {
                    x -= 25f;
                }
                if (list.displayRemove)
                {
                    x -= 25f;
                }
                rect = new Rect(x, rect.y, xMax - x, rect.height);
                Rect rect1    = new Rect(x + 4f, rect.y - 3f, 25f, 13f);
                Rect position = new Rect(xMax - 29f, rect.y - 3f, 25f, 13f);

                if (Event.current.type == EventType.Repaint)
                {
                    this.footerBackground.Draw(rect, false, false, false, false);
                }
                if (list.displayAdd && GUI.Button(rect1, list.onAddDropdownCallback == null ? this.iconToolbarPlus : this.iconToolbarPlusMore, this.preButton))
                {
                    if (list.onAddDropdownCallback != null)
                    {
                        list.onAddDropdownCallback(rect1, list);
                    }
                    else if (list.onAddCallback != null)
                    {
                        list.onAddCallback(list);
                    }
                    else
                    {
                        this.DoAddButton(list);
                    }
                    if (list.onChangedCallback != null)
                    {
                        list.onChangedCallback(list);
                    }
                }
                if (!list.displayRemove)
                {
                    return;
                }
                EditorGUI.BeginDisabledGroup(list.index < 0 || list.index >= list.count || list.onCanRemoveCallback != null && !list.onCanRemoveCallback(list));
                if (GUI.Button(position, this.iconToolbarMinus, this.preButton))
                {
                    if (list.onRemoveCallback == null)
                    {
                        this.DoRemoveButton(list);
                    }
                    else
                    {
                        list.onRemoveCallback(list);
                    }
                    if (list.onChangedCallback != null)
                    {
                        list.onChangedCallback(list);
                    }
                }
                EditorGUI.EndDisabledGroup();
            }
Exemplo n.º 3
0
			public void DrawFooter(Rect rect, ReorderableList list)
			{
				float xMax = rect.xMax;
				float num = xMax - 8f;
				if (list.displayAdd)
				{
					num -= 25f;
				}
				if (list.displayRemove)
				{
					num -= 25f;
				}
				rect = new Rect(num, rect.y, xMax - num, rect.height);
				Rect rect2 = new Rect(num + 4f, rect.y - 3f, 25f, 13f);
				Rect position = new Rect(xMax - 29f, rect.y - 3f, 25f, 13f);
				if (Event.current.type == EventType.Repaint)
				{
					this.footerBackground.Draw(rect, false, false, false, false);
				}
				if (list.displayAdd && GUI.Button(rect2, (list.onAddDropdownCallback == null) ? this.iconToolbarPlus : this.iconToolbarPlusMore, this.preButton))
				{
					if (list.onAddDropdownCallback != null)
					{
						list.onAddDropdownCallback(rect2, list);
					}
					else
					{
						if (list.onAddCallback != null)
						{
							list.onAddCallback(list);
						}
						else
						{
							this.DoAddButton(list);
						}
					}
					if (list.onChangedCallback != null)
					{
						list.onChangedCallback(list);
					}
				}
				if (list.displayRemove)
				{
					EditorGUI.BeginDisabledGroup(list.index < 0 || list.index >= list.count || (list.onCanRemoveCallback != null && !list.onCanRemoveCallback(list)));
					if (GUI.Button(position, this.iconToolbarMinus, this.preButton))
					{
						if (list.onRemoveCallback == null)
						{
							this.DoRemoveButton(list);
						}
						else
						{
							list.onRemoveCallback(list);
						}
						if (list.onChangedCallback != null)
						{
							list.onChangedCallback(list);
						}
					}
					EditorGUI.EndDisabledGroup();
				}
			}
Exemplo n.º 4
0
 public void DrawFooter(Rect rect, ReorderableList list)
 {
     float xMax = rect.xMax;
     float x = xMax - 8f;
     if (list.displayAdd)
     {
         x -= 25f;
     }
     if (list.displayRemove)
     {
         x -= 25f;
     }
     rect = new Rect(x, rect.y, xMax - x, rect.height);
     Rect position = new Rect(x + 4f, rect.y - 3f, 25f, 13f);
     Rect rect3 = new Rect(xMax - 29f, rect.y - 3f, 25f, 13f);
     if (Event.current.type == EventType.Repaint)
     {
         this.footerBackground.Draw(rect, false, false, false, false);
     }
     if (list.displayAdd && GUI.Button(position, (list.onAddDropdownCallback == null) ? this.iconToolbarPlus : this.iconToolbarPlusMore, this.preButton))
     {
         if (list.onAddDropdownCallback != null)
         {
             list.onAddDropdownCallback(position, list);
         }
         else if (list.onAddCallback != null)
         {
             list.onAddCallback(list);
         }
         else
         {
             this.DoAddButton(list);
         }
         if (list.onChangedCallback != null)
         {
             list.onChangedCallback(list);
         }
     }
     if (list.displayRemove)
     {
         using (new EditorGUI.DisabledScope(((list.index < 0) || (list.index >= list.count)) || ((list.onCanRemoveCallback != null) && !list.onCanRemoveCallback(list))))
         {
             if (GUI.Button(rect3, this.iconToolbarMinus, this.preButton))
             {
                 if (list.onRemoveCallback == null)
                 {
                     this.DoRemoveButton(list);
                 }
                 else
                 {
                     list.onRemoveCallback(list);
                 }
                 if (list.onChangedCallback != null)
                 {
                     list.onChangedCallback(list);
                 }
             }
         }
     }
 }
Exemplo n.º 5
-1
            public void DrawFooter(Rect rect, ReorderableList list)
            {
                float xMax = rect.xMax;
                float num  = xMax - 8f;

                if (list.displayAdd)
                {
                    num -= 25f;
                }
                if (list.displayRemove)
                {
                    num -= 25f;
                }
                rect = new Rect(num, rect.y, xMax - num, rect.height);
                Rect rect2    = new Rect(num + 4f, rect.y - 3f, 25f, 13f);
                Rect position = new Rect(xMax - 29f, rect.y - 3f, 25f, 13f);

                if (Event.current.type == EventType.Repaint)
                {
                    this.footerBackground.Draw(rect, false, false, false, false);
                }
                if (list.displayAdd)
                {
                    if (GUI.Button(rect2, (list.onAddDropdownCallback == null) ? this.iconToolbarPlus : this.iconToolbarPlusMore, this.preButton))
                    {
                        if (list.onAddDropdownCallback != null)
                        {
                            list.onAddDropdownCallback(rect2, list);
                        }
                        else if (list.onAddCallback != null)
                        {
                            list.onAddCallback(list);
                        }
                        else
                        {
                            this.DoAddButton(list);
                        }
                        if (list.onChangedCallback != null)
                        {
                            list.onChangedCallback(list);
                        }
                    }
                }
                if (list.displayRemove)
                {
                    using (new EditorGUI.DisabledScope(list.index < 0 || list.index >= list.count || (list.onCanRemoveCallback != null && !list.onCanRemoveCallback(list))))
                    {
                        if (GUI.Button(position, this.iconToolbarMinus, this.preButton))
                        {
                            if (list.onRemoveCallback == null)
                            {
                                this.DoRemoveButton(list);
                            }
                            else
                            {
                                list.onRemoveCallback(list);
                            }
                            if (list.onChangedCallback != null)
                            {
                                list.onChangedCallback(list);
                            }
                        }
                    }
                }
            }