本文整理汇总了C#中Controller.RemoveListener方法的典型用法代码示例。如果您正苦于以下问题:C# Controller.RemoveListener方法的具体用法?C# Controller.RemoveListener怎么用?C# Controller.RemoveListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller
的用法示例。
在下文中一共展示了Controller.RemoveListener方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main()
{
SampleListener listener = new SampleListener();
Controller controller = new Controller();
controller.AddListener(listener);
Console.WriteLine("Press Enter to quit...");
Console.ReadLine();
controller.RemoveListener(listener);
controller.Dispose();
}
示例2: Main
public static void Main()
{
// Create a sample listener and controller
SampleListener listener = new SampleListener();
Controller controller = new Controller();
// Have the sample listener receive events from the controller
controller.AddListener(listener);
// Keep this process running until Enter is pressed
Console.WriteLine("Press Enter to quit...");
Console.ReadLine();
// Remove the sample listener when done
controller.RemoveListener(listener);
controller.Dispose();
}
示例3: Main
public static void Main()
{
// Create a sample listener and controller
SampleListener listener = new SampleListener();
Controller controller = new Controller();
controller.SetPolicy(Leap.Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);
// Have the sample listener receive events from the controller
controller.AddListener(listener);
//creating socket
// UdpClient sendingClient = new UdpClient();
//sendingClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
//sendingClient.Connect("localhost", 4200);
//Socket sending_socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
// IPAddress send_to_address = IPAddress.Parse("127.0.0.1");//localhost, for broadcast use ("192.168.2.255");
// IPEndPoint sending_end_point = new IPEndPoint(send_to_address, 4200);
/*
while(true)
{
// String text_to_send = "VR_TRACKER_SENSOR_0 42 24 66 0 0 0 0 0 0 1 2 3 4";
//byte[] send_buffer = Encoding.ASCII.GetBytes(text_to_send);
//Console.WriteLine("sending to address: {0} port: {1}", sending_end_point.Address, sending_end_point.Port);
try
{
//sending_socket.SendTo(send_buffer, sending_end_point);
//sendingClient.Send(send_buffer, send_buffer.Length, sending_end_point);
}
catch (Exception send_exception)
{
//exception_thrown = true;
Console.WriteLine(" Exception {0}", send_exception.Message);
}
Console.ReadLine();
//System.Threading.Thread.Sleep(1000);
}
*/
// Keep this process running until Enter is pressed
Console.WriteLine("Press Enter to quit...");
Console.ReadLine();
// Remove the sample listener when done
controller.RemoveListener(listener);
controller.Dispose();
}
示例4: getUserMove
/**
* This method gets the users move. A listener is created for the Leap Motion camera.
* The users move is obtained from the listener and is returned as the move for this round.
*/
String getUserMove()
{
bool ready = false;
SampleListener listener = new SampleListener();
Controller controller = new Controller();
controller.AddListener(listener);
// Keep this process running until user makes thier move
while(!ready)
{
// Wait until ready to get move
if (MyStaticValues.count > 3)
{
System.Threading.Thread.Sleep(1000);
ready = true;
MyStaticValues.count = 0;
}
}
// Console.WriteLine("move = " + listener.move);
controller.RemoveListener(listener);
controller.Dispose();
return listener.move;
}
示例5: Update
void Update()
{
SampleListener listener = new SampleListener ();
Controller controller = new Controller ();
controller.AddListener (listener);
controller.RemoveListener (listener);
controller.Dispose ();
//Clicktime.clicktime += Time.deltaTime;
//if (Clicktime.clicktime > cooldown){
approximateposition (Clicktime.finali, Clicktime.finalj);
switch (Clicktime.gesture) {
case 'c':
//SpawnInductor (20,20, Clicktime.k);
SpawnInductor (Clicktime.finali, Clicktime.finalj, -100);
Debug.Log ("Spawning inductor");
break;
case 'k':
//SpawnCapacitor(20,-20,Clicktime.k);
SpawnCapacitor (Clicktime.finali, Clicktime.finalj, -100);
Debug.Log ("Spawning capacitor");
break;
case 's':
//SpawnResistor(-20,20,Clicktime.k);
SpawnResistor (Clicktime.finali, Clicktime.finalj, -100);
Debug.Log ("Spawning resistor");
break;
case 'w':
//SpawnPower (-20,-20,Clicktime.k);
SpawnPower (Clicktime.finali, Clicktime.finalj, -100);
Debug.Log ("Spawning power");
break;
case 'p':
if (Clicktime.location1 == 0) {
if (Clicktime.IsLeft == true) { // if there is no first location and left node is indicated
if (Clicktime.finali == A.nx & Clicktime.finalj == A.ny) { // CaseA
Clicktime.xi = A.nx1;
Clicktime.yi = A.ny1;
} else if (Clicktime.finali == B.nx & Clicktime.finalj == B.ny) { // CaseB
Clicktime.xi = B.nx1;
Clicktime.yi = B.ny1;
} else if (Clicktime.finali == C.nx & Clicktime.finalj == C.ny) { // CaseC
Clicktime.xi = C.nx1;
Clicktime.yi = C.ny1;
} else if (Clicktime.finali == D.nx & Clicktime.finalj == D.ny) { // CaseD
Clicktime.xi = D.nx1;
Clicktime.yi = D.ny1;
}
} else if (Clicktime.IsRight == true) {
// if there is no first location and right node is indicated
if (Clicktime.finali == A.nx & Clicktime.finalj == A.ny) { // CaseA
Clicktime.xi = A.nx2;
Clicktime.yi = A.ny1;
} else if (Clicktime.finali == B.nx & Clicktime.finalj == B.ny) { // CaseB
Clicktime.xi = B.nx2;
Clicktime.yi = B.ny1;
} else if (Clicktime.finali == C.nx & Clicktime.finalj == C.ny) { // CaseC
Clicktime.xi = C.nx2;
Clicktime.yi = C.ny1;
} else if (Clicktime.finali == D.nx & Clicktime.finalj == D.ny) { // CaseD
Clicktime.xi = D.nx2;
Clicktime.yi = D.ny1;
}
}
Clicktime.location1 = 1;
}
if (Clicktime.location1 != 0) {
if (Clicktime.IsLeft == true) { // if there is first location and left node is indicated
if (Clicktime.finali == A.nx & Clicktime.finalj == A.ny) { // CaseA
Clicktime.xf = A.nx1;
Clicktime.yf = A.ny1;
} else if (Clicktime.finali == B.nx & Clicktime.finalj == B.ny) { // CaseB
Clicktime.xf = B.nx1;
Clicktime.yf = B.ny1;
} else if (Clicktime.finali == C.nx & Clicktime.finalj == C.ny) { // CaseC
Clicktime.xf = C.nx1;
Clicktime.yf = C.ny1;
} else if (Clicktime.finali == D.nx & Clicktime.finalj == D.ny) { // CaseD
Clicktime.xf = D.nx1;
Clicktime.yf = D.ny1;
}
} else if (Clicktime.IsRight == true) {
// if there is first location and right node is indicated
if (Clicktime.finali == A.nx & Clicktime.finalj == A.ny) { // CaseA
Clicktime.xf = A.nx2;
Clicktime.yf = A.ny1;
} else if (Clicktime.finali == B.nx & Clicktime.finalj == B.ny) { // CaseB
Clicktime.xf = B.nx2;
Clicktime.yf = B.ny1;
} else if (Clicktime.finali == C.nx & Clicktime.finalj == C.ny) { // CaseC
Clicktime.xf = C.nx2;
Clicktime.yf = C.ny1;
} else if (Clicktime.finali == D.nx & Clicktime.finalj == D.ny) { // CaseD
Clicktime.xf = D.nx2;
Clicktime.yf = D.ny1;
}
}
//.........这里部分代码省略.........