author | legutus |
Mon, 30 Aug 2010 15:24:49 +0200 | |
changeset 3786 | 0907b0fd5714 |
parent 3783 | 8e9daf967406 |
child 3829 | 81db3c85784b |
permissions | -rw-r--r-- |
3621 | 1 |
// |
2 |
// WeaponCellView.m |
|
3 |
// Hedgewars |
|
4 |
// |
|
5 |
// Created by Vittorio on 03/07/10. |
|
6 |
// Copyright 2010 __MyCompanyName__. All rights reserved. |
|
7 |
// |
|
8 |
||
9 |
#import "WeaponCellView.h" |
|
10 |
#import "CommodityFunctions.h" |
|
11 |
||
12 |
@implementation WeaponCellView |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
13 |
@synthesize delegate, weaponName, weaponIcon, initialSli, probabilitySli, delaySli, crateSli, helpLabel, |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
14 |
initialImg, probabilityImg, delayImg, crateImg, initialLab, probabilityLab, delayLab, crateLab; |
3621 | 15 |
|
16 |
-(id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { |
|
17 |
if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) { |
|
3624 | 18 |
delegate = nil; |
3697 | 19 |
|
3621 | 20 |
weaponName = [[UILabel alloc] init]; |
21 |
weaponName.backgroundColor = [UIColor clearColor]; |
|
22 |
weaponName.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]]; |
|
23 |
weaponIcon = [[UIImageView alloc] init]; |
|
3697 | 24 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
25 |
initialSli = [[UISlider alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
26 |
[initialSli addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
27 |
[initialSli addTarget:self action:@selector(startDragging:) forControlEvents:UIControlEventTouchDown]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
28 |
[initialSli addTarget:self action:@selector(stopDragging:) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
29 |
initialSli.maximumValue = 9; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
30 |
initialSli.minimumValue = 0; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
31 |
initialSli.tag = 100; |
3697 | 32 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
33 |
probabilitySli = [[UISlider alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
34 |
[probabilitySli addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
35 |
[probabilitySli addTarget:self action:@selector(startDragging:) forControlEvents:UIControlEventTouchDown]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
36 |
[probabilitySli addTarget:self action:@selector(stopDragging:) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
37 |
probabilitySli.maximumValue = 9; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
38 |
probabilitySli.minimumValue = 0; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
39 |
probabilitySli.tag = 200; |
3697 | 40 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
41 |
delaySli = [[UISlider alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
42 |
[delaySli addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
43 |
[delaySli addTarget:self action:@selector(startDragging:) forControlEvents:UIControlEventTouchDown]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
44 |
[delaySli addTarget:self action:@selector(stopDragging:) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
45 |
delaySli.maximumValue = 9; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
46 |
delaySli.minimumValue = 0; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
47 |
delaySli.tag = 300; |
3697 | 48 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
49 |
crateSli = [[UISlider alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
50 |
[crateSli addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
51 |
[crateSli addTarget:self action:@selector(startDragging:) forControlEvents:UIControlEventTouchDown]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
52 |
[crateSli addTarget:self action:@selector(stopDragging:) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
53 |
crateSli.maximumValue = 9; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
54 |
crateSli.minimumValue = 0; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
55 |
crateSli.tag = 400; |
3697 | 56 |
|
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
57 |
NSString *imgAmmoStr = [NSString stringWithFormat:@"%@/iconAmmo.png",BTN_DIRECTORY()]; |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
58 |
NSString *imgDamageStr = [NSString stringWithFormat:@"%@/iconDamage.png",BTN_DIRECTORY()]; |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
59 |
NSString *imgTimeStr = [NSString stringWithFormat:@"%@/iconTime.png",BTN_DIRECTORY()]; |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
60 |
NSString *imgBoxStr = [NSString stringWithFormat:@"%@/iconBox.png",BTN_DIRECTORY()]; |
3624 | 61 |
|
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
62 |
initialImg = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:imgAmmoStr]]; |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
63 |
probabilityImg = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:imgDamageStr]]; |
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
64 |
delayImg = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:imgTimeStr]]; |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
65 |
crateImg = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:imgBoxStr]]; |
3697 | 66 |
|
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
67 |
initialLab = [[UILabel alloc] init]; |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
68 |
initialLab.backgroundColor = [UIColor clearColor]; |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
69 |
initialLab.textColor = [UIColor grayColor]; |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
70 |
initialLab.textAlignment = UITextAlignmentCenter; |
3697 | 71 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
72 |
probabilityLab = [[UILabel alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
73 |
probabilityLab.backgroundColor = [UIColor clearColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
74 |
probabilityLab.textColor = [UIColor grayColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
75 |
probabilityLab.textAlignment = UITextAlignmentCenter; |
3697 | 76 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
77 |
delayLab = [[UILabel alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
78 |
delayLab.backgroundColor = [UIColor clearColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
79 |
delayLab.textColor = [UIColor grayColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
80 |
delayLab.textAlignment = UITextAlignmentCenter; |
3697 | 81 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
82 |
crateLab = [[UILabel alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
83 |
crateLab.backgroundColor = [UIColor clearColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
84 |
crateLab.textColor = [UIColor grayColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
85 |
crateLab.textAlignment = UITextAlignmentCenter; |
3697 | 86 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
87 |
helpLabel = [[UILabel alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
88 |
helpLabel.backgroundColor = [UIColor clearColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
89 |
helpLabel.textColor = [UIColor grayColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
90 |
helpLabel.textAlignment = UITextAlignmentRight; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
91 |
helpLabel.font = [UIFont italicSystemFontOfSize:[UIFont smallSystemFontSize]]; |
3697 | 92 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
93 |
[self.contentView addSubview:weaponName]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
94 |
[self.contentView addSubview:weaponIcon]; |
3697 | 95 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
96 |
[self.contentView addSubview:initialSli]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
97 |
[self.contentView addSubview:probabilitySli]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
98 |
[self.contentView addSubview:delaySli]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
99 |
[self.contentView addSubview:crateSli]; |
3624 | 100 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
101 |
[self.contentView addSubview:initialImg]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
102 |
[self.contentView addSubview:probabilityImg]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
103 |
[self.contentView addSubview:delayImg]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
104 |
[self.contentView addSubview:crateImg]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
105 |
|
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
106 |
[self.contentView addSubview:initialLab]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
107 |
[self.contentView addSubview:probabilityLab]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
108 |
[self.contentView addSubview:delayLab]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
109 |
[self.contentView addSubview:crateLab]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
110 |
|
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
111 |
[self.contentView addSubview:helpLabel]; |
3621 | 112 |
} |
113 |
return self; |
|
114 |
} |
|
115 |
||
116 |
-(void) layoutSubviews { |
|
117 |
[super layoutSubviews]; |
|
118 |
||
119 |
CGRect contentRect = self.contentView.bounds; |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
120 |
CGFloat shiftSliders = contentRect.origin.x; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
121 |
CGFloat shiftLabel = 0; |
3697 | 122 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
123 |
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
124 |
shiftSliders += 65; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
125 |
shiftLabel += 165; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
126 |
} else |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
127 |
shiftSliders -= 13; |
3621 | 128 |
|
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
129 |
weaponIcon.frame = CGRectMake(5, 5, 32, 32); |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
130 |
weaponName.frame = CGRectMake(45, 8, 200, 25); |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
131 |
|
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
132 |
helpLabel.frame = CGRectMake(shiftLabel + 200, 8, 250, 15); |
3697 | 133 |
|
3621 | 134 |
// second line |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
135 |
initialImg.frame = CGRectMake(shiftSliders + 20, 40, 32, 32); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
136 |
initialLab.frame = CGRectMake(shiftSliders + 56, 40, 20, 32); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
137 |
initialLab.text = ((int)initialSli.value == 9) ? @"∞" : [NSString stringWithFormat:@"%d",(int)initialSli.value]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
138 |
initialSli.frame = CGRectMake(shiftSliders + 80, 40, 150, 32); |
3697 | 139 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
140 |
probabilityImg.frame = CGRectMake(shiftSliders + 255, 40, 32, 32); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
141 |
probabilityLab.frame = CGRectMake(shiftSliders + 291, 40, 20, 32); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
142 |
probabilityLab.text = ((int)probabilitySli.value == 9) ? @"∞" : [NSString stringWithFormat:@"%d",(int)probabilitySli.value]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
143 |
probabilitySli.frame = CGRectMake(shiftSliders + 314, 40, 150, 32); |
3697 | 144 |
|
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
145 |
// third line |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
146 |
delayImg.frame = CGRectMake(shiftSliders + 20, 80, 32, 32); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
147 |
delayLab.frame = CGRectMake(shiftSliders + 56, 80, 20, 32); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
148 |
delayLab.text = ((int)delaySli.value == 9) ? @"∞" : [NSString stringWithFormat:@"%d",(int)delaySli.value]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
149 |
delaySli.frame = CGRectMake(shiftSliders + 80, 80, 150, 32); |
3697 | 150 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
151 |
crateImg.frame = CGRectMake(shiftSliders + 255, 80, 32, 32); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
152 |
crateLab.frame = CGRectMake(shiftSliders + 291, 80, 20, 32); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
153 |
crateLab.text = ((int)crateSli.value == 9) ? @"∞" : [NSString stringWithFormat:@"%d",(int)crateSli.value]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
154 |
crateSli.frame = CGRectMake(shiftSliders + 314, 80, 150, 32); |
3621 | 155 |
} |
156 |
||
157 |
/* |
|
158 |
-(void) setSelected:(BOOL)selected animated:(BOOL)animated { |
|
159 |
[super setSelected:selected animated:animated]; |
|
160 |
// Configure the view for the selected state |
|
161 |
} |
|
162 |
*/ |
|
163 |
||
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
164 |
-(void) valueChanged:(id) sender { |
3624 | 165 |
if (self.delegate != nil) { |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
166 |
initialLab.text = ((int)initialSli.value == 9) ? @"∞" : [NSString stringWithFormat:@"%d",(int)initialSli.value]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
167 |
probabilityLab.text = ((int)probabilitySli.value == 9) ? @"∞" : [NSString stringWithFormat:@"%d",(int)probabilitySli.value]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
168 |
delayLab.text = ((int)delaySli.value == 9) ? @"∞" : [NSString stringWithFormat:@"%d",(int)delaySli.value]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
169 |
crateLab.text = ((int)crateSli.value == 9) ? @"∞" : [NSString stringWithFormat:@"%d",(int)crateSli.value]; |
3697 | 170 |
|
3644
42c5684289ae
finished ammo configuration (which is the last page missing in config \o/)
koda
parents:
3643
diff
changeset
|
171 |
[delegate updateValues:[NSArray arrayWithObjects: |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
172 |
[NSNumber numberWithInt:(int)initialSli.value], |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
173 |
[NSNumber numberWithInt:(int)probabilitySli.value], |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
174 |
[NSNumber numberWithInt:(int)delaySli.value], |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
175 |
[NSNumber numberWithInt:(int)crateSli.value], nil] |
3644
42c5684289ae
finished ammo configuration (which is the last page missing in config \o/)
koda
parents:
3643
diff
changeset
|
176 |
atIndex:self.tag]; |
3624 | 177 |
} else |
178 |
DLog(@"error - delegate = nil!"); |
|
179 |
} |
|
180 |
||
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
181 |
-(void) startDragging:(id) sender { |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
182 |
UISlider *slider = (UISlider *)sender; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
183 |
NSString *str = nil; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
184 |
|
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
185 |
switch (slider.tag) { |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
186 |
case 100: |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
187 |
str = NSLocalizedString(@"Initial quantity ",@"ammo selection"); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
188 |
break; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
189 |
case 200: |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
190 |
str = NSLocalizedString(@"Presence probability in crates ",@"ammo selection"); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
191 |
break; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
192 |
case 300: |
3783 | 193 |
str = NSLocalizedString(@"Number of turns before you can use this weapon ",@"ammo selection"); |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
194 |
break; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
195 |
case 400: |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
196 |
str = NSLocalizedString(@"Quantity that you will find in a crate ",@"ammo selection"); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
197 |
break; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
198 |
default: |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
199 |
DLog(@"Nope"); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
200 |
break; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
201 |
} |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
202 |
self.helpLabel.text = str; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
203 |
} |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
204 |
|
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
205 |
-(void) stopDragging:(id) sender { |
3778 | 206 |
self.helpLabel.text = @""; |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
207 |
} |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
208 |
|
3621 | 209 |
-(void) dealloc { |
3667 | 210 |
self.delegate = nil; |
211 |
releaseAndNil(weaponName); |
|
212 |
releaseAndNil(weaponIcon); |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
213 |
releaseAndNil(initialSli); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
214 |
releaseAndNil(probabilitySli); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
215 |
releaseAndNil(delaySli); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
216 |
releaseAndNil(crateSli); |
3667 | 217 |
releaseAndNil(initialImg); |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
218 |
releaseAndNil(probabilityImg); |
3667 | 219 |
releaseAndNil(delayImg); |
220 |
releaseAndNil(crateImg); |
|
221 |
releaseAndNil(initialLab); |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
222 |
releaseAndNil(probabilityLab); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
223 |
releaseAndNil(delayLab); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
224 |
releaseAndNil(crateLab); |
3778 | 225 |
releaseAndNil(helpLabel); |
3621 | 226 |
[super dealloc]; |
227 |
} |
|
228 |
||
229 |
@end |