Exemplo n.º 1
0
        public virtual void DrawInstructionList()
        {
            Event current = Event.current;

            this.m_ListViewState.totalRows = this.GetInstructionCount();
            EditorGUILayout.BeginVertical(GUIViewDebuggerWindow.s_Styles.listBackgroundStyle, new GUILayoutOption[0]);
            GUILayout.Label("Instructions", new GUILayoutOption[0]);
            int         controlID  = GUIUtility.GetControlID(FocusType.Keyboard);
            IEnumerator enumerator = ListViewGUI.ListView(this.m_ListViewState, GUIViewDebuggerWindow.s_Styles.listBackgroundStyle, new GUILayoutOption[0]).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    ListViewElement el = (ListViewElement)enumerator.Current;
                    if ((((current.type == EventType.MouseDown) && (current.button == 0)) && el.position.Contains(current.mousePosition)) && (current.clickCount == 2))
                    {
                        this.OnDoubleClickInstruction(el.row);
                    }
                    if (current.type == EventType.Repaint)
                    {
                        this.DoDrawInstruction(el, controlID);
                    }
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            EditorGUILayout.EndVertical();
        }
Exemplo n.º 2
0
        public virtual void DrawInstructionList()
        {
            Event evt = Event.current;

            m_ListViewState.totalRows = GetInstructionCount();

            EditorGUILayout.BeginVertical(GUIViewDebuggerWindow.Styles.listBackgroundStyle);
            GUILayout.Label(Styles.instructionsLabel);

            int id = GUIUtility.GetControlID(FocusType.Keyboard);

            foreach (var element in ListViewGUI.ListView(m_ListViewState, GUIViewDebuggerWindow.Styles.listBackgroundStyle))
            {
                ListViewElement listViewElement = (ListViewElement)element;
                if (evt.type == EventType.MouseDown && evt.button == 0 && listViewElement.position.Contains(evt.mousePosition))
                {
                    if (evt.clickCount == 2)
                    {
                        OnDoubleClickInstruction(listViewElement.row);
                    }
                }
                // Paint list view element
                if (evt.type == EventType.Repaint && listViewElement.row < GetInstructionCount())
                {
                    DoDrawInstruction(listViewElement, id);
                }
            }
            EditorGUILayout.EndVertical();
        }
Exemplo n.º 3
0
        private void DoProjectsGUI()
        {
            GUILayout.BeginVertical(constants.groupBox, new GUILayoutOption[0]);
            GUILayout.Label("Projects on Server", constants.title, new GUILayoutOption[0]);
            IEnumerator enumerator = ListViewGUILayout.ListView(this.projectsLv, constants.background, new GUILayoutOption[0]).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    ListViewElement current = (ListViewElement)enumerator.Current;
                    if ((current.row == this.projectsLv.row) && (Event.current.type == EventType.Repaint))
                    {
                        constants.entrySelected.Draw(current.position, false, false, false, false);
                    }
                    GUILayout.Label(this.projectsList[current.row], constants.element, new GUILayoutOption[0]);
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            if (this.projectsLv.selectionChanged)
            {
                this.projectName = this.projectsList[this.projectsLv.row];
            }
            GUILayout.EndVertical();
        }
        private string GetInstructionName(ListViewElement el)
        {
            int    row = el.row;
            string instructionListName = this.GetInstructionListName(GUIViewDebuggerHelper.GetManagedStackTrace(row));

            return(string.Format("{0}. {1}", (object)row, (object)instructionListName));
        }
Exemplo n.º 5
0
        private static void DoDragAndDrop(ListViewState listView, ListViewElement element, List <ColumnViewElement> columnViewElements, ObjectColumnGetDataFunction getDataForDraggingFunction)
        {
            if (GUIUtility.hotControl == listView.ID && Event.current.type == EventType.MouseDown &&
                element.position.Contains(Event.current.mousePosition) &&
                Event.current.button == 0)
            {
                var delay = (DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID);
                delay.mouseDownPosition = Event.current.mousePosition;
            }

            if (GUIUtility.hotControl == listView.ID &&
                Event.current.type == EventType.MouseDrag &&
                GUIClip.visibleRect.Contains(Event.current.mousePosition))
            {
                var delay = (DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID);

                if (delay.CanStartDrag())
                {
                    var data = getDataForDraggingFunction == null ? null :
                               getDataForDraggingFunction(columnViewElements[listView.row].value);

                    if (data == null)
                    {
                        return;
                    }

                    DragAndDrop.PrepareStartDrag();
                    DragAndDrop.SetGenericData("CustomDragData", data);
                    DragAndDrop.StartDrag(columnViewElements[listView.row].name);

                    Event.current.Use();
                }
            }
        }
Exemplo n.º 6
0
        private void OnGUI()
        {
            if (PragmaFixingWindow.s_Styles == null)
            {
                PragmaFixingWindow.s_Styles = new PragmaFixingWindow.Styles();
                base.minSize  = new Vector2(450f, 300f);
                base.position = new Rect(base.position.x, base.position.y, base.minSize.x, base.minSize.y);
            }
            GUILayout.Space(10f);
            GUILayout.Label("#pragma implicit and #pragma downcast need to be added to following files\nfor backwards compatibility", new GUILayoutOption[0]);
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(10f);
            IEnumerator enumerator = ListViewGUILayout.ListView(this.m_LV, PragmaFixingWindow.s_Styles.box, new GUILayoutOption[0]).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    ListViewElement listViewElement = (ListViewElement)enumerator.Current;
                    if (listViewElement.row == this.m_LV.row && Event.current.type == EventType.Repaint)
                    {
                        PragmaFixingWindow.s_Styles.selected.Draw(listViewElement.position, false, false, false, false);
                    }
                    GUILayout.Label(this.m_Paths[listViewElement.row], new GUILayoutOption[0]);
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
            GUILayout.Space(10f);
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Fix now", PragmaFixingWindow.s_Styles.button, new GUILayoutOption[0]))
            {
                base.Close();
                PragmaFixing30.FixFiles(this.m_Paths);
                GUIUtility.ExitGUI();
            }
            if (GUILayout.Button("Ignore", PragmaFixingWindow.s_Styles.button, new GUILayoutOption[0]))
            {
                base.Close();
                GUIUtility.ExitGUI();
            }
            if (GUILayout.Button("Quit", PragmaFixingWindow.s_Styles.button, new GUILayoutOption[0]))
            {
                EditorApplication.Exit(0);
                GUIUtility.ExitGUI();
            }
            GUILayout.Space(10f);
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);
        }
Exemplo n.º 7
0
 private static void DoDragAndDrop(ListViewState listView, ListViewElement element, List <ColumnViewElement> columnViewElements, ObjectColumnGetDataFunction getDataForDraggingFunction)
 {
     if (((GUIUtility.hotControl == listView.ID) && (Event.current.type == EventType.MouseDown)) && (element.position.Contains(Event.current.mousePosition) && (Event.current.button == 0)))
     {
         DragAndDropDelay stateObject = (DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID);
         stateObject.mouseDownPosition = Event.current.mousePosition;
     }
     if (((GUIUtility.hotControl == listView.ID) && (Event.current.type == EventType.MouseDrag)) && GUIClip.visibleRect.Contains(Event.current.mousePosition))
     {
         DragAndDropDelay delay2 = (DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID);
         if (delay2.CanStartDrag())
         {
             object data = getDataForDraggingFunction?.Invoke(columnViewElements[listView.row].value);
             if (data != null)
             {
                 DragAndDrop.PrepareStartDrag();
                 DragAndDrop.objectReferences = new UnityEngine.Object[0];
                 DragAndDrop.paths            = null;
                 DragAndDrop.SetGenericData("CustomDragData", data);
                 DragAndDrop.StartDrag(columnViewElements[listView.row].name);
                 Event.current.Use();
             }
         }
     }
 }
