Skip to content

Commit 59c9d42

Browse files
committed
Refactoring Result Card System
1 parent 6e456e3 commit 59c9d42

File tree

3 files changed

+123
-82
lines changed

3 files changed

+123
-82
lines changed

.vscode/settings.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"files.exclude":
3+
{
4+
"**/.DS_Store":true,
5+
"**/.git":true,
6+
"**/.gitignore":true,
7+
"**/.gitmodules":true,
8+
"**/*.booproj":true,
9+
"**/*.pidb":true,
10+
"**/*.suo":true,
11+
"**/*.user":true,
12+
"**/*.userprefs":true,
13+
"**/*.unityproj":true,
14+
"**/*.dll":true,
15+
"**/*.exe":true,
16+
"**/*.pdf":true,
17+
"**/*.mid":true,
18+
"**/*.midi":true,
19+
"**/*.wav":true,
20+
"**/*.gif":true,
21+
"**/*.ico":true,
22+
"**/*.jpg":true,
23+
"**/*.jpeg":true,
24+
"**/*.png":true,
25+
"**/*.psd":true,
26+
"**/*.tga":true,
27+
"**/*.tif":true,
28+
"**/*.tiff":true,
29+
"**/*.3ds":true,
30+
"**/*.3DS":true,
31+
"**/*.fbx":true,
32+
"**/*.FBX":true,
33+
"**/*.lxo":true,
34+
"**/*.LXO":true,
35+
"**/*.ma":true,
36+
"**/*.MA":true,
37+
"**/*.obj":true,
38+
"**/*.OBJ":true,
39+
"**/*.asset":true,
40+
"**/*.cubemap":true,
41+
"**/*.flare":true,
42+
"**/*.mat":true,
43+
"**/*.meta":true,
44+
"**/*.prefab":true,
45+
"**/*.unity":true,
46+
"build/":true,
47+
"Build/":true,
48+
"Library/":true,
49+
"library/":true,
50+
"obj/":true,
51+
"Obj/":true,
52+
"ProjectSettings/":true,
53+
"temp/":true,
54+
"Temp/":true
55+
}
56+
}

Assets/Scripts/ResultUI/CardList.cs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ public class Card
1212
public Color backgroundColor;
1313
public List<CardCondition> conditions;
1414

15-
public Card(string name, string text, bool isGood, Color textColor, Color background, List<CardCondition> conditions)
15+
public Card(string name, string text, CardColor cardColor, List<CardCondition> conditions)
1616
{
1717
cardName = name;
1818
this.text = text;
19-
this.isGood = isGood;
20-
this.textColor = textColor;
21-
backgroundColor = background;
19+
this.isGood = cardColor.isGood;
20+
this.textColor = cardColor.fontColor;
21+
backgroundColor = cardColor.color;
2222
this.conditions = conditions;
2323
}
2424

@@ -33,6 +33,19 @@ public bool IsSatisfyAllConditions(FleetHistory fleetHistory)
3333
}
3434
}
3535

