//
//  TempViewController.m
//  Golf Superstar 2
//
//  Created by Scott Baillie on 03/06/2021.
//  Copyright © 2021 Lazy Boy Developments. All rights reserved.
//
#import "GameGlobals.h"
#import "SoundEffectFactory.h"
#import "TempViewController.h"

@interface TempViewController () <UICollectionViewDataSource, UICollectionViewDelegate, UITableViewDataSource, UITableViewDelegate>

@property (weak, nonatomic) IBOutlet UICollectionView *collection;
@property (weak, nonatomic) IBOutlet UITableView *table;

@end

@implementation TempViewController

#define ROW_HEIGHT              42

- (void)viewDidLoad {
    [super viewDidLoad];
    
    _collection.delegate = self;
    _collection.dataSource = self;
    
    _table.dataSource = self;
    _table.delegate = self;
    _table.estimatedRowHeight = 0;
}

-(void)languageSetup {
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    [_collection setContentOffset:CGPointZero animated:NO];
    [_collection reloadData];
    
    [_table setContentOffset:CGPointZero animated:NO];
    [_table reloadData];
}

-(void) viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
}

-(void) viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
}

///////////////////////////////////////////////////////////////////////////////////////////
#pragma mark - Collection Delegate
///////////////////////////////////////////////////////////////////////////////////////////

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return 0;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    [[SoundEffectFactory sharedInstance] playEffect:SOUND_EFFECT_BUTTON];
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"GameCell" forIndexPath:indexPath];
    
//    UIImageView *iconImg        = (UIImageView *)[cell viewWithTag:CELL_TAG_ICON];
//    UILabel *nameLbl            = (UILabel *)[cell viewWithTag:CELL_TAG_TITLE];
//
//    // set details
//    nameLbl.text                = name;
//    iconImg.image               = [UIImage imageNamed:icon];
    
    return cell;
}

///////////////////////////////////////////////////////
#pragma mark Table Delegate
///////////////////////////////////////////////////////
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return ROW_HEIGHT;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 0;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TrainCell" forIndexPath:indexPath];
    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    
//    UILabel* nameLbl            = (UILabel *)[cell viewWithTag:ROW_NAME_TAG];
//
//    // gui
//    nameLbl.text                = [self trainingToString:trainIndx];
    
    return cell;
}


///////////////////////////////////////////////////////
#pragma mark - UI Events
///////////////////////////////////////////////////////


/////////////////////////////////////////////////////
#pragma mark - Private
/////////////////////////////////////////////////////

@end