Exemplo n.º 8
0
 private static void DoDragAndDrop(ListViewState listView, ListViewElement element, List<ColumnViewElement> columnViewElements, ObjectColumnGetDataFunction getDataForDraggingFunction)
 {
     if (((GUIUtility.hotControl == listView.ID) && (Event.current.type == EventType.MouseDown)) && (element.position.Contains(Event.current.mousePosition) && (Event.current.button == 0)))
     {
         DragAndDropDelay stateObject = (DragAndDropDelay) GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID);
         stateObject.mouseDownPosition = Event.current.mousePosition;
     }
     if (((GUIUtility.hotControl == listView.ID) && (Event.current.type == EventType.MouseDrag)) && GUIClip.visibleRect.Contains(Event.current.mousePosition))
     {
         DragAndDropDelay delay2 = (DragAndDropDelay) GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID);
         if (delay2.CanStartDrag())
         {
             object data = (getDataForDraggingFunction != null) ? getDataForDraggingFunction(columnViewElements[listView.row].value) : null;
             if (data != null)
             {
                 DragAndDrop.PrepareStartDrag();
                 DragAndDrop.objectReferences = new Object[0];
                 DragAndDrop.paths = null;
                 DragAndDrop.SetGenericData("CustomDragData", data);
                 DragAndDrop.StartDrag(columnViewElements[listView.row].name);
                 Event.current.Use();
             }
         }
     }
 }
        protected override void DoDrawInstruction(ListViewElement el, int id)
        {
            GUIContent content = GUIContent.Temp(this.GetInstructionListName(el.row));

            GUIViewDebuggerWindow.s_Styles.listItemBackground.Draw(el.position, false, false, base.m_ListViewState.row == el.row, false);
            GUIViewDebuggerWindow.s_Styles.listItem.Draw(el.position, content, id, base.m_ListViewState.row == el.row);
        }
Exemplo n.º 10
0
 private static void DoDragAndDrop(ListViewState listView, ListViewElement element, List <ColumnViewElement> columnViewElements, ColumnView.ObjectColumnGetDataFunction getDataForDraggingFunction)
 {
     if (GUIUtility.hotControl == listView.ID && Event.current.type == EventType.MouseDown && element.position.Contains(Event.current.mousePosition) && Event.current.button == 0)
     {
         DragAndDropDelay dragAndDropDelay = (DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID);
         dragAndDropDelay.mouseDownPosition = Event.current.mousePosition;
     }
     if (GUIUtility.hotControl == listView.ID && Event.current.type == EventType.MouseDrag && GUIClip.visibleRect.Contains(Event.current.mousePosition))
     {
         DragAndDropDelay dragAndDropDelay2 = (DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID);
         if (dragAndDropDelay2.CanStartDrag())
         {
             object obj = (getDataForDraggingFunction != null) ? getDataForDraggingFunction(columnViewElements[listView.row].value) : null;
             if (obj == null)
             {
                 return;
             }
             DragAndDrop.PrepareStartDrag();
             DragAndDrop.objectReferences = new UnityEngine.Object[0];
             DragAndDrop.paths            = null;
             DragAndDrop.SetGenericData("CustomDragData", obj);
             DragAndDrop.StartDrag(columnViewElements[listView.row].name);
             Event.current.Use();
         }
     }
 }
Exemplo n.º 11
0
        protected override void DoDrawInstruction(ListViewElement el, int id)
        {
            GUIContent tempContent = GUIContent.Temp(GetInstructionListName(el.row));

            var rect = el.position;

            GUIViewDebuggerWindow.Styles.listItemBackground.Draw(rect, false, false, listViewState.row == el.row, false);
            GUIViewDebuggerWindow.Styles.listItem.Draw(rect, tempContent, id, listViewState.row == el.row);
        }
Exemplo n.º 12
0
 protected override void DoDrawInstruction(ListViewElement el, int controlId)
 {
     IMGUIInstruction instruction = this.m_Instructions[el.row];
     GUIContent content = GUIContent.Temp(this.GetInstructionListName(el.row));
     Rect position = el.position;
     position.xMin += instruction.level * 10;
     GUIViewDebuggerWindow.s_Styles.listItemBackground.Draw(position, false, false, base.m_ListViewState.row == el.row, false);
     GUIViewDebuggerWindow.s_Styles.listItem.Draw(position, content, controlId, base.m_ListViewState.row == el.row);
 }
Exemplo n.º 13
0
        private string GetInstructionName(ListViewElement el)
        {
            int row = el.row;

            StackFrame[] managedStackTrace   = GUIViewDebuggerHelper.GetManagedStackTrace(row);
            string       instructionListName = this.GetInstructionListName(managedStackTrace);

            return(string.Format("{0}. {1}", row, instructionListName));
        }
        protected override void DoDrawInstruction(ListViewElement el, int id)
        {
            string     listDisplayName = GetInstructionListName(el.row);
            GUIContent tempContent     = GUIContent.Temp(listDisplayName);

            GUIViewDebuggerWindow.Styles.listItemBackground.Draw(el.position, false, false, listViewState.row == el.row, false);

            GUIViewDebuggerWindow.Styles.listItem.Draw(el.position, tempContent, id, listViewState.row == el.row);
        }
        protected override void DoDrawInstruction(ListViewElement el, int id)
        {
            IMGUILayoutInstruction iMGUILayoutInstruction = this.m_LayoutInstructions[el.row];
            GUIContent             content = GUIContent.Temp(this.GetInstructionListName(el.row));
            Rect position = el.position;

            position.xMin += (float)(iMGUILayoutInstruction.level * 10);
            GUIViewDebuggerWindow.s_Styles.listItemBackground.Draw(position, false, false, this.m_ListViewState.row == el.row, false);
            GUIViewDebuggerWindow.s_Styles.listItem.Draw(position, content, id, this.m_ListViewState.row == el.row);
        }
Exemplo n.º 16
0
        private void OnGUI()
        {
            if (BumpMapSettingsFixingWindow.s_Styles == null)
            {
                BumpMapSettingsFixingWindow.s_Styles = new BumpMapSettingsFixingWindow.Styles();
                base.minSize  = new Vector2(400f, 300f);
                base.position = new Rect(base.position.x, base.position.y, base.minSize.x, base.minSize.y);
            }
            GUILayout.Space(5f);
            GUILayout.Label(BumpMapSettingsFixingWindow.s_Styles.overviewText, new GUILayoutOption[0]);
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(10f);
            IEnumerator enumerator = ListViewGUILayout.ListView(this.m_LV, BumpMapSettingsFixingWindow.s_Styles.box, new GUILayoutOption[0]).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    ListViewElement listViewElement = (ListViewElement)enumerator.Current;
                    if (listViewElement.row == this.m_LV.row && Event.current.type == EventType.Repaint)
                    {
                        BumpMapSettingsFixingWindow.s_Styles.selected.Draw(listViewElement.position, false, false, false, false);
                    }
                    GUILayout.Label(this.m_Paths[listViewElement.row], new GUILayoutOption[0]);
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
            GUILayout.Space(10f);
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Fix now", BumpMapSettingsFixingWindow.s_Styles.button, new GUILayoutOption[0]))
            {
                InternalEditorUtility.BumpMapSettingsFixingWindowReportResult(1);
                base.Close();
            }
            if (GUILayout.Button("Ignore", BumpMapSettingsFixingWindow.s_Styles.button, new GUILayoutOption[0]))
            {
                InternalEditorUtility.BumpMapSettingsFixingWindowReportResult(0);
                base.Close();
            }
            GUILayout.Space(10f);
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);
        }
