当前位置: 首页>>代码示例>>C#>>正文


C# EditorWindow.Close方法代码示例

本文整理汇总了C#中EditorWindow.Close方法的典型用法代码示例。如果您正苦于以下问题:C# EditorWindow.Close方法的具体用法?C# EditorWindow.Close怎么用?C# EditorWindow.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EditorWindow的用法示例。


在下文中一共展示了EditorWindow.Close方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateLibraryAndCloseWindow

 private void CreateLibraryAndCloseWindow(EditorWindow editorWindow)
 {
     PresetFileLocation location = s_Texts.fileLocationOrder[this.m_SelectedIndexInPopup];
     this.m_ErrorString = this.m_CreateLibraryCallback(this.m_NewLibraryName, location);
     if (string.IsNullOrEmpty(this.m_ErrorString))
     {
         editorWindow.Close();
     }
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:9,代码来源:PopupWindowContentForNewLibrary.cs

示例2: KeyboardHandling

        private void KeyboardHandling(EditorWindow editorWindow)
        {
            Event current = Event.current;
            if (current.type == EventType.KeyDown)
            {
                switch (current.keyCode)
                {
                    case KeyCode.KeypadEnter:
                    case KeyCode.Return:
                        this.CreateLibraryAndCloseWindow(editorWindow);
                        break;

                    case KeyCode.Escape:
                        editorWindow.Close();
                        break;
                }
            }
        }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:18,代码来源:PopupWindowContentForNewLibrary.cs

示例3: KeyboardHandling

 private void KeyboardHandling(EditorWindow editorWindow)
 {
     Event current = Event.current;
     if (current.type == EventType.KeyDown)
     {
         KeyCode keyCode = current.keyCode;
         if (keyCode != KeyCode.Return)
         {
             if (keyCode == KeyCode.Escape)
             {
                 editorWindow.Close();
                 return;
             }
             if (keyCode != KeyCode.KeypadEnter)
             {
                 return;
             }
         }
         this.CreateLibraryAndCloseWindow(editorWindow);
     }
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:21,代码来源:PopupWindowContentForNewLibrary.cs

示例4: DoShaderVariants

 private void DoShaderVariants(EditorWindow caller, ref Rect drawPos)
 {
     EditorGUI.BeginChangeCheck();
     bool usedBySceneOnly = GUI.Toggle(drawPos, currentVariantStripping == 1, EditorGUIUtility.TempContent("Skip unused shader_features"), Styles.menuItem);
     drawPos.y += 16f;
     if (EditorGUI.EndChangeCheck())
     {
         currentVariantStripping = !usedBySceneOnly ? 0 : 1;
     }
     drawPos.y += 6f;
     int comboCount = ShaderUtil.GetComboCount(this.m_Shader, usedBySceneOnly);
     string text = !usedBySceneOnly ? (comboCount + " variants total") : (comboCount + " variants included");
     Rect position = drawPos;
     position.x += Styles.menuItem.padding.left;
     position.width -= Styles.menuItem.padding.left + 4;
     GUI.Label(position, text);
     position.xMin = position.xMax - 40f;
     if (GUI.Button(position, "Show", EditorStyles.miniButton))
     {
         ShaderUtil.OpenShaderCombinations(this.m_Shader, usedBySceneOnly);
         caller.Close();
         GUIUtility.ExitGUI();
     }
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:24,代码来源:ShaderInspectorPlatformsPopup.cs

示例5: CreateLibraryAndCloseWindow

 private void CreateLibraryAndCloseWindow(EditorWindow editorWindow)
 {
   this.m_ErrorString = this.m_CreateLibraryCallback(this.m_NewLibraryName, PopupWindowContentForNewLibrary.s_Texts.fileLocationOrder[this.m_SelectedIndexInPopup]);
   if (!string.IsNullOrEmpty(this.m_ErrorString))
     return;
   editorWindow.Close();
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:7,代码来源:PopupWindowContentForNewLibrary.cs

示例6: Editor

        public void Editor()
        {
            // open, do nothing, close
            EditorWindow editor = new EditorWindow();
            editor.Show();
            this.WaitForRenderingComplete();
            editor.Close();

            // open, create template database, close
            string templateDatabaseFilePath = this.GetUniqueFilePathForTest(TestConstant.File.DefaultNewTemplateDatabaseFileName);
            if (File.Exists(templateDatabaseFilePath))
            {
                File.Delete(templateDatabaseFilePath);
            }
            editor = new EditorWindow();
            PrivateObject editorAccessor = new PrivateObject(editor);
            editor.Show();
            this.WaitForRenderingComplete();
            editorAccessor.Invoke(TestConstant.InitializeDataGridMethodName, templateDatabaseFilePath);
            this.WaitForRenderingComplete();
            editor.Close();

            // open, load existing database, pop dialogs, close
            // InitializeDataGrid() sets the template pane active but without the explicit set in test code the event gets dropped, resulting the EditChoiceList
            // show failing because the UIElement its position is referenced to is not visible.
            editor = new EditorWindow();
            editor.Show();
            this.WaitForRenderingComplete();
            editorAccessor.Invoke(TestConstant.InitializeDataGridMethodName, templateDatabaseFilePath);
            this.WaitForRenderingComplete();

            editor.TemplatePane.IsActive = true;
            this.WaitForRenderingComplete();

            this.ShowDialog(new AboutEditor(editor));
            this.ShowDialog(new EditChoiceList(editor.TemplateDataGrid, new List<string>() { "Choice0", "Choice1", "Choice2", "Choice3" }, editor));

            editor.Close();
        }
开发者ID:CascadesCarnivoreProject,项目名称:Timelapse,代码行数:39,代码来源:UserInterfaceTests.cs

示例7: DrawList

		private void DrawList(EditorWindow editorWindow, Rect windowRect)
		{
			Event current = Event.current;
			int num = -1;
			foreach (PopupList.ListElement current2 in this.m_Data.GetFilteredList(this.m_EnteredText))
			{
				num++;
				Rect position = new Rect(0f, 10f + (float)num * 16f + ((this.m_Gravity != PopupList.Gravity.Top || !this.m_Data.m_AllowCustom) ? 0f : 16f), windowRect.width, 16f);
				EventType type = current.type;
				switch (type)
				{
				case EventType.MouseDown:
					if (Event.current.button == 0 && position.Contains(Event.current.mousePosition))
					{
						if (this.m_Data.m_OnSelectCallback != null)
						{
							this.m_Data.m_OnSelectCallback(current2);
						}
						current.Use();
						if (this.m_Data.m_CloseOnSelection)
						{
							editorWindow.Close();
						}
					}
					continue;
				case EventType.MouseUp:
				{
					IL_9B:
					if (type != EventType.Repaint)
					{
						continue;
					}
					GUIStyle gUIStyle = (!current2.partiallySelected) ? PopupList.s_Styles.menuItem : PopupList.s_Styles.menuItemMixed;
					bool flag = current2.selected || current2.partiallySelected;
					bool hasKeyboardFocus = false;
					bool isHover = num == this.m_SelectedCompletionIndex;
					bool isActive = flag;
					GUIContent content = current2.m_Content;
					gUIStyle.Draw(position, content, isHover, isActive, flag, hasKeyboardFocus);
					continue;
				}
				case EventType.MouseMove:
					if (position.Contains(Event.current.mousePosition))
					{
						this.SelectCompletionWithIndex(num);
						current.Use();
					}
					continue;
				}
				goto IL_9B;
			}
		}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:52,代码来源:PopupList.cs

示例8: DrawCustomTextField

		private void DrawCustomTextField(EditorWindow editorWindow, Rect windowRect)
		{
			if (!this.m_Data.m_AllowCustom)
			{
				return;
			}
			Event current = Event.current;
			bool flag = true;
			bool flag2 = false;
			bool flag3 = false;
			bool flag4 = false;
			string text = this.CurrentDisplayedText();
			if (current.type == EventType.KeyDown)
			{
				KeyCode keyCode = current.keyCode;
				switch (keyCode)
				{
				case KeyCode.Backspace:
					goto IL_12C;
				case KeyCode.Tab:
					goto IL_AB;
				case (KeyCode)10:
				case (KeyCode)11:
				case KeyCode.Clear:
					IL_5D:
					if (keyCode == KeyCode.UpArrow)
					{
						this.ChangeSelectedCompletion(-1);
						flag3 = true;
						goto IL_170;
					}
					if (keyCode == KeyCode.DownArrow)
					{
						this.ChangeSelectedCompletion(1);
						flag3 = true;
						goto IL_170;
					}
					if (keyCode == KeyCode.None)
					{
						if (current.character == ' ' || current.character == ',')
						{
							flag3 = true;
						}
						goto IL_170;
					}
					if (keyCode == KeyCode.Space)
					{
						goto IL_AB;
					}
					if (keyCode == KeyCode.Comma)
					{
						goto IL_AB;
					}
					if (keyCode != KeyCode.Delete)
					{
						goto IL_170;
					}
					goto IL_12C;
				case KeyCode.Return:
					goto IL_AB;
				}
				goto IL_5D;
				IL_AB:
				if (text != string.Empty)
				{
					if (this.m_Data.m_OnSelectCallback != null)
					{
						this.m_Data.m_OnSelectCallback(this.m_Data.NewOrMatchingElement(text));
					}
					if (current.keyCode == KeyCode.Tab || current.keyCode == KeyCode.Comma)
					{
						flag4 = true;
					}
					if (this.m_Data.m_CloseOnSelection || current.keyCode == KeyCode.Return)
					{
						flag2 = true;
					}
				}
				flag3 = true;
				goto IL_170;
				IL_12C:
				flag = false;
			}
			IL_170:
			bool flag5 = false;
			Rect rect = new Rect(5f, (this.m_Gravity != PopupList.Gravity.Top) ? (windowRect.height - 16f - 5f) : 5f, windowRect.width - 10f - 14f, 16f);
			GUI.SetNextControlName(PopupList.s_TextFieldName);
			EditorGUI.FocusTextInControl(PopupList.s_TextFieldName);
			int controlID = GUIUtility.GetControlID(PopupList.s_TextFieldHash, FocusType.Keyboard, rect);
			if (flag3)
			{
				current.Use();
			}
			if (GUIUtility.keyboardControl == 0)
			{
				GUIUtility.keyboardControl = controlID;
			}
			string text2 = EditorGUI.DoTextField(PopupList.s_RecycledEditor, controlID, rect, text, PopupList.s_Styles.customTextField, null, out flag5, false, false, false);
			Rect position = rect;
			position.x += rect.width;
//.........这里部分代码省略.........
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:101,代码来源:PopupList.cs

示例9: DrawList

 private void DrawList(EditorWindow editorWindow, Rect windowRect)
 {
   Event current = Event.current;
   int index = -1;
   foreach (PopupList.ListElement filtered in this.m_Data.GetFilteredList(this.m_EnteredText))
   {
     ++index;
     Rect position = new Rect(windowRect.x, (float) ((double) windowRect.y + 10.0 + (double) index * 16.0 + (this.m_Gravity != PopupList.Gravity.Top || !this.m_Data.m_AllowCustom ? 0.0 : 16.0)), windowRect.width, 16f);
     EventType type = current.type;
     switch (type)
     {
       case EventType.MouseDown:
         if (Event.current.button == 0 && position.Contains(Event.current.mousePosition) && filtered.enabled)
         {
           if (this.m_Data.m_OnSelectCallback != null)
             this.m_Data.m_OnSelectCallback(filtered);
           current.Use();
           if (this.m_Data.m_CloseOnSelection)
           {
             editorWindow.Close();
             continue;
           }
           continue;
         }
         continue;
       case EventType.MouseMove:
         if (position.Contains(Event.current.mousePosition))
         {
           this.SelectCompletionWithIndex(index);
           current.Use();
           continue;
         }
         continue;
       default:
         if (type == EventType.Repaint)
         {
           GUIStyle guiStyle = !filtered.partiallySelected ? PopupList.s_Styles.menuItem : PopupList.s_Styles.menuItemMixed;
           bool on = filtered.selected || filtered.partiallySelected;
           bool hasKeyboardFocus = false;
           bool isHover = index == this.m_SelectedCompletionIndex;
           bool isActive = on;
           EditorGUI.BeginDisabledGroup(!filtered.enabled);
           GUIContent content = filtered.m_Content;
           guiStyle.Draw(position, content, isHover, isActive, on, hasKeyboardFocus);
           EditorGUI.EndDisabledGroup();
           continue;
         }
         continue;
     }
   }
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:51,代码来源:PopupList.cs

示例10: DrawCustomTextField

 private void DrawCustomTextField(EditorWindow editorWindow, Rect windowRect)
 {
   if (!this.m_Data.m_AllowCustom)
     return;
   Event current = Event.current;
   bool flag1 = this.m_Data.m_EnableAutoCompletion;
   bool flag2 = false;
   bool flag3 = false;
   bool flag4 = false;
   string str1 = this.CurrentDisplayedText();
   if (current.type == EventType.KeyDown)
   {
     KeyCode keyCode = current.keyCode;
     switch (keyCode)
     {
       case KeyCode.Backspace:
         flag1 = false;
         break;
       case KeyCode.Tab:
       case KeyCode.Return:
         if (str1 != string.Empty)
         {
           if (this.m_Data.m_OnSelectCallback != null)
             this.m_Data.m_OnSelectCallback(this.m_Data.NewOrMatchingElement(str1));
           if (current.keyCode == KeyCode.Tab || current.keyCode == KeyCode.Comma)
             flag4 = true;
           if (this.m_Data.m_CloseOnSelection || current.keyCode == KeyCode.Return)
             flag2 = true;
         }
         flag3 = true;
         break;
       default:
         if (keyCode != KeyCode.UpArrow)
         {
           if (keyCode != KeyCode.DownArrow)
           {
             if (keyCode != KeyCode.None)
             {
               if (keyCode != KeyCode.Space && keyCode != KeyCode.Comma)
               {
                 if (keyCode == KeyCode.Delete)
                   goto case KeyCode.Backspace;
                 else
                   break;
               }
               else
                 goto case KeyCode.Tab;
             }
             else
             {
               if ((int) current.character == 32 || (int) current.character == 44)
               {
                 flag3 = true;
                 break;
               }
               break;
             }
           }
           else
           {
             this.ChangeSelectedCompletion(1);
             flag3 = true;
             break;
           }
         }
         else
         {
           this.ChangeSelectedCompletion(-1);
           flag3 = true;
           break;
         }
     }
   }
   bool changed = false;
   Rect position1 = new Rect(windowRect.x + 5f, windowRect.y + (this.m_Gravity != PopupList.Gravity.Top ? (float) ((double) windowRect.height - 16.0 - 5.0) : 5f), (float) ((double) windowRect.width - 10.0 - 14.0), 16f);
   GUI.SetNextControlName(PopupList.s_TextFieldName);
   EditorGUI.FocusTextInControl(PopupList.s_TextFieldName);
   int controlId = GUIUtility.GetControlID(PopupList.s_TextFieldHash, FocusType.Keyboard, position1);
   if (flag3)
     current.Use();
   if (GUIUtility.keyboardControl == 0)
     GUIUtility.keyboardControl = controlId;
   string str2 = EditorGUI.DoTextField(PopupList.s_RecycledEditor, controlId, position1, str1, PopupList.s_Styles.customTextField, (string) null, out changed, false, false, false);
   Rect position2 = position1;
   position2.x += position1.width;
   position2.width = 14f;
   if (GUI.Button(position2, GUIContent.none, !(str2 != string.Empty) ? PopupList.s_Styles.customTextFieldCancelButtonEmpty : PopupList.s_Styles.customTextFieldCancelButton) && str2 != string.Empty || flag4)
   {
     string empty = string.Empty;
     PopupList.s_RecycledEditor.text = empty;
     str2 = EditorGUI.s_OriginalText = empty;
     PopupList.s_RecycledEditor.cursorIndex = 0;
     PopupList.s_RecycledEditor.selectIndex = 0;
     flag1 = false;
   }
   if (str1 != str2)
   {
     this.m_EnteredText = 0 > PopupList.s_RecycledEditor.cursorIndex || PopupList.s_RecycledEditor.cursorIndex >= str2.Length ? str2 : str2.Substring(0, PopupList.s_RecycledEditor.cursorIndex);
     if (flag1)
       this.UpdateCompletion();
//.........这里部分代码省略.........
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:101,代码来源:PopupList.cs


注:本文中的EditorWindow.Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。