本文整理汇总了C#中UnityEditor.Editor.Repaint方法的典型用法代码示例。如果您正苦于以下问题:C# Editor.Repaint方法的具体用法?C# Editor.Repaint怎么用?C# Editor.Repaint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEditor.Editor
的用法示例。
在下文中一共展示了Editor.Repaint方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
//.........这里部分代码省略.........
{
bool fullScreenButton = string.IsNullOrEmpty(_toolTiptext);
Rect submitField = new Rect(original);
submitField.xMin += !fullScreenButton ? (width * 0.68f) + _submitButtonWidth : 10 + _submitButtonWidth;
submitField.xMax -= 10 - _submitButtonWidth;
submitField.yMin += 20 + _submitButtonHeight;
submitField.yMax -= 125 - _submitButtonHeight;
Rect lerpSpeedLabel = new Rect(original);
lerpSpeedLabel.xMin += 10;
lerpSpeedLabel.xMax -= 10;
lerpSpeedLabel.yMin += 62;
lerpSpeedLabel.yMax -= 55;
Rect distanceStopLabel = new Rect(original);
distanceStopLabel.xMin += 10;
distanceStopLabel.xMax -= 10;
distanceStopLabel.yMin += 93;
distanceStopLabel.yMax -= 25;
Rect angleStopLabel = new Rect(original);
angleStopLabel.xMin += 10;
angleStopLabel.xMax -= 10;
angleStopLabel.yMin += 125;
angleStopLabel.yMax -= 25;
Rect lerpSpeedField = new Rect(original);
lerpSpeedField.xMin += (width * 0.25f) + _submitButtonWidth;
lerpSpeedField.xMax -= 10 - _submitButtonWidth;
lerpSpeedField.yMin += 75 + _submitButtonHeight;
lerpSpeedField.yMax -= 75;
Rect distanceStopField = new Rect(original);
distanceStopField.xMin += (width * 0.25f) + _submitButtonWidth;
distanceStopField.xMax -= 10 - _submitButtonWidth;
distanceStopField.yMin += 107 + _submitButtonHeight;
distanceStopField.yMax -= 45;
Rect angleStopField = new Rect(original);
angleStopField.xMin += (width * 0.25f) + _submitButtonWidth;
angleStopField.xMax -= 10 - _submitButtonWidth;
angleStopField.yMin += 140 + _submitButtonHeight;
angleStopField.yMax -= 10;
_submitButtonTitle = Interpolation ? "Disable" : "Enable";
GUI.color = Interpolation ? Color.green : Color.gray;
if (GUI.Button(submitField, _submitButtonTitle))
{
Interpolation = !Interpolation;
_submitButtonTitle = Interpolation ? "Disable" : "Enable";
if (_submitButtonAction != null)
_submitButtonAction();
}
GUI.color = Color.white;
GUI.Label(lerpSpeedLabel, "Lerp Speed", fontStyle);
GUI.Label(distanceStopLabel, "Distance Stop", fontStyle);
GUI.Label(angleStopLabel, "Angle Stop", fontStyle);
GUI.enabled = Interpolation;
LerpSpeed = GUI.HorizontalSlider(lerpSpeedField, LerpSpeed, 0f, 1f);
float tempLerpSpeed = LerpSpeed;
if (float.TryParse(GUI.TextField(lerpSpeedLabelField, LerpSpeed.ToString()), out tempLerpSpeed))
{
LerpSpeed = tempLerpSpeed;
}
DistanceStop = GUI.HorizontalSlider(distanceStopField, DistanceStop, 0f, 1f);
float tempDistanceStop = DistanceStop;
if (float.TryParse(GUI.TextField(distanceStopLabelField, DistanceStop.ToString()), out tempDistanceStop))
{
DistanceStop = tempDistanceStop;
}
AngleStop = GUI.HorizontalSlider(angleStopField, AngleStop, 1f, 359.0f);
float tempAngleStop = AngleStop;
if (float.TryParse(GUI.TextField(angleStopLabelField, AngleStop.ToString()), out tempAngleStop))
{
AngleStop = tempAngleStop;
}
GUI.enabled = true;
}
if (_prevTex != _activeTex)
{
_prevTex = _activeTex;
window.Repaint();
}
}
示例2: BeginCommonArea
public XArea BeginCommonArea(string id,string name,Editor editor,bool forceOpen)
{
GUIStyle buttonStyle = EffectLayerCustom.Xbutton;
GUIStyle style = EffectLayerCustom.XArea;
if (!XAreas.ContainsKey(id))
{
XAreas.Add(id,new XArea());
}
//find my area.
XArea m = XAreas[id];
style.stretchWidth = true;
Rect gotLastRect = GUILayoutUtility.GetRect (new GUIContent (),style,GUILayout.Height (m.LastRect.height));
GUILayout.BeginArea (m.LastRect,style);
Rect newRect = EditorGUILayout.BeginVertical();
//head bar
EditorGUILayout.BeginHorizontal();
m.Open = GUILayout.Toggle(m.Open,GUIContent.none,EffectLayerCustom.XToggle2, GUILayout.Width(18f),GUILayout.Height(18f));
m.Enable = true;
if (GUILayout.Button (name,buttonStyle,GUILayout.Height(20f)))
m.Open = !m.Open;
if (forceOpen)
m.Open = true;
//increase a bit, need to do this.
newRect.height += 3f;
EditorGUILayout.EndHorizontal();
GUI.enabled = m.Enable;
if (!m.Open)
{
newRect.height = MinHeight;
}
//calculate area size.
if (Event.current.type == EventType.Repaint || Event.current.type == EventType.ScrollWheel) {
newRect.x = gotLastRect.x;
newRect.y = gotLastRect.y;
newRect.width = gotLastRect.width;
newRect.height += style.padding.top+ style.padding.bottom;
if (m.LastRect != newRect) {
m.LastRect = newRect;
editor.Repaint ();
}
}
return m;
}
示例3: RepaintIfUndoOrRedo
public static void RepaintIfUndoOrRedo(Editor editor)
{
if (Event.current.type == EventType.ValidateCommand) {
if (Event.current.commandName == "UndoRedoPerformed") {
editor.Repaint();
}
}
}
示例4: Enable
public static void Enable(Editor inspector)
{
var inspectorRect = new Rect(0, 0, Screen.width, Screen.height);
if (inspectorRect.Contains(Event.current.mousePosition))
{
inspector.Repaint();
}
_layoutOrigins = new Stack<Vector2>();
_layoutOrigins.Push(EditorGUILayout.GetControlRect().position);
TotalInspectorSpacing = 0;
}
示例5: SelectNode
public void SelectNode(Node node)
{
// Valid selection, but BTAsset is not selected in the project view, queue selection
if (node != null && Selection.activeObject != btAsset) {
QueuedSelectionFor = btAsset;
QueuedSelectionGUID = node.GUID;
Selection.activeObject = btAsset;
return;
}
selectedNode = node;
// Node is null, deselecting
if (node == null && btInspector != null) {
nodeInspector = null;
btInspector.Repaint ();
return;
}
// Node selected
Editor newInspector = Editor.CreateEditor (node);
if (newInspector != null) {
nodeInspector = newInspector;
nodeInspector.Repaint ();
return;
}
}