private static KeyEnum?GetKey(dynamic key) { if (key == null) { return(null); } StringBuilder keyStringBuilder = new StringBuilder(); keyStringBuilder.Append(key["standard"]["letter"]); if (System.Convert.ToBoolean(key["standard"]["sharp"])) { keyStringBuilder.Append("#"); } else if (System.Convert.ToBoolean(key["standard"]["flat"])) { keyStringBuilder.Append("b"); } if (key["standard"]["chord"] == "minor") { keyStringBuilder.Append("m"); } var keyString = keyStringBuilder.ToString(); KeyEnum returnKey = KeyEnumStringConverter.ConvertFromString(keyString); return(returnKey); }
public bool Equals(KeyEnum obj) { if ((object)obj == null) { return(false); } return(StringComparer.OrdinalIgnoreCase.Equals(this.Value, obj.Value)); }
public async Task Delete(KeyEnum id) { var entity = await this.Entity(id); if (entity != null) { Entities.Remove(entity); await SaveChanges(); } }
public async Task <Value> Update(KeyEnum valueId, ValueInput value) { var entity = await this.Entity(valueId); if (entity != null) { mapper.MapValue(value, entity); await SaveChanges(); return(mapper.MapValue(entity, new Value())); } throw new KeyNotFoundException($"Cannot find value {valueId.ToString()}"); }
public async Task <OptionmetaResult> GetOptionmetaByKeyAsync(KeyEnum key) { var option = await _context.Optionmetas.SingleOrDefaultAsync(x => x.Key == key); var optionmetaResult = new OptionmetaResult { PublicKeyName = option.PublicKeyName, Key = option.Key, KeyDescription = option.KeyDescription, Value = option.Value, ValueDescription = option.ValueDescription, AdditionalInfo = option.AdditionalInfo }; return(optionmetaResult); }
public async Task Delete(KeyEnum valueId) { await repo.Delete(valueId); }
public async Task <Value> Update(KeyEnum valueId, [FromBody] ValueInput value) { return(await repo.Update(valueId, value)); }
public async Task <Value> Get(KeyEnum valueId) { return(await repo.Get(valueId)); }
static public void ProcessKeyPress(KeyEnum key, bool press) { keys[(int)key] = press; }
public Shortcut(KeyEnum key, HotkeyModifier modifier) { Key = key; Modifier = modifier; }
/// <summary> /// Converts a key enum value into a key string to be stored in a Traktor NML file /// </summary> /// <param name="key">Key to convert</param> /// <returns>Key string value</returns> public static string ConvertToString(KeyEnum key) { switch (key) { case KeyEnum.Off: return("Off"); case KeyEnum.AFlat: return("Ab"); case KeyEnum.A: return("A"); case KeyEnum.ASharp: return("A#"); case KeyEnum.BFlat: return("Bb"); case KeyEnum.B: return("B"); case KeyEnum.C: return("C"); case KeyEnum.CSharp: return("C#"); case KeyEnum.DFlat: return("Db"); case KeyEnum.D: return("D"); case KeyEnum.DSharp: return("D#"); case KeyEnum.EFlat: return("Eb"); case KeyEnum.E: return("E"); case KeyEnum.F: return("F"); case KeyEnum.FSharp: return("F#"); case KeyEnum.GFlat: return("Gb"); case KeyEnum.G: return("G"); case KeyEnum.GSharp: return("G#"); case KeyEnum.AFlatMinor: return("Abm"); case KeyEnum.AMinor: return("Am"); case KeyEnum.ASharpMinor: return("A#m"); case KeyEnum.BFlatMinor: return("Bbm"); case KeyEnum.BMinor: return("Bm");; case KeyEnum.CMinor: return("Cm");; case KeyEnum.CSharpMinor: return("C#m"); case KeyEnum.DFlatMinor: return("Dbm"); case KeyEnum.DMinor: return("Dm"); case KeyEnum.DSharpMinor: return("D#m"); case KeyEnum.EFlatMinor: return("Ebm"); case KeyEnum.EMinor: return("Em"); case KeyEnum.FMinor: return("Fm"); case KeyEnum.FSharpMinor: return("F#m"); case KeyEnum.GFlatMinor: return("Gbm"); case KeyEnum.GMinor: return("Gm"); case KeyEnum.GSharpMinor: return("G#m"); default: throw new ArgumentException("Unexpected KeyEnum value", "key"); } }
private void ExecuteMyPlayer(PlayerContext context) { if (context.auto.Contains(AutoConditions.Talk.Talking)) { if (inputKey != KeyEnum.None) { switch (inputKey) { case KeyEnum.Send: { var targetPlayerId = context.talkingPlayerId; Debug.LogError("talk targetPlayerId:" + targetPlayerId); StackPublish(new Commands.Messaging(this.playerId, targetPlayerId, context.messageSend)); context.messageSend = string.Empty; inputKey = KeyEnum.None; break; } default: { Debug.LogError("まだ対処してない会話中の何か:" + inputKey); break; } } } } // 方向キー操作受付 if (inputDirection != DirectionEnum.None) { // あー、、このへんswitchで書けるといいなあ。もしくはchangerか。 /* * 会話中に移動したら、会話キャンセルしたいよね。 */ if (context.auto.Contains(AutoConditions.Talk.Talking)) { // 会話を途切れさせる。っていうか歩く。 EndTalking(); // 会話した相手の情報の保持 あんまり厳格にやらなくていい感じがした。 // context.lastTalkedPlayerId = context.talkingPlayerId; // context.talkingPlayerId = string.Empty; // context.messageSend = string.Empty; context.forward = inputDirection; context.auto = context.auto.ChangeTo(new Walk <PlayerContext, List <PlayerContext> >(clientFrame, context)); StackPublish(new Commands.Walk(this.playerId, inputDirection, new Commands.StructVector3((int)context.x, (int)context.z, (int)context.height))); } if (context.auto.Contains(AutoConditions.Control.Contorllable)) { context.forward = inputDirection; context.auto = context.auto.ChangeTo(new Walk <PlayerContext, List <PlayerContext> >(clientFrame, context)); StackPublish(new Commands.Walk(this.playerId, inputDirection, new Commands.StructVector3((int)context.x, (int)context.z, (int)context.height))); } // consume. inputDirection = DirectionEnum.None; } }
internal bool KeyCheck(KeyEnum requiredKey) { return(items.Exists(x => x.key == requiredKey) || requiredKey == KeyEnum.None); }
public bool MoveShip(KeyEnum pressedKey) { switch (pressedKey) { case KeyEnum.Up: if (Program.shipPosY > 2) { Program.shipPosY--; } break; case KeyEnum.Down: if (Program.rotate) { if (Program.shipPosY < (Program.borderHeight / 2) - Program.shipLength - 1) { Program.shipPosY++; } } else { if (Program.shipPosY < (Program.borderHeight / 2) - 2) { Program.shipPosY++; } } break; case KeyEnum.Left: if (Program.shipPosX > 2) { Program.shipPosX--; } break; case KeyEnum.Right: if (Program.rotate) { if (Program.shipPosX < Program.borderWidth - 2) { Program.shipPosX++; } } else { if (Program.shipPosX < Program.borderWidth - Program.shipLength - 1) { Program.shipPosX++; } } break; case KeyEnum.Space: if (Program.rotate) { if (Program.shipPosX < (Program.borderWidth) - Program.shipLength) { Program.rotate = false; for (int i = 0; i < Program.shipLength; i++) { Console.SetCursorPosition(Program.shipPosX, Program.shipPosY + i); Console.Write(" "); } } } else { if (Program.shipPosY < (Program.borderHeight / 2) - Program.shipLength) { Program.rotate = true; for (int i = 0; i < Program.shipLength; i++) { Console.SetCursorPosition(Program.shipPosX + i, Program.shipPosY); Console.Write(" "); } } } break; case KeyEnum.Enter: return(false); default: break; } if (Program.rotate) { for (int i = 0; i < Program.shipLength; i++) { Console.SetCursorPosition(Program.shipPosX, Program.shipPosY + i); Console.Write("O"); switch (pressedKey) { case KeyEnum.Up: Console.SetCursorPosition(Program.shipPosX, Program.shipPosY + Program.shipLength); Console.Write(" "); break; case KeyEnum.Down: Console.SetCursorPosition(Program.shipPosX, Program.shipPosY - 1); Console.Write(" "); break; case KeyEnum.Left: Console.SetCursorPosition(Program.shipPosX + 1, Program.shipPosY + i); Console.Write(" "); break; case KeyEnum.Right: Console.SetCursorPosition(Program.shipPosX - 1, Program.shipPosY + i); Console.Write(" "); break; } } } else { for (int i = 0; i < Program.shipLength; i++) { Console.SetCursorPosition(Program.shipPosX + i, Program.shipPosY); Console.Write("O"); switch (pressedKey) { case KeyEnum.Up: Console.SetCursorPosition(Program.shipPosX + i, Program.shipPosY + 1); Console.Write(" "); break; case KeyEnum.Down: Console.SetCursorPosition(Program.shipPosX + i, Program.shipPosY - 1); Console.Write(" "); break; case KeyEnum.Left: Console.SetCursorPosition(Program.shipPosX + Program.shipLength, Program.shipPosY); Console.Write(" "); break; case KeyEnum.Right: Console.SetCursorPosition(Program.shipPosX - 1, Program.shipPosY); Console.Write(" "); break; } } } return(true); }
public TableKeyAttributeException(Type type, KeyEnum keys) : base($"Type '{type.ToString()}' can only have 1 {keys} defined") { }
static public bool IsKeyDown(KeyEnum key) { return(keys[(int)key]); }
public InputButtonEvent(InputAction inputAction, KeyEnum keyCode, OuyaPlayer player) { m_inputAction = inputAction; m_keyCode = keyCode; m_player = player; }
private Task <ValueEntity> Entity(KeyEnum valueId) { return(Entities.Where(i => i.ValueId == valueId).FirstOrDefaultAsync()); }
public async Task <Value> Get(KeyEnum valueId) { var entity = await this.Entity(valueId); return(mapper.MapValue(entity, new Value())); }
public bool MoveTarget(KeyEnum pressedKey) { switch (pressedKey) { case KeyEnum.Up: if (Program.targetPosY > (Program.borderHeight / 2) + 2) { Program.targetPosY--; } break; case KeyEnum.Down: if (Program.targetPosY < Program.borderHeight - 2) { Program.targetPosY++; } break; case KeyEnum.Left: if (Program.targetPosX > 2) { Program.targetPosX--; } break; case KeyEnum.Right: if (Program.targetPosX < Program.borderWidth - 2) { Program.targetPosX++; } break; case KeyEnum.Enter: return(true); default: break; } Console.SetCursorPosition(Program.targetPosX, Program.targetPosY); Console.BackgroundColor = ConsoleColor.Green; Console.Write(" "); Console.BackgroundColor = ConsoleColor.DarkBlue; switch (pressedKey) { case KeyEnum.Up: Console.SetCursorPosition(Program.targetPosX, Program.targetPosY + 1); Console.Write(" "); break; case KeyEnum.Down: Console.SetCursorPosition(Program.targetPosX, Program.targetPosY - 1); Console.Write(" "); break; case KeyEnum.Left: Console.SetCursorPosition(Program.targetPosX + 1, Program.targetPosY); Console.Write(" "); break; case KeyEnum.Right: Console.SetCursorPosition(Program.targetPosX - 1, Program.targetPosY); Console.Write(" "); break; } return(false); }