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


C# SceneView.ShowNotification方法代码示例

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


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

示例1: OnScene

    static void OnScene(SceneView sceneView)
    {
        if (snazzy == null || snazzyGrid == null) {InitReferences();}
        key = Event.current;

        sceneCamera = Camera.current;
        //		if (sceneCamera != null)
        //			Handles.Label (sceneCamera.transform.position+(sceneCamera.transform.forward*1),new GUIContent(sceneCamera.transform.rotation.eulerAngles.ToString()));

        Key(key,true);

        controlID = GUIUtility.hotControl;

        // Debug.Log (controlID);

        if (snazzy.lookAtSelect) {
            if (Selection.activeTransform != null) {
                // Debug.Log ("dfd");
                if (controlID == 0) sceneView.pivot = Selection.activeTransform.position;
                if (key.type == EventType.MouseDown) {
                    if (Mathf.Abs (sceneCamera.transform.localEulerAngles.z) > 175 && Mathf.Abs (sceneCamera.transform.localEulerAngles.z) < 185)
                        rotationOld = new Vector2(-sceneCamera.transform.localEulerAngles.x-sceneCamera.transform.localEulerAngles.z,sceneCamera.transform.localEulerAngles.y+sceneCamera.transform.localEulerAngles.z);
                    else
                        rotationOld = new Vector2(sceneCamera.transform.localEulerAngles.x,sceneCamera.transform.localEulerAngles.y);
                }
                else if (key.button == 1) {
                    sceneCamera.transform.localEulerAngles = new Vector3(DeltaAngle(sceneCamera.transform.localEulerAngles.x),DeltaAngle (sceneCamera.transform.localEulerAngles.y),DeltaAngle (sceneCamera.transform.localEulerAngles.z));
                    rotationOld += new Vector2(key.delta.y/10,key.delta.x/10);
                    Quaternion rotation = Quaternion.Euler(rotationOld.x,rotationOld.y,0.0f);
                    Vector3 position = rotation * new Vector3(0,0,-2) + Selection.activeTransform.position;

                    sceneCamera.transform.rotation = rotation;
                    sceneCamera.transform.position = position;
                    // sceneView.Repaint ();
                }
            }
            if (key.button == 2) {
                snazzy.lookAtSelect = false;
                SnazzyWindowRepaint();
            }
        }

        // Display Scene Notification
        if (notify.Length > 0) {
            sceneView.ShowNotification(new GUIContent(notify));
            notify = "";
        }

        if (Selection.activeTransform != null) {
            snazzyGrid.transform.position = Selection.activeTransform.position;//gridOffset;
            if (Selection.activeTransform != snazzy.oldTransform) {
                snazzy.oldPosition = Selection.activeTransform.position;
            }
        }

        if (snazzy.lockChild) {
            if (Selection.activeTransform != snazzy.oldTransform) ParentChildren();
        }

        if (snazzy.showGrid) {
            if (!snazzy.gridIsEnabled) ShowGrid();
        }
        else {
            if (snazzy.gridIsEnabled) HideGrid();
        }
        if (Selection.transforms.Length == 0) {
            if (snazzy.gridIsEnabled) HideGrid();
        }

        if (snazzyGrid != null)	{
            if (snazzy.mov2) snazzyGridRenderer.sharedMaterial.SetFloat("_Scale", snazzy.gridIncrement2*snazzy.gridSize);
                else snazzyGridRenderer.sharedMaterial.SetFloat("_Scale", snazzy.gridIncrement*snazzy.gridSize);

            snazzyGrid.transform.localScale = new Vector3(snazzy.objectScale*snazzy.moveAmount,snazzy.objectScale*snazzy.moveAmount,snazzy.objectScale*snazzy.moveAmount);
            snazzyGridRenderer.sharedMaterial.SetFloat("_SnapAreaSize", snazzy.objectScale/(snazzy.objectScale*snazzy.snapAreaSize));
            snazzyGridRenderer.sharedMaterial.SetFloat("_ObjectScale", snazzy.objectScale*snazzy.moveAmount);
            snazzyGridRenderer.sharedMaterial.SetFloat("_GridSteps", snazzy.gridSize);
            Vector3 gridOffset2 = -(gridOffset/snazzy.gridSize)+new Vector3(snazzy.snapOffset,snazzy.snapOffset,snazzy.snapOffset);
            snazzyGridRenderer.sharedMaterial.SetVector("_SnapOffset",gridOffset2);
            snazzyGridRenderer.sharedMaterial.SetVector("_GridOffset",gridOffset2);

            if (Camera.current != null) {
                // Vector3 cameraForward = Camera.current.transform.forward;
                //snazzyGridRenderer.sharedMaterial.SetFloat("_X", cameraForward.x);
                //snazzyGridRenderer.sharedMaterial.SetFloat("_Y", cameraForward.y);
                //snazzyGridRenderer.sharedMaterial.SetFloat("_Z", cameraForward.z);
                snazzyGridRenderer.sharedMaterial.SetFloat("_Fresnel", snazzy.viewDependency);
            }
        }
    }
开发者ID:millwardesque,项目名称:PixelWar3131,代码行数:90,代码来源:SnazzyToolsEditor.cs


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