adding all Rules as Textures

This commit is contained in:
Chauntalle Schüle 2020-06-20 01:11:19 +02:00
parent 0985e02c3d
commit b945f1e236
14 changed files with 137 additions and 236 deletions

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "RulesBasen.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: 122 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "RulesBoost.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: 132 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "RulesEinheiten.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: 92 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "RulesErfolge.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: 184 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "RulesSpiel.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: 82 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "RulesSpielende.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: 78 KiB

View File

@ -20,11 +20,9 @@ class EntityManager {
var entities = Set<GKEntity>()
var scene: SKScene
var isModal: Bool
var isRules: Bool
private init() {
isModal = false
isRules = false
scene = SKScene.init()
}
@ -70,16 +68,7 @@ class EntityManager {
}
if let rulesEntity = entity as? Rules {
scene.addChild(rulesEntity.header)
scene.addChild(rulesEntity.text1)
scene.addChild(rulesEntity.text2)
scene.addChild(rulesEntity.text3)
scene.addChild(rulesEntity.text4)
scene.addChild(rulesEntity.node1)
scene.addChild(rulesEntity.node2)
scene.addChild(rulesEntity.node3)
// scene.addChild(rulesEntity.overlay)
isRules = true
}
if let wayEntity = entity as? Way {
@ -385,21 +374,12 @@ class EntityManager {
func removeRules(){
entities.forEach({entity in
if let rules = entity as? Rules {
rules.header.removeFromParent()
rules.text1.removeFromParent()
rules.text2.removeFromParent()
rules.text3.removeFromParent()
rules.text4.removeFromParent()
rules.node1.removeFromParent()
rules.node2.removeFromParent()
rules.node3.removeFromParent()
if let button = rules.component(ofType: ButtonComponent.self) {
button.buttonNode.removeFromParent()
}
self.remove(rules)
isRules = false
}
})
}

View File

@ -118,233 +118,28 @@ enum RulesCategory: String{
class Rules: GKEntity {
var entityManager = EntityManager.menuEMInstance
//var rulesCategory: RulesCategory
var header: SKLabelNode
var text1: SKLabelNode
var text2: SKLabelNode
var text3: SKLabelNode
var text4: SKLabelNode
var node1: SKSpriteNode
var node2: SKSpriteNode
var node3: SKSpriteNode
init(rulesScene: RulesScene, rulesCategory: RulesCategory) {
let texture: SKTexture
switch rulesCategory {
case .Spielbeschreibung:
header = SKLabelNode(text: "Kurze Spielbeschreibung:")
text1 = SKLabelNode(text: "GoldWars ist ein strategisches, rundenbasiertes Kampfspiel.\nZwei Spieler treten gegeneinander an und versuchen ihre Basen zu erweitern. Dazu schickst du Einheiten auf eine neue Basis.")
text1.position = CGPoint(x: rulesScene.size.width * 0.5 + 50, y: rulesScene.size.height * 0.6 - 20)
text1.numberOfLines = 4
text1.preferredMaxLayoutWidth = 750
let texture = SKTexture(imageNamed:"yellow_boxTick")
node1 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) )
node1.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100)
node1.zPosition = 4
text2 = SKLabelNode(text: "30 Sekunden Zeit pro Runde")
text2.position = CGPoint(x: rulesScene.size.width * 0.5 + 25, y: rulesScene.size.height * 0.6 - 110)
node2 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) )
node2.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 160)
node2.zPosition = 4
text3 = SKLabelNode(text: "20 Runden")
text3.position = CGPoint(x: rulesScene.size.width * 0.5 - 100, y: rulesScene.size.height * 0.6 - 170)
node3 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) )
node3.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 220)
node3.zPosition = 4
text4 = SKLabelNode(text: "Nach jeder Runde kämpfen die\ngegnerischen Einheiten gegeneinander.\nWer die Basis eingenommen hat siehst\ndu an der Farbe der Basis.")
text4.position = CGPoint(x: rulesScene.size.width * 0.5 + 115, y: rulesScene.size.height * 0.2 + 10)
text4.numberOfLines = 4
texture = SKTexture(imageNamed:"RulesSpiel")
case .Basen:
header = SKLabelNode(text: "Erklärung der Basen:")
text1 = SKLabelNode(text: "Initialisierung")
self.text1.position = CGPoint(x: rulesScene.size.width * 0.5 - 300 , y: rulesScene.size.height * 0.8 - 100)
self.text1.numberOfLines = 2
self.text1.preferredMaxLayoutWidth = 390
let texture = SKTexture(imageNamed:"yellow_boxTick")
node1 = SKSpriteNode(texture: texture, size: texture.size())
node1.setScale(2.4)
node1.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100)
node1.zPosition = 4
text2 = SKLabelNode(text: "30 Sekunden Zeit pro Runde")
self.text2.position = CGPoint(x: rulesScene.size.width * 0.5 - 220, y: rulesScene.size.height * 0.8 - 100)
node2 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) )
node2.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100)
node2.zPosition = 4
text3 = SKLabelNode(text: "30 Sekunden Zeit pro Runde")
text3.position = CGPoint(x: rulesScene.size.width * 0.5 + 25, y: rulesScene.size.height * 0.6 - 110)
node3 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) )
node3.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 160)
node3.zPosition = 4
text4 = SKLabelNode(text: "20 Runden")
text4.position = CGPoint(x: rulesScene.size.width * 0.5 - 100, y: rulesScene.size.height * 0.6 - 170)
texture = SKTexture(imageNamed:"RulesBasen")
case .Spielende:
header = SKLabelNode(text: "Erklärung des Spielendes:")
text1 = SKLabelNode(text: "Initialisierung")
self.text1.position = CGPoint(x: rulesScene.size.width * 0.5 - 300 , y: rulesScene.size.height * 0.8 - 100)
self.text1.numberOfLines = 2
self.text1.preferredMaxLayoutWidth = 390
let texture = SKTexture(imageNamed:"yellow_boxTick")
node1 = SKSpriteNode(texture: texture, size: texture.size())
node1.setScale(2.4)
node1.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100)
node1.zPosition = 4
text2 = SKLabelNode(text: "wtf")
self.text2.position = CGPoint(x: rulesScene.size.width * 0.5 , y: rulesScene.size.height * 0.8 - 500)
node2 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) )
node2.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100)
node2.zPosition = 4
text3 = SKLabelNode(text: "30 Sekunden Zeit pro Runde")
text3.position = CGPoint(x: rulesScene.size.width * 0.5 + 25, y: rulesScene.size.height * 0.6 - 110)
node3 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) )
node3.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 160)
node3.zPosition = 4
text4 = SKLabelNode(text: "20 Runden")
text4.position = CGPoint(x: rulesScene.size.width * 0.5 - 100, y: rulesScene.size.height * 0.6 - 170)
texture = SKTexture(imageNamed:"RulesSpielende")
case .Achievements:
header = SKLabelNode(text: "Erklärung der Achievements:")
text1 = SKLabelNode(text: "Initialisierung")
self.text1.position = CGPoint(x: rulesScene.size.width * 0.5 - 300 , y: rulesScene.size.height * 0.8 - 100)
self.text1.numberOfLines = 2
self.text1.preferredMaxLayoutWidth = 390
let texture = SKTexture(imageNamed:"yellow_boxTick")
node1 = SKSpriteNode(texture: texture, size: texture.size())
node1.setScale(2.4)
node1.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100)
node1.zPosition = 4
text2 = SKLabelNode(text: "wtf")
self.text2.position = CGPoint(x: rulesScene.size.width * 0.5 , y: rulesScene.size.height * 0.8 - 500)
node2 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) )
node2.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100)
node2.zPosition = 4
text3 = SKLabelNode(text: "30 Sekunden Zeit pro Runde")
text3.position = CGPoint(x: rulesScene.size.width * 0.5 + 25, y: rulesScene.size.height * 0.6 - 110)
node3 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) )
node3.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 160)
node3.zPosition = 4
text4 = SKLabelNode(text: "20 Runden")
text4.position = CGPoint(x: rulesScene.size.width * 0.5 - 100, y: rulesScene.size.height * 0.6 - 170)
texture = SKTexture(imageNamed:"RulesErfolge")
case .Einheiten:
header = SKLabelNode(text: "Erklärung der Einheiten:")
text1 = SKLabelNode(text: "Initialisierung")
self.text1.position = CGPoint(x: rulesScene.size.width * 0.5 - 300 , y: rulesScene.size.height * 0.8 - 100)
self.text1.numberOfLines = 2
self.text1.preferredMaxLayoutWidth = 390
let texture = SKTexture(imageNamed:"yellow_boxTick")
node1 = SKSpriteNode(texture: texture, size: texture.size())
node1.setScale(2.4)
node1.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100)
node1.zPosition = 4
text2 = SKLabelNode(text: "wtf")
self.text2.position = CGPoint(x: rulesScene.size.width * 0.5 , y: rulesScene.size.height * 0.8 - 500)
node2 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) )
node2.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100)
node2.zPosition = 4
text3 = SKLabelNode(text: "30 Sekunden Zeit pro Runde")
text3.position = CGPoint(x: rulesScene.size.width * 0.5 + 25, y: rulesScene.size.height * 0.6 - 110)
node3 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) )
node3.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 160)
node3.zPosition = 4
text4 = SKLabelNode(text: "20 Runden")
text4.position = CGPoint(x: rulesScene.size.width * 0.5 - 100, y: rulesScene.size.height * 0.6 - 170)
texture = SKTexture(imageNamed:"RulesEinheiten")
case .Boost:
header = SKLabelNode(text: "Erklärung der Boosts:")
text1 = SKLabelNode(text: "Initialisierung")
self.text1.position = CGPoint(x: rulesScene.size.width * 0.5 - 300 , y: rulesScene.size.height * 0.8 - 100)
self.text1.numberOfLines = 2
self.text1.preferredMaxLayoutWidth = 390
let texture = SKTexture(imageNamed:"yellow_boxTick")
node1 = SKSpriteNode(texture: texture, size: CGSize(width: 5.0, height: 5.0))
node1.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100)
node1.zPosition = 4
text2 = SKLabelNode(text: "wtf")
self.text2.position = CGPoint(x: rulesScene.size.width * 0.5 , y: rulesScene.size.height * 0.8 - 500)
node2 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) )
node2.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100)
node2.zPosition = 4
text3 = SKLabelNode(text: "30 Sekunden Zeit pro Runde")
text3.position = CGPoint(x: rulesScene.size.width * 0.5 + 25, y: rulesScene.size.height * 0.6 - 110)
node3 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) )
node3.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 160)
node3.zPosition = 4
text4 = SKLabelNode(text: "20 Runden")
text4.position = CGPoint(x: rulesScene.size.width * 0.5 - 100, y: rulesScene.size.height * 0.6 - 170)
texture = SKTexture(imageNamed:"RulesBoost")
}
self.header.position = CGPoint(x: rulesScene.size.width * 0.5 - 100 , y: rulesScene.size.height * 0.8)
self.header.fontName = "Courier-Bold"
self.header.fontColor = .black
self.header.fontSize = 30
self.header.zPosition = 5
self.text1.fontName = "Courier-Bold"
self.text1.fontColor = .black
self.text1.fontSize = 25
self.text1.zPosition = 5
self.text2.fontName = "Courier-Bold"
self.text2.fontColor = .black
self.text2.fontSize = 25
self.text2.zPosition = 5
self.text3.fontName = "Courier-Bold"
self.text3.fontColor = .black
self.text3.fontSize = 25
self.text3.zPosition = 5
self.text4.fontName = "Courier-Bold"
self.text4.fontColor = .black
self.text4.fontSize = 25
self.text4.zPosition = 5
super.init()
/* overlay = SKSpriteNode(color: UIColor.init(red: 0, green: 0, blue: 0, alpha: 0.7), size: menuScene.size)
overlay.anchorPoint = menuScene.anchorPoint
overlay.zPosition = 3 */
node1 = SKSpriteNode(texture: texture, size: CGSize(width: rulesScene.size.width * 0.8, height: rulesScene.size.height * 0.8))
node1.position = CGPoint(x: rulesScene.size.width * 0.6, y: rulesScene.size.height * 0.6 - 150)
node1.zPosition = 4
super.init()
}
required init?(coder: NSCoder) {