HasMouseUp() public static méthode

public static HasMouseUp ( Rect r ) : bool
r UnityEngine.Rect
Résultat bool
Exemple #1
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);
            }
            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 num = 0;

            foreach (ListViewElement listViewElement in ListViewGUILayout.ListView(this.m_LV, AssetSaveDialog.s_Styles.box, new GUILayoutOption[0]))
            {
                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++;
                }
            }
            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);
        }
Exemple #2
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);
        }
Exemple #3
0
        private void DoDownloadConflictsGUI()
        {
            bool enabled   = GUI.enabled;
            bool shift     = Event.current.shift;
            bool actionKey = EditorGUI.actionKey;

            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Label("The following assets have been changed both on the server and in the local project.\nPlease select a conflict resolution for each before continuing the update.", new GUILayoutOption[0]);
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUI.enabled = (this.lv1HasSelection && enabled);
            if (GUILayout.Button(ASUpdateConflictResolveWindow.conflictButtonTexts[0], this.constants.ButtonLeft, new GUILayoutOption[0]))
            {
                this.ResolveSelectedDownloadConflicts(DownloadResolution.SkipAsset);
            }
            if (GUILayout.Button(ASUpdateConflictResolveWindow.conflictButtonTexts[1], this.constants.ButtonMiddle, new GUILayoutOption[0]))
            {
                this.ResolveSelectedDownloadConflicts(DownloadResolution.TrashMyChanges);
            }
            if (GUILayout.Button(ASUpdateConflictResolveWindow.conflictButtonTexts[2], this.constants.ButtonMiddle, new GUILayoutOption[0]))
            {
                this.ResolveSelectedDownloadConflicts(DownloadResolution.TrashServerChanges);
            }
            if (!this.enableMergeButton)
            {
                GUI.enabled = false;
            }
            if (GUILayout.Button(ASUpdateConflictResolveWindow.conflictButtonTexts[3], this.constants.ButtonRight, new GUILayoutOption[0]))
            {
                this.ResolveSelectedDownloadConflicts(DownloadResolution.Merge);
            }
            GUI.enabled = enabled;
            GUILayout.EndHorizontal();
            GUILayout.Space(5f);
            SplitterGUILayout.BeginHorizontalSplit(this.lvHeaderSplit1, 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.lv1.row;
            bool flag = false;

            foreach (ListViewElement listViewElement in ListViewGUILayout.ListView(this.lv1, this.constants.background, new GUILayoutOption[0]))
            {
                if (GUIUtility.keyboardControl == this.lv1.ID && Event.current.type == EventType.KeyDown && actionKey)
                {
                    Event.current.Use();
                }
                if (this.selectedLV1Items[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.lv1.row, ref this.initialSelectedLV1Item, ref this.selectedLV1Items);
                    }
                }
                else
                {
                    if (ListViewGUILayout.HasMouseDown(listViewElement.position))
                    {
                        if (Event.current.clickCount == 2 && !AssetServer.AssetIsDir(this.downloadConflicts[listViewElement.row]))
                        {
                            this.DoShowDiff(false);
                            GUIUtility.ExitGUI();
                        }
                        else
                        {
                            if (!this.selectedLV1Items[listViewElement.row] || shift || actionKey)
                            {
                                flag |= ListViewGUILayout.MultiSelection(row, listViewElement.row, ref this.initialSelectedLV1Item, ref this.selectedLV1Items);
                            }
                            this.lv1.row = listViewElement.row;
                        }
                    }
                    else
                    {
                        if (ListViewGUILayout.HasMouseDown(listViewElement.position, 1))
                        {
                            if (!this.selectedLV1Items[listViewElement.row])
                            {
                                flag = true;
                                for (int i = 0; i < this.selectedLV1Items.Length; i++)
                                {
                                    this.selectedLV1Items[i] = false;
                                }
                                this.lv1.selectionChanged = true;
                                this.selectedLV1Items[listViewElement.row] = true;
                                this.lv1.row = listViewElement.row;
                            }
                            GUIUtility.hotControl = 0;
                            Rect position = new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 1f, 1f);
                            EditorUtility.DisplayCustomMenu(position, this.dropDownMenuItems, null, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null);
                            Event.current.Use();
                        }
                    }
                }
                GUILayout.Label(this.downloadResolutionString[(int)this.downloadResolutions[listViewElement.row]], new GUILayoutOption[]
                {
                    GUILayout.Width((float)this.lvHeaderSplit1.realSizes[0]),
                    GUILayout.Height(18f)
                });
                if (this.deletionConflict[listViewElement.row] && Event.current.type == EventType.Repaint)
                {
                    GUIContent badgeDelete = ASMainWindow.constants.badgeDelete;
                    Rect       position2   = new Rect(listViewElement.position.x + (float)this.lvHeaderSplit1.realSizes[0] - (float)badgeDelete.image.width - 5f, listViewElement.position.y + listViewElement.position.height / 2f - (float)(badgeDelete.image.height / 2), (float)badgeDelete.image.width, (float)badgeDelete.image.height);
                    EditorGUIUtility.SetIconSize(Vector2.zero);
                    GUIStyle.none.Draw(position2, badgeDelete, false, false, false, false);
                    EditorGUIUtility.SetIconSize(this.iconSize);
                }
                GUILayout.Label(new GUIContent(this.dConflictPaths[listViewElement.row], (!AssetServer.AssetIsDir(this.downloadConflicts[listViewElement.row])) ? InternalEditorUtility.GetIconForFile(this.dConflictPaths[listViewElement.row]) : EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName)), new GUILayoutOption[]
                {
                    GUILayout.Width((float)this.lvHeaderSplit1.realSizes[1]),
                    GUILayout.Height(18f)
                });
            }
            GUILayout.EndVertical();
            if (GUIUtility.keyboardControl == this.lv1.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 j = 0; j < this.selectedLV1Items.Length; j++)
                        {
                            this.selectedLV1Items[j] = true;
                        }
                        flag = true;
                        Event.current.Use();
                    }
                }
                if (this.lv1.selectionChanged && !actionKey)
                {
                    flag |= ListViewGUILayout.MultiSelection(row, this.lv1.row, ref this.initialSelectedLV1Item, ref this.selectedLV1Items);
                }
                else
                {
                    if (GUIUtility.keyboardControl == this.lv1.ID && Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return && !AssetServer.AssetIsDir(this.downloadConflicts[this.lv1.row]))
                    {
                        this.DoShowDiff(false);
                        GUIUtility.ExitGUI();
                    }
                }
            }
            if (this.lv1.selectionChanged || flag)
            {
                this.mySelection = true;
                AssetServer.SetSelectionFromGUIDs(this.GetSelectedGUIDs());
                this.lv1HasSelection   = this.HasTrue(ref this.selectedLV1Items);
                this.enableMergeButton = this.AtLeastOneSelectedAssetCanBeMerged();
            }
        }
