}//玩家回合初始化 private void EnemyTurn() { MinionManager.AddMinionToGridView(EnemyMinionPanel, new Minion(new MinionCard(1, 1, 1, "Zebra", "Zebra", "Test Zebra"))); (EnemyMinionPanel.Items.Last() as Grid).DragOver += EnemyMinion_DragOver; (EnemyMinionPanel.Items.Last() as Grid).Drop += EnemyMinion_Drop; (EnemyMinionPanel.Items.Last() as Grid).PointerEntered += MinionGrid_PointerEntered; (EnemyMinionPanel.Items.Last() as Grid).PointerExited += MinionGrid_PointerExited; }//敌方回合初始化
}//拖拽卡牌 private void PlayerMinionPanel_Drop(object sender, DragEventArgs e) { if (draggingType == "MinionCard") { SummonMinionFromHandCard(draggedMinionCard); mainBattlefield.Player.HandCard.Remove(draggedCard); UpdateHandCardGridView(HandCardGridView); MinionManager.AddMinionToGridView(PlayerMinionPanel, new Minion(draggedMinionCard)); (PlayerMinionPanel.Items.Last() as Grid).DragStarting += Minion_DragStarting; (PlayerMinionPanel.Items.Last() as Grid).PointerEntered += MinionGrid_PointerEntered; (PlayerMinionPanel.Items.Last() as Grid).PointerExited += MinionGrid_PointerExited; UpdateCostTextBlock(); draggingType = "None"; } }//拖拽卡牌(Drop)
private void AddPlayerMinionAndEventToGridView(GridView gridView, Minion minion) { MinionManager.AddMinionToGridView(gridView, minion); (gridView.Items.Last() as Grid).DragStarting += Minion_DragStarting; }