/// <summary> /// Called to generate all KanbanCards /// </summary> protected override Size MeasureOverride(Size availableSize) { if (IsItemsHost) { // internal method EnsureGenerator() is called when accessing InternalChildren ;) var children = InternalChildren; // Use generator to create all new cards IItemContainerGenerator generator = ItemContainerGenerator; UIElement child = null; // This will startup the generator and generate ALL cards using (((ItemContainerGenerator)generator).GenerateBatches()) { var startPos = generator.GeneratorPositionFromIndex(0); using (generator.StartAt(startPos, GeneratorDirection.Forward, true)) { while ((child = generator.GenerateNext(out bool newlyRealized) as UIElement) != null) { generator.PrepareItemContainer(child); if (newlyRealized) { Owner.AddCard(child); } } } } } return(base.MeasureOverride(availableSize)); }
public void Return(int costChange) { if (Avatar.MonsterConfig.IsBuilding) { BattleManager.Instance.FlowWordQueue.Add(new FlowWord("抵抗", Position, 0, "Gold", 26, 0, 0, 1, 15), false); return; } BattleManager.Instance.MemMap.GetMouseCell(Position.X, Position.Y).UpdateOwner(0); SkillManager.CheckRemoveEffect(); Owner.AddCard(this, CardId, Level, costChange); BattleManager.Instance.MonsterQueue.RemoveDirect(Id); }