Exemple #4
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;

            foreach (ListViewElement listViewElement in ListViewGUILayout.ListView(this.lv2, this.constants.background, new GUILayoutOption[0]))
            {
                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)
                });
            }
            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);
            }
        }
        void OnGUI()
        {
            if (s_Styles == null)
            {
                s_Styles = new Styles();
                minSize = new Vector2(500, 300);
                position = new Rect(position.x, position.y, minSize.x, minSize.y);
            }

            GUILayout.Space(10);
            GUILayout.BeginHorizontal();
            GUILayout.Space(10);
            GUILayout.Label("Unity is about to save the following modified files. Unsaved changes will be lost!");
            GUILayout.Space(10);
            GUILayout.EndHorizontal();
            GUILayout.Space(10);

            GUILayout.BeginHorizontal();
            GUILayout.Space(10);

            int prevSelectedRow = m_LV.row;
            int numSelected = 0;
            foreach (ListViewElement el in ListViewGUILayout.ListView(m_LV, s_Styles.box))
            {
                if (m_SelectedItems[el.row] && Event.current.type == EventType.Repaint)
                {
                    Rect box = el.position;
                    box.x += 1;
                    box.y += 1;
                    box.width -= 1;
                    box.height -= 1;
                    s_Styles.selected.Draw(box, false, false, false, false);
                }

                GUILayout.Label(m_Content[el.row], s_Styles.labelHeight);

                if (ListViewGUILayout.HasMouseUp(el.position))
                {
                    Event.current.command = true;
                    Event.current.control = true;
                    ListViewGUILayout.MultiSelection(prevSelectedRow, el.row, ref m_InitialSelectedItem, ref m_SelectedItems);
                }
                if (m_SelectedItems[el.row])
                    numSelected++;
            }

            GUILayout.Space(10);
            GUILayout.EndHorizontal();
            GUILayout.Space(10);

            GUILayout.BeginHorizontal();
            GUILayout.Space(10);

            if (GUILayout.Button(s_Styles.close, s_Styles.button, GUILayout.Width(s_Styles.buttonWidth)))
            {
                CloseWindow();
            }

            GUILayout.FlexibleSpace();

            GUI.enabled = numSelected > 0;

            bool allSelected = numSelected == m_Assets.Count;

            if (GUILayout.Button(s_Styles.dontSave, s_Styles.button, GUILayout.Width(s_Styles.buttonWidth)))
            {
                IgnoreSelectedAssets();
            }

            if (GUILayout.Button(allSelected ? s_Styles.saveAll : s_Styles.saveSelected,
                s_Styles.button, GUILayout.Width(s_Styles.buttonWidth)))
            {
                SaveSelectedAssets();
            }

            GUI.enabled = true;

            GUILayout.Space(10);
            GUILayout.EndHorizontal();

            GUILayout.Space(10);

            if (m_Assets.Count == 0)
                CloseWindow();
        }