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


C# Editor.Repaint方法代码示例

本文整理汇总了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();
        }
    }
开发者ID:edwonia,项目名称:VR-Online,代码行数:101,代码来源:ForgeEditorDisplayButton.cs

示例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;
    }
开发者ID:sylafrs,项目名称:rugby,代码行数:54,代码来源:XEditorTool.cs

示例3: RepaintIfUndoOrRedo

 public static void RepaintIfUndoOrRedo(Editor editor)
 {
     if (Event.current.type == EventType.ValidateCommand) {
         if (Event.current.commandName == "UndoRedoPerformed") {
             editor.Repaint();
         }
     }
 }
开发者ID:LogicalDragonGames,项目名称:Star_Bloom,代码行数:8,代码来源:GUIHelper.cs

示例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;
        }
开发者ID:li5414,项目名称:UnityFlatEditor,代码行数:13,代码来源:FlatEditor.cs

示例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;
            }
        }
开发者ID:mbbarange,项目名称:hivemind,代码行数:27,代码来源:BTEditorManager.cs


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