本文整理汇总了C#中ScriptCoreLib.JavaScript.DOM.HTML.IHTMLDiv.requestPointerLock方法的典型用法代码示例。如果您正苦于以下问题:C# IHTMLDiv.requestPointerLock方法的具体用法?C# IHTMLDiv.requestPointerLock怎么用?C# IHTMLDiv.requestPointerLock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScriptCoreLib.JavaScript.DOM.HTML.IHTMLDiv
的用法示例。
在下文中一共展示了IHTMLDiv.requestPointerLock方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Application
//.........这里部分代码省略.........
Native.document.exitPointerLock();
};
container.onmousedown +=
e =>
{
oldPointerX = pointer_x;
oldPointerY = pointer_y;
rotate = delegate
{
player_camera_x += (oldPointerX - pointer_x) * player_camera_speed;
player_camera_y += (oldPointerY - pointer_y) * player_camera_speed;
if (player_camera_y > 150)
{
player_camera_y = 150;
}
if (player_camera_y < -150)
{
player_camera_y = -150;
}
moveState_angle = Convert.ToInt32(player_camera_x / 2) % 360;
oldPointerX = pointer_x;
oldPointerY = pointer_y;
};
Console.WriteLine("requestPointerLock");
container.requestPointerLock();
};
#endregion
var renderer = new THREE.WebGLRenderer();
//renderer.setSize(width, height);
renderer.setSize();
renderer.shadowMapEnabled = true;
renderer.shadowMapSoft = true;
renderer.domElement.AttachTo(container);
#region create field
var planeGeometry = new THREE.PlaneGeometry(1000, 1000);
var planeMaterial = new THREE.MeshLambertMaterial(
new
{
map = THREE.ImageUtils.loadTexture(new HTML.Images.FromAssets.bg().src),
color = 0xffffff
}
);
planeMaterial.map.repeat.x = 300;
planeMaterial.map.repeat.y = 300;
planeMaterial.map.wrapS = THREE.RepeatWrapping;
planeMaterial.map.wrapT = THREE.RepeatWrapping;
var plane = new THREE.Mesh(planeGeometry, planeMaterial);
示例2: Spawn
//.........这里部分代码省略.........
if (dude.IsSelected)
{
var volume = Math.Min(1, dude.Zoom.DynamicZoom / 4);
var balance = dude.CurrentLocation.X / ViewSize.Width;
var ev_OffsetPosition = new Point(
ev.touches[0].clientX - Container.Bounds.Left,
ev.touches[0].clientY - Container.Bounds.Top
);
Argh_Stereo(volume, balance);
dude.WalkTo(ev_OffsetPosition);
}
};
#endregion
#region onclick
Container.onclick +=
ev =>
{
ev.preventDefault();
if (ev.MouseButton == IEvent.MouseButtonEnum.Middle)
{
if (Native.Document.pointerLockElement == Container)
{
Native.Document.exitPointerLock();
return;
}
pointer_x = (int)dude.CurrentLocation.X;
pointer_y = (int)dude.CurrentLocation.Y;
//Container.requestFullscreen();
Container.requestPointerLock();
return;
}
if (ev.Element != Ground)
return;
System.Console.WriteLine(ev.CursorPosition);
if (dude.IsSelected)
{
var volume = Math.Min(1, dude.Zoom.DynamicZoom / 4);
var balance = dude.CurrentLocation.X / ViewSize.Width;
Argh_Stereo(volume, balance);
dude.WalkTo(ev.OffsetPosition);
}
};
#endregion
//GroundOverlay.onclick +=
// ev =>
// {
// if (ev.Element != GroundOverlay)
// return;
// System.Console.WriteLine(ev.CursorPosition);
// if (dude.IsSelected)
// {
// new Argh().play();
// dude.WalkTo(ev.OffsetPosition);
// }
// };
dude.TeleportTo(ViewSize.Width / 2, (ViewSize.Height - MarginSafe) / 2);
dude.LookDown();
ShowRoom();
dude.DoneWalkingOnce +=
delegate
{
PrintRandomText(
LoadedScene.IntroText,
delegate
{
dude.WalkingOnce +=
delegate
{
Wallpaper.innerText = "";
};
dude.IsSelected = true;
}
);
};
dude.WalkToArc(MarginSafe, dude.Direction);
}
示例3: Application
//.........这里部分代码省略.........
div.css.active.style.backgroundColor = "yellow";
Native.document.documentElement.style.cursor = IStyle.CursorEnum.move;
div.css.hover.style.backgroundColor = "cyan";
div.onmousemove +=
e =>
{
// we could tilt the svg cursor
// like we do on heat zeeker:D
//Native.document.title = new { e.CursorX, e.CursorY }.ToString();
xy.innerText = new { e.CursorX, e.CursorY }.ToString();
};
div.onmousedown +=
async e =>
{
e.CaptureMouse();
await div.async.onmouseup;
};
}
#endregion
{
// shadow will select div from chldren
var div = new IHTMLDiv { }.AttachTo(Native.document.documentElement);
new IHTMLPre { "click to requestPointerLock, double click to stop" }.AttachTo(div);
var wasd = new IHTMLPre { "{}" }.AttachTo(div);
var xy = new IHTMLPre { "{}" }.AttachTo(div);
div.css.style.backgroundColor = "transparent";
div.css.style.transition = "background 500ms linear";
div.css.active.style.backgroundColor = "yellow";
Native.document.documentElement.style.cursor = IStyle.CursorEnum.move;
div.css.hover.style.backgroundColor = "cyan";
// https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20150704
var keys_ad = 0;
var keys_ws = 0;
var keys_c = 0;
var mousebutton = 0;
var mousewheel = 0;
var x = 0;
var y = 0;
// what about 255.255.255.255 ?
chrome.socket.getNetworkList().ContinueWithResult(
async n =>