Exemplo n.º 17
0
        protected override void DoDrawInstruction(ListViewElement el, int controlId)
        {
            IMGUIInstruction iMGUIInstruction    = this.m_Instructions[el.row];
            string           instructionListName = this.GetInstructionListName(el.row);
            GUIContent       content             = GUIContent.Temp(instructionListName);
            Rect             position            = el.position;

            position.xMin += (float)(iMGUIInstruction.level * 10);
            GUIViewDebuggerWindow.Styles.listItemBackground.Draw(position, false, false, base.listViewState.row == el.row, false);
            GUIViewDebuggerWindow.Styles.listItem.Draw(position, content, controlId, base.listViewState.row == el.row);
        }
Exemplo n.º 18
0
        protected override void DoDrawInstruction(ListViewElement el, int id)
        {
            IMGUILayoutInstruction instruction = m_LayoutInstructions[el.row];

            GUIContent tempContent = GUIContent.Temp(GetInstructionListName(el.row));

            var rect = el.position;

            rect.xMin += instruction.level * 10;

            GUIViewDebuggerWindow.Styles.listItemBackground.Draw(rect, false, false, listViewState.row == el.row, false);
            GUIViewDebuggerWindow.Styles.listItem.Draw(rect, tempContent, id, listViewState.row == el.row);
        }
Exemplo n.º 19
0
 private void DoDoubleClick(ListViewElement element, ColumnViewElement columnViewElement, ObjectColumnFunction selectedSearchItemFunction, ObjectColumnFunction selectedRegularItemFunction)
 {
     if (((Event.current.type == EventType.MouseDown) && element.position.Contains(Event.current.mousePosition)) && ((Event.current.button == 0) && (Event.current.clickCount == 2)))
     {
         if (this.isSearching)
         {
             this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElement.value);
         }
         else
         {
             DoItemSelectedEvent(selectedRegularItemFunction, columnViewElement.value);
         }
     }
 }
Exemplo n.º 20
0
 private void DoDoubleClick(ListViewElement element, ColumnViewElement columnViewElement, ObjectColumnFunction selectedSearchItemFunction, ObjectColumnFunction selectedRegularItemFunction)
 {
     if (((Event.current.type == EventType.MouseDown) && element.position.Contains(Event.current.mousePosition)) && ((Event.current.button == 0) && (Event.current.clickCount == 2)))
     {
         if (this.isSearching)
         {
             this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElement.value);
         }
         else
         {
             DoItemSelectedEvent(selectedRegularItemFunction, columnViewElement.value);
         }
     }
 }
        protected override void DoDrawInstruction(ListViewElement el, int id)
        {
            var clipInstruction = m_ClipList[el.row];
            var niceName        = GetInstructionListName(el.row);

            GUIContent tempContent = GUIContent.Temp(niceName);

            var rect = el.position;

            rect.xMin += clipInstruction.level * 12;

            GUIViewDebuggerWindow.Styles.listItemBackground.Draw(el.position, false, false, listViewState.row == el.row, false);
            GUIViewDebuggerWindow.Styles.listItem.Draw(rect, tempContent, id, listViewState.row == el.row);
        }
Exemplo n.º 22
0
        protected override void DoDrawInstruction(ListViewElement el, int controlId)
        {
            IMGUIInstruction instruction = m_Instructions[el.row];

            string     listDisplayName = GetInstructionListName(el.row);
            GUIContent tempContent     = GUIContent.Temp(listDisplayName);

            var rect = el.position;

            rect.xMin += instruction.level * 10;

            GUIViewDebuggerWindow.Styles.listItemBackground.Draw(rect, false, false, listViewState.row == el.row, false);

            GUIViewDebuggerWindow.Styles.listItem.Draw(rect, tempContent, controlId, listViewState.row == el.row);
        }
Exemplo n.º 23
0
 private void DoDoubleClick(ListViewElement element, ColumnViewElement columnViewElement, ColumnView.ObjectColumnFunction selectedSearchItemFunction, ColumnView.ObjectColumnFunction selectedRegularItemFunction)
 {
     if (Event.current.type != EventType.MouseDown || !element.position.Contains(Event.current.mousePosition) || (Event.current.button != 0 || Event.current.clickCount != 2))
     {
         return;
     }
     if (this.isSearching)
     {
         this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElement.value);
     }
     else
     {
         ColumnView.DoItemSelectedEvent(selectedRegularItemFunction, columnViewElement.value);
     }
 }
Exemplo n.º 24
0
        private static void DoDragAndDrop(ListViewState listView, ListViewElement element, List <ColumnViewElement> columnViewElements, ColumnView.ObjectColumnGetDataFunction getDataForDraggingFunction)
        {
            if (GUIUtility.hotControl == listView.ID && Event.current.type == EventType.MouseDown && (element.position.Contains(Event.current.mousePosition) && Event.current.button == 0))
            {
                ((DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID)).mouseDownPosition = Event.current.mousePosition;
            }
            if (GUIUtility.hotControl != listView.ID || Event.current.type != EventType.MouseDrag || (!GUIClip.visibleRect.Contains(Event.current.mousePosition) || !((DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID)).CanStartDrag()))
            {
                return;
            }
            object data = getDataForDraggingFunction != null?getDataForDraggingFunction(columnViewElements[listView.row].value) : (object)null;

            if (data == null)
            {
                return;
            }
            DragAndDrop.PrepareStartDrag();
            DragAndDrop.objectReferences = new Object[0];
            DragAndDrop.paths            = (string[])null;
            DragAndDrop.SetGenericData("CustomDragData", data);
            DragAndDrop.StartDrag(columnViewElements[listView.row].name);
            Event.current.Use();
        }
Exemplo n.º 25
0
        private void DrawInstructionList()
        {
            Event current = Event.current;

            EditorGUILayout.BeginVertical(s_Styles.listBackgroundStyle, new GUILayoutOption[0]);
            GUILayout.Label("Instructions", new GUILayoutOption[0]);
            int         controlID  = GUIUtility.GetControlID(FocusType.Keyboard);
            IEnumerator enumerator = ListViewGUI.ListView(this.m_ListViewState, s_Styles.listBackgroundStyle, new GUILayoutOption[0]).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    ListViewElement el = (ListViewElement)enumerator.Current;
                    if (((current.type == EventType.MouseDown) && (current.button == 0)) && (el.position.Contains(current.mousePosition) && (current.clickCount == 2)))
                    {
                        this.ShowInstructionInExternalEditor(el.row);
                    }
                    if (current.type == EventType.Repaint)
                    {
                        GUIContent content = GUIContent.Temp(this.GetInstructionName(el));
                        s_Styles.listItemBackground.Draw(el.position, false, false, this.m_ListViewState.row == el.row, false);
                        s_Styles.listItem.Draw(el.position, content, controlID, this.m_ListViewState.row == el.row);
                    }
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable == null)
                {
                }
                disposable.Dispose();
            }
            EditorGUILayout.EndVertical();
        }
