public SelectTargetUiBlock(TurnMessageUiBlock _messages, Rct _mapRct, AskMessage _message) : base(_mapRct, null, FColor.Gray) { m_messages = _messages; m_act = _message.Act; m_maxDistance = _message.GetFirstParameter<int>(); var points = new List<Point>(); for (var x = -m_maxDistance; x < m_maxDistance; ++x) { for (var y = -m_maxDistance; y < m_maxDistance; ++y) { var point = new Point(x, y); if (point.Lenght > m_maxDistance) continue; var liveCell = World.TheWorld.Avatar[point]; if (liveCell.Creature != null && !liveCell.Creature.IsAvatar) { points.Add(point); } } } m_targets.AddRange(points.Where(_point => _point.Lenght < m_maxDistance).OrderBy(_point => _point.Lenght)); Rebuild(); }
public BackpackUiBlock(Rct _rct, AskMessage _message) : base(_rct, _message.GetFirstParameter<ESelectItemDialogBehavior>(), _message.Act, World.TheWorld.Avatar.GetBackPackItems().OrderBy(_thingDescriptor => _thingDescriptor.UiOrderIndex)) { var category = _message.GetParameters<EItemCategory>(); m_allowedCategories = category ?? new EItemCategory[0]; }
public SelectTargetUiBlock(TurnMessageUiBlock _messages, Rct _mapRct, AskMessage _message) : base(_mapRct, null, FColor.Gray) { m_messages = _messages; m_act = _message.Act; m_maxDistance = _message.GetFirstParameter <int>(); var points = new List <Point>(); for (var x = -m_maxDistance; x < m_maxDistance; ++x) { for (var y = -m_maxDistance; y < m_maxDistance; ++y) { var point = new Point(x, y); if (point.Lenght > m_maxDistance) { continue; } var liveCell = World.TheWorld.Avatar[point]; if (liveCell.Creature != null && !liveCell.Creature.IsAvatar) { points.Add(point); } } } m_targets.AddRange(points.Where(_point => _point.Lenght < m_maxDistance).OrderBy(_point => _point.Lenght)); Rebuild(); }
public override void KeysPressed(ConsoleKey _key, EKeyModifiers _modifiers) { switch (_key) { case ConsoleKey.Backspace: m_count = m_count.Length > 0 ? (m_count.Substring(0, m_count.Length - 1)) : ""; break; case ConsoleKey.NumPad0: case ConsoleKey.NumPad1: case ConsoleKey.NumPad2: case ConsoleKey.NumPad3: case ConsoleKey.NumPad4: case ConsoleKey.NumPad5: case ConsoleKey.NumPad6: case ConsoleKey.NumPad7: case ConsoleKey.NumPad8: case ConsoleKey.NumPad9: case ConsoleKey.D0: case ConsoleKey.D1: case ConsoleKey.D2: case ConsoleKey.D3: case ConsoleKey.D4: case ConsoleKey.D5: case ConsoleKey.D6: case ConsoleKey.D7: case ConsoleKey.D8: case ConsoleKey.D9: var name = Enum.GetName(typeof(ConsoleKey), _key); if (m_count.Length < m_message.GetFirstParameter <int>().ToString().Length) { m_count += name.Substring(name.Length - 1, 1); } break; case ConsoleKey.Enter: var cnt = Math.Min(int.Parse(m_count), m_message.GetFirstParameter <int>()); m_message.Act.AddParameter(cnt); CloseTopBlock(); break; case ConsoleKey.Escape: m_message.Act.AddParameter(0); CloseTopBlock(); break; } }
public BackpackUiBlock(Rct _rct, AskMessage _message) : base(_rct, _message.GetFirstParameter <ESelectItemDialogBehavior>(), _message.Act, World.TheWorld.Avatar.GetBackPackItems().OrderBy(_thingDescriptor => _thingDescriptor.UiOrderIndex)) { var category = _message.GetParameters <EItemCategory>(); m_allowedCategories = category ?? new EItemCategory[0]; }
public SelectItemsUiBlock(Rct _rct, AskMessage _message) : base(_rct, _message.GetFirstParameter <ESelectItemDialogBehavior>(), _message.Act, _message.GetParameters <EssenceDescriptor>()) { }
public AskHowMuchUiBlock(Rct _rct, AskMessage _message) : base(new Rct(_rct.Left, _rct.Top, _rct.Width, 1), null, FColor.Gray) { m_message = _message; m_count = _message.GetFirstParameter<int>().ToString(); }
public AskHowMuchUiBlock(Rct _rct, AskMessage _message) : base(new Rct(_rct.Left, _rct.Top, _rct.Width, 1), null, FColor.Gray) { m_message = _message; m_count = _message.GetFirstParameter <int>().ToString(); }
public SelectItemsUiBlock(Rct _rct, AskMessage _message) : base(_rct, _message.GetFirstParameter<ESelectItemDialogBehavior>(), _message.Act, _message.GetParameters<EssenceDescriptor>()) { }