author | mikade |
Mon, 24 Jan 2011 23:48:44 +0200 | |
changeset 4872 | 6b2fb9f0054a |
parent 3996 | eb549fd864a5 |
child 4976 | 088d40d8aba2 |
permissions | -rw-r--r-- |
3829 | 1 |
/* |
2 |
* Hedgewars-iOS, a Hedgewars port for iOS devices |
|
3 |
* Copyright (c) 2009-2010 Vittorio Giovara <vittorio.giovara@gmail.com> |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
17 |
* |
|
18 |
* File created on 07/03/2010. |
|
19 |
*/ |
|
20 |
||
3621 | 21 |
|
22 |
#import "WeaponCellView.h" |
|
23 |
#import "CommodityFunctions.h" |
|
24 |
||
25 |
@implementation WeaponCellView |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
26 |
@synthesize delegate, weaponName, weaponIcon, initialSli, probabilitySli, delaySli, crateSli, helpLabel, |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
27 |
initialImg, probabilityImg, delayImg, crateImg, initialLab, probabilityLab, delayLab, crateLab; |
3621 | 28 |
|
29 |
-(id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { |
|
30 |
if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) { |
|
3624 | 31 |
delegate = nil; |
3697 | 32 |
|
3621 | 33 |
weaponName = [[UILabel alloc] init]; |
34 |
weaponName.backgroundColor = [UIColor clearColor]; |
|
35 |
weaponName.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]]; |
|
36 |
weaponIcon = [[UIImageView alloc] init]; |
|
3697 | 37 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
38 |
initialSli = [[UISlider alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
39 |
[initialSli addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
40 |
[initialSli addTarget:self action:@selector(startDragging:) forControlEvents:UIControlEventTouchDown]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
41 |
[initialSli addTarget:self action:@selector(stopDragging:) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
42 |
initialSli.maximumValue = 9; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
43 |
initialSli.minimumValue = 0; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
44 |
initialSli.tag = 100; |
3697 | 45 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
46 |
probabilitySli = [[UISlider alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
47 |
[probabilitySli addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
48 |
[probabilitySli addTarget:self action:@selector(startDragging:) forControlEvents:UIControlEventTouchDown]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
49 |
[probabilitySli addTarget:self action:@selector(stopDragging:) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
50 |
probabilitySli.maximumValue = 9; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
51 |
probabilitySli.minimumValue = 0; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
52 |
probabilitySli.tag = 200; |
3697 | 53 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
54 |
delaySli = [[UISlider alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
55 |
[delaySli addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
56 |
[delaySli addTarget:self action:@selector(startDragging:) forControlEvents:UIControlEventTouchDown]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
57 |
[delaySli addTarget:self action:@selector(stopDragging:) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
58 |
delaySli.maximumValue = 9; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
59 |
delaySli.minimumValue = 0; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
60 |
delaySli.tag = 300; |
3697 | 61 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
62 |
crateSli = [[UISlider alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
63 |
[crateSli addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
64 |
[crateSli addTarget:self action:@selector(startDragging:) forControlEvents:UIControlEventTouchDown]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
65 |
[crateSli addTarget:self action:@selector(stopDragging:) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
66 |
crateSli.maximumValue = 9; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
67 |
crateSli.minimumValue = 0; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
68 |
crateSli.tag = 400; |
3697 | 69 |
|
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
70 |
NSString *imgAmmoStr = [NSString stringWithFormat:@"%@/iconAmmo.png",BTN_DIRECTORY()]; |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
71 |
NSString *imgDamageStr = [NSString stringWithFormat:@"%@/iconDamage.png",BTN_DIRECTORY()]; |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
72 |
NSString *imgTimeStr = [NSString stringWithFormat:@"%@/iconTime.png",BTN_DIRECTORY()]; |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
73 |
NSString *imgBoxStr = [NSString stringWithFormat:@"%@/iconBox.png",BTN_DIRECTORY()]; |
3624 | 74 |
|
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
75 |
initialImg = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:imgAmmoStr]]; |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
76 |
probabilityImg = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:imgDamageStr]]; |
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
77 |
delayImg = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:imgTimeStr]]; |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
78 |
crateImg = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:imgBoxStr]]; |
3697 | 79 |
|
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
80 |
initialLab = [[UILabel alloc] init]; |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
81 |
initialLab.backgroundColor = [UIColor clearColor]; |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
82 |
initialLab.textColor = [UIColor grayColor]; |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
83 |
initialLab.textAlignment = UITextAlignmentCenter; |
3697 | 84 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
85 |
probabilityLab = [[UILabel alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
86 |
probabilityLab.backgroundColor = [UIColor clearColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
87 |
probabilityLab.textColor = [UIColor grayColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
88 |
probabilityLab.textAlignment = UITextAlignmentCenter; |
3697 | 89 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
90 |
delayLab = [[UILabel alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
91 |
delayLab.backgroundColor = [UIColor clearColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
92 |
delayLab.textColor = [UIColor grayColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
93 |
delayLab.textAlignment = UITextAlignmentCenter; |
3697 | 94 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
95 |
crateLab = [[UILabel alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
96 |
crateLab.backgroundColor = [UIColor clearColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
97 |
crateLab.textColor = [UIColor grayColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
98 |
crateLab.textAlignment = UITextAlignmentCenter; |
3697 | 99 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
100 |
helpLabel = [[UILabel alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
101 |
helpLabel.backgroundColor = [UIColor clearColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
102 |
helpLabel.textColor = [UIColor grayColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
103 |
helpLabel.textAlignment = UITextAlignmentRight; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
104 |
helpLabel.font = [UIFont italicSystemFontOfSize:[UIFont smallSystemFontSize]]; |
3697 | 105 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
106 |
[self.contentView addSubview:weaponName]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
107 |
[self.contentView addSubview:weaponIcon]; |
3697 | 108 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
109 |
[self.contentView addSubview:initialSli]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
110 |
[self.contentView addSubview:probabilitySli]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
111 |
[self.contentView addSubview:delaySli]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
112 |
[self.contentView addSubview:crateSli]; |
3624 | 113 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
114 |
[self.contentView addSubview:initialImg]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
115 |
[self.contentView addSubview:probabilityImg]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
116 |
[self.contentView addSubview:delayImg]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
117 |
[self.contentView addSubview:crateImg]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
118 |
|
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
119 |
[self.contentView addSubview:initialLab]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
120 |
[self.contentView addSubview:probabilityLab]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
121 |
[self.contentView addSubview:delayLab]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
122 |
[self.contentView addSubview:crateLab]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
123 |
|
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
124 |
[self.contentView addSubview:helpLabel]; |
3621 | 125 |
} |
126 |
return self; |
|
127 |
} |
|
128 |
||
129 |
-(void) layoutSubviews { |
|
130 |
[super layoutSubviews]; |
|
131 |
||
132 |
CGRect contentRect = self.contentView.bounds; |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
133 |
CGFloat shiftSliders = contentRect.origin.x; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
134 |
CGFloat shiftLabel = 0; |
3697 | 135 |
|
3996 | 136 |
if (IS_IPAD()) { |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
137 |
shiftSliders += 65; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
138 |
shiftLabel += 165; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
139 |
} else |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
140 |
shiftSliders -= 13; |
3621 | 141 |
|
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
142 |
weaponIcon.frame = CGRectMake(5, 5, 32, 32); |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
143 |
weaponName.frame = CGRectMake(45, 8, 200, 25); |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
144 |
|
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
145 |
helpLabel.frame = CGRectMake(shiftLabel + 200, 8, 250, 15); |
3697 | 146 |
|
3621 | 147 |
// second line |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
148 |
initialImg.frame = CGRectMake(shiftSliders + 20, 40, 32, 32); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
149 |
initialLab.frame = CGRectMake(shiftSliders + 56, 40, 20, 32); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
150 |
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
|
151 |
initialSli.frame = CGRectMake(shiftSliders + 80, 40, 150, 32); |
3697 | 152 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
153 |
probabilityImg.frame = CGRectMake(shiftSliders + 255, 40, 32, 32); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
154 |
probabilityLab.frame = CGRectMake(shiftSliders + 291, 40, 20, 32); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
155 |
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
|
156 |
probabilitySli.frame = CGRectMake(shiftSliders + 314, 40, 150, 32); |
3697 | 157 |
|
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
158 |
// third line |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
159 |
delayImg.frame = CGRectMake(shiftSliders + 20, 80, 32, 32); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
160 |
delayLab.frame = CGRectMake(shiftSliders + 56, 80, 20, 32); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
161 |
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
|
162 |
delaySli.frame = CGRectMake(shiftSliders + 80, 80, 150, 32); |
3697 | 163 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
164 |
crateImg.frame = CGRectMake(shiftSliders + 255, 80, 32, 32); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
165 |
crateLab.frame = CGRectMake(shiftSliders + 291, 80, 20, 32); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
166 |
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
|
167 |
crateSli.frame = CGRectMake(shiftSliders + 314, 80, 150, 32); |
3621 | 168 |
} |
169 |
||
170 |
/* |
|
171 |
-(void) setSelected:(BOOL)selected animated:(BOOL)animated { |
|
172 |
[super setSelected:selected animated:animated]; |
|
173 |
// Configure the view for the selected state |
|
174 |
} |
|
175 |
*/ |
|
176 |
||
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
177 |
-(void) valueChanged:(id) sender { |
3624 | 178 |
if (self.delegate != nil) { |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
179 |
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
|
180 |
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
|
181 |
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
|
182 |
crateLab.text = ((int)crateSli.value == 9) ? @"∞" : [NSString stringWithFormat:@"%d",(int)crateSli.value]; |
3697 | 183 |
|
3644
42c5684289ae
finished ammo configuration (which is the last page missing in config \o/)
koda
parents:
3643
diff
changeset
|
184 |
[delegate updateValues:[NSArray arrayWithObjects: |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
185 |
[NSNumber numberWithInt:(int)initialSli.value], |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
186 |
[NSNumber numberWithInt:(int)probabilitySli.value], |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
187 |
[NSNumber numberWithInt:(int)delaySli.value], |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
188 |
[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
|
189 |
atIndex:self.tag]; |
3624 | 190 |
} else |
191 |
DLog(@"error - delegate = nil!"); |
|
192 |
} |
|
193 |
||
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
194 |
-(void) startDragging:(id) sender { |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
195 |
UISlider *slider = (UISlider *)sender; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
196 |
NSString *str = nil; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
197 |
|
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
198 |
switch (slider.tag) { |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
199 |
case 100: |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
200 |
str = NSLocalizedString(@"Initial quantity ",@"ammo selection"); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
201 |
break; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
202 |
case 200: |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
203 |
str = NSLocalizedString(@"Presence probability in crates ",@"ammo selection"); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
204 |
break; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
205 |
case 300: |
3783 | 206 |
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
|
207 |
break; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
208 |
case 400: |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
209 |
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
|
210 |
break; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
211 |
default: |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
212 |
DLog(@"Nope"); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
213 |
break; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
214 |
} |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
215 |
self.helpLabel.text = str; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
216 |
} |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
217 |
|
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
218 |
-(void) stopDragging:(id) sender { |
3778 | 219 |
self.helpLabel.text = @""; |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
220 |
} |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
221 |
|
3621 | 222 |
-(void) dealloc { |
3667 | 223 |
self.delegate = nil; |
224 |
releaseAndNil(weaponName); |
|
225 |
releaseAndNil(weaponIcon); |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
226 |
releaseAndNil(initialSli); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
227 |
releaseAndNil(probabilitySli); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
228 |
releaseAndNil(delaySli); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
229 |
releaseAndNil(crateSli); |
3667 | 230 |
releaseAndNil(initialImg); |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
231 |
releaseAndNil(probabilityImg); |
3667 | 232 |
releaseAndNil(delayImg); |
233 |
releaseAndNil(crateImg); |
|
234 |
releaseAndNil(initialLab); |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
235 |
releaseAndNil(probabilityLab); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
236 |
releaseAndNil(delayLab); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
237 |
releaseAndNil(crateLab); |
3778 | 238 |
releaseAndNil(helpLabel); |
3621 | 239 |
[super dealloc]; |
240 |
} |
|
241 |
||
242 |
@end |