Exemplo n.º 26
0
        public void UpdateGUI()
        {
            SplitterGUILayout.BeginHorizontalSplit(this.horSplit, new GUILayoutOption[0]);
            GUILayout.BeginVertical(this.constants.box, new GUILayoutOption[0]);
            GUILayout.Label(this.totalUpdates, this.constants.title, new GUILayoutOption[0]);
            IEnumerator enumerator = ListViewGUILayout.ListView(this.lv, GUIStyle.none, new GUILayoutOption[0]).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    ListViewElement current  = (ListViewElement)enumerator.Current;
                    Rect            position = current.position;
                    position.x++;
                    position.y++;
                    if (Event.current.type == EventType.Repaint)
                    {
                        if ((current.row % 2) == 0)
                        {
                            this.constants.entryEven.Draw(position, false, false, false, false);
                        }
                        else
                        {
                            this.constants.entryOdd.Draw(position, false, false, false, false);
                        }
                    }
                    GUILayout.BeginVertical((current.row != this.lv.row) ? this.constants.entryNormal : this.constants.entrySelected, new GUILayoutOption[0]);
                    GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinWidth(50f) };
                    GUILayout.Label(this.messageFirstLines[current.row], this.constants.serverUpdateLog, options);
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.MinWidth(100f) };
                    GUILayout.Label(this.changesets[current.row].changeset.ToString() + " " + this.changesets[current.row].date, this.constants.serverUpdateInfo, optionArray2);
                    GUILayoutOption[] optionArray3 = new GUILayoutOption[] { GUILayout.Width((float)this.maxNickLength) };
                    GUILayout.Label(this.changesets[current.row].owner, this.constants.serverUpdateInfo, optionArray3);
                    GUILayout.EndHorizontal();
                    GUILayout.EndVertical();
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            if (this.lv.selectionChanged)
            {
                this.SetSelectedRevisionLine(this.lv.row);
            }
            GUILayout.EndVertical();
            SplitterGUILayout.BeginVerticalSplit(this.vertSplit, new GUILayoutOption[0]);
            GUILayout.BeginVertical(this.constants.box, new GUILayoutOption[0]);
            GUILayout.Label("Changeset", this.constants.title, new GUILayoutOption[0]);
            int         num         = -1;
            int         file        = -1;
            IEnumerator enumerator2 = ListViewGUILayout.ListView(this.pv.lv, GUIStyle.none, new GUILayoutOption[0]).GetEnumerator();

            try
            {
                while (enumerator2.MoveNext())
                {
                    ChangeFlags     changeFlags;
                    ListViewElement element2 = (ListViewElement)enumerator2.Current;
                    if ((num == -1) && !this.pv.IndexToFolderAndFile(element2.row, ref num, ref file))
                    {
                        return;
                    }
                    ParentViewFolder folder = this.pv.folders[num];
                    if (ListViewGUILayout.HasMouseDown(element2.position))
                    {
                        if (Event.current.clickCount == 2)
                        {
                            if (!this.isDirSelected && (this.selectedGUID != string.Empty))
                            {
                                this.DoShowDiff(false);
                                GUIUtility.ExitGUI();
                            }
                        }
                        else
                        {
                            this.pv.lv.scrollPos = ListViewShared.ListViewScrollToRow(this.pv.lv.ilvState, element2.row);
                            this.DoSelect(num, file, element2.row);
                        }
                    }
                    else if (ListViewGUILayout.HasMouseDown(element2.position, 1))
                    {
                        if (this.lv.row != element2.row)
                        {
                            this.DoSelect(num, file, element2.row);
                        }
                        if (!this.isDirSelected && (this.selectedGUID != string.Empty))
                        {
                            GUIUtility.hotControl = 0;
                            Rect rect2 = new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 1f, 1f);
                            EditorUtility.DisplayCustomMenu(rect2, this.dropDownMenuItems, null, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null);
                            Event.current.Use();
                        }
                    }
                    if ((element2.row == this.pv.lv.row) && (Event.current.type == EventType.Repaint))
                    {
                        this.constants.entrySelected.Draw(element2.position, false, false, false, false);
                    }
                    if (file != -1)
                    {
                        Texture2D cachedIcon = AssetDatabase.GetCachedIcon(folder.name + "/" + folder.files[file].name) as Texture2D;
                        if (cachedIcon == null)
                        {
                            cachedIcon = InternalEditorUtility.GetIconForFile(folder.files[file].name);
                        }
                        GUILayout.Label(new GUIContent(folder.files[file].name, cachedIcon), this.constants.element, new GUILayoutOption[0]);
                        changeFlags = folder.files[file].changeFlags;
                    }
                    else
                    {
                        GUILayout.Label(folder.name, this.constants.header, new GUILayoutOption[0]);
                        changeFlags = folder.changeFlags;
                    }
                    GUIContent badgeNew = null;
                    if (this.HasFlag(changeFlags, ChangeFlags.Undeleted) || this.HasFlag(changeFlags, ChangeFlags.Created))
                    {
                        badgeNew = ASMainWindow.constants.badgeNew;
                    }
                    else if (this.HasFlag(changeFlags, ChangeFlags.Deleted))
                    {
                        badgeNew = ASMainWindow.constants.badgeDelete;
                    }
                    else if (this.HasFlag(changeFlags, ChangeFlags.Renamed) || this.HasFlag(changeFlags, ChangeFlags.Moved))
                    {
                        badgeNew = ASMainWindow.constants.badgeMove;
                    }
                    if ((badgeNew != null) && (Event.current.type == EventType.Repaint))
                    {
                        Rect rect3 = new Rect(((element2.position.x + element2.position.width) - badgeNew.image.width) - 5f, (element2.position.y + (element2.position.height / 2f)) - (badgeNew.image.height / 2), (float)badgeNew.image.width, (float)badgeNew.image.height);
                        EditorGUIUtility.SetIconSize(Vector2.zero);
                        GUIStyle.none.Draw(rect3, badgeNew, false, false, false, false);
                        EditorGUIUtility.SetIconSize(this.iconSize);
                    }
                    this.pv.NextFileFolder(ref num, ref file);
                }
            }
            finally
            {
                IDisposable disposable2 = enumerator2 as IDisposable;
                if (disposable2 != null)
                {
                    disposable2.Dispose();
                }
            }
            if (this.pv.lv.selectionChanged && (this.selectedGUID != string.Empty))
            {
                if (this.selectedGUID != AssetServer.GetRootGUID())
                {
                    AssetServer.SetSelectionFromGUID(this.selectedGUID);
                }
                else
                {
                    AssetServer.SetSelectionFromGUID(string.Empty);
                }
            }
            if ((GUIUtility.keyboardControl == this.pv.lv.ID) && (((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.Return)) && (!this.isDirSelected && (this.selectedGUID != string.Empty))))
            {
                this.DoShowDiff(false);
                GUIUtility.ExitGUI();
            }
            GUILayout.EndVertical();
            GUILayout.BeginVertical(this.constants.box, new GUILayoutOption[0]);
            GUILayout.Label("Update Message", this.constants.title, new GUILayoutOption[0]);
            GUILayout.TextArea((this.lv.row < 0) ? "" : this.changesets[this.lv.row].message, this.constants.wwText, new GUILayoutOption[0]);
            GUILayout.EndVertical();
            SplitterGUILayout.EndVerticalSplit();
            SplitterGUILayout.EndHorizontalSplit();
        }
