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.
64 lines
2.1 KiB
64 lines
2.1 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 = "Cumulated Buy-ins".uppercased()
|
|
value = self.cumulatedBuyins.currencyFormatted
|
|
default:
|
|
name = ""
|
|
value = ""
|
|
}
|
|
cell.nameLabel.text = name.uppercased()
|
|
cell.valueLabel.text = value
|
|
|
|
cell.nameLabel.textColor = UIColor.white
|
|
cell.valueLabel.textColor = UIColor.white
|
|
|
|
cell.nameLabel.font = UIFont.systemFont(ofSize: 20.0)
|
|
cell.valueLabel.font = UIFont.systemFont(ofSize: 56.0, weight: .thin)
|
|
|
|
return cell
|
|
}
|
|
|
|
|
|
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
|
|
return CGSize(width: 360.0, height: 100.0)
|
|
}
|
|
|
|
}
|
|
|