HUD Layout

This commit is contained in:
Niko Jochim 2020-06-26 01:57:08 +02:00
parent 6607d6739b
commit 88ddf07a05
8 changed files with 56 additions and 12 deletions

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "exitButton.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "roundInfoTexture.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "roundInfoTexture-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "roundInfoTexture-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -52,17 +52,16 @@ class HUD: GKEntity {
self.roundTimer = RoundTimer()
leaveGame = ButtonNode(textureName: "yellow_button04", text: "Verlassen" , isEnabled: true, position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.17, y: EntityManager.gameEMInstance.scene.size.height * 0.04), onButtonPress: {
leaveGame = ButtonNode(textureName: "exitButton", text: "" , isEnabled: true, position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.05, y: EntityManager.gameEMInstance.scene.size.height * 0.11), onButtonPress: {
EntityManager.gameEMInstance.add(Modal(modaltype: .QuitGame, base: nil, anchorPoint: CGPoint(x: EntityManager.gameEMInstance.scene.size.width / 2 , y: EntityManager.gameEMInstance.scene.size.height / 2), gameScene: EntityManager.gameEMInstance.scene, currentDraggedBase: nil, touchLocation: nil, collisionBase: nil))
})
leaveGame.setScale(0.6)
leaveGame.size = CGSize(width: 120, height: 120);
spySkill = SkillButtonNode(
textureName: "spy_button",
text: "Spy",
isEnabled: true,
cooldown: 3,
position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.80, y: EntityManager.gameEMInstance.scene.size.height * 0.1),
position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.81, y: EntityManager.gameEMInstance.scene.size.height * 0.1),
onButtonPress: {
EntityManager.gameEMInstance.getOpponentBases(for: EntityManager.gameEMInstance.getTeam()).forEach({base in base.component(ofType: TeamComponent.self)?.unitcountLabel.text = "\(base.unitCount)"})
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.first.time", increasePercentComplete: 100)
@ -75,7 +74,7 @@ class HUD: GKEntity {
text: "Def",
isEnabled: true,
cooldown: 4,
position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.90, y: EntityManager.gameEMInstance.scene.size.height * 0.1),
position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.88, y: EntityManager.gameEMInstance.scene.size.height * 0.1),
onButtonPress: {
DataService.sharedInstance.localRoundData.hasDefenceBoost = true
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.first.time", increasePercentComplete: 100)
@ -88,7 +87,7 @@ class HUD: GKEntity {
text: "Atk",
isEnabled: true,
cooldown: 4,
position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.70, y: EntityManager.gameEMInstance.scene.size.height * 0.1),
position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.74, y: EntityManager.gameEMInstance.scene.size.height * 0.1),
onButtonPress: {
DataService.sharedInstance.localRoundData.hasAttackBoost = true
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.first.time", increasePercentComplete: 100)
@ -102,15 +101,16 @@ class HUD: GKEntity {
text: "",
isEnabled: true,
position: CGPoint(
x: EntityManager.gameEMInstance.scene.size.width / 2 ,
x: EntityManager.gameEMInstance.scene.size.width * 0.95 ,
y: EntityManager.gameEMInstance.scene.size.height * 0.1),
onButtonPress: { }
)
finishButton.size = CGSize(width: 100, height: 100)
//finishButton.setScale(0.9)
finishButton.zPosition = 2
backgroundRoundCounter = SKSpriteNode(texture: SKTexture(imageNamed: "roundInfo_texture"))
backgroundRoundCounter = SKSpriteNode(texture: SKTexture(imageNamed: "roundInfoTexture"))
currentRoundLabel = SKLabelNode(fontNamed: "Courier-Bold")
roundsLabel = SKLabelNode(fontNamed: "Courier-Bold")
roundLabel = SKLabelNode(fontNamed: "Courier-Bold")
@ -169,13 +169,13 @@ class HUD: GKEntity {
func initRoundInfo(size: CGSize) -> () {
backgroundRoundCounter.zPosition = 2
backgroundRoundCounter.position = CGPoint(x: Double(size.width) * 0.06, y: Double(size.height) * 0.08)
backgroundRoundCounter.position = CGPoint(x: Double(size.width) * 0.095, y: Double(size.height) * 0.11)
backgroundRoundCounter.size = CGSize(width: 120, height: 120)
currentRoundLabel.text = "\(RoundCalculatorService.sharedInstance.currentRound)"
currentRoundLabel.fontSize = 50
currentRoundLabel.fontColor = SKColor.black
currentRoundLabel.verticalAlignmentMode = .center
currentRoundLabel.position = CGPoint(x: backgroundRoundCounter.position.x, y: backgroundRoundCounter.position.y - 5)
currentRoundLabel.position = CGPoint(x: backgroundRoundCounter.position.x, y: backgroundRoundCounter.position.y - 4)
currentRoundLabel.zPosition = backgroundRoundCounter.zPosition + 1
roundsLabel.zPosition = backgroundRoundCounter.zPosition + 1