Exemplo n.º 27
0
 protected abstract void DoDrawInstruction(ListViewElement el, int controlId);
Exemplo n.º 28
0
 protected abstract void DoDrawInstruction(ListViewElement el, int controlId);
Exemplo n.º 29
0
        private void DoNamingConflictsGUI()
        {
            bool enabled   = GUI.enabled;
            bool shift     = Event.current.shift;
            bool actionKey = EditorGUI.actionKey;

            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Space(10f);
            GUILayout.Label("The following assets have the same name as an existing asset on the server.\nPlease select which one to rename before continuing the update.", new GUILayoutOption[0]);
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUI.enabled = (this.lv2HasSelection && enabled);
            if (GUILayout.Button(ASUpdateConflictResolveWindow.nameConflictButtonTexts[0], this.constants.ButtonLeft, new GUILayoutOption[0]))
            {
                this.ResolveSelectedNamingConflicts(NameConflictResolution.RenameLocal);
            }
            if (GUILayout.Button(ASUpdateConflictResolveWindow.nameConflictButtonTexts[1], this.constants.ButtonRight, new GUILayoutOption[0]))
            {
                this.ResolveSelectedNamingConflicts(NameConflictResolution.RenameRemote);
            }
            GUI.enabled = enabled;
            GUILayout.EndHorizontal();
            GUILayout.Space(5f);
            SplitterGUILayout.BeginHorizontalSplit(this.lvHeaderSplit2, new GUILayoutOption[0]);
            GUILayout.Box("Action", this.constants.lvHeader, new GUILayoutOption[0]);
            GUILayout.Box("Asset", this.constants.lvHeader, new GUILayoutOption[0]);
            SplitterGUILayout.EndHorizontalSplit();
            int         row        = this.lv2.row;
            bool        flag       = false;
            IEnumerator enumerator = ListViewGUILayout.ListView(this.lv2, this.constants.background, new GUILayoutOption[0]).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    ListViewElement listViewElement = (ListViewElement)enumerator.Current;
                    if (GUIUtility.keyboardControl == this.lv2.ID && Event.current.type == EventType.KeyDown && actionKey)
                    {
                        Event.current.Use();
                    }
                    if (this.selectedLV2Items[listViewElement.row] && Event.current.type == EventType.Repaint)
                    {
                        this.constants.selected.Draw(listViewElement.position, false, false, false, false);
                    }
                    if (ListViewGUILayout.HasMouseUp(listViewElement.position))
                    {
                        if (!shift && !actionKey)
                        {
                            flag |= ListViewGUILayout.MultiSelection(row, this.lv2.row, ref this.initialSelectedLV2Item, ref this.selectedLV2Items);
                        }
                    }
                    else if (ListViewGUILayout.HasMouseDown(listViewElement.position))
                    {
                        if (!this.selectedLV2Items[listViewElement.row] || shift || actionKey)
                        {
                            flag |= ListViewGUILayout.MultiSelection(row, listViewElement.row, ref this.initialSelectedLV2Item, ref this.selectedLV2Items);
                        }
                        this.lv2.row = listViewElement.row;
                    }
                    GUILayout.Label(this.namingResolutionString[(int)this.namingResolutions[listViewElement.row]], new GUILayoutOption[]
                    {
                        GUILayout.Width((float)this.lvHeaderSplit2.realSizes[0]),
                        GUILayout.Height(18f)
                    });
                    GUILayout.Label(new GUIContent(this.dNamingPaths[listViewElement.row], (!AssetServer.AssetIsDir(this.nameConflicts[listViewElement.row])) ? InternalEditorUtility.GetIconForFile(this.dNamingPaths[listViewElement.row]) : EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName)), new GUILayoutOption[]
                    {
                        GUILayout.Width((float)this.lvHeaderSplit2.realSizes[1]),
                        GUILayout.Height(18f)
                    });
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
            GUILayout.EndVertical();
            if (GUIUtility.keyboardControl == this.lv2.ID)
            {
                if (Event.current.type == EventType.ValidateCommand && Event.current.commandName == "SelectAll")
                {
                    Event.current.Use();
                }
                else if (Event.current.type == EventType.ExecuteCommand && Event.current.commandName == "SelectAll")
                {
                    for (int i = 0; i < this.selectedLV2Items.Length; i++)
                    {
                        this.selectedLV2Items[i] = true;
                    }
                    flag = true;
                    Event.current.Use();
                }
                if (this.lv2.selectionChanged && !actionKey)
                {
                    flag |= ListViewGUILayout.MultiSelection(row, this.lv2.row, ref this.initialSelectedLV2Item, ref this.selectedLV2Items);
                }
            }
            if (this.lv2.selectionChanged || flag)
            {
                this.mySelection = true;
                AssetServer.SetSelectionFromGUIDs(this.GetSelectedNamingGUIDs());
                this.lv2HasSelection = this.HasTrue(ref this.selectedLV2Items);
            }
        }
 protected override void DoDrawInstruction(ListViewElement el, int id)
 {
     GUIContent content = GUIContent.Temp(this.GetInstructionListName(el.row));
     GUIViewDebuggerWindow.s_Styles.listItemBackground.Draw(el.position, false, false, base.m_ListViewState.row == el.row, false);
     GUIViewDebuggerWindow.s_Styles.listItem.Draw(el.position, content, id, base.m_ListViewState.row == el.row);
 }
Exemplo n.º 31
0
 private void DoDoubleClick(ListViewElement element, ColumnViewElement columnViewElement, ColumnView.ObjectColumnFunction selectedSearchItemFunction, ColumnView.ObjectColumnFunction selectedRegularItemFunction)
 {
   if (Event.current.type != EventType.MouseDown || !element.position.Contains(Event.current.mousePosition) || (Event.current.button != 0 || Event.current.clickCount != 2))
     return;
   if (this.isSearching)
     this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElement.value);
   else
     ColumnView.DoItemSelectedEvent(selectedRegularItemFunction, columnViewElement.value);
 }
Exemplo n.º 32
0
 private static void DoDragAndDrop(ListViewState listView, ListViewElement element, List<ColumnViewElement> columnViewElements, ColumnView.ObjectColumnGetDataFunction getDataForDraggingFunction)
 {
   if (GUIUtility.hotControl == listView.ID && Event.current.type == EventType.MouseDown && (element.position.Contains(Event.current.mousePosition) && Event.current.button == 0))
     ((DragAndDropDelay) GUIUtility.GetStateObject(typeof (DragAndDropDelay), listView.ID)).mouseDownPosition = Event.current.mousePosition;
   if (GUIUtility.hotControl != listView.ID || Event.current.type != EventType.MouseDrag || (!GUIClip.visibleRect.Contains(Event.current.mousePosition) || !((DragAndDropDelay) GUIUtility.GetStateObject(typeof (DragAndDropDelay), listView.ID)).CanStartDrag()))
     return;
   object data = getDataForDraggingFunction != null ? getDataForDraggingFunction(columnViewElements[listView.row].value) : (object) null;
   if (data == null)
     return;
   DragAndDrop.PrepareStartDrag();
   DragAndDrop.objectReferences = new Object[0];
   DragAndDrop.paths = (string[]) null;
   DragAndDrop.SetGenericData("CustomDragData", data);
   DragAndDrop.StartDrag(columnViewElements[listView.row].name);
   Event.current.Use();
 }
