Here are the examples of the csharp api UICamera.GetDirection(UnityEngine.KeyCode, UnityEngine.KeyCode, UnityEngine.KeyCode, UnityEngine.KeyCode) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
19
View Source File : UICamera.cs
License : GNU General Public License v3.0
Project Creator : aelariane
License : GNU General Public License v3.0
Project Creator : aelariane
public void ProcessOthers()
{
UICamera.currentTouchID = -100;
UICamera.currentTouch = UICamera.mController;
UICamera.inputHasFocus = (UICamera.mSel != null && UICamera.mSel.GetComponent<UIInput>() != null);
bool flag = (this.submitKey0 != KeyCode.None && Input.GetKeyDown(this.submitKey0)) || (this.submitKey1 != KeyCode.None && Input.GetKeyDown(this.submitKey1));
bool flag2 = (this.submitKey0 != KeyCode.None && Input.GetKeyUp(this.submitKey0)) || (this.submitKey1 != KeyCode.None && Input.GetKeyUp(this.submitKey1));
if (flag || flag2)
{
UICamera.currentTouch.current = UICamera.mSel;
this.ProcessTouch(flag, flag2);
UICamera.currentTouch.current = null;
}
int num = 0;
int num2 = 0;
if (this.useKeyboard)
{
if (UICamera.inputHasFocus)
{
num += UICamera.GetDirection(KeyCode.UpArrow, KeyCode.DownArrow);
num2 += UICamera.GetDirection(KeyCode.RightArrow, KeyCode.LeftArrow);
}
else
{
num += UICamera.GetDirection(KeyCode.W, KeyCode.UpArrow, KeyCode.S, KeyCode.DownArrow);
num2 += UICamera.GetDirection(KeyCode.D, KeyCode.RightArrow, KeyCode.A, KeyCode.LeftArrow);
}
}
if (this.useController)
{
if (!string.IsNullOrEmpty(this.verticalAxisName))
{
num += UICamera.GetDirection(this.verticalAxisName);
}
if (!string.IsNullOrEmpty(this.horizontalAxisName))
{
num2 += UICamera.GetDirection(this.horizontalAxisName);
}
}
if (num != 0)
{
UICamera.Notify(UICamera.mSel, "OnKey", (num <= 0) ? KeyCode.DownArrow : KeyCode.UpArrow);
}
if (num2 != 0)
{
UICamera.Notify(UICamera.mSel, "OnKey", (num2 <= 0) ? KeyCode.LeftArrow : KeyCode.RightArrow);
}
if (this.useKeyboard && Input.GetKeyDown(KeyCode.Tab))
{
UICamera.Notify(UICamera.mSel, "OnKey", KeyCode.Tab);
}
if (this.cancelKey0 != KeyCode.None && Input.GetKeyDown(this.cancelKey0))
{
UICamera.Notify(UICamera.mSel, "OnKey", KeyCode.Escape);
}
if (this.cancelKey1 != KeyCode.None && Input.GetKeyDown(this.cancelKey1))
{
UICamera.Notify(UICamera.mSel, "OnKey", KeyCode.Escape);
}
UICamera.currentTouch = null;
}
19
View Source File : UICamera.cs
License : Apache License 2.0
Project Creator : OOXXXXOO
License : Apache License 2.0
Project Creator : OOXXXXOO
public void ProcessOthers ()
{
currentTouchID = -100;
currentTouch = controller;
bool submitKeyDown = false;
bool submitKeyUp = false;
if (submitKey0 != KeyCode.None && Input.GetKeyDown(submitKey0))
{
currentKey = submitKey0;
submitKeyDown = true;
}
if (submitKey1 != KeyCode.None && Input.GetKeyDown(submitKey1))
{
currentKey = submitKey1;
submitKeyDown = true;
}
if (submitKey0 != KeyCode.None && Input.GetKeyUp(submitKey0))
{
currentKey = submitKey0;
submitKeyUp = true;
}
if (submitKey1 != KeyCode.None && Input.GetKeyUp(submitKey1))
{
currentKey = submitKey1;
submitKeyUp = true;
}
if (submitKeyDown || submitKeyUp)
{
currentScheme = ControlScheme.Controller;
currentTouch.last = currentTouch.current;
currentTouch.current = mCurrentSelection;
ProcessTouch(submitKeyDown, submitKeyUp);
currentTouch.last = null;
}
int vertical = 0;
int horizontal = 0;
if (useKeyboard)
{
if (inputHasFocus)
{
vertical += GetDirection(KeyCode.UpArrow, KeyCode.DownArrow);
horizontal += GetDirection(KeyCode.RightArrow, KeyCode.LeftArrow);
}
else
{
vertical += GetDirection(KeyCode.W, KeyCode.UpArrow, KeyCode.S, KeyCode.DownArrow);
horizontal += GetDirection(KeyCode.D, KeyCode.RightArrow, KeyCode.A, KeyCode.LeftArrow);
}
}
if (useController)
{
if (!string.IsNullOrEmpty(verticalAxisName)) vertical += GetDirection(verticalAxisName);
if (!string.IsNullOrEmpty(horizontalAxisName)) horizontal += GetDirection(horizontalAxisName);
}
// Send out key notifications
if (vertical != 0)
{
currentScheme = ControlScheme.Controller;
Notify(mCurrentSelection, "OnKey", vertical > 0 ? KeyCode.UpArrow : KeyCode.DownArrow);
}
if (horizontal != 0)
{
currentScheme = ControlScheme.Controller;
Notify(mCurrentSelection, "OnKey", horizontal > 0 ? KeyCode.RightArrow : KeyCode.LeftArrow);
}
if (useKeyboard && Input.GetKeyDown(KeyCode.Tab))
{
currentKey = KeyCode.Tab;
currentScheme = ControlScheme.Controller;
Notify(mCurrentSelection, "OnKey", KeyCode.Tab);
}
// Send out the cancel key notification
if (cancelKey0 != KeyCode.None && Input.GetKeyDown(cancelKey0))
{
currentKey = cancelKey0;
currentScheme = ControlScheme.Controller;
Notify(mCurrentSelection, "OnKey", KeyCode.Escape);
}
if (cancelKey1 != KeyCode.None && Input.GetKeyDown(cancelKey1))
{
currentKey = cancelKey1;
currentScheme = ControlScheme.Controller;
Notify(mCurrentSelection, "OnKey", KeyCode.Escape);
}
currentTouch = null;
currentKey = KeyCode.None;
}