2020-05-09 18:31:06 +02:00

50 lines
1.4 KiB
Swift

//
// Modal.swift
// GoldWars
//
// Created by Niko Jochim on 01.05.20.
// Copyright © 2020 SP2. All rights reserved.
//
import GameplayKit
class Modal: GKEntity{
var unitCount:Int
init(modaltype: ModalType, base: Base, anchorPoint: CGPoint) {
unitCount = base.unitCount
super.init()
switch modaltype{
case .BaseDetails:
addComponent(ModalBackgroundComponent(anchorPoint: anchorPoint))
addComponent(ModalContentComponent(
header: "Basis Information",
body: "Diese Basis enthält \(base.unitCount) Einheiten",
footer: "",
anchorPoint: anchorPoint
)
)
case .BaseAttack:
addComponent(ModalBackgroundComponent(anchorPoint: anchorPoint))
addComponent(SliderComponent(
width: 300,
position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 80)
)
)
addComponent(ModalContentComponent(
header: "Angriff",
body: "Schicke \(unitCount / 2) Einheiten",
footer: "",
anchorPoint: anchorPoint
)
)
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}