Add blockWholeScreenPane to disable clicks after Done was clicked
This commit is contained in:
parent
c46849e95d
commit
9de3e2cfa5
@ -57,6 +57,7 @@ class EntityManager {
|
||||
scene.addChild(hudEntitiy.currentRoundLabel)
|
||||
scene.addChild(hudEntitiy.roundsLabel)
|
||||
scene.addChild(hudEntitiy.roundLabel)
|
||||
scene.addChild(hudEntitiy.blockWholeScreenPane)
|
||||
}
|
||||
|
||||
if let wayEntity = entity as? Way {
|
||||
|
@ -17,8 +17,6 @@ class HUD: GKEntity {
|
||||
|
||||
var peerLabel:SKLabelNode
|
||||
var peerUnitsLabel:SKLabelNode
|
||||
var host: GKPlayer?
|
||||
var peer: GKPlayer?
|
||||
|
||||
var spySkill: SingeClickButtonNode
|
||||
var defSkill: SingeClickButtonNode
|
||||
@ -33,19 +31,19 @@ class HUD: GKEntity {
|
||||
var roundLabel: SKLabelNode
|
||||
|
||||
var finishButton: ButtonNode
|
||||
var blockWholeScreenPane: SKSpriteNode
|
||||
|
||||
init(size: CGSize) {
|
||||
host = GameCenterManager.sharedInstance.hostingPlayer
|
||||
peer = GameCenterManager.sharedInstance.peerPlayer
|
||||
hostLabel = SKLabelNode(text: host?.displayName)
|
||||
hostLabel = SKLabelNode(text: GameCenterManager.sharedInstance.hostingPlayer?.displayName)
|
||||
hostUnitsLabel = SKLabelNode(text: "500" )
|
||||
peerLabel = SKLabelNode(text: peer?.displayName)
|
||||
peerLabel = SKLabelNode(text: GameCenterManager.sharedInstance.peerPlayer?.displayName)
|
||||
peerUnitsLabel = SKLabelNode(text: "500")
|
||||
|
||||
roundTimerLabel = SKLabelNode(text: "")
|
||||
roundTimerLabel.fontColor = UIColor.black
|
||||
roundTimerLabel.fontSize = CGFloat(45)
|
||||
roundTimerLabel.position = CGPoint(x: size.width * 0.5, y: size.height * 0.9)
|
||||
roundTimerLabel.zPosition = 900
|
||||
roundTimerLabel.horizontalAlignmentMode = .center
|
||||
|
||||
self.roundTimer = RoundTimer()
|
||||
@ -100,6 +98,11 @@ class HUD: GKEntity {
|
||||
currentRoundLabel = SKLabelNode(fontNamed: "Courier-Bold")
|
||||
roundsLabel = SKLabelNode(fontNamed: "Courier-Bold")
|
||||
roundLabel = SKLabelNode(fontNamed: "Courier-Bold")
|
||||
|
||||
blockWholeScreenPane = SKSpriteNode(color: UIColor.init(red: 0, green: 0, blue: 0, alpha: 0.7), size: size)
|
||||
blockWholeScreenPane.position = CGPoint(x: size.width * 0.5, y: size.height * 0.5)
|
||||
blockWholeScreenPane.zPosition = 899
|
||||
blockWholeScreenPane.isHidden = true
|
||||
super.init()
|
||||
initRoundInfo(size: size)
|
||||
|
||||
@ -120,8 +123,8 @@ class HUD: GKEntity {
|
||||
}
|
||||
|
||||
func updateUnitSum(){
|
||||
hostUnitsLabel.text = "\(entityManager.getUnitSum(by: host!))"
|
||||
peerUnitsLabel.text = "\(entityManager.getUnitSum(by: peer!))"
|
||||
hostUnitsLabel.text = "\(entityManager.getUnitSum(by: GameCenterManager.sharedInstance.hostingPlayer!))"
|
||||
peerUnitsLabel.text = "\(entityManager.getUnitSum(by: GameCenterManager.sharedInstance.peerPlayer!))"
|
||||
}
|
||||
|
||||
func setColor(labelNodes: [SKLabelNode]) -> Void {
|
||||
@ -139,9 +142,11 @@ class HUD: GKEntity {
|
||||
finishButton.isEnabled = true
|
||||
self.roundTimer.roundEnded = "Syncing"
|
||||
RoundCalculatorService.sharedInstance.isCalculating = false
|
||||
blockWholeScreenPane.isHidden = true
|
||||
}
|
||||
|
||||
func finishRound() -> () {
|
||||
self.blockWholeScreenPane.isHidden = false
|
||||
self.roundTimer.timeLeft = 1;
|
||||
self.roundTimer.roundEnded = "Waiting for other player..."
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user