Merge branch '114-adjust-menu-scene-for-smaller-ipads' into 'development'

Resolve "Adjust menu scene for smaller iPads"

Closes #114

See merge request marcel.schwarz/software-projekt-2!141
This commit is contained in:
Aldin Duraki 2020-06-25 19:03:31 +00:00
commit 6cfd91b659
2 changed files with 61 additions and 59 deletions

View File

@ -9,29 +9,26 @@
import Foundation import Foundation
import GameplayKit import GameplayKit
class SpinningLogoEntity: GKEntity { class SpinningLogoEntity : GKEntity {
let spinningLogoNode : SpinningLogo3DNode let spinningLogoNode: SpinningLogo3DNode
let goldLetteringNode : SKSpriteNode let goldLetteringNode: SKSpriteNode
let warsLetteringNode : SKSpriteNode let warsLetteringNode: SKSpriteNode
init(sceneSize size: CGSize) { init(sceneSize size: CGSize) {
spinningLogoNode = SpinningLogo3DNode()
let midX = size.width / 2
let midY = size.height / 2
goldLetteringNode = SKSpriteNode(texture: SKTexture(imageNamed: "goldLettering")) goldLetteringNode = SKSpriteNode(texture: SKTexture(imageNamed: "goldLettering"))
goldLetteringNode.position = CGPoint(x: midX, y: midY); goldLetteringNode.position = CGPoint(x: size.width / 2 , y: size.height * 0.83)
goldLetteringNode.size = CGSize(width: 675, height: 284) goldLetteringNode.size = CGSize(width: size.width / 2.02, height: size.height / 3.6)
goldLetteringNode.position = CGPoint(x: midX , y: midY + 280);
goldLetteringNode.size = CGSize(width: 675, height: 284)
warsLetteringNode = SKSpriteNode(texture: SKTexture(imageNamed: "warsLettering")) warsLetteringNode = SKSpriteNode(texture: SKTexture(imageNamed: "warsLettering"))
warsLetteringNode.position = CGPoint(x: midX, y: midY - 300); warsLetteringNode.position = CGPoint(x: size.width / 2, y: size.height * 0.17)
warsLetteringNode.size = CGSize(width: 700, height: 284) warsLetteringNode.size = CGSize(width: size.width / 2.02, height: size.height / 3.6)
spinningLogoNode.viewportSize = CGSize(width: 200, height: 200) spinningLogoNode = SpinningLogo3DNode()
spinningLogoNode.viewportSize = CGSize(width: size.width / 5.12 * 0.69, height: size.height / 3.84 * 0.69)
spinningLogoNode.zPosition = goldLetteringNode.zPosition - 1 spinningLogoNode.zPosition = goldLetteringNode.zPosition - 1
spinningLogoNode.position = CGPoint(x: midX - 65, y: midY + 285); spinningLogoNode.position = CGPoint(x: size.width * 0.455, y: size.height * 0.83)
super.init() super.init()
} }

View File

@ -17,50 +17,55 @@ class MenuScene: SKScene {
entityManager.setScene(scene: self) entityManager.setScene(scene: self)
let midX = self.size.width / 2 let midX = self.size.width / 2
let midY = self.size.height / 2 let midY = self.size.height / 2
entityManager.add(Button(name: "startGameButton", entityManager.add(
textureName: "gold_button_3", Button(name: "startGameButton",
text: "Start Game", textureName: "gold_button_3",
position: CGPoint(x: midX, y: midY + 90), text: "Start Game",
onButtonPress: { position: CGPoint(x: midX, y: midY + 90),
if CommandLine.arguments.contains("--no-matchmaking") { onButtonPress: {
self.loadScene(scene: GameScene(size: self.size)) if CommandLine.arguments.contains("--no-matchmaking") {
SoundManager.sharedInstance.stopMenuMusic() self.loadScene(scene: GameScene(size: self.size))
} else { SoundManager.sharedInstance.stopMenuMusic()
} else {
if GameCenterManager.isAuthenticated { if GameCenterManager.isAuthenticated {
GameCenterManager.sharedInstance.presentMatchmaker() GameCenterManager.sharedInstance.presentMatchmaker()
}else { } else {
GameCenterManager.sharedInstance.authUser() GameCenterManager.sharedInstance.authUser()
} }
} }
})) }
entityManager.add(Button(name: "settingsButton", )
textureName: "gold_button_3", )
text: "Einstellungen", entityManager.add(
position: CGPoint(x: midX, y: midY ), Button(name: "settingsButton",
onButtonPress: { textureName: "gold_button_3",
let scene = SettingsScene(size: self.size) text: "Einstellungen",
self.loadScene(scene: scene) position: CGPoint(x: midX, y: midY ),
})) onButtonPress: { self.loadScene(scene: SettingsScene(size: self.size))}
entityManager.add(Button(name: "gameCenterButton", )
textureName: "gold_button_3", )
text: "GameCenter", entityManager.add(
position: CGPoint(x: midX, y: midY - 90), Button(name: "gameCenterButton",
onButtonPress: { textureName: "gold_button_3",
if GameCenterManager.isAuthenticated { text: "GameCenter",
GameCenterManager.sharedInstance.presentGameCenter() position: CGPoint(x: midX, y: midY - 90),
}else { onButtonPress: {
GameCenterManager.sharedInstance.authUser() if GameCenterManager.isAuthenticated {
} GameCenterManager.sharedInstance.presentGameCenter()
})) } else {
entityManager.add(Button(name: "regelwerkButton", GameCenterManager.sharedInstance.authUser()
textureName: "questionmark", }
text: "", }
position: CGPoint(x: self.size.width - 50, y: self.size.height - 50), )
onButtonPress: { )
let scene = RulesScene(size: self.size) entityManager.add(
self.loadScene(scene: scene) Button(name: "regelwerkButton",
})) textureName: "questionmark",
text: "",
position: CGPoint(x: self.size.width - 50, y: self.size.height - 50),
onButtonPress: { self.loadScene(scene: RulesScene(size: self.size)) }
)
)
entityManager.add(Background(size: self.size)) entityManager.add(Background(size: self.size))
entityManager.add(SpinningLogoEntity(sceneSize: self.size)) entityManager.add(SpinningLogoEntity(sceneSize: self.size))