project_files/HedgewarsMobile/Classes/StatsPageViewController.m
changeset 6078 8c0cc07731e5
parent 6017 24631fd2fb9e
child 6700 e04da46ee43c
equal deleted inserted replaced
6077:d8fa5a85d24f 6078:8c0cc07731e5
    18  * File created on 30/12/2010.
    18  * File created on 30/12/2010.
    19  */
    19  */
    20 
    20 
    21 
    21 
    22 #import "StatsPageViewController.h"
    22 #import "StatsPageViewController.h"
    23 #import "CommodityFunctions.h"
       
    24 #import <QuartzCore/QuartzCore.h>
    23 #import <QuartzCore/QuartzCore.h>
    25 
    24 
    26 @implementation StatsPageViewController
    25 @implementation StatsPageViewController
    27 @synthesize statsArray;
    26 @synthesize statsArray;
    28 
    27 
    47         [self.tableView setBackgroundView:background];
    46         [self.tableView setBackgroundView:background];
    48         [background release];
    47         [background release];
    49     } else
    48     } else
    50         self.view.backgroundColor = [UIColor blackColor];
    49         self.view.backgroundColor = [UIColor blackColor];
    51 
    50 
    52     self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER;
    51     self.tableView.separatorColor = [UIColor darkYellowColor];
    53     self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    52     self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    54 
    53 
    55     [super viewDidLoad];
    54     [super viewDidLoad];
    56 }
    55 }
    57 
    56 
    83 
    82 
    84     if (section == 0) {         // winning team
    83     if (section == 0) {         // winning team
    85         imgName = @"star";
    84         imgName = @"star";
    86         imgPath = [[NSBundle mainBundle] resourcePath];
    85         imgPath = [[NSBundle mainBundle] resourcePath];
    87         cell.textLabel.text = [self.statsArray objectAtIndex:1];
    86         cell.textLabel.text = [self.statsArray objectAtIndex:1];
    88         cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT;
    87         cell.textLabel.textColor = [UIColor lightYellowColor];
    89     } else if (section == 1) {  // teams ranking
    88     } else if (section == 1) {  // teams ranking
    90         // color, # kills, teamname
    89         // color, # kills, teamname
    91         NSArray *info = [[[self.statsArray objectAtIndex:0] objectAtIndex:row] componentsSeparatedByString:@" "];
    90         NSArray *info = [[[self.statsArray objectAtIndex:0] objectAtIndex:row] componentsSeparatedByString:@" "];
    92         NSUInteger color = [[info objectAtIndex:0] intValue];
    91         NSUInteger color = [[info objectAtIndex:0] intValue];
    93         cell.textLabel.textColor = [UIColor colorWithRed:((color >> 16) & 0xFF)/255.0f
    92         cell.textLabel.textColor = [UIColor colorWithRed:((color >> 16) & 0xFF)/255.0f
    97         cell.textLabel.text = [NSString stringWithFormat:@"%d. %@ (%@ kills)", row+1, [info objectAtIndex:2], [info objectAtIndex:1]];
    96         cell.textLabel.text = [NSString stringWithFormat:@"%d. %@ (%@ kills)", row+1, [info objectAtIndex:2], [info objectAtIndex:1]];
    98         imgName = [NSString stringWithFormat:@"StatsMedal%d",row+1];
    97         imgName = [NSString stringWithFormat:@"StatsMedal%d",row+1];
    99     } else if (section == 2) {  // general info
    98     } else if (section == 2) {  // general info
   100         imgName = @"iconDamage";
    99         imgName = @"iconDamage";
   101         cell.textLabel.text = [self.statsArray objectAtIndex:row + 2];
   100         cell.textLabel.text = [self.statsArray objectAtIndex:row + 2];
   102         cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT;
   101         cell.textLabel.textColor = [UIColor lightYellowColor];
   103     }
   102     }
   104 
   103 
   105     NSString *imgString = [[NSString alloc] initWithFormat:@"%@/%@.png",imgPath,imgName];
   104     NSString *imgString = [[NSString alloc] initWithFormat:@"%@/%@.png",imgPath,imgName];
   106     UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgString];
   105     UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgString];
   107     [imgString release];
   106     [imgString release];
   153         [button setTitle:NSLocalizedString(@"Done",@"") forState:UIControlStateNormal];
   152         [button setTitle:NSLocalizedString(@"Done",@"") forState:UIControlStateNormal];
   154         [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
   153         [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
   155         [button setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted];
   154         [button setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted];
   156 
   155 
   157         button.titleLabel.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
   156         button.titleLabel.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
   158         button.backgroundColor = UICOLOR_HW_ALMOSTBLACK;
   157         button.backgroundColor = [UIColor blackColorTransparent];
   159         [button.layer setBorderWidth:1];
   158         [button.layer setBorderWidth:1];
   160         [button.layer setBorderColor:UICOLOR_HW_YELLOW_BODER.CGColor];
   159         [button.layer setBorderColor:[[UIColor darkYellowColor] CGColor]];
   161         [button.layer setCornerRadius:9.0f];
   160         [button.layer setCornerRadius:9.0f];
   162         [button.layer setMasksToBounds:YES];
   161         [button.layer setMasksToBounds:YES];
   163         [button addTarget:self action:@selector(dismissView) forControlEvents:UIControlEventTouchUpInside];
   162         [button addTarget:self action:@selector(dismissView) forControlEvents:UIControlEventTouchUpInside];
   164         [footer addSubview:button];
   163         [footer addSubview:button];
   165         [button release];
   164         [button release];