review changes

This commit is contained in:
Niko Jochim 2020-06-26 02:18:57 +02:00
parent 88ddf07a05
commit f689b54989

View File

@ -52,50 +52,6 @@ class HUD: GKEntity {
self.roundTimer = RoundTimer() self.roundTimer = RoundTimer()
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.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.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)
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)
}
)
defSkill = SkillButtonNode(
textureName: "def_button",
text: "Def",
isEnabled: true,
cooldown: 4,
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)
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.def.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.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)
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.atk.ten", increasePercentComplete: 10)
SoundManager.sharedInstance.playSoundEffect(pathToFile: "use_boost",fileExtension: "wav",volumeLevel: 0.0)
}
)
finishButton = SingeClickButtonNode( finishButton = SingeClickButtonNode(
textureName: "finish_button", textureName: "finish_button",
text: "", text: "",
@ -105,8 +61,50 @@ class HUD: GKEntity {
y: EntityManager.gameEMInstance.scene.size.height * 0.1), y: EntityManager.gameEMInstance.scene.size.height * 0.1),
onButtonPress: { } 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.size = CGSize(width: 120, height: 120);
defSkill = SkillButtonNode(
textureName: "def_button",
text: "Def",
isEnabled: true,
cooldown: 4,
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)
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.def.ten", increasePercentComplete: 10)
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: 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)
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.atk.ten", increasePercentComplete: 10)
SoundManager.sharedInstance.playSoundEffect(pathToFile: "use_boost",fileExtension: "wav",volumeLevel: 0.0)
}
)
finishButton.size = CGSize(width: 100, height: 100) finishButton.size = CGSize(width: 100, height: 100)
finishButton.zPosition = 2 finishButton.zPosition = 2
@ -121,7 +119,6 @@ class HUD: GKEntity {
blockWholeScreenPane.isHidden = true blockWholeScreenPane.isHidden = true
super.init() super.init()
initRoundInfo(size: size) initRoundInfo(size: size)
finishButton.onButtonPress = { [unowned self] in finishButton.onButtonPress = { [unowned self] in
self.finishRound() self.finishRound()
} }
@ -133,7 +130,6 @@ class HUD: GKEntity {
hostUnitsLabel.position = CGPoint(x: size.width * 0.05, y: size.height * 0.9) 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) peerUnitsLabel.position = CGPoint(x: size.width * 0.95, y: size.height * 0.9)
setColor(labelNodes: [hostLabel,hostUnitsLabel,peerLabel,peerUnitsLabel]) setColor(labelNodes: [hostLabel,hostUnitsLabel,peerLabel,peerUnitsLabel])
roundTimer.initTimer() roundTimer.initTimer()
startWithDuration() startWithDuration()
} }
@ -169,7 +165,7 @@ class HUD: GKEntity {
func initRoundInfo(size: CGSize) -> () { func initRoundInfo(size: CGSize) -> () {
backgroundRoundCounter.zPosition = 2 backgroundRoundCounter.zPosition = 2
backgroundRoundCounter.position = CGPoint(x: Double(size.width) * 0.095, y: Double(size.height) * 0.11) backgroundRoundCounter.position = CGPoint(x: leaveGame.position.x + 63, y: leaveGame.position.y)
backgroundRoundCounter.size = CGSize(width: 120, height: 120) backgroundRoundCounter.size = CGSize(width: 120, height: 120)
currentRoundLabel.text = "\(RoundCalculatorService.sharedInstance.currentRound)" currentRoundLabel.text = "\(RoundCalculatorService.sharedInstance.currentRound)"
currentRoundLabel.fontSize = 50 currentRoundLabel.fontSize = 50