author | Wuzzy <Wuzzy2@mail.ru> |
Fri, 19 Apr 2019 15:54:44 +0200 | |
changeset 14811 | d65e25e211d4 |
parent 12872 | 00215a7ec5f5 |
permissions | -rw-r--r-- |
3829 | 1 |
/* |
2 |
* Hedgewars-iOS, a Hedgewars port for iOS devices |
|
6700 | 3 |
* Copyright (c) 2009-2012 Vittorio Giovara <vittorio.giovara@gmail.com> |
3829 | 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 |
|
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
8441
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3829 | 17 |
*/ |
18 |
||
3621 | 19 |
|
20 |
#import "WeaponCellView.h" |
|
6078
8c0cc07731e5
headers cleanup, converted some function-only sources into proper class method files, more use of OOP power, removed some 'respondsToSelector' calls, moved defines into their own header, more use of objc categories
koda
parents:
6074
diff
changeset
|
21 |
|
3621 | 22 |
|
23 |
@implementation WeaponCellView |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
24 |
@synthesize delegate, weaponName, weaponIcon, initialSli, probabilitySli, delaySli, crateSli, helpLabel, |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
25 |
initialImg, probabilityImg, delayImg, crateImg, initialLab, probabilityLab, delayLab, crateLab; |
3621 | 26 |
|
12872
00215a7ec5f5
- BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents:
11549
diff
changeset
|
27 |
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { |
3621 | 28 |
if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) { |
3624 | 29 |
delegate = nil; |
3697 | 30 |
|
3621 | 31 |
weaponName = [[UILabel alloc] init]; |
32 |
weaponName.backgroundColor = [UIColor clearColor]; |
|
33 |
weaponName.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]]; |
|
34 |
weaponIcon = [[UIImageView alloc] init]; |
|
3697 | 35 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
36 |
initialSli = [[UISlider alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
37 |
[initialSli addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
38 |
[initialSli addTarget:self action:@selector(startDragging:) forControlEvents:UIControlEventTouchDown]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
39 |
[initialSli addTarget:self action:@selector(stopDragging:) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
40 |
initialSli.maximumValue = 9; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
41 |
initialSli.minimumValue = 0; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
42 |
initialSli.tag = 100; |
3697 | 43 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
44 |
probabilitySli = [[UISlider alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
45 |
[probabilitySli addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
46 |
[probabilitySli addTarget:self action:@selector(startDragging:) forControlEvents:UIControlEventTouchDown]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
47 |
[probabilitySli addTarget:self action:@selector(stopDragging:) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
48 |
probabilitySli.maximumValue = 9; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
49 |
probabilitySli.minimumValue = 0; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
50 |
probabilitySli.tag = 200; |
3697 | 51 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
52 |
delaySli = [[UISlider alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
53 |
[delaySli addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
54 |
[delaySli addTarget:self action:@selector(startDragging:) forControlEvents:UIControlEventTouchDown]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
55 |
[delaySli addTarget:self action:@selector(stopDragging:) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
56 |
delaySli.maximumValue = 9; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
57 |
delaySli.minimumValue = 0; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
58 |
delaySli.tag = 300; |
3697 | 59 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
60 |
crateSli = [[UISlider alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
61 |
[crateSli addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
62 |
[crateSli addTarget:self action:@selector(startDragging:) forControlEvents:UIControlEventTouchDown]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
63 |
[crateSli addTarget:self action:@selector(stopDragging:) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
64 |
crateSli.maximumValue = 9; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
65 |
crateSli.minimumValue = 0; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
66 |
crateSli.tag = 400; |
3697 | 67 |
|
5982
283be2ca54a7
mad several updates to the resource copying phase in the ios project file, changed paths of some images and added some smaller forts version
koda
parents:
4976
diff
changeset
|
68 |
NSString *imgAmmoStr = [[NSString alloc] initWithFormat:@"%@/ammopic.png",ICONS_DIRECTORY()]; |
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
69 |
initialImg = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:imgAmmoStr]]; |
5982
283be2ca54a7
mad several updates to the resource copying phase in the ios project file, changed paths of some images and added some smaller forts version
koda
parents:
4976
diff
changeset
|
70 |
NSString *imgDamageStr = [[NSString alloc] initWithFormat:@"%@/iconDamage.png",ICONS_DIRECTORY()]; |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
71 |
probabilityImg = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:imgDamageStr]]; |
5982
283be2ca54a7
mad several updates to the resource copying phase in the ios project file, changed paths of some images and added some smaller forts version
koda
parents:
4976
diff
changeset
|
72 |
NSString *imgTimeStr = [[NSString alloc] initWithFormat:@"%@/iconTime.png",ICONS_DIRECTORY()]; |
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
73 |
delayImg = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:imgTimeStr]]; |
5982
283be2ca54a7
mad several updates to the resource copying phase in the ios project file, changed paths of some images and added some smaller forts version
koda
parents:
4976
diff
changeset
|
74 |
NSString *imgBoxStr = [[NSString alloc] initWithFormat:@"%@/iconBox.png",ICONS_DIRECTORY()]; |
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
75 |
crateImg = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:imgBoxStr]]; |
3697 | 76 |
|
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
77 |
initialLab = [[UILabel alloc] init]; |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
78 |
initialLab.backgroundColor = [UIColor clearColor]; |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
79 |
initialLab.textColor = [UIColor grayColor]; |
11549
893722a2a1f9
- Some warnings fixed with text alignment on iOS front-end
antonc27 <antonc27@mail.ru>
parents:
11148
diff
changeset
|
80 |
initialLab.textAlignment = NSTextAlignmentCenter; |
3697 | 81 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
82 |
probabilityLab = [[UILabel alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
83 |
probabilityLab.backgroundColor = [UIColor clearColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
84 |
probabilityLab.textColor = [UIColor grayColor]; |
11549
893722a2a1f9
- Some warnings fixed with text alignment on iOS front-end
antonc27 <antonc27@mail.ru>
parents:
11148
diff
changeset
|
85 |
probabilityLab.textAlignment = NSTextAlignmentCenter; |
3697 | 86 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
87 |
delayLab = [[UILabel alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
88 |
delayLab.backgroundColor = [UIColor clearColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
89 |
delayLab.textColor = [UIColor grayColor]; |
11549
893722a2a1f9
- Some warnings fixed with text alignment on iOS front-end
antonc27 <antonc27@mail.ru>
parents:
11148
diff
changeset
|
90 |
delayLab.textAlignment = NSTextAlignmentCenter; |
3697 | 91 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
92 |
crateLab = [[UILabel alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
93 |
crateLab.backgroundColor = [UIColor clearColor]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
94 |
crateLab.textColor = [UIColor grayColor]; |
11549
893722a2a1f9
- Some warnings fixed with text alignment on iOS front-end
antonc27 <antonc27@mail.ru>
parents:
11148
diff
changeset
|
95 |
crateLab.textAlignment = NSTextAlignmentCenter; |
3697 | 96 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
97 |
helpLabel = [[UILabel alloc] init]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
98 |
helpLabel.backgroundColor = [UIColor clearColor]; |
6074
047eaed35cbb
ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents:
5982
diff
changeset
|
99 |
helpLabel.textColor = [UIColor darkGrayColor]; |
11549
893722a2a1f9
- Some warnings fixed with text alignment on iOS front-end
antonc27 <antonc27@mail.ru>
parents:
11148
diff
changeset
|
100 |
helpLabel.textAlignment = NSTextAlignmentRight; |
6074
047eaed35cbb
ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents:
5982
diff
changeset
|
101 |
helpLabel.font = [UIFont italicSystemFontOfSize:[UIFont systemFontSize]]; |
6670 | 102 |
helpLabel.adjustsFontSizeToFitWidth = YES; |
3697 | 103 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
104 |
[self.contentView addSubview:weaponName]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
105 |
[self.contentView addSubview:weaponIcon]; |
3697 | 106 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
107 |
[self.contentView addSubview:initialSli]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
108 |
[self.contentView addSubview:probabilitySli]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
109 |
[self.contentView addSubview:delaySli]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
110 |
[self.contentView addSubview:crateSli]; |
3624 | 111 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
112 |
[self.contentView addSubview:initialImg]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
113 |
[self.contentView addSubview:probabilityImg]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
114 |
[self.contentView addSubview:delayImg]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
115 |
[self.contentView addSubview:crateImg]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
116 |
|
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
117 |
[self.contentView addSubview:initialLab]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
118 |
[self.contentView addSubview:probabilityLab]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
119 |
[self.contentView addSubview:delayLab]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
120 |
[self.contentView addSubview:crateLab]; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
121 |
|
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
122 |
[self.contentView addSubview:helpLabel]; |
3621 | 123 |
} |
124 |
return self; |
|
125 |
} |
|
126 |
||
12872
00215a7ec5f5
- BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents:
11549
diff
changeset
|
127 |
- (void)layoutSubviews { |
3621 | 128 |
[super layoutSubviews]; |
129 |
||
6670 | 130 |
CGFloat hOffset = 80; |
131 |
CGFloat hOffsetWhenLandscape = 234; |
|
132 |
CGFloat vOffset = 40; |
|
133 |
CGFloat vOffsetWhenPortrait = 0; |
|
134 |
CGFloat helpLabelOffset = 0; |
|
135 |
CGFloat helpLabelLength = 0; |
|
136 |
CGFloat sliderLength = 150; |
|
3697 | 137 |
|
3996 | 138 |
if (IS_IPAD()) { |
6670 | 139 |
if (UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])) { |
140 |
sliderLength = 190; |
|
141 |
hOffsetWhenLandscape = 0; |
|
142 |
vOffsetWhenPortrait = 80; |
|
143 |
hOffset = 120; |
|
144 |
helpLabelOffset = -35; |
|
145 |
helpLabelLength = 200; |
|
146 |
} else { |
|
147 |
hOffset = 145; |
|
148 |
helpLabelOffset = 35; |
|
149 |
helpLabelLength = 350; |
|
150 |
} |
|
151 |
} else { |
|
152 |
helpLabelLength = 250; |
|
153 |
hOffset = 67; |
|
154 |
} |
|
3621 | 155 |
|
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
156 |
weaponIcon.frame = CGRectMake(5, 5, 32, 32); |
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
157 |
weaponName.frame = CGRectMake(45, 8, 200, 25); |
8441 | 158 |
|
6670 | 159 |
helpLabel.frame = CGRectMake(200 + helpLabelOffset, 11, helpLabelLength, 20); |
3697 | 160 |
|
3621 | 161 |
// second line |
6670 | 162 |
initialImg.frame = CGRectMake(hOffset - 60, vOffset, 32, 32); |
163 |
initialLab.frame = CGRectMake(hOffset - 23, vOffset, 20, 32); |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
164 |
initialLab.text = ((int)initialSli.value == 9) ? @"∞" : [NSString stringWithFormat:@"%d",(int)initialSli.value]; |
6670 | 165 |
initialSli.frame = CGRectMake(hOffset, vOffset, sliderLength, 32); |
3697 | 166 |
|
6670 | 167 |
probabilityImg.frame = CGRectMake(hOffset + hOffsetWhenLandscape - 60, vOffset + vOffsetWhenPortrait, 32, 32); |
168 |
probabilityLab.frame = CGRectMake(hOffset + hOffsetWhenLandscape - 23, vOffset + vOffsetWhenPortrait, 20, 32); |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
169 |
probabilityLab.text = ((int)probabilitySli.value == 9) ? @"∞" : [NSString stringWithFormat:@"%d",(int)probabilitySli.value]; |
6670 | 170 |
probabilitySli.frame = CGRectMake(hOffset + hOffsetWhenLandscape, vOffset + vOffsetWhenPortrait, sliderLength, 32); |
3697 | 171 |
|
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3624
diff
changeset
|
172 |
// third line |
6670 | 173 |
delayImg.frame = CGRectMake(hOffset - 60, vOffset + 40, 32, 32); |
174 |
delayLab.frame = CGRectMake(hOffset - 23, vOffset + 40, 20, 32); |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
175 |
delayLab.text = ((int)delaySli.value == 9) ? @"∞" : [NSString stringWithFormat:@"%d",(int)delaySli.value]; |
6670 | 176 |
delaySli.frame = CGRectMake(hOffset, vOffset + 40, sliderLength, 32); |
3697 | 177 |
|
6670 | 178 |
crateImg.frame = CGRectMake(hOffset + hOffsetWhenLandscape - 60, vOffset + 40 + vOffsetWhenPortrait, 32, 32); |
179 |
crateLab.frame = CGRectMake(hOffset + hOffsetWhenLandscape - 23, vOffset + 40 + vOffsetWhenPortrait, 20, 32); |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
180 |
crateLab.text = ((int)crateSli.value == 9) ? @"∞" : [NSString stringWithFormat:@"%d",(int)crateSli.value]; |
6670 | 181 |
crateSli.frame = CGRectMake(hOffset + hOffsetWhenLandscape, vOffset + 40 + vOffsetWhenPortrait, sliderLength, 32); |
3621 | 182 |
} |
183 |
||
184 |
/* |
|
12872
00215a7ec5f5
- BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents:
11549
diff
changeset
|
185 |
- (void)setSelected:(BOOL)selected animated:(BOOL)animated { |
3621 | 186 |
[super setSelected:selected animated:animated]; |
187 |
// Configure the view for the selected state |
|
188 |
} |
|
189 |
*/ |
|
190 |
||
12872
00215a7ec5f5
- BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents:
11549
diff
changeset
|
191 |
- (void)valueChanged:(id)sender { |
3624 | 192 |
if (self.delegate != nil) { |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
193 |
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
|
194 |
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
|
195 |
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
|
196 |
crateLab.text = ((int)crateSli.value == 9) ? @"∞" : [NSString stringWithFormat:@"%d",(int)crateSli.value]; |
3697 | 197 |
|
3644
42c5684289ae
finished ammo configuration (which is the last page missing in config \o/)
koda
parents:
3643
diff
changeset
|
198 |
[delegate updateValues:[NSArray arrayWithObjects: |
11148
064a53861759
- Refactoring in order to remove some warning related to using of int instead of NSInteger
antonc27 <antonc27@mail.ru>
parents:
10108
diff
changeset
|
199 |
[NSNumber numberWithInteger:initialSli.value], |
064a53861759
- Refactoring in order to remove some warning related to using of int instead of NSInteger
antonc27 <antonc27@mail.ru>
parents:
10108
diff
changeset
|
200 |
[NSNumber numberWithInteger:probabilitySli.value], |
064a53861759
- Refactoring in order to remove some warning related to using of int instead of NSInteger
antonc27 <antonc27@mail.ru>
parents:
10108
diff
changeset
|
201 |
[NSNumber numberWithInteger:delaySli.value], |
064a53861759
- Refactoring in order to remove some warning related to using of int instead of NSInteger
antonc27 <antonc27@mail.ru>
parents:
10108
diff
changeset
|
202 |
[NSNumber numberWithInteger:crateSli.value], nil] |
3644
42c5684289ae
finished ammo configuration (which is the last page missing in config \o/)
koda
parents:
3643
diff
changeset
|
203 |
atIndex:self.tag]; |
3624 | 204 |
} else |
205 |
DLog(@"error - delegate = nil!"); |
|
206 |
} |
|
207 |
||
12872
00215a7ec5f5
- BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents:
11549
diff
changeset
|
208 |
- (void)startDragging:(id)sender { |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
209 |
UISlider *slider = (UISlider *)sender; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
210 |
NSString *str = nil; |
8441 | 211 |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
212 |
switch (slider.tag) { |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
213 |
case 100: |
6670 | 214 |
str = NSLocalizedString(@"Initial quantity",@"ammo selection"); |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
215 |
break; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
216 |
case 200: |
6671 | 217 |
if (IS_ON_PORTRAIT()) |
6670 | 218 |
str = NSLocalizedString(@"Probability in crates",@"ammo selection"); |
219 |
else |
|
220 |
str = NSLocalizedString(@"Presence probability in crates",@"ammo selection"); |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
221 |
break; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
222 |
case 300: |
6671 | 223 |
if (IS_ON_PORTRAIT()) |
6670 | 224 |
str = NSLocalizedString(@"Weapon delay",@"ammo selection"); |
225 |
else |
|
226 |
str = NSLocalizedString(@"Turns before this weapon becomes usable",@"ammo selection"); |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
227 |
break; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
228 |
case 400: |
6671 | 229 |
if (IS_ON_PORTRAIT()) |
6670 | 230 |
str = NSLocalizedString(@"Quantity per crate",@"ammo selection"); |
231 |
else |
|
232 |
str = NSLocalizedString(@"Quantity you will find in a crate",@"ammo selection"); |
|
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
233 |
break; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
234 |
default: |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
235 |
DLog(@"Nope"); |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
236 |
break; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
237 |
} |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
238 |
self.helpLabel.text = str; |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
239 |
} |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
240 |
|
12872
00215a7ec5f5
- BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents:
11549
diff
changeset
|
241 |
- (void)stopDragging:(id)sender { |
3778 | 242 |
self.helpLabel.text = @""; |
3766
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
243 |
} |
36b625111609
add a little explanation when modifying weaponset in ifrontend
koda
parents:
3697
diff
changeset
|
244 |
|
3621 | 245 |
@end |