diff --git a/GoldWars/GoldWars/Assets.xcassets/HostInfoWrapper.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/HostInfoWrapper.imageset/Contents.json new file mode 100644 index 0000000..a77bd73 --- /dev/null +++ b/GoldWars/GoldWars/Assets.xcassets/HostInfoWrapper.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "HostInfoWrapper.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoldWars/GoldWars/Assets.xcassets/HostInfoWrapper.imageset/HostInfoWrapper.png b/GoldWars/GoldWars/Assets.xcassets/HostInfoWrapper.imageset/HostInfoWrapper.png new file mode 100644 index 0000000..b73692b Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/HostInfoWrapper.imageset/HostInfoWrapper.png differ diff --git a/GoldWars/GoldWars/Assets.xcassets/PeerInfoWrapper.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/PeerInfoWrapper.imageset/Contents.json new file mode 100644 index 0000000..5c9c65c --- /dev/null +++ b/GoldWars/GoldWars/Assets.xcassets/PeerInfoWrapper.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "PeerInfoWrapper.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoldWars/GoldWars/Assets.xcassets/PeerInfoWrapper.imageset/PeerInfoWrapper.png b/GoldWars/GoldWars/Assets.xcassets/PeerInfoWrapper.imageset/PeerInfoWrapper.png new file mode 100644 index 0000000..a8a68e3 Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/PeerInfoWrapper.imageset/PeerInfoWrapper.png differ diff --git a/GoldWars/GoldWars/Entities/EntityManager.swift b/GoldWars/GoldWars/Entities/EntityManager.swift index 69cda81..01c3806 100644 --- a/GoldWars/GoldWars/Entities/EntityManager.swift +++ b/GoldWars/GoldWars/Entities/EntityManager.swift @@ -48,6 +48,10 @@ class EntityManager { scene.addChild(hudEntitiy.hostUnitsLabel) scene.addChild(hudEntitiy.peerLabel) scene.addChild(hudEntitiy.peerUnitsLabel) + scene.addChild(hudEntitiy.skillWrapper) + scene.addChild(hudEntitiy.timerWrapper) + scene.addChild(hudEntitiy.hostInfoWrapper) + scene.addChild(hudEntitiy.peerInfoWrapper) scene.addChild(hudEntitiy.defSkill) scene.addChild(hudEntitiy.atkSkill) scene.addChild(hudEntitiy.spySkill) diff --git a/GoldWars/GoldWars/Entities/HUD.swift b/GoldWars/GoldWars/Entities/HUD.swift index 24f92a0..18f8a7c 100644 --- a/GoldWars/GoldWars/Entities/HUD.swift +++ b/GoldWars/GoldWars/Entities/HUD.swift @@ -20,6 +20,11 @@ class HUD: GKEntity { var host: GKPlayer? var peer: GKPlayer? + var skillWrapper: SKShapeNode + var timerWrapper: SKShapeNode + var hostInfoWrapper: SKSpriteNode + var peerInfoWrapper: SKSpriteNode + var spySkill: SingeClickButtonNode var defSkill: SingeClickButtonNode var atkSkill: SingeClickButtonNode @@ -38,32 +43,52 @@ class HUD: GKEntity { peerUnitsLabel = SKLabelNode(text: "500") roundTimerLabel = SKLabelNode(text: "") - roundTimerLabel.fontColor = UIColor.black + roundTimerLabel.fontColor = UIColor.white roundTimerLabel.fontSize = CGFloat(45) - roundTimerLabel.position = CGPoint(x: size.width * 0.5, y: size.height * 0.9) + roundTimerLabel.position = CGPoint(x: size.width * 0.5, y: size.height * 0.94) roundTimerLabel.horizontalAlignmentMode = .center self.roundTimer = RoundTimer() + + timerWrapper = SKShapeNode(rectOf: CGSize(width: 200, height: 60), cornerRadius: 6) + timerWrapper.position = CGPoint(x: size.width / 2, y: size.height - 27) + timerWrapper.fillColor = SKColor.lightGray + + hostInfoWrapper = SKSpriteNode(imageNamed: "HostInfoWrapper") + hostInfoWrapper.scale(to: CGSize(width: hostInfoWrapper.frame.width * 0.4, height: hostInfoWrapper.frame.height * 0.4)) + hostInfoWrapper.position = CGPoint(x: hostInfoWrapper.frame.width / 2, y: size.height - hostInfoWrapper.frame.height / 2) + hostInfoWrapper.alpha = 0.8 + + peerInfoWrapper = SKSpriteNode(imageNamed: "PeerInfoWrapper") + peerInfoWrapper.scale(to: CGSize(width: peerInfoWrapper.frame.width * 0.4 , height: peerInfoWrapper.frame.height * 0.4)) + peerInfoWrapper.position = CGPoint(x: size.width - peerInfoWrapper.frame.width / 2, y: size.height - peerInfoWrapper.frame.height / 2) + peerInfoWrapper.alpha = 0.7 + + skillWrapper = SKShapeNode(circleOfRadius: 150) + skillWrapper.position = CGPoint(x: size.width, y: 0) + skillWrapper.fillColor = SKColor(white: 0, alpha: 0) + skillWrapper.strokeColor = SKColor.darkGray + spySkill = SingeClickButtonNode( textureName: "yellow_circle", text: "Spy", isEnabled: true, - position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.75, y: EntityManager.gameEMInstance.scene.size.height * 0.1), + position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.86, y: EntityManager.gameEMInstance.scene.size.height * 0.05), onButtonPress: { print("Not implemented") } ) defSkill = SingeClickButtonNode( textureName: "yellow_circle", text: "Def", isEnabled: true, - position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.85, y: EntityManager.gameEMInstance.scene.size.height * 0.1), + position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.9, y: EntityManager.gameEMInstance.scene.size.height * 0.133), onButtonPress: {DataService.sharedInstance.localRoundData.hasDefenceBoost = true} ) atkSkill = SingeClickButtonNode( textureName: "yellow_circle", text: "Atk", isEnabled: true, - position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.95, y: EntityManager.gameEMInstance.scene.size.height * 0.1), + position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.96, y: EntityManager.gameEMInstance.scene.size.height * 0.186), onButtonPress: {DataService.sharedInstance.localRoundData.hasAttackBoost = true} ) @@ -104,6 +129,7 @@ class HUD: GKEntity { func setColor(labelNodes: [SKLabelNode]) -> Void { for label in labelNodes { label.fontColor = SKColor.black + label.zPosition = 1 } } @@ -120,6 +146,6 @@ class HUD: GKEntity { func finishRound() -> () { self.roundTimer.timeLeft = 1; - self.roundTimer.roundEnded = "Waiting for other player..." + self.roundTimer.roundEnded = "Waiting..." } }