49 private bool appHasFocus =
true;
59 if (IsRunningUnderRemoteDesktop())
64 Debug.LogWarning(
"Running under Remote Desktop, so changed ButtonController method to Left mouse button");
69 Debug.LogWarning(
"Running under Remote Desktop, so changed ButtonController method to Right mouse button");
74 Debug.LogWarning(
"Running under Remote Desktop, so changed ButtonController method to Middle mouse button");
86 bool left = Input.GetMouseButton(0);
87 bool right = Input.GetMouseButton(1);
88 bool middle = Input.GetMouseButton(2);
89 bool control = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
90 bool shift = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
91 bool alt = Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt);
92 bool space = Input.GetKey(KeyCode.Space);
110 return Input.GetKey(KeyCode.Return);
112 return this.appHasFocus;
114 return control && left;
116 return control && right;
118 return control && middle;
120 return shift && left;
122 return shift && right;
124 return shift && middle;
130 return alt && middle;
132 return space && left;
134 return space && right;
136 return space && middle;
143 private void OnApplicationFocus(
bool focusStatus)
145 this.appHasFocus = focusStatus;
149 [
System.Runtime.InteropServices.DllImport(
"kernel32.dll")]
150 private static extern uint GetCurrentProcessId();
152 [
System.Runtime.InteropServices.DllImport(
"kernel32.dll")]
153 private static extern bool ProcessIdToSessionId(uint dwProcessId, out uint pSessionId);
155 [
System.Runtime.InteropServices.DllImport(
"kernel32.dll")]
156 private static extern uint WTSGetActiveConsoleSessionId();
158 private bool IsRunningUnderRemoteDesktop()
160 uint processId = GetCurrentProcessId();
162 return ProcessIdToSessionId(processId, out sessionId) && (sessionId != WTSGetActiveConsoleSessionId());
165 private bool IsRunningUnderRemoteDesktop()