Compare commits
4 Commits
developmen
...
83-version
Author | SHA1 | Date | |
---|---|---|---|
|
9ed7faf2aa | ||
|
722edad36d | ||
|
76a61b3daf | ||
|
714c17ee30 |
@ -49,11 +49,14 @@
|
|||||||
ABC0C3732481509300387B8F /* MapUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC0C3722481509300387B8F /* MapUtils.swift */; };
|
ABC0C3732481509300387B8F /* MapUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC0C3722481509300387B8F /* MapUtils.swift */; };
|
||||||
C04783EE2468583F004961FB /* intro-music.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = C04783ED2468583F004961FB /* intro-music.mp3 */; };
|
C04783EE2468583F004961FB /* intro-music.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = C04783ED2468583F004961FB /* intro-music.mp3 */; };
|
||||||
C04783F024685995004961FB /* SettingsScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = C04783EF24685995004961FB /* SettingsScene.swift */; };
|
C04783F024685995004961FB /* SettingsScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = C04783EF24685995004961FB /* SettingsScene.swift */; };
|
||||||
|
C04E26D5249BEBB0003B9E51 /* AppUpdater.swift in Sources */ = {isa = PBXBuildFile; fileRef = C04E26D4249BEBB0003B9E51 /* AppUpdater.swift */; };
|
||||||
C05BB9C4247D890C00411249 /* SliderComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C05BB9C3247D890C00411249 /* SliderComponent.swift */; };
|
C05BB9C4247D890C00411249 /* SliderComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C05BB9C3247D890C00411249 /* SliderComponent.swift */; };
|
||||||
C05FAED62468559D0006AF2E /* SoundManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C05FAED52468559D0006AF2E /* SoundManager.swift */; };
|
C05FAED62468559D0006AF2E /* SoundManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C05FAED52468559D0006AF2E /* SoundManager.swift */; };
|
||||||
C064E9A8246C0EA50022B228 /* LabelNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = C064E9A7246C0EA50022B228 /* LabelNode.swift */; };
|
C064E9A8246C0EA50022B228 /* LabelNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = C064E9A7246C0EA50022B228 /* LabelNode.swift */; };
|
||||||
C064E9AA246C114C0022B228 /* LabelComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C064E9A9246C114C0022B228 /* LabelComponent.swift */; };
|
C064E9AA246C114C0022B228 /* LabelComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C064E9A9246C114C0022B228 /* LabelComponent.swift */; };
|
||||||
C064E9AC246C151F0022B228 /* Label.swift in Sources */ = {isa = PBXBuildFile; fileRef = C064E9AB246C151F0022B228 /* Label.swift */; };
|
C064E9AC246C151F0022B228 /* Label.swift in Sources */ = {isa = PBXBuildFile; fileRef = C064E9AB246C151F0022B228 /* Label.swift */; };
|
||||||
|
C06C71DD249BC74D00B2D63C /* AppUpdater.swift in Sources */ = {isa = PBXBuildFile; fileRef = C06C71DC249BC74D00B2D63C /* AppUpdater.swift */; };
|
||||||
|
C06C71DF249BDADF00B2D63C /* UpdatePopUp.swift in Sources */ = {isa = PBXBuildFile; fileRef = C06C71DE249BDADF00B2D63C /* UpdatePopUp.swift */; };
|
||||||
C099579C246C5E5C0016AA22 /* DataService.swift in Sources */ = {isa = PBXBuildFile; fileRef = C099579B246C5E5C0016AA22 /* DataService.swift */; };
|
C099579C246C5E5C0016AA22 /* DataService.swift in Sources */ = {isa = PBXBuildFile; fileRef = C099579B246C5E5C0016AA22 /* DataService.swift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
@ -115,11 +118,14 @@
|
|||||||
ABC0C3722481509300387B8F /* MapUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapUtils.swift; sourceTree = "<group>"; };
|
ABC0C3722481509300387B8F /* MapUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapUtils.swift; sourceTree = "<group>"; };
|
||||||
C04783ED2468583F004961FB /* intro-music.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "intro-music.mp3"; sourceTree = "<group>"; };
|
C04783ED2468583F004961FB /* intro-music.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "intro-music.mp3"; sourceTree = "<group>"; };
|
||||||
C04783EF24685995004961FB /* SettingsScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsScene.swift; sourceTree = "<group>"; };
|
C04783EF24685995004961FB /* SettingsScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsScene.swift; sourceTree = "<group>"; };
|
||||||
|
C04E26D4249BEBB0003B9E51 /* AppUpdater.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppUpdater.swift; path = GoldWars/AppUpdater.swift; sourceTree = SOURCE_ROOT; };
|
||||||
C05BB9C3247D890C00411249 /* SliderComponent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SliderComponent.swift; sourceTree = "<group>"; };
|
C05BB9C3247D890C00411249 /* SliderComponent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SliderComponent.swift; sourceTree = "<group>"; };
|
||||||
C05FAED52468559D0006AF2E /* SoundManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoundManager.swift; sourceTree = "<group>"; };
|
C05FAED52468559D0006AF2E /* SoundManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoundManager.swift; sourceTree = "<group>"; };
|
||||||
C064E9A7246C0EA50022B228 /* LabelNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelNode.swift; sourceTree = "<group>"; };
|
C064E9A7246C0EA50022B228 /* LabelNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelNode.swift; sourceTree = "<group>"; };
|
||||||
C064E9A9246C114C0022B228 /* LabelComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelComponent.swift; sourceTree = "<group>"; };
|
C064E9A9246C114C0022B228 /* LabelComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelComponent.swift; sourceTree = "<group>"; };
|
||||||
C064E9AB246C151F0022B228 /* Label.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Label.swift; sourceTree = "<group>"; };
|
C064E9AB246C151F0022B228 /* Label.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Label.swift; sourceTree = "<group>"; };
|
||||||
|
C06C71DC249BC74D00B2D63C /* AppUpdater.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppUpdater.swift; sourceTree = "<group>"; };
|
||||||
|
C06C71DE249BDADF00B2D63C /* UpdatePopUp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdatePopUp.swift; sourceTree = "<group>"; };
|
||||||
C099579B246C5E5C0016AA22 /* DataService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataService.swift; sourceTree = "<group>"; };
|
C099579B246C5E5C0016AA22 /* DataService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataService.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
@ -149,6 +155,7 @@
|
|||||||
110360EC244B101B008610AF /* GoldWarsTests */,
|
110360EC244B101B008610AF /* GoldWarsTests */,
|
||||||
110360D0244B101A008610AF /* Products */,
|
110360D0244B101A008610AF /* Products */,
|
||||||
9E78ACB4245C9A5300526FF7 /* Frameworks */,
|
9E78ACB4245C9A5300526FF7 /* Frameworks */,
|
||||||
|
C04E26D3249BEB73003B9E51 /* Recovered References */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
@ -185,6 +192,7 @@
|
|||||||
C04783EF24685995004961FB /* SettingsScene.swift */,
|
C04783EF24685995004961FB /* SettingsScene.swift */,
|
||||||
3EAD889424801B6A0048A10A /* RoundTimer.swift */,
|
3EAD889424801B6A0048A10A /* RoundTimer.swift */,
|
||||||
AB671B242494ECF0003FBE8D /* EloHelper.swift */,
|
AB671B242494ECF0003FBE8D /* EloHelper.swift */,
|
||||||
|
C04E26D4249BEBB0003B9E51 /* AppUpdater.swift */,
|
||||||
);
|
);
|
||||||
path = GoldWars;
|
path = GoldWars;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -230,6 +238,7 @@
|
|||||||
9EEDE02C246FCD770096C735 /* SpinningLogoEntity.swift */,
|
9EEDE02C246FCD770096C735 /* SpinningLogoEntity.swift */,
|
||||||
3E6785412472CBEC007B9DE4 /* Way.swift */,
|
3E6785412472CBEC007B9DE4 /* Way.swift */,
|
||||||
C064E9AB246C151F0022B228 /* Label.swift */,
|
C064E9AB246C151F0022B228 /* Label.swift */,
|
||||||
|
C06C71DE249BDADF00B2D63C /* UpdatePopUp.swift */,
|
||||||
);
|
);
|
||||||
path = Entities;
|
path = Entities;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -289,6 +298,14 @@
|
|||||||
path = Map;
|
path = Map;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
C04E26D3249BEB73003B9E51 /* Recovered References */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
C06C71DC249BC74D00B2D63C /* AppUpdater.swift */,
|
||||||
|
);
|
||||||
|
name = "Recovered References";
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
/* Begin PBXNativeTarget section */
|
||||||
@ -399,6 +416,7 @@
|
|||||||
3FE19DB5246C7A22004827AB /* RoundCalculatorService.swift in Sources */,
|
3FE19DB5246C7A22004827AB /* RoundCalculatorService.swift in Sources */,
|
||||||
9EC239E1246878A900952F74 /* MultiplayerNetwork.swift in Sources */,
|
9EC239E1246878A900952F74 /* MultiplayerNetwork.swift in Sources */,
|
||||||
9EA3ABEB245C6DFA006BC61D /* BaseNode.swift in Sources */,
|
9EA3ABEB245C6DFA006BC61D /* BaseNode.swift in Sources */,
|
||||||
|
C04E26D5249BEBB0003B9E51 /* AppUpdater.swift in Sources */,
|
||||||
3E6785422472CBEC007B9DE4 /* Way.swift in Sources */,
|
3E6785422472CBEC007B9DE4 /* Way.swift in Sources */,
|
||||||
110360D9244B101A008610AF /* GameScene.swift in Sources */,
|
110360D9244B101A008610AF /* GameScene.swift in Sources */,
|
||||||
C04783F024685995004961FB /* SettingsScene.swift in Sources */,
|
C04783F024685995004961FB /* SettingsScene.swift in Sources */,
|
||||||
@ -421,6 +439,7 @@
|
|||||||
3F745DF0246F48FC00CE7375 /* PlayerMoveType.swift in Sources */,
|
3F745DF0246F48FC00CE7375 /* PlayerMoveType.swift in Sources */,
|
||||||
3EAD889524801B6A0048A10A /* RoundTimer.swift in Sources */,
|
3EAD889524801B6A0048A10A /* RoundTimer.swift in Sources */,
|
||||||
3E67854024728368007B9DE4 /* CElements.swift in Sources */,
|
3E67854024728368007B9DE4 /* CElements.swift in Sources */,
|
||||||
|
C06C71DD249BC74D00B2D63C /* AppUpdater.swift in Sources */,
|
||||||
ABA03DA0244BD54F00A66916 /* Base.swift in Sources */,
|
ABA03DA0244BD54F00A66916 /* Base.swift in Sources */,
|
||||||
C064E9AC246C151F0022B228 /* Label.swift in Sources */,
|
C064E9AC246C151F0022B228 /* Label.swift in Sources */,
|
||||||
ABC0C3732481509300387B8F /* MapUtils.swift in Sources */,
|
ABC0C3732481509300387B8F /* MapUtils.swift in Sources */,
|
||||||
@ -429,6 +448,7 @@
|
|||||||
9E61EAC7249BB61A00334DDE /* SpinningLogo3DNode.swift in Sources */,
|
9E61EAC7249BB61A00334DDE /* SpinningLogo3DNode.swift in Sources */,
|
||||||
9E174C84245DD8CE00209FF0 /* Button.swift in Sources */,
|
9E174C84245DD8CE00209FF0 /* Button.swift in Sources */,
|
||||||
110360DB244B101A008610AF /* GameViewController.swift in Sources */,
|
110360DB244B101A008610AF /* GameViewController.swift in Sources */,
|
||||||
|
C06C71DF249BDADF00B2D63C /* UpdatePopUp.swift in Sources */,
|
||||||
C05BB9C4247D890C00411249 /* SliderComponent.swift in Sources */,
|
C05BB9C4247D890C00411249 /* SliderComponent.swift in Sources */,
|
||||||
110360D3244B101A008610AF /* AppDelegate.swift in Sources */,
|
110360D3244B101A008610AF /* AppDelegate.swift in Sources */,
|
||||||
9EC86B9F245C88A300796EF3 /* Modal.swift in Sources */,
|
9EC86B9F245C88A300796EF3 /* Modal.swift in Sources */,
|
||||||
@ -595,14 +615,14 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = GoldWars/GoldWars.entitlements;
|
CODE_SIGN_ENTITLEMENTS = GoldWars/GoldWars.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 4;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEVELOPMENT_TEAM = DDKFQG46BQ;
|
DEVELOPMENT_TEAM = DDKFQG46BQ;
|
||||||
INFOPLIST_FILE = GoldWars/Info.plist;
|
INFOPLIST_FILE = GoldWars/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.1;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = de.hft.stuttgart.ip2.goldwars;
|
PRODUCT_BUNDLE_IDENTIFIER = de.hft.stuttgart.ip2.goldwars;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
@ -618,14 +638,14 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = GoldWars/GoldWars.entitlements;
|
CODE_SIGN_ENTITLEMENTS = GoldWars/GoldWars.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 4;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEVELOPMENT_TEAM = DDKFQG46BQ;
|
DEVELOPMENT_TEAM = DDKFQG46BQ;
|
||||||
INFOPLIST_FILE = GoldWars/Info.plist;
|
INFOPLIST_FILE = GoldWars/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.1;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = de.hft.stuttgart.ip2.goldwars;
|
PRODUCT_BUNDLE_IDENTIFIER = de.hft.stuttgart.ip2.goldwars;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
|
83
GoldWars/GoldWars/AppUpdater.swift
Normal file
83
GoldWars/GoldWars/AppUpdater.swift
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
//
|
||||||
|
// AppUpdater.swift
|
||||||
|
// GoldWars
|
||||||
|
//
|
||||||
|
// Created by Tim Herbst on 18.06.20.
|
||||||
|
// Copyright © 2020 SP2. All rights reserved.
|
||||||
|
//
|
||||||
|
import GameKit
|
||||||
|
|
||||||
|
enum VersionError: Error {
|
||||||
|
case invalidBundleInfo, invalidResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
class LookupResult: Decodable {
|
||||||
|
var results: [AppInfo]
|
||||||
|
}
|
||||||
|
|
||||||
|
class AppInfo: Decodable {
|
||||||
|
var version: String
|
||||||
|
var trackViewUrl: String
|
||||||
|
}
|
||||||
|
|
||||||
|
class AppUpdater: NSObject {
|
||||||
|
static var appStoreUrl = ""
|
||||||
|
static let appUpdaterInstance = AppUpdater()
|
||||||
|
var entityManager = EntityManager.menuEMInstance
|
||||||
|
|
||||||
|
private func getAppInfo(completion: @escaping (AppInfo?, Error?) -> Void) -> URLSessionTask? {
|
||||||
|
guard let identifier = Bundle.main.infoDictionary!["CFBundleIdentifier"] as? String,
|
||||||
|
let url = URL(string: "http://itunes.apple.com/lookup?bundleId=\(identifier)") else {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
completion(nil, VersionError.invalidBundleInfo)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
let task = URLSession.shared.dataTask(with: url) { (data, response, error) in
|
||||||
|
do {
|
||||||
|
if error != nil { throw error! }
|
||||||
|
guard let data = data else { throw VersionError.invalidResponse }
|
||||||
|
|
||||||
|
print("Data: ", data)
|
||||||
|
print("response: ", response!)
|
||||||
|
|
||||||
|
let result = try JSONDecoder().decode(LookupResult.self, from: data)
|
||||||
|
|
||||||
|
let dictionary = try JSONSerialization.jsonObject(with: data, options: .mutableLeaves)
|
||||||
|
|
||||||
|
print("dictionary: ", dictionary)
|
||||||
|
|
||||||
|
guard let info = result.results.first else { throw VersionError.invalidResponse }
|
||||||
|
print("result: ", result)
|
||||||
|
|
||||||
|
completion(info, nil)
|
||||||
|
} catch {
|
||||||
|
completion(nil, error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
task.resume()
|
||||||
|
print("task***",task)
|
||||||
|
return task
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkVersion() -> Bool {
|
||||||
|
let info = Bundle.main.infoDictionary
|
||||||
|
let currentVersion = info?["CFBundleShortVersionString"] as? String
|
||||||
|
var appStoreVersion: AppInfo
|
||||||
|
var isUpToDate = true
|
||||||
|
_ = getAppInfo{ (info, error) in
|
||||||
|
appStoreVersion = info!.version
|
||||||
|
print("info-version", info?.version)
|
||||||
|
if let error = error {
|
||||||
|
print("error: ",error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print("currentVersion", currentVersion)
|
||||||
|
print("appStoreVersion", appStoreVersion)
|
||||||
|
if !(currentVersion == appStoreVersion) {
|
||||||
|
isUpToDate = false
|
||||||
|
}
|
||||||
|
print("isUptoDate", isUpToDate)
|
||||||
|
return isUpToDate
|
||||||
|
}
|
||||||
|
}
|
@ -43,6 +43,11 @@ class EntityManager {
|
|||||||
isModal = true
|
isModal = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let updateEntity = entity as? UpdatePopUp {
|
||||||
|
scene.addChild(updateEntity.background)
|
||||||
|
scene.addChild(updateEntity.message)
|
||||||
|
}
|
||||||
|
|
||||||
if let hudEntitiy = entity as? HUD {
|
if let hudEntitiy = entity as? HUD {
|
||||||
scene.addChild(hudEntitiy.hostLabel)
|
scene.addChild(hudEntitiy.hostLabel)
|
||||||
scene.addChild(hudEntitiy.hostUnitsLabel)
|
scene.addChild(hudEntitiy.hostUnitsLabel)
|
||||||
|
44
GoldWars/GoldWars/Entities/UpdatePopUp.swift
Normal file
44
GoldWars/GoldWars/Entities/UpdatePopUp.swift
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
//
|
||||||
|
// UpdatePopUp.swift
|
||||||
|
// GoldWars
|
||||||
|
//
|
||||||
|
// Created by Tim Herbst on 18.06.20.
|
||||||
|
// Copyright © 2020 SP2. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import GameplayKit
|
||||||
|
|
||||||
|
class UpdatePopUp: GKEntity {
|
||||||
|
|
||||||
|
var entityManager = EntityManager.menuEMInstance
|
||||||
|
var background: SKSpriteNode
|
||||||
|
var message: SKLabelNode
|
||||||
|
|
||||||
|
init(anchorPoint: CGPoint) {
|
||||||
|
let texture = SKTexture(imageNamed: "ModalBackground")
|
||||||
|
background = SKSpriteNode(texture: texture, size: texture.size())
|
||||||
|
background.setScale(2.4)
|
||||||
|
background.position = anchorPoint
|
||||||
|
background.zPosition = 4
|
||||||
|
|
||||||
|
message = SKLabelNode(text: "Update erforderlich")
|
||||||
|
self.message.position = CGPoint(x: anchorPoint.x, y: anchorPoint.y + 60)
|
||||||
|
self.message.fontName = "HelveticaNeue-Bold"
|
||||||
|
self.message.fontSize = 40
|
||||||
|
self.message.zPosition = 5
|
||||||
|
|
||||||
|
super.init()
|
||||||
|
|
||||||
|
addComponent(ButtonComponent(textureName: "yellow_button04", text: "zum Update", position: CGPoint(x: anchorPoint.x, y: anchorPoint.y - 105), isEnabled: true, onButtonPress: {
|
||||||
|
if let url = URL(string: AppUpdater.appStoreUrl), UIApplication.shared.canOpenURL(url) {
|
||||||
|
if #available(iOS 13.2, *) {
|
||||||
|
UIApplication.shared.open(url, options: [:], completionHandler: nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
required init?(coder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,7 @@ import SceneKit
|
|||||||
class MenuScene: SKScene {
|
class MenuScene: SKScene {
|
||||||
|
|
||||||
var entityManager = EntityManager.menuEMInstance
|
var entityManager = EntityManager.menuEMInstance
|
||||||
|
var appOutdated = false
|
||||||
|
|
||||||
override func sceneDidLoad() {
|
override func sceneDidLoad() {
|
||||||
GameCenterManager.sharedInstance.menusc = self
|
GameCenterManager.sharedInstance.menusc = self
|
||||||
@ -28,7 +29,7 @@ class MenuScene: SKScene {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
if GameCenterManager.isAuthenticated {
|
if GameCenterManager.isAuthenticated {
|
||||||
GameCenterManager.sharedInstance.presentMatchmaker()
|
GameCenterManager.sharedInstance.presentGameCenter()
|
||||||
}else {
|
}else {
|
||||||
GameCenterManager.sharedInstance.authUser()
|
GameCenterManager.sharedInstance.authUser()
|
||||||
}
|
}
|
||||||
@ -70,7 +71,9 @@ class MenuScene: SKScene {
|
|||||||
override func update(_ currentTime: TimeInterval) {
|
override func update(_ currentTime: TimeInterval) {
|
||||||
if entityManager.entities.count != 0 {
|
if entityManager.entities.count != 0 {
|
||||||
entityManager.getBackground()!.update(deltaTime: currentTime)
|
entityManager.getBackground()!.update(deltaTime: currentTime)
|
||||||
entityManager.getButtonByName(buttonName: "startGameButton").component(ofType: ButtonComponent.self)?.buttonNode.isEnabled = GameCenterManager.isAuthenticated
|
if !appOutdated {
|
||||||
|
entityManager.getButtonByName(buttonName: "startGameButton").component(ofType: ButtonComponent.self)?.buttonNode.isEnabled = GameCenterManager.isAuthenticated
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if GameCenterManager.sharedInstance.initIsFinish {
|
if GameCenterManager.sharedInstance.initIsFinish {
|
||||||
|
Loading…
Reference in New Issue
Block a user