如何为我的专注游戏设置重置/重启按钮?

时间:2019-02-04 05:15:18

标签: swift

我用26张卡创建了一个专注游戏。现在,我想创建一个新的游戏按钮,以启动游戏并重新回到 如果正在进行中,则开始。

我做了一个新按钮,但我不知道重置它的代码

@IBOutlet var cardButtons: [UIButton]!
var emojiChoices = ["", "", "☂", "☀", "","", "", "☂", "☀", "","", "", "☂", "☀", "","", "", "☂", "☀", "","", "", "☂", "☀", "", ""]

@IBOutlet weak var flipCountLabel: UILabel!

@IBAction func touchCard(_ sender: UIButton) {
    flipCount += 1
    if let cardNumber = cardButtons.firstIndex(of: sender) {
    flipCard(withEmoji: emojiChoices[cardNumber], on: sender)
    } else {
        print("Chosen Card was not in cardButton")
    }
}

@IBAction func resetCards(_ sender: UIButton) {
    self.resetCards(_ sender:

}

@IBAction func resetCards(_ sender: UIButton) {
    self.resetCards(_ sender:

}

我必须在此resetCards()中添加什么才能使所有翻转的卡都恢复到原始状态?请指出正确的方向。谢谢!

0 个答案:

没有答案