Exemplo n.º 33
0
        private int DoListColumn(ListViewState listView, List <ColumnViewElement> columnViewElements, int columnIndex, int selectedIndex, ObjectColumnFunction selectedSearchItemFunction, ObjectColumnFunction selectedRegularItemFunction, ObjectColumnGetDataFunction getDataForDraggingFunction)
        {
            if (((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.Return)) && (listView.row > -1))
            {
                if (this.isSearching && (selectedSearchItemFunction != null))
                {
                    this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElements[selectedIndex].value);
                }
                if ((!this.isSearching && (GUIUtility.keyboardControl == listView.ID)) && (selectedRegularItemFunction != null))
                {
                    DoItemSelectedEvent(selectedRegularItemFunction, columnViewElements[selectedIndex].value);
                }
            }
            if (((GUIUtility.keyboardControl == listView.ID) && (Event.current.type == EventType.KeyDown)) && !this.isSearching)
            {
                switch (Event.current.keyCode)
                {
                case KeyCode.LeftArrow:
                    this.m_ColumnToFocusKeyboard = columnIndex - 1;
                    Event.current.Use();
                    break;

                case KeyCode.RightArrow:
                    this.m_ColumnToFocusKeyboard = columnIndex + 1;
                    Event.current.Use();
                    break;
                }
            }
            GUILayoutOption[] options    = new GUILayoutOption[] { GUILayout.Width(this.columnWidth) };
            IEnumerator       enumerator = ListViewGUILayout.ListView(listView, s_Styles.background, options).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    ListViewElement   current           = (ListViewElement)enumerator.Current;
                    ColumnViewElement columnViewElement = columnViewElements[current.row];
                    if ((current.row == listView.row) && (Event.current.type == EventType.Repaint))
                    {
                        Rect position = current.position;
                        position.x++;
                        position.y++;
                        s_Styles.selected.Draw(position, false, true, true, GUIUtility.keyboardControl == listView.ID);
                    }
                    GUILayout.Label(columnViewElement.name, new GUILayoutOption[0]);
                    if (columnViewElement.value is List <ColumnViewElement> )
                    {
                        Rect rect2 = current.position;
                        rect2.x  = (rect2.xMax - s_Styles.categoryArrowIcon.width) - 5f;
                        rect2.y += 2f;
                        GUI.Label(rect2, s_Styles.categoryArrowIcon);
                    }
                    this.DoDoubleClick(current, columnViewElement, selectedSearchItemFunction, selectedRegularItemFunction);
                    DoDragAndDrop(listView, current, columnViewElements, getDataForDraggingFunction);
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            if (Event.current.type == EventType.Layout)
            {
                selectedIndex = listView.row;
            }
            return(selectedIndex);
        }
Exemplo n.º 34
0
        private void OnGUI()
        {
            if (AssetSaveDialog.s_Styles == null)
            {
                AssetSaveDialog.s_Styles = new AssetSaveDialog.Styles();
                base.minSize             = new Vector2(500f, 300f);
                base.position            = new Rect(base.position.x, base.position.y, base.minSize.x, base.minSize.y);
            }
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(10f);
            GUILayout.Label("Unity is about to save the following modified files. Unsaved changes will be lost!", new GUILayoutOption[0]);
            GUILayout.Space(10f);
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(10f);
            int         row        = this.m_LV.row;
            int         num        = 0;
            IEnumerator enumerator = ListViewGUILayout.ListView(this.m_LV, AssetSaveDialog.s_Styles.box, new GUILayoutOption[0]).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    ListViewElement listViewElement = (ListViewElement)enumerator.Current;
                    if (this.m_SelectedItems[listViewElement.row] && Event.current.type == EventType.Repaint)
                    {
                        Rect position = listViewElement.position;
                        position.x      += 1f;
                        position.y      += 1f;
                        position.width  -= 1f;
                        position.height -= 1f;
                        AssetSaveDialog.s_Styles.selected.Draw(position, false, false, false, false);
                    }
                    GUILayout.Label(this.m_Content[listViewElement.row], new GUILayoutOption[0]);
                    if (ListViewGUILayout.HasMouseUp(listViewElement.position))
                    {
                        Event.current.command = true;
                        Event.current.control = true;
                        ListViewGUILayout.MultiSelection(row, listViewElement.row, ref this.m_InitialSelectedItem, ref this.m_SelectedItems);
                    }
                    if (this.m_SelectedItems[listViewElement.row])
                    {
                        num++;
                    }
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
            GUILayout.Space(10f);
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(10f);
            if (GUILayout.Button(AssetSaveDialog.s_Styles.close, AssetSaveDialog.s_Styles.button, new GUILayoutOption[]
            {
                GUILayout.Width(AssetSaveDialog.s_Styles.buttonWidth)
            }))
            {
                this.CloseWindow();
            }
            GUILayout.FlexibleSpace();
            GUI.enabled = (num > 0);
            bool flag = num == this.m_Assets.Count;

            if (GUILayout.Button(AssetSaveDialog.s_Styles.dontSave, AssetSaveDialog.s_Styles.button, new GUILayoutOption[]
            {
                GUILayout.Width(AssetSaveDialog.s_Styles.buttonWidth)
            }))
            {
                this.IgnoreSelectedAssets();
            }
            if (GUILayout.Button((!flag) ? AssetSaveDialog.s_Styles.saveSelected : AssetSaveDialog.s_Styles.saveAll, AssetSaveDialog.s_Styles.button, new GUILayoutOption[]
            {
                GUILayout.Width(AssetSaveDialog.s_Styles.buttonWidth)
            }))
            {
                this.SaveSelectedAssets();
            }
            if (this.m_Assets.Count == 0)
            {
                this.CloseWindow();
            }
            GUI.enabled = true;
            GUILayout.Space(10f);
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);
        }
