我的暂停菜单的代码我如何将一个承认插页式广告集成到 swift 3 中。它是一个虚拟按钮。这是我的暂停屏幕的样子:import SpriteKit
让 BUTTON_DISTANCE: CGFloat = 15 让 Background_COLOR = UIColor(red: 255, green: 255, blue: 255, alpha: 0.2)
类 PauseMenu { 让 resumeButton: 按钮让 resetButton: 按钮让 menuButton: 按钮让根: SKNode = SKNode() 让 gameDelegate: GameDelegate 让背景: SKSpriteNode
init(scene: SKScene, delegate: GameDelegate) {
self.gameDelegate = delegate
root.position = CGPoint(x: scene.frame.midX, y: scene.frame.midY)
root.zPosition = 5
resumeButton = Button(scene: scene, parent: root, text: "Resume",
x: 0, y: DEFAULT_BUTTON_SIZE.height + BUTTON_DISTANCE,
action: gameDelegate.gameResumed)
resetButton = Button(scene: scene, parent: root, text: "Reset",
x: 0, y: 0, action: gameDelegate.gameReseted)
menuButton = Button(scene: scene, parent: root, text: "Menu",
x: 0, y: -(DEFAULT_BUTTON_SIZE.height + BUTTON_DISTANCE),
action: gameDelegate.returnMenu)
background = SKSpriteNode()
background.size = scene.size
background.position = CGPoint(x: 0, y: 0)
background.color = BACKGROUND_COLOR
root.addChild(background)
hide()
scene.addChild(root)
}
func touch(_ touch: UITouch) {
resumeButton.press(touch)
resetButton.press(touch)
menuButton.press(touch)
}
func release(_ touch: UITouch) {
resumeButton.release(touch)
resetButton.release(touch)
menuButton.release(touch)
}
func hide() {
root.isHidden = true
}
func show() {
root.isHidden = false
}
}
我希望在您单击休息按钮时显示广告。-Thx Zain