36+
public class CardColor
37+
{
38+
public Color color;
39+
public Color fontColor;
40+
public bool isGood;
41+
42+
public CardColor(Color color, Color fontColor, bool isGood) {
43+
this.color = color;
44+
this.fontColor = fontColor;
45+
this.isGood = isGood;
46+
}
47+
}
48+
3649
public class CardCondition
3750
{
3851
public float value;

Assets/Scripts/ResultUI/CardManager.cs

Lines changed: 50 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ public static class CardList
7777
private static Color badColor = new Color(0.553f, 0.553f, 0.553f);
7878
private static Color badFontColor = new Color(0.553f, 0.553f, 0.553f);
7979

80+
private static CardColor good = new CardColor(goodColor, goodFontColor, true);
81+
private static CardColor bad = new CardColor(badColor, badFontColor, false);
82+
8083
public static void InitAllCards()
8184
{
8285
cardList.Clear();
@@ -121,32 +124,35 @@ public static void InitAllCards()
121124
card = new Card(
122125
"절대자",
123126
"완벽한 승리.. 혹시 신이세요?",
124-
true,
125-
goodFontColor,
126-
goodColor,
127+
good,
127128
new List<CardCondition>());
128129
card.conditions.Add(new CardCondition_HP(100, true));
129130
card.conditions.Add(new CardCondition_HitRate(100, true));
130131
cardList.Add(card);
131132

132133
// 순수 체력 관련
134+
card = new Card(
135+
"HP 100퍼",
136+
"풀피",
137+
good,
138+
new List<CardCondition>());
139+
card.conditions.Add (new CardCondition_HP(100, true));
140+
cardList.Add(card);
141+
133142
card = new Card(
134143
"압도적인 승리",
135144
"압도적인 승리!",
136-
true,
137-
goodFontColor,
138-
goodColor,
145+
good,
139146
new List<CardCondition>());
147+
card.conditions.Add (new CardCondition_HP(100, false));
140148
card.conditions.Add(new CardCondition_HP(90, true));
141149
card.conditions.Add(new CardCondition_HitRate(100, false));
142150
cardList.Add(card);
143151

144152
card = new Card(
145153
"남은 피 높음",
146154
"양학했습니다 ^^",
147-
true,
148-
goodFontColor,
149-
goodColor,
155+
good,
150156
new List<CardCondition>());
151157
card.conditions.Add(new CardCondition_HP(70, true));
152158
card.conditions.Add(new CardCondition_HP(90, false));
@@ -155,42 +161,34 @@ public static void InitAllCards()
155161
card = new Card(
156162
"남은 피 낮음",
157163
"아슬아슬한 승리",
158-
true,
159-
goodFontColor,
160-
goodColor,
164+
good,
161165
new List<CardCondition>());
162166
card.conditions.Add(new CardCondition_HP(0.1f, true));
163167
card.conditions.Add(new CardCondition_HP(10, false));
164168
cardList.Add(card);
165169

166170
card = new Card(
167171
"남은 피 낮음",
168-
"함선의 절반이 자살함",
169-
true,
170-
badFontColor,
171-
badColor,
172+
"죽은 함선중 절반이 자살함",
173+
bad,
172174
new List<CardCondition>());
173175
card.conditions.Add(new CardCondition_HP(0.1f, true));
174-
card.conditions.Add(new CardCondition_DamagedByWall(50, true));
176+
card.conditions.Add(new CardCondition_DamagedByWall(50, true));
175177
cardList.Add(card);
176178

177179
// 순수 명중률 관련
178180
card = new Card(
179181
"명중률 100%",
180182
"명중률 100%",
181-
true,
182-
goodFontColor,
183-
goodColor,
183+
good,
184184
new List<CardCondition>());
185185
card.conditions.Add(new CardCondition_HitRate(100, true));
186186
cardList.Add(card);
187187

188188
card = new Card(
189189
"높은 명중률",
190190
"엄청난 명중률",
191-
true,
192-
goodFontColor,
193-
goodColor,
191+
good,
194192
new List<CardCondition>());
195193
card.conditions.Add(new CardCondition_HitRate(70, true));
196194
card.conditions.Add(new CardCondition_HitRate(100, false));
@@ -199,9 +197,7 @@ public static void InitAllCards()
199197
card = new Card(
200198
"낮은 명중률",
201199
"어딜보고 쏘는 거야?",
202-
false,
203-
badFontColor,
204-
badColor,
200+
bad,
205201
new List<CardCondition>());
206202
card.conditions.Add(new CardCondition_HitRate(20, false));
207203
card.conditions.Add(new CardCondition_HitRate(10, true));
@@ -210,9 +206,7 @@ public static void InitAllCards()
210206
card = new Card(
211207
"명중률 한자리",
212208
"손가락은 움직일 줄 아는거지?",
213-
false,
214-
badFontColor,
215-
badColor,
209+
bad,
216210
new List<CardCondition>());
217211
card.conditions.Add(new CardCondition_HitRate(10, false));
218212
cardList.Add(card);
@@ -221,41 +215,33 @@ public static void InitAllCards()
221215
card = new Card(
222216
"아군 학살자",
223217
"아군 학살자",
224-
false,
225-
badFontColor,
226-
badColor,
218+
bad,
227219
new List<CardCondition>());
228-
card.conditions.Add(new CardCondition_DamagedByAlly(50, true));
220+
card.conditions.Add(new CardCondition_DamagedByAlly(50, true));
229221
cardList.Add(card);
230222

231-
card = new Card(
232-
"아군 안죽인다",
233-
"아군 그만 좀 때려요",
234-
true,
235-
badFontColor,
236-
badColor,
237-
new List<CardCondition>());
238-
card.conditions.Add(new CardCondition_DamagedByAlly(50, false));
239-
card.conditions.Add(new CardCondition_DamagedByAlly(10, true));
240-
cardList.Add(card);
223+
card = new Card(
224+
"아군 안죽인다",
225+
"아군 그만 좀 때려요",
226+
bad,
227+
new List<CardCondition>());
228+
card.conditions.Add(new CardCondition_DamagedByAlly(50, false));
229+
card.conditions.Add(new CardCondition_DamagedByAlly(10, true));
230+
cardList.Add(card);
241231

242232
card = new Card(
243233
"아군 안죽인다",
244234
"아군을 거의 안 때림!",
245-
true,
246-
badFontColor,
247-
badColor,
235+
good,
248236
new List<CardCondition>());
249-
card.conditions.Add(new CardCondition_DamagedByAlly(10, false));
237+
card.conditions.Add(new CardCondition_DamagedByAlly(10, false));
250238
cardList.Add(card);
251239

252240
// 적킬
253241
card = new Card(
254242
"적팀에게 가한 피해(%) 높음",
255243
"널 위해 발사했어ㅎ",
256-
true,
257-
goodFontColor,
258-
goodColor,
244+
good,
259245
new List<CardCondition>());
260246
card.conditions.Add(new CardCondition_DamageToEnemy(70, true));
261247
cardList.Add(card);
@@ -264,9 +250,7 @@ public static void InitAllCards()
264250
card = new Card(
265251
"벽에게 가한 피해(%) 높음",
266252
"저는 벽 쏘는걸 좋아합니다",
267-
false,
268-
badFontColor,
269-
badColor,
253+
bad,
270254
new List<CardCondition>());
271255
card.conditions.Add(new CardCondition_DamageToWall(50, true));
272256
card.conditions.Add(new CardCondition_DamageToWall(70, false));
@@ -275,9 +259,7 @@ public static void InitAllCards()
275259
card = new Card(
276260
"벽에게 가한 피해(%) 매우 높음",
277261
"저는 벽만 계속 쏠겁니다",
278-
false,
279-
badFontColor,
280-
badColor,
262+
bad,
281263
new List<CardCondition>());
282264
card.conditions.Add(new CardCondition_DamageToWall(70, true));
283265
cardList.Add(card);
@@ -286,19 +268,15 @@ public static void InitAllCards()
286268
card = new Card(
287269
"받은 피해중 벽에게 받은 데미지 (%)가 대부분",
288270
"벽으로 돌격하라!",
289-
false,
290-
badFontColor,
291-
badColor,
271+
bad,
292272
new List<CardCondition>());
293273
card.conditions.Add(new CardCondition_DamagedByWall(70, true));
294274
cardList.Add(card);
295275

296276
card = new Card(
297277
"받은 피해중 벽에게 받은 데미지 (%)가 매우 높음",
298278
"자살 매니아",
299-
false,
300-
badFontColor,
301-
badColor,
279+
bad,
302280
new List<CardCondition>());
303281
card.conditions.Add(new CardCondition_DamagedByWall(70, false));
304282
card.conditions.Add(new CardCondition_DamagedByWall(40, true));
@@ -307,9 +285,7 @@ public static void InitAllCards()
307285
card = new Card(
308286
"받은 피해중 벽에게 받은 데미지 (%)가 높음",
309287
"벽을 사랑하기 시작하였다...",
310-
false,
311-
badFontColor,
312-
badColor,
288+
bad,
313289
new List<CardCondition>());
314290
card.conditions.Add(new CardCondition_DamagedByWall(40, false));
315291
card.conditions.Add(new CardCondition_DamagedByWall(20, true));
@@ -319,22 +295,18 @@ public static void InitAllCards()
319295
card = new Card(
320296
"레이저를 굉장히 조금만 쏨",
321297
"초 에너지 절약주의자",
322-
false,
323-
badFontColor,
324-
badColor,
298+
bad,
325299
new List<CardCondition>());
326300
card.conditions.Add(new CardCondition_TotalUseEnerge(BattleHistory.maxTotalEnergy * 0.2f, false));
327301
cardList.Add(card);
328302

329-
card = new Card(
330-
"레이저를 안씀",
331-
"Peace Keeper",
332-
false,
333-
goodFontColor,
334-
goodColor,
335-
new List<CardCondition>());
336-
card.conditions.Add(new CardCondition_TotalUseEnerge(0.1, false));
337-
cardList.Add(card);
338-
}
303+
card = new Card(
304+
"레이저를 안씀",
305+
"Peace Keeper",
306+
good,
307+
new List<CardCondition>());
308+
card.conditions.Add(new CardCondition_TotalUseEnerge(0.1f, false));
309+
cardList.Add(card);
310+
}
339311
}
340312

0 commit comments

Comments
 (0)