Exemplo n.º 35
0
        private void OnGUI()
        {
            if (s_Styles == null)
            {
                s_Styles      = new Styles();
                base.minSize  = new Vector2(500f, 300f);
                base.position = new Rect(base.position.x, base.position.y, base.minSize.x, base.minSize.y);
            }
            this.HandleKeyboard();
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(10f);
            GUILayout.Label("Unity is about to save the following modified files. Unsaved changes will be lost!", new GUILayoutOption[0]);
            GUILayout.Space(10f);
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(10f);
            int         row        = this.m_LV.row;
            int         num2       = 0;
            IEnumerator enumerator = ListViewGUILayout.ListView(this.m_LV, s_Styles.box, new GUILayoutOption[0]).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    ListViewElement current = (ListViewElement)enumerator.Current;
                    if (this.m_SelectedItems[current.row] && (Event.current.type == EventType.Repaint))
                    {
                        Rect position = current.position;
                        position.x++;
                        position.y++;
                        position.width--;
                        position.height--;
                        s_Styles.selected.Draw(position, false, false, false, false);
                    }
                    GUILayout.Label(this.m_Content[current.row], new GUILayoutOption[0]);
                    if (ListViewGUILayout.HasMouseUp(current.position))
                    {
                        Event.current.command = true;
                        Event.current.control = true;
                        ListViewGUILayout.MultiSelection(row, current.row, ref this.m_InitialSelectedItem, ref this.m_SelectedItems);
                    }
                    if (this.m_SelectedItems[current.row])
                    {
                        num2++;
                    }
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable == null)
                {
                }
                disposable.Dispose();
            }
            GUILayout.Space(10f);
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(10f);
            GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(s_Styles.buttonWidth) };
            if (GUILayout.Button(s_Styles.close, s_Styles.button, options))
            {
                this.CloseWindow();
            }
            GUILayout.FlexibleSpace();
            GUI.enabled = num2 > 0;
            bool flag = num2 == this.m_Assets.Count;

            GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(s_Styles.buttonWidth) };
            if (GUILayout.Button(s_Styles.dontSave, s_Styles.button, optionArray2))
            {
                this.IgnoreSelectedAssets();
            }
            GUILayoutOption[] optionArray3 = new GUILayoutOption[] { GUILayout.Width(s_Styles.buttonWidth) };
            if (GUILayout.Button(!flag ? s_Styles.saveSelected : s_Styles.saveAll, s_Styles.button, optionArray3))
            {
                this.SaveSelectedAssets();
            }
            if (this.m_Assets.Count == 0)
            {
                this.CloseWindow();
            }
            GUI.enabled = true;
            GUILayout.Space(10f);
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);
        }
 private string GetInstructionName(ListViewElement el)
 {
   int row = el.row;
   string instructionListName = this.GetInstructionListName(GUIViewDebuggerHelper.GetManagedStackTrace(row));
   return string.Format("{0}. {1}", (object) row, (object) instructionListName);
 }
Exemplo n.º 37
0
        private int DoListColumn(ListViewState listView, List <ColumnViewElement> columnViewElements, int columnIndex, int selectedIndex, ColumnView.ObjectColumnFunction selectedSearchItemFunction, ColumnView.ObjectColumnFunction selectedRegularItemFunction, ColumnView.ObjectColumnGetDataFunction getDataForDraggingFunction)
        {
            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return && listView.row > -1)
            {
                if (this.isSearching && selectedSearchItemFunction != null)
                {
                    this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElements[selectedIndex].value);
                }
                if (!this.isSearching && GUIUtility.keyboardControl == listView.ID && selectedRegularItemFunction != null)
                {
                    ColumnView.DoItemSelectedEvent(selectedRegularItemFunction, columnViewElements[selectedIndex].value);
                }
            }
            if (GUIUtility.keyboardControl == listView.ID && Event.current.type == EventType.KeyDown && !this.isSearching)
            {
                KeyCode keyCode = Event.current.keyCode;
                if (keyCode != KeyCode.LeftArrow)
                {
                    if (keyCode == KeyCode.RightArrow)
                    {
                        this.m_ColumnToFocusKeyboard = columnIndex + 1;
                        Event.current.Use();
                    }
                }
                else
                {
                    this.m_ColumnToFocusKeyboard = columnIndex - 1;
                    Event.current.Use();
                }
            }
            IEnumerator enumerator = ListViewGUILayout.ListView(listView, ColumnView.s_Styles.background, new GUILayoutOption[]
            {
                GUILayout.Width(this.columnWidth)
            }).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    ListViewElement   element           = (ListViewElement)enumerator.Current;
                    ColumnViewElement columnViewElement = columnViewElements[element.row];
                    if (element.row == listView.row)
                    {
                        if (Event.current.type == EventType.Repaint)
                        {
                            Rect position = element.position;
                            position.x += 1f;
                            position.y += 1f;
                            ColumnView.s_Styles.selected.Draw(position, false, true, true, GUIUtility.keyboardControl == listView.ID);
                        }
                    }
                    GUILayout.Label(columnViewElement.name, new GUILayoutOption[0]);
                    if (columnViewElement.value is List <ColumnViewElement> )
                    {
                        Rect position2 = element.position;
                        position2.x  = position2.xMax - (float)ColumnView.s_Styles.categoryArrowIcon.width - 5f;
                        position2.y += 2f;
                        GUI.Label(position2, ColumnView.s_Styles.categoryArrowIcon);
                    }
                    this.DoDoubleClick(element, columnViewElement, selectedSearchItemFunction, selectedRegularItemFunction);
                    ColumnView.DoDragAndDrop(listView, element, columnViewElements, getDataForDraggingFunction);
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
            if (Event.current.type == EventType.Layout)
            {
                selectedIndex = listView.row;
            }
            return(selectedIndex);
        }
