本文整理汇总了C#中KeyCode.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# KeyCode.ToString方法的具体用法?C# KeyCode.ToString怎么用?C# KeyCode.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyCode
的用法示例。
在下文中一共展示了KeyCode.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessInput
public override void ProcessInput(KeyCode key)
{
base.ProcessInput (key);
if (gameState != GameState.Play) {
return;
}
GetContainerForKey(key.ToString()).Fill();
}
示例2: PC
public static AxisKey PC(KeyCode neg, KeyCode pos)
{
AxisKey ak = new AxisKey();
ak.Type = ControlKeyType.PC;
ak.keys.Add(neg.ToString());
ak.keys.Add(pos.ToString());
return ak;
}
示例3: setInfo
public void setInfo(KeyCode _key, Color _col)
{
mPKey = _key;
gameObject.name = "dead" + mPKey;
SpriteRenderer sr = gameObject.GetComponent<SpriteRenderer>();
sr.color = _col;
GameObject textChild = transform.FindChild("DeadPlayerText").gameObject;
DeadPlayerText dptScript = textChild.GetComponent<DeadPlayerText>();
dptScript.setName(mPKey.ToString());
}
示例4: ToString
string ToString(KeyCode key)
{
switch (key)
{
case KeyCode.Alpha0:
case KeyCode.Alpha1:
case KeyCode.Alpha2:
case KeyCode.Alpha3:
case KeyCode.Alpha4:
case KeyCode.Alpha5:
case KeyCode.Alpha6:
case KeyCode.Alpha7:
case KeyCode.Alpha8:
case KeyCode.Alpha9:
return key.ToString().Replace("Alpha", "");
case KeyCode.LeftParen: return "(";
case KeyCode.RightParen: return ")";
case KeyCode.Keypad0:
case KeyCode.Keypad1:
case KeyCode.Keypad2:
case KeyCode.Keypad3:
case KeyCode.Keypad4:
case KeyCode.Keypad5:
case KeyCode.Keypad6:
case KeyCode.Keypad7:
case KeyCode.Keypad8:
case KeyCode.Keypad9:
return "Num" + key.ToString().Replace("Keypad", "");
case KeyCode.KeypadMinus: return "Num-";
case KeyCode.KeypadPlus: return "Num+";
case KeyCode.Escape: return "Esc";
case KeyCode.Minus: return "-";
case KeyCode.Plus: return "+";
default:
return key.ToString();
}
}
示例5: BindKey
public void BindKey(KeyCode key)
{
GlobalOptions options = GlobalOptions.Instance;
//print(ConfigListenerAction + " bound to " + key);
string[] configAction = ConfigListenerAction.Split('_');
if(configAction[0] == "player1"){
options.SetKeyConfig(0, configAction[1], key);
}
else if(configAction[0] == "player2"){
options.SetKeyConfig(1, configAction[1], key);
}
KeyText.text = key.ToString();
}
示例6: getPlayerName
//Function to compare the pressed key with both the KeySpaces to determine which player pressed the key
void getPlayerName(KeyCode kCode)
{
for (int i = 0; i < player1keys.Length; i++)
{
if (kCode.ToString() == player1keys[i])
{
thePlayer[0] = "One";
Debug.Log("It was Player " + thePlayer[0]);
convertKeysToString(kCode);
compareKeysWithDisplayedKeys(thePlayer, temp, RandomArray1, inputArrayIndex1);
}
else if (kCode.ToString() == player2keys[i])
{
thePlayer[0] = "Two";
Debug.Log("It was Player " + thePlayer[0]);
convertKeysToString(kCode);
compareKeysWithDisplayedKeys(thePlayer, temp, RandomArray2, inputArrayIndex2);
}
else
{
}
}
}
示例7: endListenning
private void endListenning(KeyCode code)
{
this.animator.Play("Empty");
this.listening = false;
if (code != KeyCode.None)
{
this.actualKeyCode = code;
this.btn.EditText(actualKeyCode.ToString());
Settings.Instance.UpdateKeyboard(this.action, this.actualKeyCode);
SaveLoad.save_setting();
}
else
this.btn.EditText(this.transKeys["cancel"]);
this.pressId++;
StartCoroutine(defaultSetUp(this.pressId));
}
示例8: ControlSequences
public void ControlSequences(KeyCode code)
{
_userSequence += code.ToString();
if (PlatformSpawner.Instance.ActivePlatforms.Any(x => x.KeyCombination.Equals(_userSequence)))
{
if (CharacterManager.Instance.CurrentPlatform != null)
CharacterManager.Instance.CurrentPlatform.Deactivate();
Platform correctPlatform = PlatformSpawner.Instance.ActivePlatforms.Find(x => x.KeyCombination.Equals(_userSequence));
correctPlatform.Activate();
CharacterManager.Instance.MoveCharacterToTransform(correctPlatform);
}
if (!PlatformSpawner.Instance.ActivePlatforms.Any(x => x.KeyCombination.StartsWith(_userSequence, System.StringComparison.CurrentCulture)))
{
_userSequence = "";
}
}
示例9: KeyToggle
public KeyCode KeyToggle(KeyCode character,int id)
{
if ( GUILayout.Button(character.ToString() , keySelectionId == id ? ToggleButtonStyleToggled : ToggleButtonStyleNormal ) )
{
keySelectionId = id;
}
if (keySelectionId == id) {
KeyCode e;
if (FetchKey (out e)) {
keySelectionId = -1;
return e;
}
}
return character;
//selectedKey = Keyb
}
示例10: GetSprite
public Sprite GetSprite(KeyCode kc)
{
int index = keyCodeList.IndexOf(kc);
if(index < 0)
{
Debug.LogError("Cannot find Keycode: " + kc.ToString() + " in list");
return null;
}
Sprite outSprite = null;
if(spritesList[index] != null)
{
outSprite = spritesList[index];
}
else
Debug.LogError("Cannot find sprite at index: " + index);
return outSprite;
}
示例11: Update
void Update() {
timer -= Time.deltaTime;
if (timer <= 0) {
buttonToPress.SetActive(true);
loadBar.goOnline();
if (Input.GetKeyDown(btn)) {
btn = GetRandomButton();
transform.GetComponentInChildren<TextMesh>().text = btn.ToString();
buttonToPress.SetActive(false);
timer = defaultTimer;
}
}
//Kuolema
if(timer <= offsetTimer) {
//pb.TakeDmg();
}
}
示例12: canAddKey
bool canAddKey(KeyCode key)
{
string keyTokens = key.ToString();
if (keyTokens == "Escape")
{
return false;
}
if (keyTokens == "Pause")
{
return false;
}
if(keyTokens.Length >= 14)
{
if (keyTokens.Substring(0, 14) == "JoystickButton")
{
return false;
}
}
return true;
}
示例13: Start
//TODO: SIIVOA!!!!!
void Start() {
btnArray[0] = KeyCode.Q;
btnArray[1] = KeyCode.W;
btnArray[2] = KeyCode.E;
btnArray[3] = KeyCode.R;
btnArray[4] = KeyCode.A;
btnArray[5] = KeyCode.S;
btnArray[6] = KeyCode.D;
btnArray[7] = KeyCode.F;
btnArray[8] = KeyCode.Z;
btnArray[9] = KeyCode.X;
btnArray[10] = KeyCode.X;
btnArray[11] = KeyCode.C;
btn = GetRandomButton();
buttonToPress.GetComponentInChildren<TextMesh>().text = btn.ToString();
//Cicle loaderin alustus
loadBar = buttonToPress.GetComponent<CircleLoad>();
loadBar.setTickRate(1.5f);
buttonToPress.SetActive(false);
}
示例14: widget_EventKeyButtonReleased
static void widget_EventKeyButtonReleased(Widget _sender, KeyCode _key)
{
Gui.Instance.Log("TestApp", LogLevel.Info, "EventKeyButtonReleased _key=" + _key.ToString());
}
示例15: widget_EventKeyButtonPressed
static void widget_EventKeyButtonPressed(Widget _sender, KeyCode _key, uint _char)
{
Gui.Instance.Log("TestApp", LogLevel.Info, "EventMouseMove _key=" + _key.ToString() + " _char=" + _char.ToString());
}