author | koda |
Tue, 19 Oct 2010 23:58:27 +0200 | |
changeset 3983 | aa24192417a8 |
parent 3981 | 928e2040d34f |
child 3984 | d92509c2f255 |
permissions | -rw-r--r-- |
3924 | 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 03/10/2010. |
|
19 |
*/ |
|
20 |
||
21 |
||
22 |
#import "AmmoMenuViewController.h" |
|
23 |
#import <QuartzCore/QuartzCore.h> |
|
24 |
#import "CommodityFunctions.h" |
|
25 |
#import "UIImageExtra.h" |
|
26 |
#import "PascalImports.h" |
|
27 |
||
3952
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
28 |
#define BTNS_PER_ROW 9 |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
29 |
|
3924 | 30 |
@implementation AmmoMenuViewController |
3981
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
31 |
@synthesize imagesArray, buttonsArray, nameLabel, extraLabel, captionLabel, isVisible; |
3924 | 32 |
|
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
33 |
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
34 |
return rotationManager(interfaceOrientation); |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
35 |
} |
3924 | 36 |
|
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
37 |
#pragma mark - |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
38 |
#pragma mark view handling |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
39 |
-(void) viewDidLoad { |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
40 |
[[NSNotificationCenter defaultCenter] addObserver:self |
3935 | 41 |
selector:@selector(updateAmmoVisuals) |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
42 |
name:@"updateAmmoVisuals" |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
43 |
object:nil]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
44 |
|
3924 | 45 |
self.view.frame = CGRectMake(0, 0, 480, 320); |
46 |
self.view.backgroundColor = [UIColor blackColor]; |
|
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
47 |
self.view.layer.borderColor = [[UIColor whiteColor] CGColor]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
48 |
self.view.layer.borderWidth = 1.3f; |
3924 | 49 |
[self.view.layer setCornerRadius:10]; |
50 |
[self.view.layer setMasksToBounds:YES]; |
|
3952
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
51 |
self.view.autoresizingMask = UIViewAutoresizingNone; |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
52 |
|
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
53 |
self.isVisible = NO; |
3978 | 54 |
delay = (uint8_t *)calloc(HW_getNumberOfWeapons(), sizeof(uint8_t)); |
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
55 |
HW_getAmmoDelays(delay); |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
56 |
|
3978 | 57 |
shouldUpdateImage = (BOOL *)calloc(HW_getNumberOfWeapons(), sizeof(BOOL)); |
58 |
||
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
59 |
[super viewDidLoad]; |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
60 |
} |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
61 |
|
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
62 |
-(void) viewWillAppear:(BOOL)animated { |
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
63 |
[self updateAmmoVisuals]; |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
64 |
[super viewWillAppear:animated]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
65 |
} |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
66 |
|
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
67 |
-(void) appearInView:(UIView *)container { |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
68 |
[self viewWillAppear:YES]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
69 |
[container addSubview:self.view]; |
3952
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
70 |
if (IS_DUALHEAD() == NO) |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
71 |
self.view.center = CGPointMake(container.center.y, container.center.x); |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
72 |
else { |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
73 |
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
74 |
if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight) |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
75 |
self.view.center = CGPointMake(container.center.y, container.center.x); |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
76 |
else |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
77 |
self.view.center = CGPointMake(container.center.x, container.center.y); |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
78 |
} |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
79 |
self.isVisible = YES; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
80 |
} |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
81 |
|
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
82 |
-(void) disappear { |
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
83 |
if (self.isVisible) |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
84 |
[self.view removeFromSuperview]; |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
85 |
self.isVisible = NO; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
86 |
} |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
87 |
|
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
88 |
#pragma mark - |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
89 |
#pragma mark drawing |
3981
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
90 |
-(void) prepareLabels { |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
91 |
int x = 12; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
92 |
int y = (HW_getNumberOfWeapons()/BTNS_PER_ROW)*44 + 18; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
93 |
UILabel *name = [[UILabel alloc] initWithFrame:CGRectMake(x, y, 200, 20)]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
94 |
name.backgroundColor = [UIColor clearColor]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
95 |
name.textColor = UICOLOR_HW_YELLOW_BODER; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
96 |
name.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
97 |
self.nameLabel = name; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
98 |
[self.view addSubview:self.nameLabel]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
99 |
[name release]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
100 |
|
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
101 |
UILabel *caption = [[UILabel alloc] initWithFrame:CGRectMake(x+200, y, 220, 20)]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
102 |
caption.backgroundColor = [UIColor clearColor]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
103 |
caption.textColor = [UIColor whiteColor]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
104 |
caption.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize]]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
105 |
caption.adjustsFontSizeToFitWidth = YES; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
106 |
caption.minimumFontSize = 8; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
107 |
self.captionLabel = caption; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
108 |
[self.view addSubview:self.captionLabel]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
109 |
[caption release]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
110 |
|
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
111 |
UILabel *description = [[UILabel alloc] initWithFrame:CGRectMake(x+2, y+20, 410, 53)]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
112 |
description.backgroundColor = [UIColor clearColor]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
113 |
description.textColor = [UIColor whiteColor]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
114 |
description.font = [UIFont italicSystemFontOfSize:[UIFont systemFontSize]]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
115 |
description.adjustsFontSizeToFitWidth = YES; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
116 |
description.minimumFontSize = 8; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
117 |
description.numberOfLines = 0; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
118 |
self.extraLabel = description; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
119 |
[self.view addSubview:self.extraLabel]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
120 |
[description release]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
121 |
} |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
122 |
|
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
123 |
-(void) loadAmmoStuff:(id) object { |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
124 |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
3924 | 125 |
NSString *str = [NSString stringWithFormat:@"%@/AmmoMenu/Ammos.png",GRAPHICS_DIRECTORY()]; |
126 |
UIImage *ammoStoreImage = [[UIImage alloc] initWithContentsOfFile:str]; |
|
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
127 |
|
3977 | 128 |
NSMutableArray *imgs = [[NSMutableArray alloc] initWithCapacity:HW_getNumberOfWeapons()]; |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
129 |
NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:HW_getNumberOfWeapons()]; |
3952
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
130 |
int i, j, e; |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
131 |
for (i = 0, j = 0, e = 0; i < HW_getNumberOfWeapons(); i++) { |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
132 |
int x, y; |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
133 |
float w, radius; |
3924 | 134 |
|
3952
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
135 |
// move utilities aside and make 'em rounded |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
136 |
if (HW_isWeaponAnEffect(i)) { |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
137 |
x = 432; |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
138 |
y = 20 + 48*e++; |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
139 |
w = 1.5; |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
140 |
radius = 22; |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
141 |
} else { |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
142 |
x = 10+(j%BTNS_PER_ROW)*44; |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
143 |
y = 10+(j/BTNS_PER_ROW)*44; |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
144 |
if (j / BTNS_PER_ROW % 2 != 0) |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
145 |
x += 20; |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
146 |
w = 1; |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
147 |
radius = 6; |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
148 |
j++; |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
149 |
} |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
150 |
|
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
151 |
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; |
3952
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
152 |
button.frame = CGRectMake(x, y, 40, 40); |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
153 |
button.tag = i; |
3924 | 154 |
button.layer.borderColor = [UICOLOR_HW_YELLOW_TEXT CGColor]; |
3952
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
155 |
button.layer.borderWidth = w; |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3941
diff
changeset
|
156 |
[button.layer setCornerRadius:radius]; |
3924 | 157 |
[button.layer setMasksToBounds:YES]; |
3976 | 158 |
[button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchDown]; |
159 |
[button addTarget:self action:@selector(buttonReleased:) forControlEvents:UIControlEventTouchUpInside]; |
|
3981
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
160 |
[button addTarget:self action:@selector(buttonCancel:) forControlEvents:UIControlEventTouchUpOutside|UIControlEventTouchCancel]; |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
161 |
[button setTitleColor:UICOLOR_HW_YELLOW_TEXT forState:UIControlStateNormal]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
162 |
button.titleLabel.backgroundColor = [UIColor blackColor]; |
3935 | 163 |
button.titleLabel.font = [UIFont boldSystemFontOfSize:[UIFont smallSystemFontSize]]; |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
164 |
[button.titleLabel.layer setCornerRadius:3]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
165 |
[button.titleLabel.layer setMasksToBounds:YES]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
166 |
button.titleLabel.layer.borderColor = [[UIColor whiteColor] CGColor]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
167 |
button.titleLabel.layer.borderWidth = 1; |
3924 | 168 |
[self.view addSubview:button]; |
169 |
[array addObject:button]; |
|
3977 | 170 |
|
171 |
int x_src = ((i*32)/(int)ammoStoreImage.size.height)*32; |
|
172 |
int y_src = (i*32)%(int)ammoStoreImage.size.height; |
|
173 |
UIImage *img = [ammoStoreImage cutAt:CGRectMake(x_src, y_src, 32, 32)]; |
|
174 |
[imgs addObject:img]; |
|
3924 | 175 |
} |
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
176 |
[self performSelectorOnMainThread:@selector(setButtonsArray:) withObject:array waitUntilDone:NO]; |
3924 | 177 |
[array release]; |
3977 | 178 |
|
179 |
[self performSelectorOnMainThread:@selector(setImagesArray:) withObject:imgs waitUntilDone:NO]; |
|
180 |
[imgs release]; |
|
181 |
[ammoStoreImage release]; |
|
182 |
||
183 |
[self performSelectorOnMainThread:@selector(updateAmmoVisuals) withObject:nil waitUntilDone:YES]; |
|
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
184 |
UIActivityIndicatorView *spinner = (UIActivityIndicatorView *)object; |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
185 |
[spinner stopAnimating]; |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
186 |
[pool drain]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
187 |
} |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
188 |
|
3935 | 189 |
-(void) updateAmmoVisuals { |
3977 | 190 |
if (self.buttonsArray == nil || self.imagesArray == nil) { |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
191 |
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
192 |
spinner.hidesWhenStopped = YES; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
193 |
spinner.center = self.view.center; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
194 |
[spinner startAnimating]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
195 |
[self.view addSubview:spinner]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
196 |
[NSThread detachNewThreadSelector:@selector(loadAmmoStuff:) toTarget:self withObject:spinner]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
197 |
[spinner release]; |
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
198 |
return; |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
199 |
} |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
200 |
|
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
201 |
int *loadout = (int *)calloc(HW_getNumberOfWeapons(), sizeof(int)); |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
202 |
int res = HW_getAmmoCounts(loadout); |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
203 |
int turns = HW_getTurnsForCurrentTeam(); |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
204 |
|
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
205 |
if (res == 0) { |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
206 |
self.view.userInteractionEnabled = YES; |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
207 |
|
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
208 |
for (int i = 0; i < HW_getNumberOfWeapons(); i++) { |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
209 |
UIButton *button = [self.buttonsArray objectAtIndex:i]; |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
210 |
if (loadout[i] > 0) { |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
211 |
if (delay[i]-turns >= 0) { |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
212 |
button.layer.borderColor = [[UIColor lightGrayColor] CGColor]; |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
213 |
[button setTitle:[NSString stringWithFormat:@" %d ",delay[i]-turns+1] forState:UIControlStateNormal]; |
3978 | 214 |
if (button.currentBackgroundImage == nil || shouldUpdateImage[i] == NO) { |
3977 | 215 |
UIImage *img = [self.imagesArray objectAtIndex:i]; |
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
216 |
[button setBackgroundImage:[img convertToGrayScale] forState:UIControlStateNormal]; |
3978 | 217 |
shouldUpdateImage[i] = YES; |
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
218 |
} |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
219 |
} else { |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
220 |
button.layer.borderColor = [UICOLOR_HW_YELLOW_TEXT CGColor]; |
3976 | 221 |
[button setTitle:nil forState:UIControlStateNormal]; |
3978 | 222 |
if (button.currentBackgroundImage == nil || shouldUpdateImage[i] == YES) { |
3977 | 223 |
UIImage *img = [self.imagesArray objectAtIndex:i]; |
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
224 |
[button setBackgroundImage:img forState:UIControlStateNormal]; |
3978 | 225 |
shouldUpdateImage[i] = NO; |
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
226 |
} |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
227 |
} |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
228 |
button.enabled = YES; |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
229 |
} else { |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
230 |
if (button.enabled == YES) |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
231 |
[button setBackgroundImage:nil forState:UIControlStateNormal]; |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
232 |
button.layer.borderColor = [[UIColor darkGrayColor] CGColor]; |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
233 |
button.enabled = NO; |
3978 | 234 |
shouldUpdateImage[i] = NO; |
3935 | 235 |
} |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
236 |
} |
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
237 |
} else { |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
238 |
self.view.userInteractionEnabled = NO; |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
239 |
} |
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
240 |
|
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
241 |
free(loadout); |
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
242 |
loadout = NULL; |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
243 |
} |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
244 |
|
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
245 |
#pragma mark - |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
246 |
#pragma mark user interaction |
3981
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
247 |
-(void) buttonPressed:(id) sender { |
3924 | 248 |
UIButton *theButton = (UIButton *)sender; |
3981
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
249 |
if (self.nameLabel == nil || self.extraLabel == nil) |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
250 |
[self prepareLabels]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
251 |
|
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
252 |
self.nameLabel.text = [NSString stringWithUTF8String:HW_getWeaponNameByIndex(theButton.tag)]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
253 |
// description contains a lot of unnecessary stuff, we clean it by removing .|, !| and ?| |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
254 |
NSString *description = [NSString stringWithUTF8String:HW_getWeaponDescriptionByIndex(theButton.tag)]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
255 |
NSArray *elements = [description componentsSeparatedByString:@".|"]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
256 |
NSArray *purgedElements = [[elements objectAtIndex:0] componentsSeparatedByString:@"!|"]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
257 |
NSArray *morePurgedElements = [[purgedElements objectAtIndex:0] componentsSeparatedByString:@"?|"]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
258 |
self.extraLabel.text = [[[morePurgedElements objectAtIndex:0] stringByReplacingOccurrencesOfString:@"|" withString:@" "] stringByAppendingString:@"."]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
259 |
if (theButton.currentTitle != nil) |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
260 |
self.captionLabel.text = NSLocalizedString(@"This weapon is locked",@""); |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
261 |
else |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
262 |
self.captionLabel.text = [NSString stringWithUTF8String:HW_getWeaponCaptionByIndex(theButton.tag)]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
263 |
} |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
264 |
|
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
265 |
-(void) buttonCancel:(id) sender { |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
266 |
self.nameLabel.text = nil; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
267 |
self.extraLabel.text = nil; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
268 |
self.captionLabel.text = nil; |
3976 | 269 |
} |
270 |
||
271 |
-(void) buttonReleased:(id) sender { |
|
272 |
UIButton *theButton = (UIButton *)sender; |
|
3981
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
273 |
if (self.nameLabel == nil || self.extraLabel == nil) |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
274 |
[self prepareLabels]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
275 |
|
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
276 |
self.nameLabel.text = nil; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
277 |
self.extraLabel.text = nil; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
278 |
self.captionLabel.text = nil; |
3976 | 279 |
if (theButton.currentTitle == nil) { |
280 |
HW_setWeapon(theButton.tag); |
|
281 |
playSound(@"clickSound"); |
|
282 |
} |
|
3941 | 283 |
if (IS_DUALHEAD() == NO) |
284 |
[self disappear]; |
|
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
285 |
} |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
286 |
|
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
287 |
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
288 |
/* |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
289 |
NSSet *allTouches = [event allTouches]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
290 |
|
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
291 |
if ([touches count] == 1) { |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
292 |
self.view.layer.borderWidth = 3.5; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
293 |
startingPoint = [[[allTouches allObjects] objectAtIndex:0] locationInView:self.view]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
294 |
} |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
295 |
*/ |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
296 |
} |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
297 |
|
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
298 |
-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
299 |
//self.view.layer.borderWidth = 1.3; |
3924 | 300 |
} |
301 |
||
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
302 |
-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
303 |
/* |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
304 |
NSSet *allTouches = [event allTouches]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
305 |
|
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
306 |
if ([touches count] == 1) { |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
307 |
CGPoint touchedPoint = [[[allTouches allObjects] objectAtIndex:0] locationInView:self.view]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
308 |
CGFloat deltaX = touchedPoint.x - startingPoint.x; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
309 |
CGFloat deltaY = touchedPoint.y - startingPoint.y; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
310 |
|
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
311 |
//startingPoint = touchedPoint; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
312 |
self.view.frame = CGRectMake(self.view.frame.origin.x + deltaX, self.view.frame.origin.y + deltaY, |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
313 |
self.view.frame.size.width, self.view.frame.size.height); |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
314 |
} |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
315 |
*/ |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
316 |
} |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
317 |
|
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
318 |
-(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
319 |
//[self touchesEnded:touches withEvent:event]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
320 |
} |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
321 |
|
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
322 |
#pragma mark - |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
323 |
#pragma mark memory |
3924 | 324 |
-(void) didReceiveMemoryWarning { |
3977 | 325 |
self.imagesArray = nil; |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
326 |
self.buttonsArray = nil; |
3981
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
327 |
self.nameLabel = nil; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
328 |
self.extraLabel = nil; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
329 |
self.captionLabel = nil; |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
330 |
MSG_MEMCLEAN(); |
3924 | 331 |
[super didReceiveMemoryWarning]; |
332 |
} |
|
333 |
||
334 |
-(void) viewDidUnload { |
|
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
335 |
[[NSNotificationCenter defaultCenter] removeObserver:self]; |
3977 | 336 |
self.imagesArray = nil; |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
337 |
self.buttonsArray = nil; |
3981
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
338 |
self.nameLabel = nil; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
339 |
self.extraLabel = nil; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
340 |
self.captionLabel = nil; |
3940
cc29628976cc
some optimizations to drawing and fetching data of new ammomenu
koda
parents:
3935
diff
changeset
|
341 |
free(delay); |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
342 |
delay = NULL; |
3978 | 343 |
free(shouldUpdateImage); |
344 |
shouldUpdateImage = NULL; |
|
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
345 |
MSG_DIDUNLOAD(); |
3924 | 346 |
[super viewDidUnload]; |
347 |
} |
|
348 |
||
349 |
-(void) dealloc { |
|
3981
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
350 |
[nameLabel release]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
351 |
[extraLabel release]; |
928e2040d34f
add name, caption and description to the new ammomenu
koda
parents:
3978
diff
changeset
|
352 |
[captionLabel release]; |
3977 | 353 |
[imagesArray release]; |
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
354 |
[buttonsArray release]; |
3924 | 355 |
[super dealloc]; |
356 |
} |
|
357 |
||
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
358 |
@end |
3924 | 359 |
|
3933
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
360 |
void updateVisualsNewTurn (void) { |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
361 |
[[NSNotificationCenter defaultCenter] postNotificationName:@"updateAmmoVisuals" object:nil]; |
1a873262f5dd
polishing the cocoa ammomenu a little, still requires work
koda
parents:
3924
diff
changeset
|
362 |
} |