Exemplo n.º 38
0
        private void OnGUI()
        {
            Event current = Event.current;

            ConsoleWindow.LoadIcons();
            GUILayout.BeginHorizontal(ConsoleWindow.Constants.Toolbar, new GUILayoutOption[0]);
            if (GUILayout.Button("Clear", ConsoleWindow.Constants.MiniButton, new GUILayoutOption[0]))
            {
                LogEntries.Clear();
                GUIUtility.keyboardControl = 0;
            }
            int count = LogEntries.GetCount();

            if (this.m_ListView.totalRows != count && this.m_ListView.totalRows > 0)
            {
                if (this.m_ListView.scrollPos.y >= (float)(this.m_ListView.rowHeight * this.m_ListView.totalRows - this.ms_LVHeight))
                {
                    this.m_ListView.scrollPos.y = (float)(count * 32 - this.ms_LVHeight);
                }
            }
            EditorGUILayout.Space();
            bool flag = ConsoleWindow.HasFlag(ConsoleWindow.ConsoleFlags.Collapse);

            ConsoleWindow.SetFlag(ConsoleWindow.ConsoleFlags.Collapse, GUILayout.Toggle(flag, "Collapse", ConsoleWindow.Constants.MiniButtonLeft, new GUILayoutOption[0]));
            bool flag2 = flag != ConsoleWindow.HasFlag(ConsoleWindow.ConsoleFlags.Collapse);

            if (flag2)
            {
                this.m_ListView.row         = -1;
                this.m_ListView.scrollPos.y = (float)(LogEntries.GetCount() * 32);
            }
            ConsoleWindow.SetFlag(ConsoleWindow.ConsoleFlags.ClearOnPlay, GUILayout.Toggle(ConsoleWindow.HasFlag(ConsoleWindow.ConsoleFlags.ClearOnPlay), "Clear on Play", ConsoleWindow.Constants.MiniButtonMiddle, new GUILayoutOption[0]));
            ConsoleWindow.SetFlag(ConsoleWindow.ConsoleFlags.ErrorPause, GUILayout.Toggle(ConsoleWindow.HasFlag(ConsoleWindow.ConsoleFlags.ErrorPause), "Error Pause", ConsoleWindow.Constants.MiniButtonRight, new GUILayoutOption[0]));
            EditorGUILayout.Space();
            if (this.m_DevBuild)
            {
                GUILayout.FlexibleSpace();
                ConsoleWindow.SetFlag(ConsoleWindow.ConsoleFlags.StopForAssert, GUILayout.Toggle(ConsoleWindow.HasFlag(ConsoleWindow.ConsoleFlags.StopForAssert), "Stop for Assert", ConsoleWindow.Constants.MiniButtonLeft, new GUILayoutOption[0]));
                ConsoleWindow.SetFlag(ConsoleWindow.ConsoleFlags.StopForError, GUILayout.Toggle(ConsoleWindow.HasFlag(ConsoleWindow.ConsoleFlags.StopForError), "Stop for Error", ConsoleWindow.Constants.MiniButtonRight, new GUILayoutOption[0]));
            }
            GUILayout.FlexibleSpace();
            int num  = 0;
            int num2 = 0;
            int num3 = 0;

            LogEntries.GetCountsByType(ref num, ref num2, ref num3);
            bool val  = GUILayout.Toggle(ConsoleWindow.HasFlag(ConsoleWindow.ConsoleFlags.LogLevelLog), new GUIContent((num3 > 999) ? "999+" : num3.ToString(), (num3 <= 0) ? ConsoleWindow.iconInfoMono : ConsoleWindow.iconInfoSmall), ConsoleWindow.Constants.MiniButtonRight, new GUILayoutOption[0]);
            bool val2 = GUILayout.Toggle(ConsoleWindow.HasFlag(ConsoleWindow.ConsoleFlags.LogLevelWarning), new GUIContent((num2 > 999) ? "999+" : num2.ToString(), (num2 <= 0) ? ConsoleWindow.iconWarnMono : ConsoleWindow.iconWarnSmall), ConsoleWindow.Constants.MiniButtonMiddle, new GUILayoutOption[0]);
            bool val3 = GUILayout.Toggle(ConsoleWindow.HasFlag(ConsoleWindow.ConsoleFlags.LogLevelError), new GUIContent((num > 999) ? "999+" : num.ToString(), (num <= 0) ? ConsoleWindow.iconErrorMono : ConsoleWindow.iconErrorSmall), ConsoleWindow.Constants.MiniButtonLeft, new GUILayoutOption[0]);

            ConsoleWindow.SetFlag(ConsoleWindow.ConsoleFlags.LogLevelLog, val);
            ConsoleWindow.SetFlag(ConsoleWindow.ConsoleFlags.LogLevelWarning, val2);
            ConsoleWindow.SetFlag(ConsoleWindow.ConsoleFlags.LogLevelError, val3);
            GUILayout.EndHorizontal();
            this.m_ListView.totalRows = LogEntries.StartGettingEntries();
            SplitterGUILayout.BeginVerticalSplit(this.spl, new GUILayoutOption[0]);
            EditorGUIUtility.SetIconSize(new Vector2(32f, 32f));
            GUIContent gUIContent = new GUIContent();
            int        controlID  = GUIUtility.GetControlID(FocusType.Native);

            try
            {
                bool        flag3      = false;
                bool        flag4      = ConsoleWindow.HasFlag(ConsoleWindow.ConsoleFlags.Collapse);
                IEnumerator enumerator = ListViewGUI.ListView(this.m_ListView, ConsoleWindow.Constants.Box, new GUILayoutOption[0]).GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        ListViewElement listViewElement = (ListViewElement)enumerator.Current;
                        if (current.type == EventType.MouseDown && current.button == 0 && listViewElement.position.Contains(current.mousePosition))
                        {
                            if (current.clickCount == 2)
                            {
                                LogEntries.RowGotDoubleClicked(this.m_ListView.row);
                            }
                            flag3 = true;
                        }
                        if (current.type == EventType.Repaint)
                        {
                            int    mode = 0;
                            string text = null;
                            LogEntries.GetFirstTwoLinesEntryTextAndModeInternal(listViewElement.row, ref mode, ref text);
                            GUIStyle gUIStyle = (listViewElement.row % 2 != 0) ? ConsoleWindow.Constants.EvenBackground : ConsoleWindow.Constants.OddBackground;
                            gUIStyle.Draw(listViewElement.position, false, false, this.m_ListView.row == listViewElement.row, false);
                            gUIContent.text = text;
                            GUIStyle styleForErrorMode = ConsoleWindow.GetStyleForErrorMode(mode);
                            styleForErrorMode.Draw(listViewElement.position, gUIContent, controlID, this.m_ListView.row == listViewElement.row);
                            if (flag4)
                            {
                                Rect position = listViewElement.position;
                                gUIContent.text = LogEntries.GetEntryCount(listViewElement.row).ToString(CultureInfo.InvariantCulture);
                                Vector2 vector = ConsoleWindow.Constants.CountBadge.CalcSize(gUIContent);
                                position.xMin  = position.xMax - vector.x;
                                position.yMin += (position.yMax - position.yMin - vector.y) * 0.5f;
                                position.x    -= 5f;
                                GUI.Label(position, gUIContent, ConsoleWindow.Constants.CountBadge);
                            }
                        }
                    }
                }
                finally
                {
                    IDisposable disposable;
                    if ((disposable = (enumerator as IDisposable)) != null)
                    {
                        disposable.Dispose();
                    }
                }
                if (flag3)
                {
                    if (this.m_ListView.scrollPos.y >= (float)(this.m_ListView.rowHeight * this.m_ListView.totalRows - this.ms_LVHeight))
                    {
                        this.m_ListView.scrollPos.y = (float)(this.m_ListView.rowHeight * this.m_ListView.totalRows - this.ms_LVHeight - 1);
                    }
                }
                if (this.m_ListView.totalRows == 0 || this.m_ListView.row >= this.m_ListView.totalRows || this.m_ListView.row < 0)
                {
                    if (this.m_ActiveText.Length != 0)
                    {
                        this.SetActiveEntry(null);
                    }
                }
                else
                {
                    LogEntry logEntry = new LogEntry();
                    LogEntries.GetEntryInternal(this.m_ListView.row, logEntry);
                    this.SetActiveEntry(logEntry);
                    LogEntries.GetEntryInternal(this.m_ListView.row, logEntry);
                    if (this.m_ListView.selectionChanged || !this.m_ActiveText.Equals(logEntry.condition))
                    {
                        this.SetActiveEntry(logEntry);
                    }
                }
                if (GUIUtility.keyboardControl == this.m_ListView.ID && current.type == EventType.KeyDown && current.keyCode == KeyCode.Return && this.m_ListView.row != 0)
                {
                    LogEntries.RowGotDoubleClicked(this.m_ListView.row);
                    Event.current.Use();
                }
                if (current.type != EventType.Layout && ListViewGUI.ilvState.rectHeight != 1)
                {
                    this.ms_LVHeight = ListViewGUI.ilvState.rectHeight;
                }
            }
            finally
            {
                LogEntries.EndGettingEntries();
                EditorGUIUtility.SetIconSize(Vector2.zero);
            }
            this.m_TextScroll = GUILayout.BeginScrollView(this.m_TextScroll, ConsoleWindow.Constants.Box);
            float minHeight = ConsoleWindow.Constants.MessageStyle.CalcHeight(GUIContent.Temp(this.m_ActiveText), base.position.width);

            EditorGUILayout.SelectableLabel(this.m_ActiveText, ConsoleWindow.Constants.MessageStyle, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(true),
                GUILayout.ExpandHeight(true),
                GUILayout.MinHeight(minHeight)
            });
            GUILayout.EndScrollView();
            SplitterGUILayout.EndVerticalSplit();
            if ((current.type == EventType.ValidateCommand || current.type == EventType.ExecuteCommand) && current.commandName == "Copy" && this.m_ActiveText != string.Empty)
            {
                if (current.type == EventType.ExecuteCommand)
                {
                    EditorGUIUtility.systemCopyBuffer = this.m_ActiveText;
                }
                current.Use();
            }
        }