本文整理汇总了C#中Cursor.SetStyleAuto方法的典型用法代码示例。如果您正苦于以下问题:C# Cursor.SetStyleAuto方法的具体用法?C# Cursor.SetStyleAuto怎么用?C# Cursor.SetStyleAuto使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cursor
的用法示例。
在下文中一共展示了Cursor.SetStyleAuto方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateUI
void CreateUI()
{
var cache = ResourceCache;
// Set up global UI style into the root UI element
XmlFile style = cache.GetXmlFile("UI/DefaultStyle.xml");
UI.Root.SetDefaultStyle(style);
// Create a Cursor UI element because we want to be able to hide and show it at will. When hidden, the mouse cursor will
// control the camera, and when visible, it will interact with the UI
Cursor cursor=new Cursor();
cursor.SetStyleAuto(null);
UI.Cursor=cursor;
// Set starting position of the cursor at the rendering window center
var graphics = Graphics;
cursor.SetPosition(graphics.Width / 2, graphics.Height / 2);
// Load UI content prepared in the editor and add to the UI hierarchy
UI.LoadLayoutToElement(UI.Root, cache, "UI/UILoadExample.xml");
// Subscribe to button actions (toggle scene lights when pressed then released)
var button1 = (Button) UI.Root.GetChild("ToggleLight1", true);
var button2 = (Button) UI.Root.GetChild("ToggleLight2", true);
button1.SubscribeToReleased (args => ToggleLight1 ());
button2.SubscribeToReleased (args => ToggleLight2 ());
}
示例2: CreateUI
void CreateUI()
{
var cache = ResourceCache;
var ui = UI;
var graphics = Graphics;
var style = cache.GetXmlFile("UI/DefaultStyle.xml");
var cursor = new Cursor();
cursor.SetStyleAuto(style);
ui.Cursor = cursor;
cursor.SetPosition(graphics.Width / 2, graphics.Height / 2);
SimpleCreateInstructionsWithWasd(
"\nLMB to paint decals, RMB to rotate view\n" +
"Space to toggle debug geometry\n" +
"7 to toggle occlusion culling");
}
示例3: CreateUI
void CreateUI()
{
var cache = ResourceCache;
// Create a Cursor UI element because we want to be able to hide and show it at will. When hidden, the mouse cursor will
// control the camera, and when visible, it will point the raycast target
XmlFile style = cache.GetXmlFile("UI/DefaultStyle.xml");
Cursor cursor = new Cursor();
cursor.SetStyleAuto(style);
UI.Cursor = cursor;
// Set starting position of the cursor at the rendering window center
var graphics = Graphics;
cursor.SetPosition(graphics.Width / 2, graphics.Height / 2);
// Construct new Text object, set string to display and font to use
var instructionText = new Text();
instructionText.Value =
"Use WASD keys to move, RMB to rotate view\n" +
"LMB to set destination, SHIFT+LMB to spawn a Jack\n" +
"CTRL+LMB to teleport main agent\n" +
"MMB to add obstacles or remove obstacles/agents\n" +
"F5 to save scene, F7 to load\n" +
"Space to toggle debug geometry";
instructionText.SetFont(cache.GetFont("Fonts/Anonymous Pro.ttf"), 15);
// The text has multiple rows. Center them in relation to each other
instructionText.TextAlignment = HorizontalAlignment.Center;
// Position the text relative to the screen center
instructionText.HorizontalAlignment = HorizontalAlignment.Center;
instructionText.VerticalAlignment = VerticalAlignment.Center;
instructionText.SetPosition(0, UI.Root.Height / 4);
UI.Root.AddChild(instructionText);
}