void OnGUI() { e = Event.current; if (e.isKey && isChange) { string s = e.keyCode.ToString(); switch (KeyName) { case "MoveF": MoveF.GetComponentInChildren <Text>().text = s; jt[0]["MoveF"] = s; break; case "MoveB": MoveB.GetComponentInChildren <Text>().text = s; jt[0]["MoveB"] = s; break; case "MoveU": MoveU.GetComponentInChildren <Text>().text = s; jt[0]["MoveU"] = s; break; case "MoveD": MoveD.GetComponentInChildren <Text>().text = s; jt[0]["MoveD"] = s; break; case "Jump": Jump.GetComponentInChildren <Text>().text = s; jt[0]["Jump"] = s; break; case "AtkKey": AtkKey.GetComponentInChildren <Text>().text = s; jt[0]["AtkKey"] = s; break; case "CheckKey": CheckKey.GetComponentInChildren <Text>().text = s; jt[0]["CheckKey"] = s; break; } jobj["PlayerSet"] = jt; string output = JsonConvert.SerializeObject(jobj, Formatting.Indented); File.WriteAllText(trl, output); ChangEnd(); print(s); } }
void TestStart() { MoveF.GetComponentInChildren <Text>().text = jt[0]["MoveF"].ToString(); MoveB.GetComponentInChildren <Text>().text = jt[0]["MoveB"].ToString(); MoveU.GetComponentInChildren <Text>().text = jt[0]["MoveU"].ToString(); MoveD.GetComponentInChildren <Text>().text = jt[0]["MoveD"].ToString(); Jump.GetComponentInChildren <Text>().text = jt[0]["Jump"].ToString(); AtkKey.GetComponentInChildren <Text>().text = jt[0]["AtkKey"].ToString(); CheckKey.GetComponentInChildren <Text>().text = jt[0]["CheckKey"].ToString(); }
public void ChangEnd() { MoveF.GetComponent <Button>().interactable = true; MoveB.GetComponent <Button>().interactable = true; MoveU.GetComponent <Button>().interactable = true; MoveD.GetComponent <Button>().interactable = true; Jump.GetComponent <Button>().interactable = true; AtkKey.GetComponent <Button>().interactable = true; CheckKey.GetComponent <Button>().interactable = true; TestStart(); isChange = false; }
/// <summary>Checks if a hotkey has already been registered as a Local or Global HotKey. /// </summary> /// <param name="shortcut">The hotkey string to check.</param> /// <param name="ToCheck">The HotKey type to check.</param> /// <returns>True if the HotKey is already registered, false otherwise.</returns> public bool HotKeyExists(string shortcut, CheckKey ToCheck) { Keys Key = (Keys)HotKeyShared.ParseShortcut(shortcut).GetValue(1); ModifierKeys Modifier = (ModifierKeys)HotKeyShared.ParseShortcut(shortcut).GetValue(0); switch (ToCheck) { case CheckKey.GlobalHotKey: return(((from item in GlobalHotKeyContainer where item.Key == Key && item.Modifier == Modifier select item).FirstOrDefault()) != null); //return GlobalHotKeyContainer.Exists // ( // delegate(GlobalHotKey g) // { // return (g.Key == Key && g.Modifier == Modifier); // } //); case CheckKey.LocalHotKey: return((((from item in LocalHotKeyContainer where item.Key == Key && item.Modifier == Modifier select item).FirstOrDefault()) != null) | (((from items in ChordHotKeyContainer where items.BaseKey == Key && items.BaseModifier == Modifier select items).FirstOrDefault()) != null)); //return (LocalHotKeyContainer.Exists // ( // delegate(LocalHotKey l) // { // return (l.Key == Key && l.Modifier == Modifier); // } // ) // | //Or. // ChordHotKeyContainer.Exists // ( // delegate(ChordHotKey c) // { // return (c.BaseKey == Key && c.BaseModifier == Modifier); // })); case CheckKey.Both: return(HotKeyExists(shortcut, CheckKey.GlobalHotKey) ^ HotKeyExists(shortcut, CheckKey.LocalHotKey)); } return(false); }
/// <summary>Checks if a hotkey has already been registered as a Local or Global HotKey. /// </summary> /// <param name="shortcut">The hotkey string to check.</param> /// <param name="ToCheck">The HotKey type to check.</param> /// <returns>True if the HotKey is already registered, false otherwise.</returns> public bool HotKeyExists(string shortcut, CheckKey ToCheck) { Keys Key = (Keys)HotKeyShared.ParseShortcut(shortcut).GetValue(1); Modifiers Modifier = (Modifiers)HotKeyShared.ParseShortcut(shortcut).GetValue(0); switch (ToCheck) { case CheckKey.GlobalHotKey: return(Program.SysConfig.GlobalHotKeyContainer.Exists ( delegate(GlobalHotKey g) { return (g.Key == Key && g.Modifier == Modifier); } )); case CheckKey.LocalHotKey: return(Program.SysConfig.LocalHotKeyContainer.Exists ( delegate(LocalHotKey l) { return (l.Key == Key && l.Modifier == Modifier); } ) | Program.SysConfig.ChordHotKeyContainer.Exists ( delegate(ChordHotKey c) { return (c.BaseKey == Key && c.BaseModifier == Modifier); })); case CheckKey.Both: return(HotKeyExists(shortcut, CheckKey.GlobalHotKey) ^ HotKeyExists(shortcut, CheckKey.LocalHotKey)); } return(false); }
/// <summary>Checks if a hotkey has already been registered as a Local or Global HotKey. /// </summary> /// <param name="shortcut">The hotkey string to check.</param> /// <param name="ToCheck">The HotKey type to check.</param> /// <returns>True if the HotKey is already registered, false otherwise.</returns> public bool HotKeyExists(string shortcut, CheckKey ToCheck) { Keys Key = (Keys)HotKeyShared.ParseShortcut(shortcut).GetValue(1); ModifierKeys Modifier = (ModifierKeys)HotKeyShared.ParseShortcut(shortcut).GetValue(0); switch (ToCheck) { case CheckKey.GlobalHotKey: return(GlobalHotKeyContainer.Exists ( delegate(GlobalHotKey g) { return (g.Key == Key && g.Modifier == Modifier); } )); case CheckKey.LocalHotKey: //Check if a LocalHotkey already exists with the same name and modifier or a chord has it's base key set. return(LocalHotKeyContainer.Exists ( delegate(LocalHotKey l) { return (l.Key == Key && l.Modifier == Modifier); } ) | //Or. ChordHotKeyContainer.Exists ( delegate(ChordHotKey c) { return (c.BaseKey == Key && c.BaseModifier == Modifier); })); case CheckKey.Both: return(HotKeyExists(shortcut, CheckKey.GlobalHotKey) ^ HotKeyExists(shortcut, CheckKey.LocalHotKey)); } return(false); }
/// <summary>Checks if a hotkey has already been registered as a Local or Global HotKey. /// </summary> /// <param name="key">The key of the HotKey.</param> /// <param name="modifier">The modifier of the HotKey.</param> /// <param name="ToCheck">The HotKey type to check.</param> /// <returns>True if the HotKey is already registered, false otherwise.</returns> public bool HotKeyExists(Keys key, ModifierKeys modifier, CheckKey ToCheck) { return (HotKeyExists(HotKeyShared.CombineShortcut(modifier, key), ToCheck)); }
/// <summary>Checks if a hotkey has already been registered as a Local or Global HotKey. /// </summary> /// <param name="shortcut">The hotkey string to check.</param> /// <param name="ToCheck">The HotKey type to check.</param> /// <returns>True if the HotKey is already registered, false otherwise.</returns> public bool HotKeyExists(string shortcut, CheckKey ToCheck) { Keys Key = (Keys)HotKeyShared.ParseShortcut(shortcut).GetValue(1); ModifierKeys Modifier = (ModifierKeys)HotKeyShared.ParseShortcut(shortcut).GetValue(0); switch (ToCheck) { case CheckKey.GlobalHotKey: return GlobalHotKeyContainer.Exists ( delegate(GlobalHotKey g) { return (g.Key == Key && g.Modifier == Modifier); } ); case CheckKey.LocalHotKey: //Check if a LocalHotkey already exists with the same name and modifier or a chord has it's base key set. return (LocalHotKeyContainer.Exists ( delegate(LocalHotKey l) { return (l.Key == Key && l.Modifier == Modifier); } ) | //Or. ChordHotKeyContainer.Exists ( delegate(ChordHotKey c) { return (c.BaseKey == Key && c.BaseModifier == Modifier); })); case CheckKey.Both: return (HotKeyExists(shortcut, CheckKey.GlobalHotKey) ^ HotKeyExists(shortcut, CheckKey.LocalHotKey)); } return false; }
/// <summary>Checks if a hotkey has already been registered as a Local or Global HotKey. /// </summary> /// <param name="key">The key of the HotKey.</param> /// <param name="modifier">The modifier of the HotKey.</param> /// <param name="ToCheck">The HotKey type to check.</param> /// <returns>True if the HotKey is already registered, false otherwise.</returns> public bool HotKeyExists(Keys key, Modifiers modifier, CheckKey ToCheck) { return(HotKeyExists(HotKeyShared.CombineShortcut(modifier, key), ToCheck)); }
/// <summary>Checks if a hotkey has already been registered as a Local or Global HotKey. /// </summary> /// <param name="shortcut">The hotkey string to check.</param> /// <param name="ToCheck">The HotKey type to check.</param> /// <returns>True if the HotKey is already registered, false otherwise.</returns> public bool HotKeyExists(string shortcut, CheckKey ToCheck) { Keys Key = (Keys)HotKeyShared.ParseShortcut(shortcut).GetValue(1); Modifiers Modifier = (Modifiers)HotKeyShared.ParseShortcut(shortcut).GetValue(0); switch (ToCheck) { case CheckKey.GlobalHotKey: return GlobalHotKeyContainer.Exists ( delegate(GlobalHotKey g) { return (g.Key == Key && g.Modifier == Modifier); } ); case CheckKey.LocalHotKey: return (LocalHotKeyContainer.Exists ( delegate(LocalHotKey l) { return (l.Key == Key && l.Modifier == Modifier); } ) | ChordHotKeyContainer.Exists ( delegate(ChordHotKey c) { return (c.BaseKey == Key && c.BaseModifier == Modifier); })); case CheckKey.Both: return (HotKeyExists(shortcut, CheckKey.GlobalHotKey) ^ HotKeyExists(shortcut, CheckKey.LocalHotKey)); } return false; }
/// <summary>Checks if a hotkey has already been registered as a Local or Global HotKey. /// </summary> /// <param name="shortcut">The hotkey string to check.</param> /// <param name="ToCheck">The HotKey type to check.</param> /// <returns>True if the HotKey is already registered, false otherwise.</returns> public bool HotKeyExists(string shortcut, CheckKey ToCheck) { Keys Key = (Keys)HotKeyShared.ParseShortcut(shortcut).GetValue(1); ModifierKeys Modifier = (ModifierKeys)HotKeyShared.ParseShortcut(shortcut).GetValue(0); switch (ToCheck) { case CheckKey.GlobalHotKey: return (((from item in GlobalHotKeyContainer where item.Key == Key && item.Modifier == Modifier select item).FirstOrDefault()) != null); //return GlobalHotKeyContainer.Exists // ( // delegate(GlobalHotKey g) // { // return (g.Key == Key && g.Modifier == Modifier); // } //); case CheckKey.LocalHotKey: return (((from item in LocalHotKeyContainer where item.Key == Key && item.Modifier == Modifier select item).FirstOrDefault()) != null) | (((from items in ChordHotKeyContainer where items.BaseKey == Key && items.BaseModifier == Modifier select items).FirstOrDefault()) != null); //return (LocalHotKeyContainer.Exists // ( // delegate(LocalHotKey l) // { // return (l.Key == Key && l.Modifier == Modifier); // } // ) // | //Or. // ChordHotKeyContainer.Exists // ( // delegate(ChordHotKey c) // { // return (c.BaseKey == Key && c.BaseModifier == Modifier); // })); case CheckKey.Both: return (HotKeyExists(shortcut, CheckKey.GlobalHotKey) ^ HotKeyExists(shortcut, CheckKey.LocalHotKey)); } return false; }
public void isCheck(string keyname) { KeyName = keyname; if (isChange) { print(KeyName); switch (KeyName) { case "MoveF": MoveB.GetComponentInChildren <Text>().text = jt[0]["MoveB"].ToString(); MoveU.GetComponentInChildren <Text>().text = jt[0]["MoveU"].ToString(); MoveD.GetComponentInChildren <Text>().text = jt[0]["MoveD"].ToString(); Jump.GetComponentInChildren <Text>().text = jt[0]["Jump"].ToString(); AtkKey.GetComponentInChildren <Text>().text = jt[0]["AtkKey"].ToString(); CheckKey.GetComponentInChildren <Text>().text = jt[0]["CheckKey"].ToString(); break; case "MoveB": MoveF.GetComponentInChildren <Text>().text = jt[0]["MoveF"].ToString(); MoveU.GetComponentInChildren <Text>().text = jt[0]["MoveU"].ToString(); MoveD.GetComponentInChildren <Text>().text = jt[0]["MoveD"].ToString(); Jump.GetComponentInChildren <Text>().text = jt[0]["Jump"].ToString(); AtkKey.GetComponentInChildren <Text>().text = jt[0]["AtkKey"].ToString(); CheckKey.GetComponentInChildren <Text>().text = jt[0]["CheckKey"].ToString(); break; case "MoveU": MoveB.GetComponentInChildren <Text>().text = jt[0]["MoveB"].ToString(); MoveD.GetComponentInChildren <Text>().text = jt[0]["MoveD"].ToString(); MoveF.GetComponentInChildren <Text>().text = jt[0]["MoveF"].ToString(); Jump.GetComponentInChildren <Text>().text = jt[0]["Jump"].ToString(); AtkKey.GetComponentInChildren <Text>().text = jt[0]["AtkKey"].ToString(); CheckKey.GetComponentInChildren <Text>().text = jt[0]["CheckKey"].ToString(); break; case "MoveD": MoveB.GetComponentInChildren <Text>().text = jt[0]["MoveB"].ToString(); MoveU.GetComponentInChildren <Text>().text = jt[0]["MoveU"].ToString(); MoveF.GetComponentInChildren <Text>().text = jt[0]["MoveF"].ToString(); Jump.GetComponentInChildren <Text>().text = jt[0]["Jump"].ToString(); AtkKey.GetComponentInChildren <Text>().text = jt[0]["AtkKey"].ToString(); CheckKey.GetComponentInChildren <Text>().text = jt[0]["CheckKey"].ToString(); break; case "Jump": MoveF.GetComponentInChildren <Text>().text = jt[0]["MoveF"].ToString(); MoveB.GetComponentInChildren <Text>().text = jt[0]["MoveB"].ToString(); MoveU.GetComponentInChildren <Text>().text = jt[0]["MoveU"].ToString(); MoveD.GetComponentInChildren <Text>().text = jt[0]["MoveD"].ToString(); AtkKey.GetComponentInChildren <Text>().text = jt[0]["AtkKey"].ToString(); CheckKey.GetComponentInChildren <Text>().text = jt[0]["CheckKey"].ToString(); break; case "AtkKey": MoveF.GetComponentInChildren <Text>().text = jt[0]["MoveF"].ToString(); MoveB.GetComponentInChildren <Text>().text = jt[0]["MoveB"].ToString(); MoveU.GetComponentInChildren <Text>().text = jt[0]["MoveU"].ToString(); MoveD.GetComponentInChildren <Text>().text = jt[0]["MoveD"].ToString(); Jump.GetComponentInChildren <Text>().text = jt[0]["Jump"].ToString(); CheckKey.GetComponentInChildren <Text>().text = jt[0]["CheckKey"].ToString(); break; case "CheckKey": MoveF.GetComponentInChildren <Text>().text = jt[0]["MoveF"].ToString(); MoveB.GetComponentInChildren <Text>().text = jt[0]["MoveB"].ToString(); MoveU.GetComponentInChildren <Text>().text = jt[0]["MoveU"].ToString(); MoveD.GetComponentInChildren <Text>().text = jt[0]["MoveD"].ToString(); Jump.GetComponentInChildren <Text>().text = jt[0]["Jump"].ToString(); AtkKey.GetComponentInChildren <Text>().text = jt[0]["AtkKey"].ToString(); break; } } if (!isChange) { isChange = true; } }