本文整理汇总了C#中EditorWindow类的典型用法代码示例。如果您正苦于以下问题:C# EditorWindow类的具体用法?C# EditorWindow怎么用?C# EditorWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EditorWindow类属于命名空间,在下文中一共展示了EditorWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AttachView
public bool AttachView(EditorWindow parent, ScriptableObject webView, bool initialize = false)
{
this.parentWin = parent;
this.internalWebView = webView;
if (this.internalWebView != null)
{
this.hostView = Tools.GetReflectionField<object>(parent, "m_Parent");
this.dockedGetterMethod = this.parentWin.GetType().GetProperty("docked", Tools.FullBinding).GetGetMethod(true);
if (this.hostView != null && dockedGetterMethod != null)
{
if (initialize)
{
Rect initViewRect = new Rect(0, 20, this.parentWin.position.width, this.parentWin.position.height - ((this.IsDocked()) ? 20 : 40));
this.InitWebView(this.hostView, (int)initViewRect.x, (int)initViewRect.y, (int)initViewRect.width, (int)initViewRect.height, false);
this.SetHideFlags(HideFlags.HideAndDontSave);
this.AllowRightClickMenu(true);
}
}
else
{
throw new Exception("Failed to get parent window or docked property");
}
}
return (this.internalWebView != null);
}
示例2: gridDiffs_CellClick
private void gridDiffs_CellClick(object sender, DataGridViewCellEventArgs e)
{
try
{
if (e.ColumnIndex == colCompare.DisplayIndex && e.RowIndex >= 0)
{
var diff = (InstallItemDiff)gridDiffs.Rows[e.RowIndex].DataBoundItem;
if (diff.DiffType == DiffType.Different)
{
Settings.Current.PerformDiff("Left"
, s => ToAml(s, diff.LeftScript)
, "Right"
, s => ToAml(s, diff.RightScript));
}
else
{
using (var dialog = new EditorWindow())
{
dialog.AllowRun = false;
dialog.Script = Utils.FormatXml(diff.LeftScript ?? diff.RightScript);
dialog.SetConnection(_wizard.Connection, _wizard.ConnectionInfo.First().ConnectionName);
dialog.ShowDialog(this);
}
}
}
}
catch (Exception ex)
{
Utils.HandleError(ex);
}
}
示例3: ShowWindow
public static void ShowWindow()
{
GUIContent newWindowContent = new GUIContent("PlatformGenerator", (Texture)AssetDatabase.LoadAssetAtPath("Assets/Art/PlatformTiles/tile5.png", typeof(Texture)), "Tool to generate new platforms with width and height");
_window = EditorWindow.GetWindow(typeof(PlatformGenerateEditor));
_platformGenerator = new PlatformGenerator();
_window.titleContent = newWindowContent;
}
示例4: gridDiffs_CellClick
private void gridDiffs_CellClick(object sender, DataGridViewCellEventArgs e)
{
try
{
if (e.ColumnIndex == colCompare.DisplayIndex && e.RowIndex >= 0)
{
var diff = (InstallItemDiff)gridDiffs.Rows[e.RowIndex].DataBoundItem;
if (diff.DiffType == DiffType.Different)
{
var diffWin = new ADiff.DiffWindow();
diffWin.LeftText = diff.LeftScript.OuterXml;
diffWin.RightText = diff.RightScript.OuterXml;
ElementHost.EnableModelessKeyboardInterop(diffWin);
diffWin.Show();
}
else
{
using (var dialog = new EditorWindow())
{
dialog.AllowRun = false;
dialog.AmlGetter = o => Utils.FormatXml(diff.LeftScript ?? diff.RightScript);
dialog.DisplayMember = "Name";
dialog.DataSource = new List<InstallItemDiff>() { diff };
dialog.SetConnection(_wizard.Connection, _wizard.ConnectionInfo.First().ConnectionName);
dialog.ShowDialog(this);
}
}
}
}
catch (Exception ex)
{
Utils.HandleError(ex);
}
}
示例5: ShowWindow
public static void ShowWindow ()
{
_window = EditorWindow.GetWindow(typeof(MapTool));
_window.maxSize = new Vector2(600f, 400f);
_window.minSize = _window.maxSize;
}
示例6: GrabSingleView
private void GrabSingleView(EditorWindow view, FileInfo targetFile, OutputFormat format)
{
var width = Mathf.FloorToInt(view.position.width);
var height = Mathf.FloorToInt(view.position.height);
Texture2D screenShot = new Texture2D(width, height);
this.HideOnGrabbing();
var colorArray = InternalEditorUtility.ReadScreenPixel(view.position.position, width, height);
screenShot.SetPixels(colorArray);
byte[] encodedBytes = null;
if (format == OutputFormat.jpg)
{
encodedBytes = screenShot.EncodeToJPG();
}
else
{
encodedBytes = screenShot.EncodeToPNG();
}
File.WriteAllBytes(targetFile.FullName, encodedBytes);
this.ShowAfterHiding();
}
示例7: GetCenterRect
public static Rect GetCenterRect(EditorWindow editorWindow, float width, float height) {
var size = editorWindow.position;
return new Rect(size.width * 0.5f - width * 0.5f, size.height * 0.5f - height * 0.5f, width, height);
}
示例8: AddCurvesPopupHierarchyGUI
public AddCurvesPopupHierarchyGUI(TreeView treeView, AnimationWindowState state, EditorWindow owner) : base(treeView, true)
{
this.plusButtonStyle = new GUIStyle("OL Plus");
this.plusButtonBackgroundStyle = new GUIStyle("Tag MenuItem");
this.owner = owner;
this.state = state;
}
示例9: DrawIconButton
public static bool DrawIconButton(string buttonLabel, Texture2D buttonIcon, EditorWindow edWindow = null, EditorStyles buttonStyle = null)
{
bool clicked = false;
Rect buttonRect = EditorGUILayout.BeginVertical("box");
if (GUI.Button(buttonRect, new GUIContent("", "Tooltip"), GetFoldoutButton())){
//toggleDropDown = (toggleDropDown ? false : true);
}
GUILayout.Space(5f);
EditorGUILayout.BeginHorizontal();
if(clicked){
GUILayout.Label("[ ]", GetLargeLabelIcon());
//GUILayout.Label("[ V ]", largeLabelIcon);
}
else
{
GUILayout.Label(" [] ", GetLargeLabelIcon());
}
GUILayout.Label(buttonLabel, GetLargeLabel());
EditorGUILayout.EndHorizontal();
GUILayout.Space(8f);
EditorGUILayout.EndVertical();
return clicked;
}
示例10: GDEDrawHelper
public GDEDrawHelper(EditorWindow window, float topBuf=2f, float leftBuf=2f, float bottomBuf = 2f, float rightBuf=2f, float lineHeight=20f)
{
if (mainHeaderStyle.IsNullOrEmpty())
{
mainHeaderStyle = new GUIStyle(GUI.skin.label);
mainHeaderStyle.fontSize = 20;
mainHeaderStyle.fontStyle = FontStyle.Bold;
}
if (subHeaderStyle.IsNullOrEmpty())
{
subHeaderStyle = new GUIStyle(GUI.skin.label);
subHeaderStyle.fontSize = mainHeaderStyle.fontSize - 4;
subHeaderStyle.fontStyle = FontStyle.Bold;
}
TopBuffer = topBuf;
LeftBuffer = leftBuf;
BottomBuffer = bottomBuf;
RightBuffer = rightBuf;
LineHeight = lineHeight;
windowHandle = window;
SizeCache = new Dictionary<string, Vector2>();
ResetToTop();
}
示例11: EmptyEditor
public EmptyEditor(string name, EditorWindow window)
{
this.name = name;
this.window = window;
this.toolbarIndex = 0;
this.requiresDatabase = false;
}
示例12: Draw
private void Draw(EditorWindow caller, float listElementWidth)
{
Rect rect = new Rect(0.0f, 0.0f, listElementWidth, 16f);
this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sShadedHeader);
for (int index = 0; index < SceneRenderModeWindow.sRenderModeCount; ++index)
{
DrawCameraMode drawCameraMode = (DrawCameraMode) index;
switch (drawCameraMode)
{
case DrawCameraMode.ShadowCascades:
this.DrawSeparator(ref rect);
this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sMiscellaneous);
break;
case DrawCameraMode.DeferredDiffuse:
this.DrawSeparator(ref rect);
this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sDeferredHeader);
break;
case DrawCameraMode.Charting:
this.DrawSeparator(ref rect);
this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sGlobalIlluminationHeader);
break;
}
EditorGUI.BeginDisabledGroup(this.IsModeDisabled(drawCameraMode));
this.DoOneMode(caller, ref rect, drawCameraMode);
EditorGUI.EndDisabledGroup();
}
bool disabled = this.m_SceneView.renderMode < DrawCameraMode.Charting || this.IsModeDisabled(this.m_SceneView.renderMode);
this.DoResolutionToggle(rect, disabled);
}
示例13: SetWindowValues
public static void SetWindowValues(EditorWindow editor, Texture icon, string title)
{
GUIContent guiContent;
if (m_windowContentDict == null)
m_windowContentDict = new Dictionary<EditorWindow, GUIContent>();
if (m_windowContentDict.ContainsKey(editor))
{
guiContent = m_windowContentDict[editor];
if (guiContent != null)
{
if (guiContent.image != icon) guiContent.image = icon;
if (title != null && guiContent.text != title) guiContent.text = title;
return;
}
m_windowContentDict.Remove(editor);
}
guiContent = getContent(editor);
if (guiContent != null)
{
if (guiContent.image != icon) guiContent.image = icon;
if (title != null && guiContent.text != title) guiContent.text = title;
m_windowContentDict.Add(editor, guiContent);
}
}
示例14: RemoveFailedToLoadWindowDockedWithInspector
private static void RemoveFailedToLoadWindowDockedWithInspector(EditorWindow[] allWindows)
{
EditorWindow inspectorWindow = null;
foreach (EditorWindow editorWin in allWindows)
{
if (editorWin.GetType().ToString() == "UnityEditor.InspectorWindow")
{
inspectorWindow = editorWin;
break;
}
}
if (inspectorWindow != null)
{
foreach (EditorWindow editorWin in allWindows)
{
if (editorWin.GetType().ToString() == "UnityEditor.FallbackEditorWindow") //cleans up old unused windows to deal with Unity layout bug
{
if (editorWin.position == inspectorWindow.position) //if docked
{
editorWin.Close();
break;
}
}
}
}
}
示例15: getContent
static GUIContent getContent(EditorWindow editor)
{
const BindingFlags bFlags = BindingFlags.Instance | BindingFlags.NonPublic;
PropertyInfo p = typeof(EditorWindow).GetProperty("cachedTitleContent", bFlags);
if (p == null) return null;
return p.GetValue(editor, null) as GUIContent;
}