HUD v1
This commit is contained in:
parent
5bb1b6764a
commit
1074d244b1
21
GoldWars/GoldWars/Assets.xcassets/HostInfoWrapper.imageset/Contents.json
vendored
Normal file
21
GoldWars/GoldWars/Assets.xcassets/HostInfoWrapper.imageset/Contents.json
vendored
Normal file
@ -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
|
||||
}
|
||||
}
|
BIN
GoldWars/GoldWars/Assets.xcassets/HostInfoWrapper.imageset/HostInfoWrapper.png
vendored
Normal file
BIN
GoldWars/GoldWars/Assets.xcassets/HostInfoWrapper.imageset/HostInfoWrapper.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 139 KiB |
21
GoldWars/GoldWars/Assets.xcassets/PeerInfoWrapper.imageset/Contents.json
vendored
Normal file
21
GoldWars/GoldWars/Assets.xcassets/PeerInfoWrapper.imageset/Contents.json
vendored
Normal file
@ -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
|
||||
}
|
||||
}
|
BIN
GoldWars/GoldWars/Assets.xcassets/PeerInfoWrapper.imageset/PeerInfoWrapper.png
vendored
Normal file
BIN
GoldWars/GoldWars/Assets.xcassets/PeerInfoWrapper.imageset/PeerInfoWrapper.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 144 KiB |
@ -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)
|
||||
|
@ -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..."
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user