Merge branch '90-ueberarbeitung-einzelner-hud-elemente' into 'development'
Resolve "Ueberarbeitung einzelner HUD Elemente" Closes #90 See merge request marcel.schwarz/software-projekt-2!142
Before Width: | Height: | Size: 209 KiB |
Before Width: | Height: | Size: 209 KiB |
Before Width: | Height: | Size: 209 KiB |
BIN
GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/BaseTexture-1.png
vendored
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/BaseTexture-2.png
vendored
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/BaseTexture.png
vendored
Normal file
After Width: | Height: | Size: 35 KiB |
@ -1,17 +1,17 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Base.png",
|
||||
"filename" : "BaseTexture.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "Base-1.png",
|
||||
"filename" : "BaseTexture-1.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "Base-2.png",
|
||||
"filename" : "BaseTexture-2.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
|
21
GoldWars/GoldWars/Assets.xcassets/exitButton.imageset/Contents.json
vendored
Normal 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
|
||||
}
|
||||
}
|
BIN
GoldWars/GoldWars/Assets.xcassets/exitButton.imageset/exitButton.png
vendored
Normal file
After Width: | Height: | Size: 3.9 KiB |
21
GoldWars/GoldWars/Assets.xcassets/finish_button.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "finish_button 2.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
GoldWars/GoldWars/Assets.xcassets/finish_button.imageset/finish_button 2.png
vendored
Normal file
After Width: | Height: | Size: 4.0 KiB |
@ -1,7 +1,7 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "gold_button_3.png",
|
||||
"filename" : "gold_button_4.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
|
Before Width: | Height: | Size: 7.8 KiB |
BIN
GoldWars/GoldWars/Assets.xcassets/gold_button_3.imageset/gold_button_4.png
vendored
Normal file
After Width: | Height: | Size: 7.2 KiB |
21
GoldWars/GoldWars/Assets.xcassets/gold_button_4.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "gold_button_4.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
GoldWars/GoldWars/Assets.xcassets/gold_button_4.imageset/gold_button_4.png
vendored
Normal file
After Width: | Height: | Size: 9.8 KiB |
23
GoldWars/GoldWars/Assets.xcassets/roundInfoTexture.imageset/Contents.json
vendored
Normal 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
|
||||
}
|
||||
}
|
BIN
GoldWars/GoldWars/Assets.xcassets/roundInfoTexture.imageset/roundInfoTexture-1.png
vendored
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
GoldWars/GoldWars/Assets.xcassets/roundInfoTexture.imageset/roundInfoTexture-2.png
vendored
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
GoldWars/GoldWars/Assets.xcassets/roundInfoTexture.imageset/roundInfoTexture.png
vendored
Normal file
After Width: | Height: | Size: 2.7 KiB |
@ -20,6 +20,8 @@ class SkillButtonNode: ButtonNode {
|
||||
self.cooldown = cooldown
|
||||
self.displayText = text
|
||||
super.init(textureName: textureName, text: text, isEnabled: isEnabled, position: position, onButtonPress: onButtonPress)
|
||||
self.size = CGSize(width: 100, height: 100)
|
||||
self.label.fontSize = 25
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,31 +51,27 @@ class HUD: GKEntity {
|
||||
roundTimerLabel.horizontalAlignmentMode = .center
|
||||
|
||||
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: {
|
||||
|
||||
finishButton = SingeClickButtonNode(
|
||||
textureName: "finish_button",
|
||||
text: "",
|
||||
isEnabled: true,
|
||||
position: CGPoint(
|
||||
x: EntityManager.gameEMInstance.scene.size.width * 0.95 ,
|
||||
y: EntityManager.gameEMInstance.scene.size.height * 0.1),
|
||||
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)
|
||||
|
||||
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),
|
||||
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)
|
||||
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.spy.ten", increasePercentComplete: 10)
|
||||
SoundManager.sharedInstance.playSoundEffect(pathToFile: "use_boost",fileExtension: "wav",volumeLevel: 0.0)
|
||||
}
|
||||
)
|
||||
leaveGame.size = CGSize(width: 120, height: 120);
|
||||
|
||||
defSkill = SkillButtonNode(
|
||||
textureName: "def_button",
|
||||
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: finishButton.position.x - 85, y: finishButton.position.y),
|
||||
onButtonPress: {
|
||||
DataService.sharedInstance.localRoundData.hasDefenceBoost = true
|
||||
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.first.time", increasePercentComplete: 100)
|
||||
@ -83,12 +79,25 @@ class HUD: GKEntity {
|
||||
SoundManager.sharedInstance.playSoundEffect(pathToFile: "use_boost",fileExtension: "wav",volumeLevel: 0.0)
|
||||
}
|
||||
)
|
||||
spySkill = SkillButtonNode(
|
||||
textureName: "spy_button",
|
||||
text: "Spy",
|
||||
isEnabled: true,
|
||||
cooldown: 3,
|
||||
position: CGPoint(x: defSkill.position.x - 85, y: defSkill.position.y),
|
||||
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)
|
||||
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.spy.ten", increasePercentComplete: 10)
|
||||
SoundManager.sharedInstance.playSoundEffect(pathToFile: "use_boost",fileExtension: "wav",volumeLevel: 0.0)
|
||||
}
|
||||
)
|
||||
atkSkill = SkillButtonNode(
|
||||
textureName: "atk_button",
|
||||
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: spySkill.position.x - 85, y: spySkill.position.y),
|
||||
onButtonPress: {
|
||||
DataService.sharedInstance.localRoundData.hasAttackBoost = true
|
||||
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.first.time", increasePercentComplete: 100)
|
||||
@ -96,21 +105,10 @@ class HUD: GKEntity {
|
||||
SoundManager.sharedInstance.playSoundEffect(pathToFile: "use_boost",fileExtension: "wav",volumeLevel: 0.0)
|
||||
}
|
||||
)
|
||||
|
||||
finishButton = SingeClickButtonNode(
|
||||
textureName: "yellow_button04",
|
||||
text: "Fertig",
|
||||
isEnabled: true,
|
||||
position: CGPoint(
|
||||
x: EntityManager.gameEMInstance.scene.size.width * 0.17,
|
||||
y: EntityManager.gameEMInstance.scene.size.height * 0.09),
|
||||
onButtonPress: { }
|
||||
)
|
||||
finishButton.size = CGSize(width: 125, height: 40)
|
||||
finishButton.setScale(0.9)
|
||||
finishButton.size = CGSize(width: 100, height: 100)
|
||||
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")
|
||||
@ -121,7 +119,6 @@ class HUD: GKEntity {
|
||||
blockWholeScreenPane.isHidden = true
|
||||
super.init()
|
||||
initRoundInfo(size: size)
|
||||
|
||||
finishButton.onButtonPress = { [unowned self] in
|
||||
self.finishRound()
|
||||
}
|
||||
@ -133,7 +130,6 @@ class HUD: GKEntity {
|
||||
hostUnitsLabel.position = CGPoint(x: size.width * 0.05, y: size.height * 0.9)
|
||||
peerUnitsLabel.position = CGPoint(x: size.width * 0.95, y: size.height * 0.9)
|
||||
setColor(labelNodes: [hostLabel,hostUnitsLabel,peerLabel,peerUnitsLabel])
|
||||
|
||||
roundTimer.initTimer()
|
||||
startWithDuration()
|
||||
}
|
||||
@ -169,13 +165,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: leaveGame.position.x + 63, y: leaveGame.position.y)
|
||||
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
|
||||
|
@ -153,8 +153,8 @@ class GameScene: SKScene{
|
||||
let action = SKAction.afterDelay(2) {
|
||||
(self.childNode(withName: "hostLabel") as! SKLabelNode).horizontalAlignmentMode = .center
|
||||
(self.childNode(withName: "peerLabel") as! SKLabelNode).horizontalAlignmentMode = .center
|
||||
self.childNode(withName: "hostLabel")?.run(SKAction.move(to: CGPoint(x: self.size.width * 0.25, y: self.size.height * 0.3), duration: 1))
|
||||
self.childNode(withName: "peerLabel")?.run(SKAction.move(to: CGPoint(x: self.size.width * 0.75, y: self.size.height * 0.3), duration: 1))
|
||||
self.childNode(withName: "hostLabel")?.run(SKAction.move(to: CGPoint(x: self.size.width * 0.25, y: self.size.height * 0.25), duration: 1))
|
||||
self.childNode(withName: "peerLabel")?.run(SKAction.move(to: CGPoint(x: self.size.width * 0.75, y: self.size.height * 0.25), duration: 1))
|
||||
self.initGameEndIcons()
|
||||
let node = ButtonNode(textureName: "yellow_button05", text: "Menü", isEnabled: true, position: CGPoint(x: self.size.width / 2, y: self.size.height / 2 - 300), onButtonPress: {
|
||||
self.backToMenuAction()
|
||||
@ -336,16 +336,18 @@ class GameScene: SKScene{
|
||||
|
||||
|
||||
@objc func pauseGame() -> Void {
|
||||
entityManager.removeModal()
|
||||
entityManager.getHUD()?.roundTimer.stopTimer()
|
||||
entityManager.add(Modal(modaltype: .PauseGame,
|
||||
base: nil,
|
||||
anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2),
|
||||
gameScene: self,
|
||||
currentDraggedBase: nil,
|
||||
touchLocation: nil,
|
||||
collisionBase: nil
|
||||
))
|
||||
if !self.gameEndEffects{
|
||||
entityManager.removeModal()
|
||||
entityManager.getHUD()?.roundTimer.stopTimer()
|
||||
entityManager.add(Modal(modaltype: .PauseGame,
|
||||
base: nil,
|
||||
anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2),
|
||||
gameScene: self,
|
||||
currentDraggedBase: nil,
|
||||
touchLocation: nil,
|
||||
collisionBase: nil
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@objc func resumeGame() -> Void {
|
||||
|