本文整理汇总了C#中SceneView类的典型用法代码示例。如果您正苦于以下问题:C# SceneView类的具体用法?C# SceneView怎么用?C# SceneView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SceneView类属于命名空间,在下文中一共展示了SceneView类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Update
public static void Update(SceneView sv)
{
Event e = Event.current;
if (e == null)
{
return;
}
if (e.type == EventType.keyDown)
{
switch(e.keyCode)
{
case KeyCode.L:
GrendelEditorPreferences.DrawEditorObjectLabels = !GrendelEditorPreferences.DrawEditorObjectLabels;
break;
case KeyCode.End:
MoveObjectToGround.Move(Selection.activeGameObject);
break;
}
}
}
开发者ID:ekhudson,项目名称:old-Grendel,代码行数:27,代码来源:EditorInput.cs
示例2: OnSceneInteract
static void OnSceneInteract(SceneView sceneView)
{
Event e = Event.current;
if (isActive)
{
Vector2 mousePos = Event.current.mousePosition;
mousePos.y = sceneView.camera.pixelHeight - mousePos.y;
Vector3 position = sceneView.camera.ScreenPointToRay(mousePos).origin;
Vector3 roundedPosition = new Vector3(Mathf.Round((position.x / SIZE_X) * SIZE_X), Mathf.Round((position.y / SIZE_Y) * SIZE_Y), 0);
if (e.type == EventType.MouseDown && e.button == 0)
{
if (Selection.activeGameObject && Selection.activeGameObject.tag == "Tile")
LastTile = Selection.activeGameObject;
if (LastTile)
{
GameObject tile = Instantiate(LastTile, roundedPosition, Quaternion.identity) as GameObject;
tile.name = LastTile.name;
}
}
else if (e.type == EventType.MouseDown && e.button == 1)
{
GameObject[] tiles = GameObject.FindGameObjectsWithTag("Tile");
foreach (GameObject tile in tiles)
{
if (tile.transform.position == roundedPosition)
DestroyImmediate(tile);
}
}
}
}
开发者ID:Julow,项目名称:unity_pool,代码行数:31,代码来源:MapEditor.cs
示例3: OnSceneGui
private void OnSceneGui(SceneView s)
{
if (lastObj != null)
{
lastObj.OnSceneGui(s);
}
}
开发者ID:friuns,项目名称:New-Unity-Project-tm2---Copy,代码行数:7,代码来源:Tools3.cs
示例4: CreatePointAsync
/// <summary>
/// Create a new point. This will activate drawing experience on the map. To complete it, select location from the map.
/// </summary>
/// <param name="sceneView">The <see cref="SceneView"/> that is used for drawing.</param>
/// <exception cref="TaskCanceledException">If previous task wasn't completed, <see cref="TaskCanceledException"/>
/// will be thrown. The task is cancelled if <see cref="Cancel"/> method or if any other draw or edit method is called.
/// </exception>
/// <returns>Return new <see cref="MapPoint"/> based on the user interactions.</returns>
public static async Task<MapPoint> CreatePointAsync(SceneView sceneView)
{
Initialize();
var geometry = await SceneDrawHelper.DrawPointAsync(sceneView, _drawTaskTokenSource.Token);
Cleanup();
return geometry;
}
开发者ID:Esri,项目名称:arcgis-runtime-demos-dotnet,代码行数:15,代码来源:SceneEditHelper.cs
示例5: GridUpdate
void GridUpdate(SceneView sceneview)
{
e = Event.current;
//Make sure MapData has been loaded
_MapData = EditorHelper.CheckMapData(_MapData);
//If a Grid exists place tiles
if (EditorHelper.GridExsists())
{
if(grid == null)
{
grid = GameObject.FindObjectOfType<DrawGrid>();
}
if (EditorHelper.InsideGrid(EditorHelper.GetMousePosition(e)))
{
//if input is from a mouse and the mouse button was a left click event
if (e.button == 0 && e.isMouse && e.type == EventType.MouseDown)
{
PaintTile();
}
}
}
}
开发者ID:DanWeston626,项目名称:LevelEditor,代码行数:25,代码来源:GridEditorSceneView.cs
示例6: OnScene
static void OnScene(SceneView sceneview)
{
var targets = GameObject.FindObjectsOfType<SimpleCCD>();
foreach (var target in targets)
{
foreach (var node in target.angleLimits)
{
if (node.Transform == null)
continue;
Transform transform = node.Transform;
Vector3 position = transform.position;
float handleSize = HandleUtility.GetHandleSize(position);
float discSize = handleSize * gizmoSize;
float parentRotation = transform.parent ? transform.parent.eulerAngles.z : 0;
Vector3 min = Quaternion.Euler(0, 0, node.min + parentRotation)*Vector3.down;
Vector3 max = Quaternion.Euler(0, 0, node.max + parentRotation)*Vector3.down;
Handles.color = new Color(0, 1, 0, 0.1f);
Handles.DrawWireDisc(position, Vector3.back, discSize);
Handles.DrawSolidArc(position, Vector3.forward, min, node.max - node.min, discSize);
Handles.color = Color.green;
Handles.DrawLine(position, position + min * discSize);
Handles.DrawLine(position, position + max*discSize);
Vector3 toChild = FindChildNode(transform, target.endTransform).position - position;
Handles.DrawLine(position, position + toChild);
}
}
}
开发者ID:Sushiy,项目名称:ShamanDance,代码行数:35,代码来源:SimpleCCDEditor.cs
示例7: GridUpdate
void GridUpdate(SceneView sceneView)
{
Event e = Event.current;
Ray r = Camera.current.ScreenPointToRay(new Vector3(e.mousePosition.x, -e.mousePosition.y + Camera.current.pixelHeight));
Vector3 mousePosition = r.origin;
if(e.isKey && e.character == 'a') {
GameObject obj;
Object prefab = PrefabUtility.GetPrefabParent(Selection.activeObject);
if (prefab)
{
obj = (GameObject)PrefabUtility.InstantiatePrefab(prefab);
Vector3 closestGridPoint = grid.grid[0,0];
foreach(Vector3 point in grid.grid)
{
if (Mathf.Abs(Vector3.Distance(point, mousePosition)) < Mathf.Abs(Vector3.Distance(closestGridPoint, mousePosition)))
closestGridPoint = point;
}
Vector3 alignedWithGrid = closestGridPoint;
obj.transform.position = alignedWithGrid;
}
}
}
开发者ID:alexwaslike,项目名称:TheLab,代码行数:30,代码来源:GridEditor.cs
示例8: SceneGUI
void SceneGUI(SceneView sceneView)
{
Event e = Event.current;
Handles.BeginGUI();
switch (uiMode)
{
case UIMODE.MODE1:
{
if (GUI.Button(new Rect(10, 10, 100, 50), "to MODE2"))
uiMode = UIMODE.MODE2;
}
break;
case UIMODE.MODE2:
{
if (GUI.Button(new Rect(10, 10, 100, 50), "to MODE1"))
uiMode = UIMODE.MODE1;
if (GUI.Button(new Rect(150, 10, 200, 50), "Show My Window"))
{
Debug.Log("Hello =====================");
isShow = !isShow;
}
if (isShow)
GUILayout.Window(0, new Rect(10, 90, 300, 300), ShowMyWindow, "Unity Objects");
}
break;
}
Handles.EndGUI();
}
开发者ID:yelimlim,项目名称:UnityStudy,代码行数:33,代码来源:MyEditorWindow.cs
示例9: OnSceneGUI
private void OnSceneGUI(SceneView scene)
{
UpdateOther(scene);
UpdateSetCam(scene);
timer.Update();
}
开发者ID:ConnectDeveloper01,项目名称:dorumon,代码行数:7,代码来源:InspectorSearch.cs
示例10: OnSceneGUI
static void OnSceneGUI(SceneView scnView)
{
if (_toolbarEnabled)
{
GUI.Window(110, new Rect(0,16, 256, _buttonSize), ToolbarWindow,"", GUI.skin.label);
}
}
开发者ID:ekhudson,项目名称:old-Grendel,代码行数:7,代码来源:GrendelToolbar.cs
示例11: ToSceneView
/// <summary>
/// Returns SceneView representation more suitable for ray tracer.
/// </summary>
/// <param name="fov">Field of view in degrees.</param>
/// <param name="aspectRatio">Width / height of the rectangle in space to render.</param>
/// <returns></returns>
public SceneView ToSceneView(double fov, double aspectRatio)
{
SceneView view = new SceneView();
view.Origin = this.Origin;
Vector lookVector = LookAt - Origin;
double rectWidth = lookVector.Len / (double)60 * fov;
double rectHeight = rectWidth / aspectRatio;
// use UP vector to determine left vector
view.RenderRectTopSide = new Vector(0, 1, 0).Cross(lookVector);
view.RenderRectTopSide.Normalize();
view.RenderRectTopSide.Mul(rectWidth);
// top vector must be perpendicular to lookVector and left vector
view.RenderRectLeftSide = view.RenderRectTopSide.Cross(lookVector);
view.RenderRectLeftSide.Normalize();
view.RenderRectLeftSide.Mul(-rectHeight);
// render rect centered at LookAt
view.RenderRectOrigin = LookAt;
view.RenderRectOrigin -= view.RenderRectLeftSide / 2;
view.RenderRectOrigin -= view.RenderRectTopSide / 2;
double test = lookVector.Dot(view.RenderRectLeftSide);
double test2 = lookVector.Dot(view.RenderRectTopSide);
Debug.Assert(Math.Abs(test) < Constants.Epsilon && Math.Abs(test2) < Constants.Epsilon,
"RenderRect not perpendicular to lookVector");
return view;
}
开发者ID:mkonicek,项目名称:raytracer,代码行数:38,代码来源:Camera.cs
示例12: OnSceneGUI
void OnSceneGUI(SceneView sceneView)
{
Event e = Event.current;
if (e.type == EventType.KeyDown)
{
switch (e.keyCode)
{
case KeyCode.PageUp:
selectedLayer = Wrap(--selectedLayer, layerNames.Length);
Selection.activeGameObject = tilemapGos[selectedLayer];
break;
case KeyCode.PageDown:
selectedLayer = Wrap(++selectedLayer, layerNames.Length);
Selection.activeGameObject = tilemapGos[selectedLayer];
break;
default:
break;
}
e.Use();
}
Handles.BeginGUI();
selectedLayer = GUI.SelectionGrid(new Rect(0, 32, 128, 64), selectedLayer, layerNames, 1);
if (fadeOtherLayers)
{
SetTileMapLayerColors();
}
Handles.EndGUI();
}
开发者ID:CarlosMeloStuff,项目名称:UnityLibrary,代码行数:35,代码来源:TilemapLayerHelper.cs
示例13: OnSceneGui
public override void OnSceneGui(SceneView sc)
{
#if UNITY_EDITOR
bool spa = Event.current.keyCode == KeyCode.F1;
bool bag = Event.current.keyCode == KeyCode.F2;
if (Event.current.type == EventType.keyDown && (spa || bag))
{
RaycastHit h;
var spw = GameObject.Find("dmSpawns");
if (spw == null)
spw = new GameObject("dmSpawns");
Vector2 mousePosition = Event.current.mousePosition;
mousePosition.y = Screen.height - mousePosition.y - 40;
if (Physics.Raycast(sc.camera.ScreenPointToRay(mousePosition), out h))
{
GameObject a;
if (bag)
a = (GameObject)PrefabUtility.InstantiatePrefab(resEditor.bag);
else
a = new GameObject("Spawn");
Undo.RegisterCreatedObjectUndo(a, "a");
a.transform.position = h.point + Vector3.up * 1;
a.transform.parent = spw.transform;
if (spa)
a.AddComponent<Spawn>();
}
}
#endif
}
开发者ID:friuns,项目名称:New-Unity-Project-Eddy-Car-Phys,代码行数:31,代码来源:GameBots.cs
示例14: GridUpdate
void GridUpdate(SceneView sceneview)
{
Event e = Event.current;
Ray r = Camera.current.ScreenPointToRay(new Vector3(e.mousePosition.x, -e.mousePosition.y + Camera.current.pixelHeight));
Vector3 mousePos = r.origin;
if (e.isKey && e.character == 'a')
{
GameObject obj;
Object prefab = PrefabUtility.GetPrefabParent(Selection.activeObject);
if (prefab)
{
Undo.IncrementCurrentGroup();
obj = (GameObject)PrefabUtility.InstantiatePrefab(prefab);
blocks.Add(obj);
Vector3 aligned = new Vector3(Mathf.Floor(mousePos.x / grid.width) * grid.width + grid.width / 2.0f,
Mathf.Floor(mousePos.y / grid.height) * grid.height + grid.height / 2.0f, 0.0f);
int blockOrientation = 0;
for (int i = blocks.Count - 1; i >= 0; i--)
{
if (blocks[i] == null || blocks[i].transform.position == aligned)
{
DestroyImmediate(blocks[i]);
blocks.RemoveAt(i);
}
Debug.Log("aligned=" + aligned + " Block Position=" + blocks[i].transform.position);
}
obj.transform.position = aligned;
obj.transform.SetParent(GameObject.Find("Grid").transform);
if (obj.tag == "Grass")
{
grassBlocks.Add(obj);
for (int i = grassBlocks.Count - 1; i >= 0; i--)
{
blockOrientation = 15;
Vector3 up = new Vector3(grassBlocks[i].transform.position.x, grassBlocks[i].transform.position.y + 1.0f, 0.0f);
Vector3 down = new Vector3(grassBlocks[i].transform.position.x, grassBlocks[i].transform.position.y - 1.0f, 0.0f);
Vector3 left = new Vector3(grassBlocks[i].transform.position.x - 1.0f, grassBlocks[i].transform.position.y, 0.0f);
Vector3 right = new Vector3(grassBlocks[i].transform.position.x + 1.0f, grassBlocks[i].transform.position.y, 0.0f);
for (int j = grassBlocks.Count - 1; j >= 0; j--)
{
if (grassBlocks[j].transform.position == up) blockOrientation -= 1;
if (grassBlocks[j].transform.position == down) blockOrientation -= 2;
if (grassBlocks[j].transform.position == left) blockOrientation -= 4;
if (grassBlocks[j].transform.position == right) blockOrientation -= 8;
Debug.Log(" Block Orientation=" + blockOrientation);
}
Debug.Log(" Block sprite=" + i + " grassSprite= " + blockOrientation);
Debug.Log(" Blocks=" + grassBlocks.Count + " grass= " + grassSprites.Length);
grassBlocks[i].GetComponent<SpriteRenderer>().sprite = grassSprites[blockOrientation];
}
}
Undo.RegisterCreatedObjectUndo(obj, "Create " + obj.name);
}
}
}
开发者ID:JeremyAstolfi,项目名称:MorningRitual,代码行数:59,代码来源:GridEditor.cs
示例15: OnSceneGUI
public void OnSceneGUI(SceneView sceneView)
{
// Select objects with right mouse
if (Event.current.type == EventType.mouseDown && Event.current.button == 0)
{
_ctrlKeyFlag = Event.current.control;
MouseRightClickFlag = true;
MousePosition = Event.current.mousePosition;
}
}
开发者ID:illvisation,项目名称:cellVIEW_bdbox,代码行数:10,代码来源:SelectionManager.cs
示例16: DrawNode
public void DrawNode(SceneView view)
{
Handles.BeginGUI();
//GUILayout.BeginArea(new Rect(50, 50, 500, 500));
view.BeginWindows();
screenPosition = GUI.Window(0, screenPosition, DrawWindowGUI, name );
view.EndWindows();
// GUILayout.EndArea();
Handles.EndGUI();
}
开发者ID:Aeal,项目名称:ULib,代码行数:10,代码来源:ComponentNode_Editor.cs
示例17: OnSceneGUI
public static void OnSceneGUI(SceneView sceneview)
{
if ((currentSelection== null) || (currentSelectionMesh == null) || (currentSelectionMeshFilter == null) )
return;
SetMaterial();
int ctrlID = GUIUtility.GetControlID (VertexPainterHash , FocusType.Passive);
Event current = Event.current;
switch(current.type){
case EventType.keyUp :
if ((current.keyCode == KeyCode.Q) && (current.control))
RenderVertexColors = !RenderVertexColors;
break;
case EventType.mouseUp:
switch (currentMode) {
case Mode.Painting:
break;
}
break;
case EventType.mouseDown:
switch (currentMode) {
case Mode.Painting:
current.Use();
break;
}
break;
case EventType.mouseDrag:
switch (currentMode) {
case Mode.None:
break;
case Mode.Painting:
EditorUtility.SetDirty(currentSelectionMesh);
PaintVertexColors();
break;
}
DrawHandle();
HandleUtility.Repaint();
break;
case EventType.mouseMove:
HandleUtility.Repaint();
break;
case EventType.repaint:
DrawHandle();
break;
case EventType.layout:
HandleUtility.AddDefaultControl(ctrlID);
break;
}
}
开发者ID:SeanAtr0n,项目名称:LD25-SeanAtr0n,代码行数:55,代码来源:VertexPainter.cs
示例18: Input
/// <summary>
/// Used for handling keyboard input.
/// </summary>
public virtual void Input (SceneView _sceneView) {
if (settingsObject == null) {
settingsObject = VMESettingsObject.LoadScriptableObject();
}
OnSceneUI(_sceneView);
}
开发者ID:KevinBreurken,项目名称:VME,代码行数:14,代码来源:BaseEditorGroup.cs
示例19: OnScene
static void OnScene(SceneView sceneView)
{
var current = Event.current;
switch(current.type)
{
case EventType.DragPerform:
{
break;
}
case EventType.DragUpdated:
{
break;
}
case EventType.DragExited:
{
break;
}
case EventType.MouseMove:
{
break;
}
case EventType.MouseDown:
{
break;
}
case EventType.MouseUp:
{
break;
}
case EventType.Repaint:
{
Vector3 delta = new Vector3(0,0,10.0f);
LineDrawer.DrawLine(Matrix4x4.identity, Vector3.zero, delta, new Color(1,1,1,0.75f));
for (int i = 2; i < 20; i++)
{
var pos = new Vector3(i, 0, 0);
LineDrawer.DrawDottedLine(Matrix4x4.identity, pos, pos + delta, new Color(1, 1, 1, 0.75f), i);
}
break;
}
case EventType.Layout:
{
break;
}
default:
{
break;
}
}
}
开发者ID:Oleksii-Slipets,项目名称:UnityLines,代码行数:51,代码来源:Tester.cs
示例20: OnSceneGUI
// Update - Scene
public static void OnSceneGUI(SceneView sceneview)
{
if (Event.current.type == EventType.mouseDown)
button = Event.current.button;
if (Event.current.type == EventType.mouseUp)
button = -1;
if (Event.current.type == EventType.keyDown && Event.current.keyCode == KeyCode.N)
editing = !editing;
if (button > -1 && editing)
{
editPrefab(HandleUtility.GUIPointToWorldRay(Event.current.mousePosition));
Event.current.Use();
}
}
开发者ID:jitendrac,项目名称:level3d,代码行数:15,代码来源:MapEditor.cs
注:本文中的SceneView类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论