You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.0 KiB
63 lines
2.0 KiB
//
|
|
// FestivalStats.swift
|
|
// TournamentStats
|
|
//
|
|
// Created by Laurent Morvillier on 27/08/2019.
|
|
// Copyright © 2019 Stax River. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
|
|
class FestivalStats : NSObject, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
|
|
|
|
var eventsCount: Int = 0
|
|
var totalPrizePool: Double = 0.0
|
|
var totalEntries: Double = 0.0
|
|
var cumulatedBuyins: Double = 0.0
|
|
|
|
// MARK: - UICollectionViewDataSource
|
|
|
|
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
|
return 4
|
|
}
|
|
|
|
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
|
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Stat", for: indexPath) as! StatCollectionViewCell
|
|
|
|
let name: String
|
|
let value: String
|
|
switch indexPath.row {
|
|
case 0:
|
|
name = "Total Events"
|
|
value = "\(eventsCount)"
|
|
case 1:
|
|
name = "Total Prizepool".uppercased()
|
|
value = self.totalPrizePool.currencyFormatted
|
|
case 2:
|
|
name = "Total Entries".uppercased()
|
|
value = self.totalEntries.formatted
|
|
case 3:
|
|
name = "Cost of entering all tournaments".uppercased()
|
|
value = self.cumulatedBuyins.currencyFormatted
|
|
default:
|
|
name = ""
|
|
value = ""
|
|
}
|
|
cell.nameLabel.text = name.uppercased()
|
|
cell.valueLabel.text = value
|
|
|
|
cell.nameLabel.textColor = Fonts.color
|
|
cell.valueLabel.textColor = Fonts.color
|
|
|
|
cell.nameLabel.font = Fonts.regular
|
|
cell.valueLabel.font = Fonts.bigNumbers
|
|
|
|
return cell
|
|
}
|
|
|
|
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
|
|
return CGSize(width: 380.0, height: 90.0)
|
|
}
|
|
|
|
}
|
|
|